From: Alan Woodland (awoodland_at_debian_dot_org)
Date: Sun Oct 04 2009 - 15:06:46 PDT
Hi, I've run into another minor problem building. When the userland/toolchain is i386 it is possible still to be using an x86_64 kernel. If I try and configure for this kernel, e.g.: ./configure --with-installed-libcr --with-installed-util --with-components=modules --prefix=/usr --with-linux=2.6.30-2-amd64 Everything appears to be fine, however during building it dies: CC [M] /usr/src/modules/blcr/cr_module/kbuild/vmadump_i386.o /usr/src/modules/blcr/cr_module/kbuild/vmadump_i386.c: In function 'vmadump_store_cpu': /usr/src/modules/blcr/cr_module/kbuild/vmadump_i386.c:56: error: 'struct pt_regs' has no member named 'ds' /usr/src/modules/blcr/cr_module/kbuild/vmadump_i386.c:57: error: 'struct pt_regs' has no member named 'es' /usr/src/modules/blcr/cr_module/kbuild/vmadump_i386.c: In function 'vmadump_restore_cpu': /usr/src/modules/blcr/cr_module/kbuild/vmadump_i386.c:161: error: 'struct pt_regs' has no member named 'ds' /usr/src/modules/blcr/cr_module/kbuild/vmadump_i386.c:162: error: 'struct pt_regs' has no member named 'es' make[7]: *** [/usr/src/modules/blcr/cr_module/kbuild/vmadump_i386.o] Error 1 Presumably it shouldn't be trying to use vmadump_i386.c here... What's the best way to handle this? On Debian at least we can detect this because either the running kernel or the target kernel will have amd64 in the name, but that doesn't always have to be the case. We could use file to test the kernel image itself? Or look at the length of the addresses in System.map for that kernel. Or the presence of startup_64 in the kernel could be tested for... The attached patch seems to work (counting length of kernel symbol addresses). Even though it works, I can't actually test the modules it produces on any x86_64 machines due to a xen related problem. The patch is a little rough around the edges, but is it sane? Any suggestions gratefully received! Kbuild magic does seems to be sorting out the c compiler to build the module correctly: debian-devel64:/usr/src/modules/blcr/cr_module/kbuild# file *.ko blcr.ko: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped debian-devel64:/usr/src/modules/blcr/cr_module/kbuild# uname -a Linux debian-devel64 2.6.30-1-686-bigmem #1 SMP Sat Aug 15 20:10:47 UTC 2009 i686 GNU/Linux Thanks, Alan