MAS kernel patch compilation
- Most people can skip the explicit kernel compilation described here by using the automated MAS install package. See MAS OS setup.
This procedure is based on http://www.howtoforge.com/kernel_compilation_ubuntu .
Ubuntu 6.06
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
Bigphys kernel was successfully created for 8.04 both 32-bit and 64-bit machines. I don't know how to package it properly yet, so you just have to do it on each machine.
Blacklist snd_asihpi
The 8.04 kernel has a sound-card driver that lays claim to the Motorola DSP on the PCI card. Before trying to boot an 8.04 system with the PCI card installed, we must blacklist this module to prevent it from trying to configure the card as a sound card. Add the following to the bottom of /etc/modprobe.d/blacklist :
# Conflicts with Astro-cam PCI card!! blacklist snd_asihpi
Preparation and patching
From fresh 8.04 install:
sudo apt-get update sudo apt-get install build-essential subversion kernel-package linux-source libncurses5-dev
The linux-source package should put an archive in /usr/src, e.g. linux-source-2.6.24.tar.bz2. Extract it:
cd /usr/src sudo tar -xjf linux-source-2.6.24.tar.bz2
Get the bigphys patch for 2.6.24 (a new version of this was created on Jan 6, 2009 that eliminates the Makefile patch problem...), and apply it to the source tree:
cd ~/install wget http://e-mode.phas.ubc.ca/~mhasse/mce/bigphysarea/bigphysarea-2.6.24.patch cd /usr/src/linux-source-2.6.24 patch -p1 --dry-run < ~/install/bigphysarea-2.6.24.patch sudo patch -p1 < ~/install/bigphysarea-2.6.24.patch
Copy in your config file into the root of your source tree, and make menuconfig.
sudo cp /boot/config-2.6.24-16-generic .config sudo make menuconfig
Under "Processor Type and Features", turn "Big Physical Area (NEW)" to ON. Then exit, exit, save.
Compilation
We have to be careful about architectures here:
on amd64 (64 bit machines), you can do
sudo make-kpkg clean sudo make-kpkg --initrd kernel-image kernel-headers --append-to-version=-bigphys
on i386 (32 bit machines), do
sudo make-kpkg clean -arch i386 sudo make-kpkg --initrd kernel-image kernel-headers --append-to-version=-bigphys -arch i386
Installation
As usual, you'll get two kernel packages in /usr/src. Install them in the usual way:
dpkg -i /usr/src/*bigphys*deb
However, it is possible that the "initramfs" will fail to be created (particularly in the case of i386 architecture). To remedy this, run
sudo mkinitramfs -o /boot/initrd.img-2.6.24.3-bigphys 2.6.24.3-bigphys
(substituting version numbers where necessary).
Having completed these steps, check that GRUB knows about the kernel. If it doesn't, add an entry similar to these ones to your /boot/grub/menu.lst (be sure to copy the "root" disk references from an existing kernel entry in the file):
title Big physical area kernel 2.6.24.3-bigphys root (hd0,0) kernel /boot/vmlinuz-2.6.24.3-bigphys root=UUID=<your UUID!!> ro quiet splash bigphysarea=8192 initrd /boot/initrd.img-2.6.24.3-bigphys quiet title Big physical area kernel 2.6.24.3-bigphys (recovery mode) root (hd0,0) kernel /boot/vmlinuz-2.6.24.3-bigphys root=UUID=<your UUID!!> ro single initrd /boot/initrd.img-2.6.24.3-bigphys
Ubuntu 8.10
The current deal with 8.10: the kernel API has changed slightly, and the bigphys patch requires less-trivial-than-usual modifications. These can likely be resolved; but until then please use 8.04 LTS.
Ubuntu 9.04
Follow the instructions for Ubuntu 8.04, with a few modifications. The kernel should be a 2.6.28 version. The bigphysarea patch is here:
wget http://e-mode.phas.ubc.ca/~mhasse/mce/bigphysarea-2.6.28.patch
This Ubuntu is picky about permissions, so do things properly. Get kernel source, and helpers:
sudo apt-get install linux-source-2.6.28 fakeroot kernel-package libncurses5-dev
Unzip the kernel to home folder or something -- we will compile as a non-superuser.
tar -xjf /usr/src/linux-source-2.6.28.tar.bz2
Apply patch
cd linux-source-2.6.28 patch -p1 --dry-run < ../bigphysarea-2.6.28.patch patch -p1 < ../bigphysarea-2.6.28.patch
Update config
cp /boot/config-2.6.28-11-generic .config
Enable BIGPHYSAREA (under Processor Type and Features, or whatever):
make menuconfig
Compile kernel
fakeroot make-kpkg clean fakeroot make-kpkg --initrd kernel-image kernel-headers --append-to-version=-bigphys
Ubuntu 10.04 LTS
The following outlines how to compile the bigphysarea'd kernel for Ubuntu 10.04 on the MCE Control Computer (MCC), which is a 32-bit machine, but it may work in general for 10.04. We'll roughly follow the 9.04 compilation procedure.
Preparation
You shouldn't have to blacklist anything. So, first apt-get some stuff:
$ sudo apt-get install linux-source-2.6.32 fakeroot kernel-package libncurses5-dev
On the MCC, it strongly recommended to compile the kernel in some scratch space on the SATA drive, as the CF card is slow as galaxies merging. You could do it in /data/tmp
, but that will get purged on the next boot. So, it might be better to make a new directory:
$ sudo mkdir /data/src $ sudo chown mce:mce /data/src $ cd /data/src
otherwise, do it anywhere convenient. As with the 9.04 install above, we'll be compiling this as a normal user. Unpack the kernel, and apply the bigphysarea patch
$ tar -jxvf /usr/src/linux-source-2.6.32.tar.bz2 $ cd linux-source-2.6.32 $ wget http://e-mode.phas.ubc.ca/mce/pc_install/bigphys/bigphysarea-2.6.32.patch -O- | patch -p1 --verbose
Configuration and compilation
On the MCC, use the MCC kernel config:
$ wget http://ketiltrout.net/mcc/mcc-config-2.6.32 -O.config
otherwise, configure your kernel as usual, ensuring that bigphysarea is on. Now compile the kernel packages:
$ make-kpkg --rootcmd fakeroot clean $ make-kpkg --rootcmd fakeroot --initrd kernel-image kernel-headers --append-to-version=-bigphys-mcc
(You may remove the -mcc
part of the version suffix if you aren't on the MCC.)
Installation
A simple:
$ sudo dpkg -i ../linux-*.deb
should install things. On the MCC, don't worry about the lack of an initrd; it's not needed. The linux-image package you just created points the build
symlink in /lib/modules/... to the place where you built the kernel, not where the linux-headers package was installed, so let's fix that:
$ cd /lib/modules/2.6.32*-bigphys-mcc $ sudo rm build $ sudo ln -s /usr/src/linux-headers-2.6.32*-bigphys-mcc build
To actually enable the bigphysarea in your new kernel, edit the grub menu to enable bigphysarea by modifying the value of GRUB_CMDLINE_LINUX_DEFAULT
in /etc/default/grub
to:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash bigphysarea=8192"
and then re-generating the grub configuration:
$ sudo update-grub
Done!