0
votes

I am going to compile the linux kernel 2.4.32 in my x86_64 system.

make dep is ok but make bzImage stop after showing lots of link error like these:

ld -m elf_x86_64 -e stext  -r -o kernel.o sched.o dma.o fork.o exec_domain.o panic.o printk.o module.o exit.o itimer.o info.o time.o softirq.o resource.o sysctl.o acct.o capability.o ptrace.o timer.o user.o signal.o sys.o kmod.o context.o ksyms.o pm.o
dma.o: In function `set_64bit':
dma.c:(.text+0x0): multiple definition of `set_64bit'
sched.o:sched.c:(.text+0x1b): first defined here
dma.o: In function `get_order':
dma.c:(.text+0x4): multiple definition of `get_order'
sched.o:sched.c:(.text+0x0): first defined here
dma.o: In function `read_lock':
dma.c:(.text+0x1a): multiple definition of `read_lock'
sched.o:sched.c:(.text+0x9c): first defined here
dma.o: In function `cpuid':
dma.c:(.text+0xc9): multiple definition of `cpuid'
sched.o:sched.c:(.text+0x24): first defined here
dma.o: In function `cpuid_eax':
dma.c:(.text+0xe1): multiple definition of `cpuid_eax'
sched.o:sched.c:(.text+0x41): first defined here
dma.o: In function `cpuid_ebx':
dma.c:(.text+0xe8): multiple definition of `cpuid_ebx'
sched.o:sched.c:(.text+0x4d): first defined here
dma.o: In function `cpuid_ecx':
dma.c:(.text+0xf1): multiple definition of `cpuid_ecx'
sched.o:sched.c:(.text+0x5b): first defined here
dma.o: In function `cpuid_edx':
dma.c:(.text+0xfa): multiple definition of `cpuid_edx'
sched.o:sched.c:(.text+0x69): first defined here
dma.o: In function `thread_saved_pc':
dma.c:(.text+0x103): multiple definition of `thread_saved_pc'
sched.o:sched.c:(.text+0x77): first defined here
dma.o: In function `rep_nop':
dma.c:(.text+0x10c): multiple definition of `rep_nop'
sched.o:sched.c:(.text+0x85): first defined here
dma.o: In function `sync_core':
dma.c:(.text+0x10f): multiple definition of `sync_core'
sched.o:sched.c:(.text+0x8d): first defined here

in the kernel2.4.32/include directory there is lots of asm directories each belonging to an specific architecture (e.g. asm-i386, asm-x86_64, asm-a64)

and there is a single asm directory which is linked to asm-x86_64 directory (because of my system architecture)

when i remove a function with multiple definition (like set_64bit in error list) from one of these two directories asm and asm-x86_64 the error will disappear.

Is there any problem with makefile or config file? why these functions compile multiple times??!

pleas help me...

1
That kernel is around ten years old, and may not be compatible with modern compilers. Is there a specific reason you need to build that version?user149341
Looks like it is a misprint in function's definition: they uses extern inline instead of common static inline definition in the header.Tsyvarev
@duskwuff I want to add a kernel module of a software (click modular router) and this software support just some limited version of linux. I also test 2.6 but doesn't work either.N. S.
@Tsyvarev Thanx a lot.... it seems the problem can be solved by using static inlineN. S.
@Tsyvarev All function's problem is solved except some function about IO (inb, inw, inl, outb, outw, outl, insb ...) I can't find these function definition! There is no pure function for these names! Although i have changed some similar functions to static inline. But the problem with these function is still left!!N. S.

1 Answers

0
votes

The problem is from a misprint functions' definition in header file as @Tsyvarev had been correctly mentioned.

These problematic functions definition must be changed from extern inline to static inline.

Also the definition of functions about I/O, like inb, inw, inl, outb, outw, outl.... must be changed in linux2.4.32/include/asm/io.h file where these functions is defined as macros with extern keyword!