1
votes

I have a 64-bit 3.9 kernel. Actually I applied a patch and rebuilt the entire kernel on a different (32-bit) Ubuntu machine then I brought the *.deb files over and used the "dpkg -i" procedure to install the patched up kernel to my Ubuntu 12.04. It's a minor patch, doesn't change much and everything works except...

I did a "apt-get install module-assistant build-essentials linux-headers-$(uname -r)". I can see the usr/include/src/linux-headers-3.9.0-custom. It's all there.

My Makefile says

make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

But I inevitably get:

usr/include/src/linux-headers-3.9.0-custom/scripts/recordmcount: 1: usr/include/src/linux-headers-3.9.0-custom/scripts/recordmcount: Syntax error: word unexpected (expecting ")")

when I try to do the build. This same source code builds sucessfully when I attempt it on my Ubuntu 32-bit 3.2 Kernel system.

1

1 Answers

3
votes

This was an issue of cross-compiling. I used a 32-bit Ubuntu system to build a 64-bit kernel and it's been nothing but headaches. Apparently the scripts etc still get built as 32-bit. (They'd have to since my 32-bit system needed to use them to build the kernel.) But then if bring that /usr/src/linux-headers-x.x.x dir over to my 64-bit system I can't use it to build any kernel modules because its /scripts dir is 32-bit.

I rebuilt recordmcount on the 64-bit machine and that worked. But then there was another script that was incompatible with 64-bits, that wasn't as easy to build without rebuilding the entire kernel.

Anyway, if you cross compile you don't get a /usr/src/linux-header-x.x.x/scripts dir that's usable on your target system.