MAS kernel patch compilation

From MCEWiki
Revision as of 18:31, 3 June 2008 by 142.103.235.35 (talk) (Configure and compile)

This procedure is based on

http://www.howtoforge.com/kernel_compilation_ubuntu


Get linux sources

We use vanilla 2.6.15.7, vanilla, from kernel.org.

Get bigphys patch

Patch is available here:

http://e-mode.phas.ubc.ca/~mhasse/mce/bigphysarea-2.6.15.7.patch

Get kernel compilation packages

apt-get update
apt-get install kernel-package libncurses5-dev fakeroot wget bzip2

Make sure bash is your default shell

sudo rm /bin/sh
sudo ln -s /bin/bash /bin/sh

Uncompress and patch

tar xjf linux-2.6.18.1.tar.bz2
ln -s linux-2.6.18.1 linux
cd /usr/src/linux

For uncompressed patches (like the bigphysarea patch), just redirect the file to the patch program:

patch -p1 --dry-run < bigphysarea-2.6.22-server.patch
patch -p1 < bigphysarea-2.6.22-server.patch

The first line (dry-run) will not make any changes to your source tree. If it says "fuzz" and "offset", that's fine. If you get errors, you have to go in by hand and figure out what's up. It's probably the line in the makefile that specifies the minor version of the kernel release.

Configure and compile

cp /boot/config-`uname -r` ./.config
make menuconfig

In the kernel configuration menu, go to "Processor type and features" and make sure that "Big Physical Area" is on.

make-kpkg clean
sudo make-kpkg --initrd kernel_image kernel_headers

(At one point there was a "--append-to-version=-bigphys" line, but we don't need that cause it's done in the patch already.)

(Can't use fakeroot in this last step, since the .deb are written to /usr/src.)

Binary kernel package installation

See MAS OS configuration .

The .deb's that come out of the compilation above are incomplete, be we install them anyway. They are missing arch/i386/Makefile.cpu, and Modules.symvers. They might be missing other things too, but MAS really misses those ones. These have been put into a patch; which must be applied at the end.


Patch creation

To generate a patch from a successful hack/patch/wobble-job, use, e.g.:

diff -urN linux-source-2.6.22 linux-source-2.6.22-bigphys > ~/bigphysarea-2.6.22-server.patch


Ubuntu 8.04

Note to self: always wait for version X.XX.01 before trying anything hard. Ubuntu 8.04 packaged kernel wouldn't compile using make-kpkg, there were script errors of some kind. Vanilla kernel did patch/compile/package/install/boot, but when building the MAS driver there was a weird Makefile missing and include/asm is linked to include/asm-i386 when it should probably be linked to include/asm-x86. This helps a bit but the driver compile still chokes on a lot of *_32.h files.

Ultimate solution was to link the original source tree into /lib/modules/2.6.24.5-bigphys/build. Also, adjust Makefile to use EXTRA_CFLAGS and not modify CFLAGS.