Difference between revisions of "MAS kernel patch compilation"

From MCEWiki
(Ubuntu 8.04)
(Ubuntu 8.04)
Line 66: Line 66:
  
 
Bigphys kernel was successfully created for 8.04 x64.  I don't know how to package it properly yet, so you just have to do it on each machine.
 
Bigphys kernel was successfully created for 8.04 x64.  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:
 
From fresh 8.04 install:
 
  sudo apt-get update
 
  sudo apt-get update
  sudo apt-get install build-essential subversion kernel-package linux-kernel-source libncurses5-dev
+
  sudo apt-get install build-essential subversion kernel-package linux-source libncurses5-dev
  
The linux-kernel-source package should put an archive in /usr/src, e.g. linux-source-2.6.24.tar.bz2.  Extract it:
+
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
 
  cd /usr/src
 
  sudo tar -xjf linux-source-2.6.24.tar.bz2
 
  sudo tar -xjf linux-source-2.6.24.tar.bz2
  
Get the bigphys patch for 2.6.24, and apply it to the source tree:
+
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
 
  cd ~/install
 
  wget http://cmbr.phas.ubc.ca/~mhasse/mce/bigphysarea-2.6.24.patch
 
  wget http://cmbr.phas.ubc.ca/~mhasse/mce/bigphysarea-2.6.24.patch
Line 81: Line 89:
 
  patch -p1 --dry-run < ~/install/bigphysarea-2.6.24.patch
 
  patch -p1 --dry-run < ~/install/bigphysarea-2.6.24.patch
 
  sudo patch -p1 < ~/install/bigphysarea-2.6.24.patch
 
  sudo patch -p1 < ~/install/bigphysarea-2.6.24.patch
 
The patch is most likely to fail on the file 'Makefile'.  This is probably minor.  Simply open the Makefile in an editor and change the 4th line from something like
 
EXTRAVERSION = .3
 
to something like
 
EXTRAVERSION = .3-bigphys
 
  
 
Copy in your config file into the root of your source tree, and make menuconfig.
 
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 cp /boot/config-2.6.24-16-generic .config
 
  sudo make menuconfig
 
  sudo make menuconfig
  
 
Under "Processor Type and Features", turn "Big Physical Area (NEW)" to ON.  Then exit, exit, save.
 
Under "Processor Type and Features", turn "Big Physical Area (NEW)" to ON.  Then exit, exit, save.
sudo make-kpkg --initrd kernel-image kernel-headers
 
  
== Blacklist snd_asihpi! ==
+
== 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):
  
The 8.04 kernel has a sound-card driver that lays claim to the Motorola DSP on the PCI card. We have to blacklist this module to prevent it from trying to configure the card as a sound cardAdd the following to the bottom of /etc/modprobe.d/blacklist :
+
title          Big physical area kernel 2.6.24.3-bigphys
  # Conflicts with Astro-cam PCI card!!
+
root            (hd0,0)
  blacklist snd_asihpi
+
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

Revision as of 17:39, 6 January 2009

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

Bigphys kernel was successfully created for 8.04 x64. 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://cmbr.phas.ubc.ca/~mhasse/mce/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