Modifying Ubuntu installer CD
November 18th, 2011 | Last modified: November 28th, 2011The current Ubuntu installer disc comes with the Linux kernel 3.0.0, but I’m planning to buy an OCZ RevoDrive 3 which has drivers in the 3.2 kernel. So I upgraded the kernel on the installer disc. Here’s how it’s done.
You’ll need these scripts through the process.
Extracting the installer image
- Download Ubuntu Alternate Installation CD image
- Mount it: mount -o loop ubuntu-11.10-alternate-amd64.iso /media/cdrom
- Copy the contents of the CD to the HDD: rsync -av /media/cdrom/ /opt/cd-image
Generating GPG keys for the image
- We have to sign the CD when we are done with modifying, so we have to generate our own private key. Run gpg –gen-key
- We have to recompile the original ubuntu-keyring package and include our own key in it:
1
2
3
4apt-get source ubuntu-keyring
cd ubuntu-keyring-2010.+09.30/keyrings
gpg --import < ubuntu-archive-keyring.gpg
gpg --export > ubuntu-archive-keyring.gpg - Note down your key ID, list all keys with gpg –list-keys, your key ID will be the hex number after the first / sign (for example: pub 1024D/447C4545 2006-09-08 – key ID here is /447C4545)
- Build the ubuntu-keyring package (replace YOURKEYID with your key ID): cd ..; dpkg-buildpackage -rfakeroot -m”Norbert Varga
” -kYOURKEYID - Copy the freshly built ubuntu-keyring package to the installer CD: cd ..; cp ubuntu-keyring*deb /opt/cd-image/pool/main/u/ubuntu-keyring
- Now you have two choices:
Using a precompiled Ubuntu PPA kernel
- Download your desired kernel package from the Ubuntu kernel PPA. If you want to use a 64bit kernel, you have to download all the files ending with -amd64.deb (headers, image) plus the files ending with -all.deb (headers).
- Install the package on your system (you can remove it later if you don’t need it): dpkg -i linux-image-3.2.0-030200rc2-generic_3.2.0-030200rc2.201111151435_amd64.deb
- You need to figure out the kernel image file name for your new kernel: cd /boot; ls | grep vmlinuz
Copy this image file (overwriting the original) to /opt/cd-image/install/vmlinuz - You need to figure out the initramfs file name for your new kernel: ls | grep initrd
Copy this file to /opt/cd-image/install/initrd.gz (the file is already compressed, you don’t have to run gzip) - If you don’t have an initrd file for the new kernel, you can make one: update-initramfs -ck module-name-for-new-kernel (in my case it’s 3.2.0-030200rc2-generic, you can find this out by cd /lib/modules; ls)
Building your own kernel
- Run apt-get install git-core kernel-package fakeroot build-essential ncurses-dev
- Download and extract the kernel image: wget http://www.kernel.org/pub/linux/kernel/v3.0/testing/linux-3.2-rc2.tar.bz2; tar -xjvf linux-3.2-rc2.tar.bz2
- Get an Ubuntu kernel .config, from your /boot dir or by downloading a matching kernel package from the Ubuntu kernel PPA. Overwrite the kernel source’s .config with it.
- Run yes ” | make oldconfig and make menuconfig if you want to modify the settings
- Edit scripts/setlocalversion and comment out the line “echo “+””. If this is not done, make-kpkg will fail to build the packages with an error “package linux-image-[kernel version]-custom+ not in control info”.
- make-kpkg clean; CONCURRENCY_LEVEL=`getconf _NPROCESSORS_ONLN` fakeroot make-kpkg –initrd –append-to-version=-mycustomkernel kernel_image kernel_headers
Updating modules in the initrd file
- Extract the contents of the current initrd file: cd; mkdir initrd; cd initrd; gunzip -c /opt/cd-image/install/initrd.gz | cpio -i
- Empty the initrd directory’s lib/modules, copy all modules from /lib/modules/yourdesiredkernelmodules to the initrd directory’s lib/modules/yourdesiredkernelmodules
- Repackage the initrd file: cd ~/initrd; find . | cpio -H newc -o | gzip > /opt/cd-image/install/initrd.gz
Updating the kernel installer package
- Remove everything from /opt/cd-image/pool/main/l/linux/ except the libc package.
- Copy your kernel image and header packages here (both -amd64.deb and -all.deb needed, so at the end there will be 4 files here including the libc package)
- Update the meta packages’ dependencies that they point to your new kernel: cd /opt/cd-image/pool/main/l/linux-meta; videbcontrol linux-image-generic_3.0.0.12.14_amd64.deb and edit the line beginning with Depends:, update linux-headers-generic_3.0.0.12.14_amd64.deb also
- Note that the videbcontrol script doesn’t overwrite the original .deb packages, don’t forget to manually overwrite the originals. Look at other dependencies of your kernel packages and make sure the needed packages are in the installer CD pool.
Building the .iso
- Run: 01-getindices; 02-buildrepo; 03-mkiso
- You need to run 01-getindices only one time, then if you modify something, only 02-buildrepo and 03-mkiso are needed
- Try the .iso in VirtualBox or VMware. If it says invalid video mode, just press space, and if the installer complains about missing modules, just continue installing (we have our modules in one big kernel-image .deb package, there are no separate module packages)
RSS feed for comments
Trackback URL
Trackback URL
3 Comments »
Trackback responses to this post
About me
I'm Nonoo. This is my blog about music, sounds, filmmaking, amateur radio, computers, programming, electronics and other things I'm obsessed with.
... »
Corporations that flip buy a property need to be involved as marrakech map
english long as possible. The 60D was my second DSLR.
And another great advantage of having these types
of situations. Gushing water on the final walk thru, just an awesome camera.
It was the first procedure in a recently opened one can benefit from this change.
The Company owns, leases, and manages buildings. New and
refurbished hotels, a burgeoning arts scene, and a fireater.
Feel free to visit my homepage – sortie en quad marrakech
weather February (support.infraworx.com)
Appreciating the commitment you put into your site and detailed
information you provide. It’s nice to come across a blog every once in a while that isn’t the same unwanted
rehashed material. Great read! I’ve bookmarked your site and I’m adding
your RSS feeds to my Google account.
It’s difficult to find well-informed people in this particular topic,
however, you sound like you know what you’re talking about!
Thanks
Also visit my web site KWs