Configuring and compiling a new kernel on Ubuntu Linux 6.10 (Edgy Eft) running on an iBook G4 (PowerPc processor)

Ubuntu is a community developed, linux-based operating system that is perfect for laptops, desktops and servers. It contains all the applications you need - a web browser, presentation, document and spreadsheet software, instant messaging and much more. […] What does Ubuntu mean? Ubuntu is an African word meaning ‘Humanity to others’, or ‘I am what I am because of who we all are’. The Ubuntu distribution brings the spirit of Ubuntu to the software world.

UbuntuUbuntu is my favourite Linux distro. It’s very easy to install and to use. Moreover it’s Debian-based. I had no problems installing Ubuntu on my iBook G4: it’s enough to download the Desktop Edition for PowerPC based Apple computers and OpenPower/Power5 computers, burn the CD image to CD, and install Ubuntu.
iBook G4 If you want to keep Mac OS X on your system, first you should free some space on your hard drive by removing or resizing existing partitions. Your iBook G4 will dual boot with Mac OS X and Ubuntu Linux automatically.

Now, what if you want to compile a new kernel?

First of all, why to recompile the kernel or compile a new one? For example, you might want to compile a new kernel in order to take advantage of new features available in the last kernel release, or to take advantage of hardware not included in the stock kernel that came with the distribution you installed. Or again to close potential holes from modules or features that you do not ever use, or to tailor the kernel specifically of your computer hardware resulting in a performance boost. Or just because you love to hack the Linux kernel! :)

Now, how to configure and compile a new kernel?

  • First of all, you need to install some packages.
    sudo apt-get install libncurses5-dev kernel-package dpkg-dev
  • Now, get a new kernel from kernel.org (I used version 2.6.20) and move it to the kernel sources directory:
    sudo mv linux-2.6.20.tar.bz2 /usr/src
  • Move to the kernel sources directory and unzip the compressed archive. If it’s a bz2 archive, type:
    cd /usr/src
    sudo bunzip2 linux-2.6.20.tar.bz2
    sudo tar -xvvf linux-2.6.20.tar
  • Copy the whole kernel directory:
    sudo cp -r linux-2.6.20 linux-2.6.20franciov
    (the string “franciov” is just an example…)
  • Remove previous symbolic link and make a new symbolic link:
    sudo rm -f linux
    sudo ln -s linux-2.6.20franciov linux
  • Move to the new kernel’s root:
    cd linux
  • Optional. Edit the Makefile modifying the EXTRAVERSION flag:
    sudo vim Makefile
    “EXTRAVERSION = franciov”
  • Configure the kernel to be compiled. It’s not the easiest thing in the world, because you have to know every details of your machine, and sometimes this is not enough..
    You might try by yourself by typing:
    sudo make menuconfig

    or download my working configuration file (for iBook G4) and type:
    sudo cp config-2.6.20-franciov /usr/src/linux/.config
  • Compile the kernel, create an INITial RamDisk image (initrd) and install the kernel image on the system. Using Ubuntu, it’s possible to do all these operations by running just two commands:

    sudo make-kpkg -initrd –revision=ibookg4 kernel-image kernel-headers modules_image

    sudo dpkg -i ../linux-image-2.6.20_ibookg4_powerpc.deb

    Now, if everything has gone well, you have got debian packages containing the kernel image and the kernel headers. Moreover your /boot directory has been modified, thus don’t reboot your machine now.[UPDATE-2007-03-19] Make sure that modules have been installed in /lib/modules/’kernel version’ (in this case ‘kernel version’ = 2.6.20+EXTRAVERSION flag). On the contrary, type sudo make modules_install.

    Note that you can obtain the same effect by typing:
    sudo make
    sudo make modules_install
    sudo make install

    and then by using the mkinitramfs or mkinitrd command to generate an initial ramdisk image. You could avoid this, but make sure to compile filesystems you need statically. However I haven’t tried this method on my iBook G4: my advice is to create a debian package, as shown above.

  • In your /boot directory there is the new kernel image vmlinux-2.6.20franciov and the new initial ramdisk image initrd.img-2.6.20franciov. Moreover symbolic links vmlinux and initrd has been modified and this has to be fixed before rebooting your system. To list files in /boot:
    ls -la /boot
    You have to edit your bootloader’s configuration file. In this case the bootloader is yaboot and the configuration file is located in /etc/yaboot.conf.
    sudo vim /etc/yaboot.confIt follows an example of configuration:

     ## The default kernel configuration.
    ## You need to fix the kernel image and the initrd image.
    ## My solution is to avoid the use of symbolic links.
    image=/boot/vmlinux-2.6.17-10-powerpc
    label=Linux
    read-only
    initrd=/boot/initrd.img-2.6.17-10-powerpc
    append="quiet splash"
    
    ## Your new kernel configuration.
    ## You need to add the following lines manually,
    ## according to the name of you images.
    image=/boot/vmlinux-2.6.20franciov
    label=franciov-linux
    read-only
    initrd=/boot/initrd.img-2.6.20franciov
    append="quiet splash" 
  • Since yaboot.conf is not read at boot time, the MBR needs to be “refreshed” when this is changed. If you do not do this upon rebooting, none of your changes to yaboot.conf will be reflected at startup. Like getting YABOOT the MBR in the first place, you need to run:
    cd /etc
    sudo ybin -v
  • You can reboot your iBook G4 now! Keep your fingers crossed and let me know whether I’ve been helpful to you! ;)

Source: Linux Kernel Hacking Free Course, third edition.

Popularity: 100% [?]



Related Posts:
  • How to fix little problems with Ubuntu Linux 6.10 running on an iBook G4
  • About Apple
  • Is Linux ready for…?
  • 2 Responses to “Configuring and compiling a new kernel on Ubuntu Linux 6.10 (Edgy Eft) running on an iBook G4 (PowerPc processor)”

    1. MyAvatars 0.2 perkl Says:

      nice how-to !
      I only got a little confuses by the typo in :
      sudo make-kpg -initrd –revision=ibookg4 kernel-image kernel-headers modules_image
      must be :
      sudo make-kpkg -initrd –revision=ibookg4 kernel-image kernel-headers modules_image

      great how-to, anyway !

    2. MyAvatars 0.2 franciov Says:

      Thank you perkl, bug fixed ;)

    Leave a Reply

    *
    To prove you're a person (not a spam script), type the security word shown in the picture.
    Anti-Spam Image


    Close
    E-mail It