编译时如果遇到
i386-linux-ld -m elf_i386 -T /build/trunk/snapgear/AscenApps/linux-2.4.32/arch/i386/vmlinux.lds -e stext arch/i386/kernel/head.o arch/i386/kernel/init_task.o init/main.o init/version.o init/do_mounts.o \
--start-group \
arch/i386/kernel/kernel.o arch/i386/mm/mm.o kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o \
drivers/acpi/acpi.o drivers/char/char.o drivers/serial/serial.o drivers/block/block.o drivers/misc/misc.o drivers/net/net.o drivers/ide/idedriver.o drivers/cdrom/driver.o drivers/pci/driver.o drivers/video/video.o drivers/media/media.o arch/i386/math-emu/math.o \
net/network.o \
/build/trunk/snapgear/AscenApps/linux-2.4.32/arch/i386/lib/lib.a /build/trunk/snapgear/AscenApps/linux-2.4.32/lib/lib.a /build/trunk/snapgear/AscenApps/linux-2.4.32/arch/i386/lib/lib.a \
--end-group \
-o vmlinux
net/network.o(.text+0x51586): In function `ipgre_rcv':
: undefined reference to `__divdi3'
make[1]: *** [vmlinux] Error 1
make[1]: Leaving directory `/build/trunk/snapgear/AscenApps/linux-2.4.32
很可能是由于内核中做了这样的运算 :
(long long)(jiffies*1000/HZ) - (long long)ntohl(ptime->tv_sec)*1000 - (long long)ntohl(ptime->tv_usec)/1000;
long long 除以1000了。改成:
(long long)((long long)(jiffies*1000/HZ) - (long long)ntohl(ptime->tv_sec)*1000 - (long long)(ntohl(ptime->tv_usec)/1000));
就可以了。