01 September 2010

howto create bootable CDROM in linux - 2

Please refer howto create bootable CDROM in linux - 1.

download latest nasm from here.
tar xzvf nasm-2.08.02.tar.gz
cd nasm-2.08.02
./configure && make && make install
/usr/local/bin/nasm got installed

download latest syslinux from here.
tar xzvf syslinux-4.02.tar.gz
cd syslinux-4.02
make && make install
/usr/share/syslinux/isolinux.bin got installed

Install glibc-static from here.
Download BusyBox from here.
Download BusyBox config file from here.
tar xjbf busybox-1.17.1.tar.bz2
cd busybox-1.17.1
cp initrd.config .config
make && make install
_install/* got installed

create initrd:
dd if=/dev/zero of=initrd-new.img bs=1k count=4096
mke2fs -F initrd-new.img
mkdir -p initrd
mount initrd-new.img initrd -o loop

cd initrd
cp -a ../busybox-1.17.1/_install/* .
mkdir -p bin lib dev etc/init.d mnt proc root sbin sys
cat > etc/inittab << EOF
# This is run first except when booting in single-user mode.
::sysinit:/etc/init.d/rcS

# Start an "askfirst" shell on the console (whatever that may be)
::askfirst:/bin/sh

# Stuff to do when restarting the init process
::restart:/sbin/init

# Stuff to do before rebooting
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
::shutdown:/sbin/swapoff -a
EOF

cat > etc/fstab << EOF
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/sr0 /mnt/cdrom iso9660 defaults 0 0
EOF

cat > etc/init.d/rcS << EOF
#!/bin/sh

mkdir -p /proc /sys /dev/pts /mnt/cdrom
/bin/mount -t proc proc /proc
/bin/mount -t sysfs sysfs /sys
/sbin/mdev -s 2>/dev/null
/bin/mount -a
mount -t devpts devpts /dev/pts
ln -sf /proc/mounts /etc/mtab

echo "Welcome to busybox powered linux ..."
EOF
chmod +x etc/init.d/rcS

mknod dev/ram0 b 1 0
mknod dev/null c 1 3
mknod dev/tty c 5 0
mknod dev/console c 5 1
mknod dev/tty0 c 4 0
mknod dev/tty1 c 4 1
cd ..
umount initrd
gzip -9 initrd-new.img
mv -f initrd-new.img.gz initrd.img

download linux 2.6.35 config file from here.
create bootable iso image with linux kernel and initrd.img:
yum install genisoimage
cp initrd.img .
cp config.35 .config
make oldconfig
make isoimage FDARGS="root=/dev/ram0 rw" FDINITRD=initrd.img
cp arch/x86/boot/image.iso bootcd.iso

Reference:
http://syslinux.zytor.com/wiki/index.php/Download
http://www.clusters.umaine.edu/wiki/index.php/Building_a_Minimal_Linux_Image

No comments:

Post a Comment