HOW TO MAKE A SPARC BOOTABLE CDROM SILO may be used to create a bootable CDROM for sparc. At the moment it will support booting on sun4c, sun4m and sun4d machines only, but sun4u (UltraSparc) and sun4 support will come soon. INTRO ===== A CDROM is booted on Sparc by issuing following commands in the PROM (depending on PROM version - v0 is PROM with major versions 0 or 1, found on sun4c only, v2 is PROM with major versions 2 or 3, found on some newer sun4c and all sun4m and sun4d machines): v0: b sd(0,6,0) v2: boot cdrom (cdrom is actually alias to /iommu/sbus/espdma/esp/sd@0,6:d) As Solaris has different kernels for each architecture, the PROM boots by default from different "partitions" on the CD depending on the architecture of the machine (that's e.g. the :d in the cdrom alias on v2 PROM). That partition table is stored in the first 512 bytes of the CD (with exactly the same format as partition tables on Sparc disks), so you can use SparcLinux fdisk program to look into that partition table. As SparcLinux at the moment uses one kernel image for all the architectures and if in the future the need of different kernel images arises, SILO will have other means of supporting it, SparcLinux bootable CDROMs have a partition table with only one partition which covers the whole iso9660 image of the CD. Other partitions are set up, so that they start at offset 0 (like the first one) and have size of 0, ie. are disabled. The only value PROM looks at is starting offset, so that it will boot on all machines correctly. In the boot process PROM finds start of the boot partition (in SILO case it is always 0) and loads 7680 bytes from offset 512 in that partition. Fortunately iso9660 has first 32KB reserved for OS use, so that the partition table and bootblock can be safely stored there. As SILO is longer in size than those 32KB (eventhough it is compressed), it puts its first stage loader in there and puts its second stage loader somewhere in the iso9660 filesystem. That's why the procedure is actually so complicated. You need first to put all the files which will be stored in the iso9660 filesystem in some tree, run mkisofs or you favourite user interface to it and then let SILO do some magic on the raw iso9660 image. Because SILO doesn't understand iso9660 format yet (it understands ext2fs and ufs only), it will create a list of block starts for each image you'd like to load from the CD (either executable, like kernel, or some message text, or initial ramdisk image, etc.). STEP BY STEP ============ You should first prepare the tree you'd like to have on the CD. The only requirement is that you put boot/* files from SILO distribution into /boot in the tree, edit appropriate /etc/silo.conf in the tree and maybe also put sbin/silo into /sbin/silo in the tree, so that users use same version of SILO as is the CD made with. To edit /etc/silo.conf in the tree, you should know which files you'd like SILO at runtime to load from the CD. This includes executable images (like Linux kernel), messages (for use with message= option in silo.conf - these messages are displayed when SILO comes up), initial ramdisk images. Note that images which the user has on disks will SILO still be able to load, so you shouldn't put them in the list. You should put those names in a list and assign them numbers from 1 to 30. Let's say you will need to load following files during run-time: /boot/vmlinux-2.0.24.gz /etc/welcome.msg /boot/initial.ramdisk.gz /boot/vmlinux-2.1.6.gz /boot/vmlinux-2.1.30.gz You assign them numbers like this: !cd1 /boot/vmlinux-2.0.24.gz !cd2 /etc/welcome.msg !cd3 /boot/initial.ramdisk.gz !cd4 /boot/vmlinux-2.1.6.gz !cd5 /boot/vmlinux-2.1.30.gz (the !cd is a prefix, as !cd1 to !cd30 you refer to the particular files in silo.conf). Now you edit the silo.conf file according to your needs. The only difference between usual on-disk silo.conf and silo.conf on the cd is that you replace all the paths to files on the CD (and their prom disk paths) with the !cdX notation. Files you'd like to load with the on-CD SILO from user's disks should keep the format dependent on the PROM version of the machine, but it is usually not wise idea to put it on the CD, as the location of user's disks differs from machine to machine and you cannot use the default boot-on disk, as the boot-on disk is the CD, so you don't know which disk will be root for the user. If the user wants, he'll still be able to use the SILO command line. Here is an example how such silo.conf may look like: message=!cd2 image=!cd1 label=stable alias=2.0.24 initrd=!cd3 image=!cd4 label=old image=!cd5 label=current alias=2.1.30 For exact format of silo.conf consult SILO.CONF.HOWTO. Next step is to make the iso9660 filesystem (either on a raw partition, such as /dev/sdb1, or into a file (e.g. ~/sparcbootable.iso). How to do this is outside the scope of this document, there are many programs which can do it. I'm for instance using CDW tools, which is a shell + dialog interface to mkisofs and related programs. Following step can be done on Linux/Sparc or Linux/i386 machines only. If you have the iso9660 raw image in a file, the kernel should support the loopback device and you should have losetup utility somewhere available. You should then mount the iso9660 image somewhere and run either sbin/silo (on Linux/Sparc) or misc/intelsilo (on Linux/i[3456]86) with the following arguments: -r /mount_point_of_iso9660_image -c /raw_iso9660_image -l comma,separated,list,of,files,you,used,in,silo,conf,as,!cdX,from,1,to,last,number,used You may also use other flags, see silo -? Examples for the above shown list of SILO loadable files and with iso9660 raw image on raw partition /dev/sdb1: /sbin/mount /dev/sdb1 /mnt sbin/silo -r /mnt -c /dev/sdb1 -l /boot/vmlinux-2.0.24.gz,/etc/welcome.msg,/boot/initial.ramdisk.gz,/boot/vmlinux-2.1.6.gz,/boot/vmlinux-2.1.30.gz /sbin/umount /mnt The same for iso9660 image on ~/sparcbootable.iso /sbin/losetup /dev/loop0 ~/sparcbootable.iso /sbin/mount /dev/loop0 /mnt sbin/silo -r /mnt -c ~/sparcbootable.iso -l /boot/vmlinux-2.0.24.gz,/etc/welcome.msg,/boot/initial.ramdisk.gz,/boot/vmlinux-2.1.6.gz,/boot/vmlinux-2.1.30.gz /sbin/umount /mnt /sbin/losetup -d /dev/loop0 (replace sbin/silo with misc/intelsilo on Linux/i[3456]86). This step does following steps: It sets up the partition table in the first 512 bytes of the image. It puts the first stage boot loader starting from offset 512 in the image. It puts offset to /boot/second.b in 512B chunks into the first stage loader and sets up internal first stage loader variables. It fills first 2048 bytes of /boot/second.b with the table of second.b sectors (again, in 512B chunks). It sets up a table in second.b, which is at run-time used to translate !cdX names into CD blocks and file sizes. (note: if you want to see the changes in second.b, you have to umount it and mount it again, as silo writes to the raw image, iso9660 is read-only, so it doesn't reread it correctly). SILO doesn't change the size of the image, so that isosize on the iso raw image file before and after silo magic will tell you the same number. Now is the time to burn the CD and then cross your fingers and see what happens. If you have any problems, mail jj@sunsite.mff.cuni.cz