Hi all,
I just checked out a fresh Linux kernel 2.6.30 source code from kernel.org. If I leave everything intact and just do a "make all", it compiled successfully. I saw that it uses standard gcc, ld, ar, nm ... from /usr/bin to compile. Since it's compiled natively on an x86_64 machine (Red Hat), I assume it's 64-bit toolchains. Here is the info I got:
/usr/bin/gcc --version
gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-9)
Copyright (C) 2006 Free Software Foundation, Inc.
Due to some incompatibility issue, I have to compile this source code in 32-bit. I forced the SUBARCH := i386 in the Makefile then I used the toolchains provided in-house called gcc.c4.2.1-p0.linux, ld.c4.2.1-p0.linux, nm.c4.2.1-p0.linux ... to compile. However, I got these following error:
...
CC lib/reciprocal_div.o
CC lib/rwsem.o
CC lib/sha1.o
CC lib/show_mem.o
CC lib/string.o
CC lib/vsprintf.o
AR lib/lib.a
CC arch/x86/lib/msr-on-cpu.o
LD arch/x86/lib/built-in.o
CC arch/x86/lib/delay.o
AS arch/x86/lib/getuser.o
CC arch/x86/lib/memcpy_32.o
AS arch/x86/lib/putuser.o
CC arch/x86/lib/string_32.o
CC arch/x86/lib/strstr_32.o
CC arch/x86/lib/usercopy_32.o
AR arch/x86/lib/lib.a
LD vmlinux.o
MODPOST vmlinux.o
WARNING: vmlinux.o(.cpuinit.data+0x0): Section mismatch in reference from the variable initial_code to the function .init.text:i386_start_kernel() The variable __cpuinitdata initial_code references a function __init i386_start_kernel().
If i386_start_kernel is only used by initial_code then annotate i386_start_kernel with a matching annotation.
GEN .version
CHK include/linux/compile.h
UPD include/linux/compile.h
CC init/version.o
LD init/built-in.o
LD .tmp_vmlinux1
drivers/built-in.o: In function `next_device':
core.c

.text+0x9367d): undefined reference to `klist_next'
drivers/built-in.o: In function `device_find_child':
(.text+0x936aa): undefined reference to `klist_iter_init'
drivers/built-in.o: In function `device_find_child':
(.text+0x936d7): undefined reference to `klist_iter_exit'
drivers/built-in.o: In function `device_for_each_child':
(.text+0x93701): undefined reference to `klist_iter_init'
drivers/built-in.o: In function `device_for_each_child':
...
Here is everything I changed from the original Makefile:
TOOLS_VER=c4.2.1-p0.linux
SUBARCH := i386
HOSTCC = gcc.$(TOOLS_VER)
HOSTCXX = g++.$(TOOLS_VER)
HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
HOSTCXXFLAGS = -O2
CC = gcc.$(TOOLS_VER)
AS = $(CC)
LD = $(CC) -nostdlib
CPP = $(CC) -E
AR = ar.$(TOOLS_VER)
NM = nm.$(TOOLS_VER)
STRIP = strip.$(TOOLS_VER)
OBJCOPY = objcopy.$(TOOLS_VER)
OBJDUMP = objdump.$(TOOLS_VER)
Does anyone knows what's wrong and how to fix it? Any help is greatly appreciated.
Thanks,