Mailing List Archive

Updated Makefile to produce a utility cd for Linux installations for OldWorld from an Original MacOS CD
Hello,


I've updated my Makefile. This new version supports booting the Gentoo
Minimal Installation CD all from a ramdisk (it did not work with the
last version).

- choose Linux Kernels/genallinitrd.gz for a ramdisk in BootX/Options
- type 64000 in the field ramdisk size
- enter init=linuxrc video="atyfb:off" as boot arguments (video
option only if you have a pci video card and don't use onboard video)

See my last posts if you need further instructions on how to create the
CD with the Makefile. The deballinitrd.gz is still broken. Choose from
the netboot, cd, or hd-media targets, if you want to boot the debian
installer. The Gentoo Minimal Installation Boot from my rather
crude-hacked-together genallinitrd.gz was tested with a Beige G3, 192 MB
RAM (probably works with less, but I suspect not less than 100) and a
Mac OS 8.5 CD (template for the Makefile).

It is also possible to use miboot with the cd, though I've not automated
this yet. Thoughts are:
- hmount Mac OS 8.5 CD template
- remove all data on it
- put genvmlinux and genallinitrd.gz on it
- run a modified miboot script (the one from debian) to put the fake Mac
OS files on the CD needed to but the previous two files
- oldworld livecds should be possible with that, but you would need a
kernel with hfs filesystem support to mount the cd (at least i couldn't
get hybrid cd's to boot yet) unless you squeeze everything into the
initrd, like I did with the minimal gentoo (this is impractical for a
big livecd, since most oldworld machines probably have less than 512 MB
of ram)


cat >Makefile <<EOF
# This is a convenience Makefile to add SystemDisk, BootX and
# a couple of current linux kernels to a bootable Mac OS CD.
# It tries to do the right thing (tm) ;-)
#
#
# $name: Makefile$
# $author: Christian Mueller <cmue81 at gmx dot de>$
# $copyright: Copyright (C) 2007 by Christian Mueller$
# $license: http://www.gnu.org/licenses/gpl.html$
# $license-version: GNU GPL version 2$
# $date: 2007-01-23$
#
#
# Dependencies: hfsutils, cdr-tools
#
# Usage: The only thing you should need to adjust is the
# BOOTABLE_MAC_CD variable or *URL if the URLs listed
# deliver a "404 not found". If you have a rewritable
# cd handy, adjust CDBURNER and try make cdrw.
#
# Motivation: Even in the lucky case you get bootloaders for
# a Beige G3 working (miboot, quik, etc.) you
# would still need a booting Mac OS System to
# apply the System Disk patches in case they
# get screwed up. So if you're the owner of a
# proprietary Mac OS CD let this Makefile convert
# it to a useful utility CD in case you get stuck
# with stand-alone-linux on your Mac-Box.
#
# WARNING: The image given with BOOTABLE_MAC_CD will get
# modified! It might not work, so do backups !!
#
# NOTE: You cannot compress your kernels if you want to use
# them with BootX ;-(
#
# Tested on a Beige G3 with OpenFirmware 2.4, might work on
# other models. Hopefully we will not need this anymore
# some day, when support for Apple's oldworld machines has
# grown up ;-) Ciao ..
#
BOOTABLE_MAC_CD = /media/hdb1/macos8.iso
CDBURNER = ATA:1,0,0


SELF = Makefile

SYSDISK = SystemDisk2.3.1.smi.bin

STUFFIT = stuffit520.611linux-i386.tar.gz
UNSTUFF = bin/unstuff

BOOTX = BootX_1.2.2.sit
BOOTX_DIR = BootX_1.2.2
BOOTX_DIR_KRNL = $(BOOTX_DIR)/Linux_Kernels

APPDISK = AppDisk174.sit
APPDISK_DIR = AppDisk_1.7.4

RESEDIT = ResEdit_2.1.3.sea.bin
RSEDPDF = ResEditReference.pdf

TOMEVIEW = tomeviewer.sit
TOMEVIEW_DIR = TomeViewer_1.3d3

XPOSTFACTO = XPostFacto4.sit
XPOSTFACTO_DIR = XPostFacto4

GEN_IMG = install-ppc-minimal-$(GEN_IMG_VER).iso
GEN_IMG_VER = 2006.0
GEN_IMG_KRNL = ppc32


SYSDISKURL = ftp://ftp.apple.com/developer/macosxserver/utilities/$(SYSDISK)
STUFFITURL = http://www.allume.com/downloads/files/$(STUFFIT)
BOOTXURL = http://penguinppc.org/historical/benh/$(BOOTX)
APPDISKURL = http://homepage.mac.com/mavsftwre/$(APPDISK)
RESEDITURL =
http://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/English-North_American/Macintosh/Utilities/$(RESEDIT)
RSEDPDFURL = http://developer.apple.com/documentation/mac/pdf/$(RSEDPDF)
TOMEVIEWURL = http://aspect1.mac.tucows.com/files/$(TOMEVIEW)
XPOSTFACTOURL =
http://eshop.macsales.com/OSXCenter/XPostFacto/Archive/$(XPOSTFACTO)
DEBURL = http://people.debian.org/~wouter/d-i/powerpc/daily/powerpc
GENMIRROR = ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo
GENURL = $(GENMIRROR)/releases/ppc/$(GEN_IMG_VER)/ppc32/installcd/$(GEN_IMG)




modimage: fetchonly \
hfsmount \
$(SELF).treecopy \
$(RSEDPDF).treecopy \
$(SYSDISK).treecopy \
copyarchives \
debianstuff \
gentoostuff \
$(BOOTX_DIR).treecopy \
$(APPDISK_DIR).treecopy \
$(TOMEVIEW_DIR).treecopy \
$(XPOSTFACTO_DIR).treecopy \
hfsumount

copyarchives: hfscd_archives_dir \
$(BOOTX).treecopy \
$(APPDISK).treecopy \
$(RESEDIT).treecopy \
$(TOMEVIEW).treecopy \
$(XPOSTFACTO).treecopy \
hfscd_cretyp \
hfscd_dotdot

fetchonly: $(BOOTX_DIR_KRNL) \
$(SYSDISK) \
$(STUFFIT) \
$(APPDISK) \
$(RESEDIT) \
$(RSEDPDF) \
$(TOMEVIEW) \
$(XPOSTFACTO) \
$(GEN_IMG) \
$(BOOTX_DIR_KRNL)/debnetbootird.gz \
$(BOOTX_DIR_KRNL)/debcdromird.gz \
$(BOOTX_DIR_KRNL)/debhd-mediaird.gz \
$(BOOTX_DIR_KRNL)/debvmlinux

cd: modimage
cdrecord -dao dev=$(CDBURNER) $(BOOTABLE_MAC_CD)

cdclean:
cdrecord dev=$(CDBURNER) blank=fast

cdrw: cdclean cd

clean:
umount -d genloop || exit 0
rm -rf bin/ genloop/ "$(BOOTX_DIR)" "$(APPDISK_DIR)" "$(TOMEVIEW_DIR)" \
"$(XPOSTFACTO_DIR)" *.dirs *.files *irdbuild *irdmerge .*irdmerge

distclean: clean
rm $(SYSDISK) $(STUFFIT) $(BOOTX) $(APPDISK) $(RESEDIT) $(RSEDPDF) \
$(TOMEVIEW) $(XPOSTFACTO) $(GEN_IMG)




hfscd_archives_dir:
hmkdir ":Archives" 2>/dev/null || exit 0
hcd ":Archives"

hfscd_cretyp:
hattrib -c SITx -t SITD ":*"

hfscd_dotdot:
hcd "::"

hfsumount:
humount

hfsmount:
hmount $(BOOTABLE_MAC_CD)

TCRW = \($(BOOTX_DIR_KRNL)\)\|\($(BOOTX)\)\|\($(APPDISK)\)
TCRAW = $(TCRW)\|\($(RSEDPDF)\)\|\($(TOMEVIEW)\)\|\($(XPOSTFACTO)\)
TCSPEC1 = s^hcopy -m\( .\)\($(TCRAW)\)^hcopy -r\1\2^
TCSPEC2 = s^hcopy -m\( .\)\($(SELF)\)^hcopy -t\1\2^
TCSPECIALS = $(TCSPEC1);$(TCSPEC2);
CPLSED = h;s|/|:|g;s|_| |g;s|^ '\(.*:\)\?.*| ':\1'|;H;g;s/\n//;s/^/hcopy
-m/;
%.treecopy: %
echo "#!/bin/sh" > "$*.dirs" && chmod +x "$*.dirs"
echo "#!/bin/sh" > "$*.files" && chmod +x "$*.files"
find "$*" -type d -printf "hmkdir '/%p'\n" | \
sed -e "s|/|:|g;s|_| |g;$(TCSPECIALS)" >> "$*.dirs"
find "$*" -not -type d -printf " '%p'\n" | \
sed -ne "$(CPLSED)$(TCSPECIALS)p" >> "$*.files"
"./$*.dirs" 2>/dev/null || exit 0
"./$*.files" || exit 0

%.irdmerge:
mkdir -p "$(suffix $*).irdmerge" && \
cd "$(suffix $*).irdmerge" && \
gunzip -c "../$(BOOTX_DIR_KRNL)/$(subst .,,$(suffix $*))$(patsubst \
%$(suffix $*),%,$*)ird.gz" > "initrd.tmp" && \
cpio -i < "initrd.tmp" 2> /dev/null && \
rm "initrd.tmp" && \
cd .. && \
touch "$@"

%.irdbuild:
test -e "$(patsubst %$(suffix $*),%,$*).gz" || { \
cd $(suffix $*).irdmerge && \
find > ../files$(suffix $*).irdmerge && \
cpio -o < ../files$(suffix $*).irdmerge > "../$(patsubst \
%$(suffix $*),%,$*)" && \
cd .. ; }

%.gz: %
test -e "$@" || gzip -9 "$*"




$(STUFFIT):
wget $(STUFFITURL)

$(UNSTUFF): $(STUFFIT)
tar xzf $(STUFFIT) $(UNSTUFF)
touch $(UNSTUFF)

$(BOOTX):
wget $(BOOTXURL)

$(BOOTX_DIR): $(UNSTUFF) $(BOOTX)
$(UNSTUFF) -m=on $(BOOTX)
mv "$(subst _, ,$@)" "$@"

$(BOOTX_DIR_KRNL): $(BOOTX_DIR)
mv "$(subst Linux_,Linux ,$@)" "$@"
touch "$@"

$(APPDISK):
wget $(APPDISKURL)

$(APPDISK_DIR): $(UNSTUFF) $(APPDISK)
$(UNSTUFF) -m=on $(APPDISK)
mv "$(subst _, ,$@)" "$@"

$(RESEDIT):
wget $(RESEDITURL)

$(RSEDPDF):
wget $(RSEDPDFURL)

$(TOMEVIEW):
wget $(TOMEVIEWURL)

$(TOMEVIEW_DIR): $(UNSTUFF) $(TOMEVIEW)
$(UNSTUFF) -m=on $(TOMEVIEW)
mv "$(subst _, ,$@)" "$@"

$(XPOSTFACTO):
wget $(XPOSTFACTOURL)

$(XPOSTFACTO_DIR): $(UNSTUFF) $(XPOSTFACTO)
$(UNSTUFF) -m=on $(XPOSTFACTO)




$(GEN_IMG):
wget $(GENURL)

$(GEN_IMG).mount: $(GEN_IMG)
mkdir -p genloop && \
mount -o loop $(GEN_IMG) genloop

$(BOOTX_DIR_KRNL)/genliveird.gz: genloop/boot/$(GEN_IMG_KRNL).igz
cp "genloop/boot/$(GEN_IMG_KRNL).igz" "$@"

# .gen.irdmerge/image.squashfs: genloop/image.squashfs
# cp "genloop/image.squashfs" "$@"

INITDEFAULTS = real_root=/dev/ram3 cdroot console=tty0 loop=image.squashfs \
looptype=squashfs
$(BOOTX_DIR_KRNL)/genallinitrd: $(BOOTX_DIR_KRNL)/genliveird.gz
test -e "$@.gz" || { \
gunzip -c "$<" > "$@" && \
mkdir -p .gen.irdmerge && cd .gen.irdmerge && \
dd if="../$@" skip=5 | cpio -i && cat init | sed -e \
's^bootstrapCD^mv /$${LOOP} $${NEW_ROOT}/mnt/cdrom > /dev/null 2>\&1^' -e \
's:^REAL_ROOT=.*:CMDLINE="$(INITDEFAULTS) $$CMDLINE":' > in && \
cat <in >init && \
echo "init" | cpio -o -H newc >> "../$@" && \
cd .. && \
cd genloop && \
echo "image.squashfs" | cpio -o -H newc >> "../$@" && \
cd .. ; }
# live.gen.irdmerge \
# .gen.irdmerge/image.squashfs \
# $(BOOTX_DIR_KRNL)/genallinitrd.gen.irdbuild

$(BOOTX_DIR_KRNL)/genvmlinux: genloop/boot/$(GEN_IMG_KRNL)
test -e "$@.gz" || cp "genloop/boot/$(GEN_IMG_KRNL)" "$@"

gentoostuff: $(GEN_IMG).mount \
$(BOOTX_DIR_KRNL) \
$(BOOTX_DIR_KRNL)/genliveird.gz \
$(BOOTX_DIR_KRNL)/genallinitrd.gz \
$(BOOTX_DIR_KRNL)/genvmlinux
umount -d genloop




$(BOOTX_DIR_KRNL)/deb%ird.gz:
wget -O "$@" $(DEBURL)/$*/initrd.gz

$(BOOTX_DIR_KRNL)/deballinitrd: $(BOOTX_DIR_KRNL)/debnetbootird.gz \
$(BOOTX_DIR_KRNL)/debcdromird.gz \
$(BOOTX_DIR_KRNL)/debhd-mediaird.gz \
netboot.deb.irdmerge \
cdrom.deb.irdmerge \
hd-media.deb.irdmerge \
$(BOOTX_DIR_KRNL)/deballinitrd.deb.irdbuild

$(BOOTX_DIR_KRNL)/debvmlinux:
test -e "$@.gz" || wget -O "$@" $(DEBURL)/cdrom/vmlinux

debianstuff: $(BOOTX_DIR_KRNL) \
$(BOOTX_DIR_KRNL)/debnetbootird.gz \
$(BOOTX_DIR_KRNL)/debcdromird.gz \
$(BOOTX_DIR_KRNL)/debhd-mediaird.gz \
$(BOOTX_DIR_KRNL)/deballinitrd.gz \
$(BOOTX_DIR_KRNL)/debvmlinux




$(SYSDISK):
wget $(SYSDISKURL)


EOF