First of all. Make sure you really want to do do this. I spend 2 weeks (14 days) in trial and error, until i got it working. Secundley even if you follow those steps, you might not succed first time. Be prepared to spend time wondering why it don't work.
If you are still up to it, have fun. I know i did, when i got it right.
I have been told that mandrake are not so different from Redhat, so..
I did this with RedHat version 8, for a school project. where we wantet to make a firewall running on a cd-rom. Some of the following are rufley copyed and translated from my danish sa (i think it's called in english) and translated to english.
Here the roufley guide of how i got RH 8.0 on a bootable cd.
Thanks to the knoppix net distrubtion, to sort of show me how it's done
When you have your system just like you want it. Boot on a rescue disk.
Mount your partition / partitiosions. Then make a directory to contain your currend installetion.
I maid the directory /hdimg and used rsync to copy all the files to /hdimg
Code:
rsync -av --exclude /hdimg / /hdimg
Then chroot into /hdimg You don't want to damage your current working installetion.
Now you have to find the start up script who are resposebill for starting all the services. exaime the file /etc/inittab for a line who looks like this:
si::sysinit:/etc/rc.d/rc.sysinit
it is the script /etc/rc.d/rc.sysinit you have to modify.
You can chooice to put the commands into this file or call another script through rc.sysinit. I used the last option.
On redhat, the rc.sysinit script there are a line like this:
Code:
# Rerun ourselves through initlog
if [ -z "$IN_INITLOG" -a -x /sbin/initlog ]; then
exec /sbin/initlog $INITLOG_ARGS -r /etc/rc.d/rc.sysinit
fi
You have to place your script after this(or commands) if this line exist, otherwice they will be run twice, witch can do some wired things. I ended up with a 4 TB ramdrive, even through the computer only had 128 mb memory (well at last df -h said it was 4 TB)
Right after those lines i inserted the following into the file
Code:
# Kør custum script
if [ -f /etc/rc.d/custum ]; then
. /etc/rc.d/custum
fi
created the file /etc/rc.d/custum
this file lookes somthing like this:
Code:
#!/bin/bash
#Custum boot cd redhat script
#Export global variables
export PATH=/bin:/sbin
#Format ramdrive
mke2fs -vvv /dev/ram1
#mount ram drive
mount -n -t ext2 /dev/ram1 /ramdev
#creates the file /etc/mtab and link it to
mkdir /ramdev/etc
touch /ramdev/etc/mtab
#creates div directoryes.
mkdir /ramdev/var
mkdir /ramdev/var/run
mkdir /ramdev/var/lock
mkdir /ramdev/var/lock/subsys
mkdir /ramdev/var/utmp
#Create tep
mkdir /ramdev/tmp
#Create empty log files
mkdir /ramdev/var/log
mkdir /ramdev/var/log/vbox
touch /ramdev/var/log/boot.log
touch /ramdev/var/log/cron
touch /ramdev/var/log/dmesg
touch /ramdev/var/log/ksyms.0
touch /ramdev/var/log/lastlog
touch /ramdev/var/log/maillog
touch /ramdev/var/log/messages
touch /ramdev/var/log/rpmpkgs
touch /ramdev/secure
touch /ramdev/spooler
touch /ramdev/wtmp
make sure to make the file executeable
I altered the file /etc/fstab
The first line should be where / gets mountet. i altered this line so it looks like this:
Code:
/dev/root.old / ext3 defaults 0 0
Then delete the file /etc/mtab and create a synlink to /proc mounts
Code:
ln -s /proc/mounts /etc/mtab
and then delete /var/log and var/run
At this point i exited chroot and created my own kernel-2.4.23
I maid sure that ext3, iso9660 was compiled in the kernel (not as modules)
Also ramdrive support, and set it to dafult size of 8Mb. And maked sure that initial ramdisk (initrd) also was compiled into the kernel.
Else i i maid as mutch as possebil as modules
I then graped the cloop source code from
http://developer.linuxtag.net/knoppi..._2.00-1.tar.gz
And compiled it for my kernel
I then created the initrd filesystem
Code:
dd if=/dev/zero of=./initrd bs=M count=3000
Format it with ext2 file system
Mount it
Code:
mount -o loop /miniroot /mnt/floppy
I then created the following on the initrd image:
Code:
mkdir system ramdrv modules static loop mnt mnt/floppt mnt/cdrom
ln -s system/bin/
ln -s system/etc/
ln -s system/lib/
ln -s system/sbin/
ln -s system/usr/
ln -s ramdev/tmp
ln -s ../ramdrev/var/run
ln -s ../ramdrev/var/lock
ln -s ../ramdrev/var/log
ln -s ../ramdrev/var/tmp
ln -s ../ramdrev/var/utmp
cp -dpR /dev/* ./dev/
cp ~/cloop-2.00/cloop.o ./modules/
I then graped busybox source code from:
://busybox.net/downloads/busybox-1.00-pre3.tar.bz2
Make sure you chooce build BusyBox as a static binary
under build options.
Then all you need to compile in is (i think) mount, ash, insmod
If you build it in the default directory _install
copy the contencs of this directory to the bin directory on the initrd image
Then create the file linuxrc in the root of the initrd image.
This file looks like this:
Code:
#!/bin/ash
## DD 5-12-2003
#Start af initrd
#Export parth
export PATH=/bin:/sbin:
#mounter proc
mount -t proc proc /proc
#mount cd note change this to where your cd drive is!!!!
mount -t iso9660 /dev/hdb /loop
#indlæser cloop.o modulet i kernen og peger på filen /loop/cd
insmod /modules/cloop.o file=/loop/cdfs
#mounter compressed fs
mount -t iso9660 -o ro /dev/cloop /system
#Switch troot device
echo "0x100" > /proc/sys/kernel/real-root-dev
exit 0
allso make sure to make this script executeable
Then unmount the initrd image and crompress it with gzip
Then i created a 2.88 floppy image to be sure everything could fit on the image.
Code:
dd if=/dev/zero of=/boot.img bs=M count=2880
format it with msdos fs
Code:
mkfs.msdos /boot.img
Then grap syslinux from
http://freshmeat.net/redir/syslinux/...x-2.07.tar.bz2
and run
Code:
syslinux -s ./boot.img
Make sure the switsh -s is there, otherwise the final cd might not be combatibel with your bios and won't boot!
mount the floppy
Code:
msdos -o loop /boot.img /mnt/floppy
and copy the nessary files on the floppy image
Code:
cp /usr/src/linux-2.4.23/arch/i386/boot/bzImage /miniroot.gz /root/syslinux-2.07/ldlinux.sys /mnt/floppy
Create the file syslinux.cfg on the root of the floppy
And this file contains
Code:
DEFAULT bzImage
APPEND ramdisk_size=100000 initrd=miniroot.gz
LABEL linux
KERNEL bzImage
APPEND ramdisk_size=100000 initrd=miniroot.gz
PROMPT 1
Unmount the floppy image.
I maid the following directoryes to contain my actual cd image
/bootcd and /bootcd /boot
Copyed boot.img to /bootcd/boot
now create the compressed file system with
Code:
mkisofs -pad -no-bak -J -R | /root/cloop-2.00/create_compressed_fs - 65536 > /bootcd/cdfs
and to the final cd who can be burned
Code:
cd /bootcd
mkisofs -pad -J -R -b /boot/boot.img -c /boot/boot.cat -o /redhat_boot_cd.iso ./
Have fun
Sincerley
Gozar