View previous topic :: View next topic |
Author |
Message |
hirakendu Guru

Joined: 24 Jan 2007 Posts: 386 Location: san diego
|
Posted: Thu Sep 06, 2007 3:37 am Post subject: [HOWTO] Modding the gentoo minimal livecd (reiser4, kernel) |
|
|
A self explanatory example script for modding the gentoo minimal livecd :
Code: |
#!/bin/bash
# This is a (short) example and HOWTO for modifying the gentoo minimal livecd.
# (The example is about creating a reiser4 minimal livecd with our own kernel
# from original minimal livecd.)
# 0) We need about 600 MB of free space.
cd /tmp/
mkdir gentoo-min/
cd gentoo-min/
wget http://gentoo.osuosl.org/releases/x86/2007.0/installcd/install-x86-minimal-2007.0-r1.iso
# [[ It is assumed that we have a kernel with reiser4 and squashfs installed
# (in this example, its 2.6.22-helium9), and also that we have squashfs-tools
# and reiser4progs :
emerge -u squashfs-tools reiser4progs
# ]]
# 1) Extract the livecd contents, the squashfs img contents and initrd contents :
mkdir iso/ iso-ori/
mount install-x86-minimal-2007.0-r1.iso iso/ -o loop
cp -a iso/* iso-ori/
umount iso/
rm -rf iso/
cp -a iso-ori/ iso-new/
mkdir sqfs-old/
unsquashfs -f -d sqfs-old/ iso-ori/image.squashfs
cp -a sqfs-old/ sqfs-new/
gunzip < iso-ori/isolinux/gentoo.igz > gentoo.i
mkdir initrd-old/
cd initrd-old/
cpio -idv < ../gentoo.i
cd ..
cp -a initrd-old/ initrd-new/
# 2) Modify stuff :
# 2a) For adding reiser4 support :
emerge -u gentoolkit
mkdir -p /usr/portage/packages/
emerge -u reiser4progs
quickpkg reiser4progs libaal
mkdir 1/ 2/
tar -xjpf /usr/portage/packages/All/libaal-1.0.5.tbz2 -C 1/
tar -xjpf /usr/portage/packages/All/reiser4progs-1.0.6.tbz2 -C 2/
cp -a 2/* 1/* sqfs-new/
# 2b) For adding the our own kernel :
cp /usr/src/linux/arch/i386/boot/bzImage iso-new/isolinux/gentoo
cp /usr/src/linux/.config iso-new/isolinux/config
rm -rf initrd-new/lib/modules/
rm -rf sqfs-new/lib/modules/*
cp -a /lib/modules/$(uname -r)/ sqfs-new/lib/modules/
# Note that this assumes that we have all ide and sata and raid related
# drivers compiled into our kernel (and not as modules). Its also assumed
# that we have reiser4 and squashfs compiled into the kernel (not as modular).
# [[ 2c) Optional : Additional firmware (for network cards say ;-) -
cp -a /lib/firmware/* sqfs-new/lib/firmware/
# ]]
# 3) Merge back :) -
rm iso-new/image.squashfs
mksquashfs sqfs-new/ iso-new/image.squashfs
cd initrd-new/
find . | cpio --quiet --dereference -o -H newc | gzip -9 > ../gentoo.igz
cd ../
cp gentoo.igz iso-new/isolinux/
cd iso-new/
echo \#\!/bin/bash >> create_iso.sh
echo "mkisofs -R -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -c isolinux/boot.cat -iso-level 3 -o ../livecd.iso . " >> create_iso.sh
chmod +x create_iso.sh
./create_iso.sh
cd ..
# Thats it, we have our livecd.iso :D.
# Hirakendu Das
# (20070905)
|
And here is a resultant livecd :
Many thanks to many livecd guides, and to Wainkoko for his excellent kernel patchsets (kamikaze sources) . _________________ Helium Sources || Gentoo Minimal Livecd |
|
Back to top |
|
 |
kernelOfTruth Watchman


Joined: 20 Dec 2005 Posts: 6111 Location: Vienna, Austria; Germany; hello world :)
|
|
Back to top |
|
 |
dusanc Apprentice

Joined: 19 Sep 2005 Posts: 248 Location: Serbia
|
Posted: Thu Nov 15, 2007 9:07 pm Post subject: Thaks a lot |
|
|
I'd like to thank you for this livecd. It's the best thing if you manage to corrupt your / partition with reiser4+cryptocompress as I did (played with some experimental patches), because to repair it you need reiser4progs1.0.6, which I believe exist only on your livecd. Everyone else runs 1.0.5 which corrupts cryptocompress partitions.
Thanks a lot. You saved me a lot of nerves and hair
Dushan
PS. Anyone informed why reiser4progs1.0.6 aren't marked stable after 9 months?
Should I fill a bug report? |
|
Back to top |
|
 |
kernelOfTruth Watchman


Joined: 20 Dec 2005 Posts: 6111 Location: Vienna, Austria; Germany; hello world :)
|
|
Back to top |
|
 |
dusanc Apprentice

Joined: 19 Sep 2005 Posts: 248 Location: Serbia
|
Posted: Thu Nov 15, 2007 10:17 pm Post subject: |
|
|
Great. Well I skimmed the release notes and missed that.  |
|
Back to top |
|
 |
hirakendu Guru

Joined: 24 Jan 2007 Posts: 386 Location: san diego
|
Posted: Fri Nov 16, 2007 2:34 am Post subject: |
|
|
@ dusanc :
thanks for the appreciation. btw, it was a very quick crude hack of the gentoo livecd (reverse engg fun and googling ). and i personally wasn't aware that i have reiser4progs-1.0.6 . (in fact i don't use reiser4 .) aside, i guess there is some on going row about different 'versions' of reiser4progs_106 - portage/namesys/...? (check the reiser4 / 23-kamikaze5 threads).
@ kernelOfTruth :
i must say, i should try out your livecd in the winter break too . (btw, you may not be interested in mine, because its practically as useless as the gentoo minimal disk except for rescue/install . in fact, you have spare bandwidth and don't mind downloading a gorilla, there is a full blown system of mine in a 2 gb livedvd image - http://hirakendu.mooo.com/gentoo/neon-iso/ which you may want to have a look at. and it doesn't support raid/lvm etc.) (ps : given that we both made livedisks, we both appreciate the effort and fun involved . i didn't spend any effort in trimming the system of course, only making it out-of-box. only initrd and linuxrc were the harder parts .) _________________ Helium Sources || Gentoo Minimal Livecd |
|
Back to top |
|
 |
cjubon Guru


Joined: 03 Jul 2007 Posts: 450 Location: Vienna/Europe
|
Posted: Wed Dec 19, 2007 12:54 am Post subject: |
|
|
Hi hirakendu, thank you for this HOWTO.
With your help, I managed to build my own minimal-install-cd-with-reiser4, but when booting from it, I get Code: | Kernel panic - not syncing. No init found. Try passing init= option to kernel. | However, I've no idea what init option I should pass to the kernel .
I tried various options, but none worked. I must admit that I do not really understand the process of booting from a cd, so I can only guess. Perhaps one of you gurus out there has a quick solution.
Perhaps I should mention thatin order to boot from this live-cd I have to pass root=/dev/hdb to the kernel due to my specific hardware setup. Further, I appended a version string to the kernel during config (i.e., "-smp-reiser4"), but this doesn't matter, I hope.
Thanks for your advice. |
|
Back to top |
|
 |
hirakendu Guru

Joined: 24 Jan 2007 Posts: 386 Location: san diego
|
Posted: Wed Dec 19, 2007 3:00 am Post subject: |
|
|
Hi.
My first question of interest would be this - hopefully my livecd, unchanged, booted fine .
Coming to your error - init not found, my best guess is that you may not have initrd and initramfs support compiled into the kernel. Also make sure isofs (iso9660 file system used in the cd) is compiled directly into the kernel (not as module). And the other stuff - make sure the necessary stuff like chipset drivers (sata and ata drivers) and filesystems like squashfs and unionfs are compiled in (not modular).
(Typically init is a script, usually named /linuxrc or /sbin/init, inside the initrd which acts like a small compact linux system. The init script performs most of the basic actions like mounting root filesystem etc before the actual system starts.)
Now the other things. Hopefully you have used this script more as a HOWTO than the script itself. Please be careful about specific steps. Especially step 2(b). The kernel image (bzImage, aka vmlinuz) is picked from /usr/src/linux/, so make sure the kernel you are interested in, has sources linked to /usr/src/linux. Also, kernel modules are copied from /lib/modules/, and the the version chosen is the output of 'uname -r', i.e., the currently running kernel. So please make sure your running kernel is the kernel you want, or edit the script to point to that version accordingly.
PS : It will be a little more disconcerting to know that this is a crude script (as you can see) and if something doesn't go right while brewing up the livecd, there will not be any warning/error messages. So its best to test the livecd in a virtual machine (like virtualbox or vmware) before trying out on the main machine.
In livecd, the root is root=/dev/ram0 and that argument root=/dev/hdb shouldn't help. In any case, for recent kernels, if you are not using the old ata drivers and using the new libata driver stack, that would be /dev/sdX (if its a hard drive) or /dev/srX (if its a cdrom drive). _________________ Helium Sources || Gentoo Minimal Livecd |
|
Back to top |
|
 |
cjubon Guru


Joined: 03 Jul 2007 Posts: 450 Location: Vienna/Europe
|
Posted: Wed Dec 19, 2007 10:31 am Post subject: |
|
|
hirakendu wrote: | My first question of interest would be this - hopefully my livecd, unchanged, booted fine . |
Indeed, it did! Well done!
hirakendu wrote: | Coming to your error - init not found, my best guess is that you may not have initrd and initramfs support compiled into the kernel. |
Your first guess was immediately right. I forgot to compile initramfs support into the kernel . Perhaps a little hint in the comments of your script would be helpful for others, too. Although it seems clear, I simply didn't think about it because for normal operation - i mean, booting from a hard disk - gentoo doesn't need it.
The only thing which I still don't understand is why all my IDE devices show up as SCSI. But that's not so important once I've figured out that I have to run fsck.reiser4 /dev/sda9 instead of the "fsck.reiser4 /dev/hda9" I was used to .
Thanks for your work and for your advice.
Cheers, cjubon |
|
Back to top |
|
 |
hirakendu Guru

Joined: 24 Jan 2007 Posts: 386 Location: san diego
|
Posted: Wed Dec 19, 2007 11:22 am Post subject: |
|
|
. So hopefully you managed to create a custom disk for yourself at the end of the day. _________________ Helium Sources || Gentoo Minimal Livecd |
|
Back to top |
|
 |
trumee Guru

Joined: 02 Mar 2003 Posts: 551 Location: London,UK
|
Posted: Sat Aug 17, 2013 10:57 pm Post subject: |
|
|
This works very well. If this needs to be written to a usb disk, following needs to be done
Code: |
isohybrid livecd.iso
|
|
|
Back to top |
|
 |
|