星期一, 11月 17, 2003

Making Mac Bootable CD

this is pretty easy with current mkisofs (the one that ships in debian
woody is fine).
 
here is what you do:
 
1: create your CD hierarchy, at say ~/cd-master
2: create a boot directory; mkdir ~/cd-master/boot
3: create a boot/ofboot.b; 
   cat /usr/share/doc/yaboot/examples/simpleboot.chrp | \
       sed -e 's/hd:2/cd:/' > ~/cd-master/boot/ofboot.b
 
   (note if you don't use debian this path will be
    /path/to/yabootsource/doc/examples/simpleboot.chrp)
4: copy yaboot binary; cp /usr/lib/yaboot/yaboot ~/cd-master/boot
5: create a `maps' file for mkisofs;
   cat < ~/maps
# EXTN   XLate   CREATOR   TYPE     Comment
.b              Raw     'UNIX'    'tbxi'   "bootstrap"
yaboot          Raw     'UNIX'    'boot'   "bootstrap"
linux           Raw     'UNIX'    'boot'   "kernel"
vmlinux         Raw     'UNIX'    'boot'   "kernel"
.conf           Raw     'UNIX'    'conf'   "bootstrap"
root.bin        Raw     'UNIX'    'root'   "root_image"
*               Raw     'UNIX     'UNIX'   "unix"
EOF
 
6: create ISO; mkisofs -hfs -part -map ~/maps -no-desktop \
                -hfs-volid "Yaboot_Boot_CD" -hfs-bless ~/cd-master/boot \
                -r -o yaboot-cd.iso ~/cd-master
 
7: burn .iso to CD; cdrecord -blahblah -data yaboot-cd.iso
 
note that step 3 is quite important, as is step 5.  the sed command
just replaces the hard coded `hd:2' device with `cd:' which is
required for CD booting.  the maps file ensures the correct HFS
type/creators are set on the right files.  the ofboot.b is required
since some models (notably blue g3) refuse to boot binaries by
default, thus the ofboot.b first stage is necessary.
 
the resulting ISO will be bootable on all NewWorld powermacs by simply
holding down the C key during boot, you can mount it in *nix as
regular ISO9660.
 
note that you *must* use a subdirectory in your CD tree, not the root of
the CD tree, mkisofs will ignore your -hfs-bless option if you attempt
to use the root of the cd mastering tree.  check the output of mkisofs
for a `Blessing cd-master/boot' message, this is the only indication
of whether it worked, if it can't find the dir or some other error
occurs it just silently ignores that option and your CD won't be
bootable (i consider this a bug).

ah right, i knew i was forgetting something, yes you need to put the
yaboot.conf in the boot directory.  it should look something like
this:
device=cd: 
image=/boot/vmlinux

with all the rest of the normal stuff, do not specify partition=
 
you can put kernels wherever you want on the CD, just use a full path.

沒有留言:

張貼留言