I want to install (L)ubuntu on a hard disk via an SATA controller which is by default (not yet) supported by the standard ubuntu kernel (OCZ revodrive 3 x2). However, I was able to patch the Kernel and then access the hard disk that way.

Now I am stuck as I do not know how to get an (L)Ubuntu boot CD with this patched Kernel.

Ideas I had no success with until now:

  • Installing Lubuntu on another hard disk and copying its root partition content to the new disk, then setting up a new bootloader -> system did not show any messages and did not boot

  • Running the ubiquity installer from within the ubuntu installation on another hard disk (but with the patched kernel)

Is there a way to generate a CD with a custom kernel?


"Easy" is a relative term. It would not be too difficult, the basics are on this page


In your case, the changes are fairly minimal.

Extract the iso and filesystem.squashfs (as outlined in the above link)

Copy your new kernel to casper/vmlinux (over write the old kernel).

# Assuming you are following the above link
cp your_kernel ~/extract-cd/casper/vmlinuz

Copy your kernel modules to the extracted squashfs , to lib/modules (you can delete the old modules).

# Assuming you are following the above link
cp -R /lib/modules/your_custom_kernel ~/edit/lib/modules

Extract the old initramfs, here I will use ~/initrd as a build directory

mkdir ~/initrd
cd ~/initrd
lzma -dc -S .lz casper/initrd.lz | cpio -imvd --no-absolute-filenames

Copy your lib/modules to the initrd lib/modules (you can delete the old modules)

cp -R /lib/modules/your_custom_kernel ~/initrd/lib/modules

Package the initrd

find . | cpio --quiet --dereference -o -H newc | lzma -7 > ../cusotm.initrd.lz

Over-write the old initrd

cp ~/cusotm.initrd.lz ~/extract-cd/casper/initrd.lz

Now re-package the iso


| improve this answer | |
  • Thank you,why didnt I find this link.I already extracted the iso image once,but had no clue about the folder structure on the Live CD. – Michael K Jan 10 '12 at 8:09
  • Hello, when I issuethe last command in the following, I get some premature end of arhive error. Do i need to run this in chroot ? mkdir ~/initrd cd ~/initrd lzma -dc -S .lz casper/initrd.lz | cpio -imvd --no-absolute-filenames – Roshan George Jul 27 '12 at 14:43
  • I am trying to do something similar. Took Xubuntu 15.04 amd64 ISO... Followed the guide... Updated the kernel using mainline ubuntu deb files... Generated the iso.. But it fails to boot ... After loading initramfs.. It throws error - AuFS: failed to mount root filesystem.. The resultant ISO boots and works fine as long as I dont update the kernel.. Seems to be an issue with mksquashfs and newer kernel.. as mentioned... Here is a gist of what I did - gist.github.com/praveenbm5/bea8171ff50e4114ec46 – Praveen Jun 25 '15 at 19:09
  • @Praveen - You do understand this is a question from almost 3 years ago ? You should ask a question of your own rather then leaving a comment here. I suspect the problem is you are using a mainline kernel, those are for testing only and unsupported. You would need to probably compile a custom mainline kernel ;) – Panther Jun 25 '15 at 19:13
  • I thought installing .deb files would make the process error free. Should I try installing upstrem/debian kernel or compile the whole thing myself? Here is the new questing I asked - askubuntu.com/questions/641179/… – Praveen Jun 26 '15 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.