Modifying Ubuntu installer CD

The 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

  1. Download Ubuntu Alternate Installation CD image
  2. Mount it: mount -o loop ubuntu-11.10-alternate-amd64.iso /media/cdrom
  3. Copy the contents of the CD to the HDD: rsync -av /media/cdrom/ /opt/cd-image

Generating GPG keys for the image

  1. 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
  2. We have to recompile the original ubuntu-keyring package and include our own key in it:
    1
    2
    3
    4
    apt-get source ubuntu-keyring
    cd ubuntu-keyring-2010.+09.30/keyrings
    gpg --import < ubuntu-archive-keyring.gpg
    gpg --export > ubuntu-archive-keyring.gpg
  3. 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)
  4. Build the ubuntu-keyring package (replace YOURKEYID with your key ID): cd ..; dpkg-buildpackage -rfakeroot -m”Norbert Varga ” -kYOURKEYID
  5. Copy the freshly built ubuntu-keyring package to the installer CD: cd ..; cp ubuntu-keyring*deb /opt/cd-image/pool/main/u/ubuntu-keyring
  6. Now you have two choices:

Using a precompiled Ubuntu PPA kernel

  1. 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).
  2. 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
  3. 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

  4. 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)
  5. 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

  1. Run apt-get install git-core kernel-package fakeroot build-essential ncurses-dev
  2. 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
  3. 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.
  4. Run yes ” | make oldconfig and make menuconfig if you want to modify the settings
  5. 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”.
  6. 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

  1. Extract the contents of the current initrd file: cd; mkdir initrd; cd initrd; gunzip -c /opt/cd-image/install/initrd.gz | cpio -i
  2. Empty the initrd directory’s lib/modules, copy all modules from /lib/modules/yourdesiredkernelmodules to the initrd directory’s lib/modules/yourdesiredkernelmodules
  3. Repackage the initrd file: cd ~/initrd; find . | cpio -H newc -o | gzip > /opt/cd-image/install/initrd.gz

Updating the kernel installer package

  1. Remove everything from /opt/cd-image/pool/main/l/linux/ except the libc package.
  2. 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)
  3. 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
  4. 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

  1. Run: 01-getindices; 02-buildrepo; 03-mkiso
  2. You need to run 01-getindices only one time, then if you modify something, only 02-buildrepo and 03-mkiso are needed
  3. 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)
support.infraworx.com 2014-08-28 20:12:59

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)

 
http://thecounselor.in 2014-08-30 22:41:14

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.

 
KWs 2014-09-23 02:36:09

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

 
Name (required)
E-mail (required - never shown publicly)
Webpage URL
Comment:
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> in your comment.

Trackback responses to this post

About me

Nonoo
I'm Nonoo. This is my blog about music, sounds, filmmaking, amateur radio, computers, programming, electronics and other things I'm obsessed with. ... »

Twitter

Listening now

My favorite artists