Quote:
Originally posted by sibtay
Hello
i am trying to make a linux distro.
For that i need to build an installer. my idea is to run a very basic (low foot print) kernel, run bash on top of it and then run the install scripts that i have created.
The kernel image will be present on some external storage media like cd, floppy or usb and therefore would have to be loaded in the memory first.
How can i achieve this.
My question is "how can i load the image of a kernel from an external storage device to the RAM" without using grub or LILO
Or in other words i want to create a boot disk that would load the kernel image in the memory (and do some other stuff which i'll ask later)
thank you
|
basically, to do this from cd you need three things on the cd:
- isolinux
- a ramdisk image
- a kernel
isolinux will make the cd bootable... it will boot the kernel and load the ramdisk image...
the ramdisk image needs only to contain a
basic linux system... you could go for something like
busybox (which is a VERY small system) or just install whatever you need in there...
here's a rough outline of the BASIC steps needed to make a bootable linux ramdisk cd, AFAIK:
# make a directory to create the cd:
mkdir /tmp/livecd
# make a directory called "isolinux" and one called "kernels" in there...
mkdir /tmp/livecd/isolinux
mkdir /tmp/livecd/kernels
# download the latest isolinux package from
http://www.kernel.org/pub/linux/utils/boot/syslinux/ and unpack it...
# basically, you just need the
isolinux.bin file...
cd /tmp
wget http://www.kernel.org/pub/linux/util...ux-2.11.tar.gz
tar -xzf syslinux-2.11.tar.gz
cd syslinux-2.11
cp isolinux.bin /tmp/livecd/isolinux
# now place a kernel in the kernel dir:
cp /example/bzImage /tmp/livecd/kernels/bare.i
# now take care of the ramdisk... create and format an image like this:
# this example makes a 16MB ramdisk image file...
dd if=/dev/zero of=/tmp/ramdisk.img bs=1k count=16384
mkfs.ext2 -F -m 0 /tmp/ramdisk.img
# now mount the ramdisk image and install your basic system into it:
mount -o loop /tmp/ramdisk.img /mnt/ramdisk
# this is how you'd install your packages using your ramdisk image as root on slackware,
# it'll be different on other distros, but you get the idea:
cd /wherever_your_packages_are
installpkg -root /mnt/ramdisk *.tgz
# in your case, remember to install your installation scripts and stuff... the actual
packages and stuff
# that your end-users will be installing obviously doesn't need to go in this ramdisk, though...
# edit whatever else you need to edit in the ramdisk image, like /etc/fstab, which will
# need to have a line like this, indicating the root system should be the ramdisk:
Code:
/dev/ram0 / ext2 defaults 0 0
# when you're done tweaking the ramdisk image's system run ldconfig through it:
ldconfig -r /mnt/ramdisk
# you can then unmount the ramdisk image
umount /mnt/ramdisk
# now compress the ramdisk image:
cd /tmp
gzip -9 ramdisk.img
# now place it in the isolinux dir:
mv /tmp/ramdisk.img.gz /tmp/livecd/isolinux/ramdisk.img
### so now your /tmp/livecd/isolinux directory contains the isolinux.bin
### and ramdisk.img files, while the /tmp/livecd/kernels dir contains
### your kernel...
# the only file you're missing now is an isolinux.cfg file...
touch /tmp/livecd/isolinux/isolinux.cfg
# open it up with vi or something
vi /tmp/livecd/isolinux/isolinux.cfg
and make it look
somewhat like this (EXAMPLE):
Code:
default /kernels/bare.i initrd=ramdisk.img load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=16384 rw root=/dev/ram
prompt 0
# once that's done, you're ready to create an ISO image which you can then burn to a cd:
cd /tmp/livecd
mkisofs -o /tmp/livecd.iso -R -J -hide-rr-moved -v -d -N \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-b isolinux/isolinux.bin -c isolinux/isolinux.boot .
your ramdisk-based linux cd iso image is now ready in /tmp/
livecd.iso!!
=)