This CD is based of CentOS 4.3 (http://www.centos.org) In addition to CentOS packages file system drivers unionfs, SquashFS and boot loader ISOLINUX 3.11 is used. A list of mirrors where the source code of CentOS can be found here: http://www.centos.org/modules/tinycontent/index.php?id=13 Direct link to CentOS source code: http://mirrors.kernel.org/centos/4.3/os/SRPMS/ Source Code for unionfs and SquashFS can be found on the following locations: SquashFS - http://squashfs.sourceforge.net unionfs - http://www.fsl.cs.sunysb.edu/project-unionfs.html Source Code for ISOLINUX can be found here: http://www.kernel.org/pub/linux/utils/boot/syslinux/ Source Code for dkms can be found here: http://linux.dell.com/dkms/ Source Code for openipmi can be found here: http://linux.dell.com/files/openipmi/ OpenManage Server Administrator v.5.0 installating media and tarball can be downloaded from: OMSA 5.0 in ISO format: http://ftp.us.dell.com/sysman/5.0_ISM_A00.ISO http://ftp.euro.dell.com/sysman/5.0_ISM_A00.ISO http://ftp.jp.dell.com/sysman/5.0_ISM_A00.ISO OMSA 5.0 in tarball format: http://ftp.us.dell.com/sysman/OMI-SrvAdmin-Dell-Web-LX-50_A00.tar.gz http://ftp.euro.dell.com/sysman/OMI-SrvAdmin-Dell-Web-LX-50_A00.tar.gz http://ftp.jp.dell.com/sysman/OMI-SrvAdmin-Dell-Web-LX-50_A00.tar.gz ---------------------------------------- A quick How-To describing how this CD came to life: This how-to is heavily based on this Gentoo LiveCD how-to - http://forums.gentoo.org/viewtopic-t-410389.html First a short description on how the CD works: - Boot a Linux kernel and load an initial ram disk. - Execute linuxrc script in initial ram disk. - linuxrc will mount the CD. - linuxrc will mount a squashfs file system - linuxrc will unify the squashfs read only file system with a read write tmpfs. - linuxrc will execute init, and CentOS should load. And now some more details: NOTE! I wrote this how-to from memory; it is possible that I have missed something. First: Install a build/development environment; I used CentOS 4.3 and chose to install all development packages. 1. You need to install the Kernel Source Code. Obtain the kernel-.src.rpm file from one of the following Sources: - The SRPMS directory on the appropriate "SRPMS" CD ISO image - The FTP site where you got the kernel package - By running the following command: bash# up2date --get-source kernel Install kernel-.src.rpm (given the default RPM configuration, the files this package contains will be written to /usr/src/redhat/) Change directory to /usr/src/redhat/SPECS/, and issue the following command: bash# rpmbuild -bp --target= kernel.spec (Where is the desired target architecture.) On a default RPM configuration, the kernel tree will be located in /usr/src/redhat/BUILD/. In resulting tree, the configurations for the specific kernels shipped in Red Hat Enterprise Linux 4 are in the /configs/ directory. For example, the i686 SMP configuration file is named /configs/kernel--i686-smp.config. Issue the following command to place the desired configuration file in the proper place for building: bash# cp ./.config 2. We need to add SquashFS support. Download SquashFS from: http://squashfs.sourceforge.net First patch the kernel source code: (http://www.artemio.net/projects/linuxdoc/squashfs/SquashFS-HOWTO.html#preparing) Change to the SquashFS source directory and copy the kernel patch (we'll assume it's named squashfs-patch) to /usr/src/linux. bash# cd /usr/src/squashfs bash# cp linux-2.x.y/squashfs-patch /usr/src/linux Go to the Linux kernel source directory /usr/src/linux: bash# cd /usr/src/linux Note: please remember that we will not be leaving this directory during all further kernel-related procedures, and all paths will be given relative to /usr/src/linux. Now patch the source with the SquashFS patch: bash# patch -p1 < squashfs-patch Second we need to compile and install the mksquashfs tool: (http://www.artemio.net/projects/linuxdoc/squashfs/SquashFS-HOWTO.html#mksquashfs) bash# cd /usr/src/squashfs/squashfs-tools Compile and install mksquashfs: bash# make bash# cp mksquashfs /usr/sbin If everything went fine, typing mksquashfs at the shell prompt should print its "usage" message. 3. To compile the Kernel change directory to the location of the source code and run the following commands: bash# make oldconfig Answer YES to add SqushFS support. bash# make menuconfig I made the following changes: * ext3 support in the kernel instead of a kernel module. * support for SCSI, SCSI Drives and SCSI CD-ROM's in the kernel instead of kernel modules. * support for USB-Mass Storage Devices in the kernel instead of kernel module. * support for different USB Controller Chipsets in the kernel instead of kernel module. You will need to build a kernel with support for your hardware so that it can boot without and initrd. bash# make bash# make install 4. We need to reboot using our newly built kernel. Copy the new bzImage into /boot and edit your boot loader configuration. Reboot. 5. We need to add unionfs support. Getting unionfs to play with CentOS was a bit unpleasant. In the later versions of unionfs it is possible to patch the kernel sources to add unionfs support, this however does not work with the CentOS Kernel sources. In addition the later versions also failed when I tried to compile them as modules. In the end I found that the most recent version of unionfs that I could get to play with CentOS is unionfs-1.0.9. Download: unionfs-1.0.9.tar.gz from ftp://ftp.fsl.cs.sunysb.edu/pub/unionfs/ Extract the archive and run the following commands: bash# make bash# make install bash# depmod -a To check that the unionfs module was successfully build run commands: bash# modprobe unionfs bash# dmesg 6. Installed OMSA 5.0 from OMI-SrvAdmin-Dell-Web-LX-50_A00.tar.gz Once the OMSA tarball is extracted I did the following: Move to the install dir. bash# cd /supportscripts/ I am doing this in VMWare so I need to run installation with OMIIGNORESYSIDE=1 bash# OMIIGNORESYSID=1 srvadmin-install.sh I installed openipmi drivers using dkms. bash# cd /RPMS/RH4_i386 bash# dkms-2.0.11-1.noarch.rpm bash# rpm -Uhv openipmi-33.13.RHEL4-1dkms.noarch.rpm It seems dkms installs the kernel modules into /var, I copied the oppenipmi drivers from /var to my /lib/modules directory. Second: Install CentOS 4.3, use the GUI installer. (Will refer to this install as "LiveCD Install" later) - I installed a custom system with no SElinux, and choose "minimal" at package selection. I created the following partitions during install: /boot / swap 9. After the install, configure the system to use the Dell yum repository, and update the system: bash# wget -q -O - http://linux.dell.com/yum/software/bootstrap.sh | bash bash# rpm --import /usr/share/rhn/RPM-GPG-KEY bash# up2date -u 10. To install X and Gnome Run the following commands: bash# up2date -i system-config-display bash# up2date -i gnome-session 11. We need to copy the kernel modules for our custom kernel over from the development/build system. Reboot into the development/build system, mount the minimal root (/) partition of the minimal install. bash# mount /dev/hdb3 /mnt/livecd Copy the custom-kernel modules over to the livecd install: bash# cp -a /lib/modules/ /mnt/livecd/lib/modules/ Remove the kernel modules for the default-centos-kernel: bash# rm -rf /mnt/livecd/lib/modules/ 12. We need to install OMSA on the "liveCD Install". Reboot into the "liveCD Install" and Install OMSA 5.0 from OMI-SrvAdmin-Dell-Web-LX-50_A00.tar.gz Once the OMSA tarball is extracted I did the following: Move to the install dir. bash# cd /supportscripts/ I am doing this in VMWare so I need to run installation with OMIIGNORESYSIDE=1 bash# OMIIGNORESYSID=1 srvadmin-install.sh 13. Cleanup the startup, faster boot and some services fail to start from the CD. (I do not remember exactly what services I turned off; here is a short list to give you a general idea.) bash# chkconfig smartd off bash# chkconfig sendmail off bash# chkconfig cron off bash# chkconfig anacron off bash# chkconfig kudzu off bash# chkconfig isdn off 14. To make networking work on all systems We need to edit the following file: /etc/sysconfig/network-scripts/ifcfg-eth0 Remove the line with the MAC address. (I also created ifcfg-ethX files for 3 additional NIC's.) 15. To Auto configure X and automatically start a GNOME session Edit the following file: /etc/rc.local Add the following: echo "Trying to auto configure X" system-config-display --noui --reconfig --set-resolution=1024x768 echo "Starting X and GNOME" startx 16. To help the initrd we need to move chroot from to /bin bash# mv /usr/sbin/chroot /bin (I believe it is located in /usr/sbin/ as default, if not look in /sbin or /usr/bin) 17. Install any additional software you want, add any configuration changes that you want etc. When you have done all the changes you want, reboot into the build/development install. 18. We need to populate /dev on the "liveCD install" root partition. bash# mount /dev/hdb3 /mnt/livecd bash# tar xvzf dev.tar.gz -C /mnt/livecd/ 19. We need to edit /etc/fstab on the "liveCD install" The /etc/fstab file should include only the following: unionfs / unionfs defaults 0 0 none /dev/pts devpts gid=5,mode=620 0 0 none /dev/shm tmpfs defaults 0 0 none /proc proc defaults 0 0 none /sys sysfs defaults 0 0 20. Creating the initrd ** First we create an image file, put an ext2 file system on it and mount it a loop device. bash# dd if=/dev/zero of=initrd BS=1M count=8 bash# mke2fs initrd bash# mkdir /mnt/loop bash# mount -o loop initrd /mnt/loop ** Now we need to create the files and directories we need in our initial ram disk. bash# mkdir etc dev lib bin proc new cdrom static dynamic union bash# touch linuxrc bash# chmod +x linuxrc bash# touch etc/mtab bash# touch etc/fstab ** Then we need to copy the files, binaries, libraries and kernel modules that we need in our initial ram disk. ** Files that go in /mnt/loop/bin (The initrd /bin directory) cat chroot insmod mkdir mount pivot_root sh tar umount usleep To figure out what files should go in /mnt/loop/lib (The initrd /lib directory) use the ldd command. Example: bash# ldd /bin/sh Will output: linux-gate.so.1 => (0xffffe000) libreadline.so.5 => /lib/libreadline.so.5 (0xb7f72000) libhistory.so.5 => /lib/libhistory.so.5 (0xb7f6b000) libncurses.so.5 => /lib/libncurses.so.5 (0xb7f33000) libdl.so.2 => /lib/libdl.so.2 (0xb7f2f000) libc.so.6 => /lib/libc.so.6 (0xb7e42000) /lib/ld-linux.so.2 (0xb7fad000) So, sh need the above list of libraries to run, copy them into place. NOTE! Ignore linux-gate.so.1 In addition to this wee need to copy our unionfs drive module and the modules.dep file into /lib bash# cp /lib/modules//kernel/fs/unionfs.ko /mnt/loop/lib bash# cp /lib/modules//modules.dep /mnt/loop/lib Populate the /dev directory in our initial ram disk: bash# mknod /mnt/loop/dev/console c 5 1 bash# mknod /mnt/loop/dev/null c 1 3 bash# mknod /mnt/loop/dev/hda b 3 0 bash# mknod /mnt/loop/dev/hdb b 3 64 bash# mknod /mnt/loop/dev/hdc b 22 0 bash# mknod /mnt/loop/dev/hdd b 22 64 bash# mknod /mnt/loop/dev/scd0 b 11 0 bash# mknod /mnt/loop/dev/scd1 b 11 1 bash# mknod /mnt/loop/dev/scd2 b 11 2 bash# mknod /mnt/loop/dev/scd3 b 11 3 bash# mknod /mnt/loop/dev/sda b 8 0 bash# mknod /mnt/loop/dev/sdb b 8 16 bash# mknod /mnt/loop/dev/sdc b 8 32 bash# mknod /mnt/loop/dev/sdd b 8 48 bash# mknod /mnt/loop/dev/sde b 8 64 bash# mknod /mnt/loop/dev/sdf b 8 80 bash# mknod /mnt/loop/dev/tty c 4 0 bash# mknod /mnt/loop/dev/loop0 b 7 0 Create/Edit the linuxrc script that will find the CD, mount the file systems and execute init in the end: #!/bin/sh export PATH=/bin echo "Wait 5 seconds for slow USB CD-ROM devices to be detected..." for x in 1 2 3 4 5 do usleep 1000000 echo -n " $x" done for x in hda hdb hdc hdd sda sdb sdc sdd sde sdf scd0 scd1 scd2 scd3 do mount -t iso9660 /dev/${x} /cdrom if [ "$?" == "0" ] then CDROM=${x} break fi done if [ "${CDROM}" == "" ] then echo "FATAL --- LIVECD NOT FOUND" exec /bin/sh exit fi echo "LiveCD found in /dev/${CDROM}" /bin/insmod /lib/unionfs.ko mount -t squashfs -o loop /cdrom/livecd.squashfs /static mount -t tmpfs -o size=300M none /dynamic mount -t unionfs -o dirs=/dynamic=rw:/static=ro unionfs /union cd /union /bin/pivot_root . initrd mount --move /initrd/dynamic /mnt/dynamic mount --move /initrd/static /mnt/static mount --move /initrd/cdrom /mnt/cdrom mount -t tmpfs -o size=50M none /tmp mount -t proc none /proc cat /proc/mounts > /etc/mtab umount /proc exec chroot . /bin/sh <<- EOF >dev/console umount /initrd echo "Startng init!" exec /sbin/init EOF Finally we need to unmount the initrd, and compress it with gzip. bash# ummount /mnt/loop bash# gzip initrd 21. We need to copy out bzImage, ISOLINUX and initrd into what will be the BOOT directory on the CD bash# mkdir boot bash# mkdir boot/isolinux bash# cp boot/isolinux/ bash# touch boot/isolinux/isolinux.cfg bash# cp initrd.gz boot/isolinux/ bash# cp bzImage boot/isolinux/livekrnl 22. Edit the isolinux.cfg file: timeout 1 default Linux label Linux kernel livekrnl append initrd=initrd.gz init=/linuxrc root=/dev/ram0 23. Preparing the CDROOT directory bash# mkdir cdroot bash# cp -a boot cdroot/ 24. Creating the SquashFS file system bash# cd cdroot/ bash# mksquashfs /mnt/livecd livecd.squashfs bash# cd .. 25. Create a bootable CD ISO image using mkisofs bash# mkisofs -R -b boot/isolinux/isolinux.bin -no-emul-boot -boot-load-size \ 4 -boot-info-table -c boot/isolinux/boot.cat -iso-level 3 -o livecd.iso cdroot/ Once this ISO I created it is time to burn it to a CD and test it. To save space I also spent some time deleting documentation files and the rpm database etc.