Gentoo Archives: gentoo-ppc-dev

From: "Christian Müller" <cmue81@×××.de>
To: Debian PowerPC <debian-powerpc@××××××××××××.org>, gentoo-ppc-user@l.g.o, gentoo-ppc-dev@l.g.o
Subject: [gentoo-ppc-dev] Updated Makefile to produce a utility cd for Linux installations for OldWorld from an Original MacOS CD
Date: Tue, 23 Jan 2007 17:58:05
Message-Id: 45B64C64.7050604@gmx.de
1 Hello,
2
3
4 I've updated my Makefile. This new version supports booting the Gentoo
5 Minimal Installation CD all from a ramdisk (it did not work with the
6 last version).
7
8 - choose Linux Kernels/genallinitrd.gz for a ramdisk in BootX/Options
9 - type 64000 in the field ramdisk size
10 - enter init=linuxrc video="atyfb:off" as boot arguments (video
11 option only if you have a pci video card and don't use onboard video)
12
13 See my last posts if you need further instructions on how to create the
14 CD with the Makefile. The deballinitrd.gz is still broken. Choose from
15 the netboot, cd, or hd-media targets, if you want to boot the debian
16 installer. The Gentoo Minimal Installation Boot from my rather
17 crude-hacked-together genallinitrd.gz was tested with a Beige G3, 192 MB
18 RAM (probably works with less, but I suspect not less than 100) and a
19 Mac OS 8.5 CD (template for the Makefile).
20
21 It is also possible to use miboot with the cd, though I've not automated
22 this yet. Thoughts are:
23 - hmount Mac OS 8.5 CD template
24 - remove all data on it
25 - put genvmlinux and genallinitrd.gz on it
26 - run a modified miboot script (the one from debian) to put the fake Mac
27 OS files on the CD needed to but the previous two files
28 - oldworld livecds should be possible with that, but you would need a
29 kernel with hfs filesystem support to mount the cd (at least i couldn't
30 get hybrid cd's to boot yet) unless you squeeze everything into the
31 initrd, like I did with the minimal gentoo (this is impractical for a
32 big livecd, since most oldworld machines probably have less than 512 MB
33 of ram)
34
35
36 cat >Makefile <<EOF
37 # This is a convenience Makefile to add SystemDisk, BootX and
38 # a couple of current linux kernels to a bootable Mac OS CD.
39 # It tries to do the right thing (tm) ;-)
40 #
41 #
42 # $name: Makefile$
43 # $author: Christian Mueller <cmue81 at gmx dot de>$
44 # $copyright: Copyright (C) 2007 by Christian Mueller$
45 # $license: http://www.gnu.org/licenses/gpl.html$
46 # $license-version: GNU GPL version 2$
47 # $date: 2007-01-23$
48 #
49 #
50 # Dependencies: hfsutils, cdr-tools
51 #
52 # Usage: The only thing you should need to adjust is the
53 # BOOTABLE_MAC_CD variable or *URL if the URLs listed
54 # deliver a "404 not found". If you have a rewritable
55 # cd handy, adjust CDBURNER and try make cdrw.
56 #
57 # Motivation: Even in the lucky case you get bootloaders for
58 # a Beige G3 working (miboot, quik, etc.) you
59 # would still need a booting Mac OS System to
60 # apply the System Disk patches in case they
61 # get screwed up. So if you're the owner of a
62 # proprietary Mac OS CD let this Makefile convert
63 # it to a useful utility CD in case you get stuck
64 # with stand-alone-linux on your Mac-Box.
65 #
66 # WARNING: The image given with BOOTABLE_MAC_CD will get
67 # modified! It might not work, so do backups !!
68 #
69 # NOTE: You cannot compress your kernels if you want to use
70 # them with BootX ;-(
71 #
72 # Tested on a Beige G3 with OpenFirmware 2.4, might work on
73 # other models. Hopefully we will not need this anymore
74 # some day, when support for Apple's oldworld machines has
75 # grown up ;-) Ciao ..
76 #
77 BOOTABLE_MAC_CD = /media/hdb1/macos8.iso
78 CDBURNER = ATA:1,0,0
79
80
81 SELF = Makefile
82
83 SYSDISK = SystemDisk2.3.1.smi.bin
84
85 STUFFIT = stuffit520.611linux-i386.tar.gz
86 UNSTUFF = bin/unstuff
87
88 BOOTX = BootX_1.2.2.sit
89 BOOTX_DIR = BootX_1.2.2
90 BOOTX_DIR_KRNL = $(BOOTX_DIR)/Linux_Kernels
91
92 APPDISK = AppDisk174.sit
93 APPDISK_DIR = AppDisk_1.7.4
94
95 RESEDIT = ResEdit_2.1.3.sea.bin
96 RSEDPDF = ResEditReference.pdf
97
98 TOMEVIEW = tomeviewer.sit
99 TOMEVIEW_DIR = TomeViewer_1.3d3
100
101 XPOSTFACTO = XPostFacto4.sit
102 XPOSTFACTO_DIR = XPostFacto4
103
104 GEN_IMG = install-ppc-minimal-$(GEN_IMG_VER).iso
105 GEN_IMG_VER = 2006.0
106 GEN_IMG_KRNL = ppc32
107
108
109 SYSDISKURL = ftp://ftp.apple.com/developer/macosxserver/utilities/$(SYSDISK)
110 STUFFITURL = http://www.allume.com/downloads/files/$(STUFFIT)
111 BOOTXURL = http://penguinppc.org/historical/benh/$(BOOTX)
112 APPDISKURL = http://homepage.mac.com/mavsftwre/$(APPDISK)
113 RESEDITURL =
114 http://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/English-North_American/Macintosh/Utilities/$(RESEDIT)
115 RSEDPDFURL = http://developer.apple.com/documentation/mac/pdf/$(RSEDPDF)
116 TOMEVIEWURL = http://aspect1.mac.tucows.com/files/$(TOMEVIEW)
117 XPOSTFACTOURL =
118 http://eshop.macsales.com/OSXCenter/XPostFacto/Archive/$(XPOSTFACTO)
119 DEBURL = http://people.debian.org/~wouter/d-i/powerpc/daily/powerpc
120 GENMIRROR = ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo
121 GENURL = $(GENMIRROR)/releases/ppc/$(GEN_IMG_VER)/ppc32/installcd/$(GEN_IMG)
122
123
124
125
126 modimage: fetchonly \
127 hfsmount \
128 $(SELF).treecopy \
129 $(RSEDPDF).treecopy \
130 $(SYSDISK).treecopy \
131 copyarchives \
132 debianstuff \
133 gentoostuff \
134 $(BOOTX_DIR).treecopy \
135 $(APPDISK_DIR).treecopy \
136 $(TOMEVIEW_DIR).treecopy \
137 $(XPOSTFACTO_DIR).treecopy \
138 hfsumount
139
140 copyarchives: hfscd_archives_dir \
141 $(BOOTX).treecopy \
142 $(APPDISK).treecopy \
143 $(RESEDIT).treecopy \
144 $(TOMEVIEW).treecopy \
145 $(XPOSTFACTO).treecopy \
146 hfscd_cretyp \
147 hfscd_dotdot
148
149 fetchonly: $(BOOTX_DIR_KRNL) \
150 $(SYSDISK) \
151 $(STUFFIT) \
152 $(APPDISK) \
153 $(RESEDIT) \
154 $(RSEDPDF) \
155 $(TOMEVIEW) \
156 $(XPOSTFACTO) \
157 $(GEN_IMG) \
158 $(BOOTX_DIR_KRNL)/debnetbootird.gz \
159 $(BOOTX_DIR_KRNL)/debcdromird.gz \
160 $(BOOTX_DIR_KRNL)/debhd-mediaird.gz \
161 $(BOOTX_DIR_KRNL)/debvmlinux
162
163 cd: modimage
164 cdrecord -dao dev=$(CDBURNER) $(BOOTABLE_MAC_CD)
165
166 cdclean:
167 cdrecord dev=$(CDBURNER) blank=fast
168
169 cdrw: cdclean cd
170
171 clean:
172 umount -d genloop || exit 0
173 rm -rf bin/ genloop/ "$(BOOTX_DIR)" "$(APPDISK_DIR)" "$(TOMEVIEW_DIR)" \
174 "$(XPOSTFACTO_DIR)" *.dirs *.files *irdbuild *irdmerge .*irdmerge
175
176 distclean: clean
177 rm $(SYSDISK) $(STUFFIT) $(BOOTX) $(APPDISK) $(RESEDIT) $(RSEDPDF) \
178 $(TOMEVIEW) $(XPOSTFACTO) $(GEN_IMG)
179
180
181
182
183 hfscd_archives_dir:
184 hmkdir ":Archives" 2>/dev/null || exit 0
185 hcd ":Archives"
186
187 hfscd_cretyp:
188 hattrib -c SITx -t SITD ":*"
189
190 hfscd_dotdot:
191 hcd "::"
192
193 hfsumount:
194 humount
195
196 hfsmount:
197 hmount $(BOOTABLE_MAC_CD)
198
199 TCRW = \($(BOOTX_DIR_KRNL)\)\|\($(BOOTX)\)\|\($(APPDISK)\)
200 TCRAW = $(TCRW)\|\($(RSEDPDF)\)\|\($(TOMEVIEW)\)\|\($(XPOSTFACTO)\)
201 TCSPEC1 = s^hcopy -m\( .\)\($(TCRAW)\)^hcopy -r\1\2^
202 TCSPEC2 = s^hcopy -m\( .\)\($(SELF)\)^hcopy -t\1\2^
203 TCSPECIALS = $(TCSPEC1);$(TCSPEC2);
204 CPLSED = h;s|/|:|g;s|_| |g;s|^ '\(.*:\)\?.*| ':\1'|;H;g;s/\n//;s/^/hcopy
205 -m/;
206 %.treecopy: %
207 echo "#!/bin/sh" > "$*.dirs" && chmod +x "$*.dirs"
208 echo "#!/bin/sh" > "$*.files" && chmod +x "$*.files"
209 find "$*" -type d -printf "hmkdir '/%p'\n" | \
210 sed -e "s|/|:|g;s|_| |g;$(TCSPECIALS)" >> "$*.dirs"
211 find "$*" -not -type d -printf " '%p'\n" | \
212 sed -ne "$(CPLSED)$(TCSPECIALS)p" >> "$*.files"
213 "./$*.dirs" 2>/dev/null || exit 0
214 "./$*.files" || exit 0
215
216 %.irdmerge:
217 mkdir -p "$(suffix $*).irdmerge" && \
218 cd "$(suffix $*).irdmerge" && \
219 gunzip -c "../$(BOOTX_DIR_KRNL)/$(subst .,,$(suffix $*))$(patsubst \
220 %$(suffix $*),%,$*)ird.gz" > "initrd.tmp" && \
221 cpio -i < "initrd.tmp" 2> /dev/null && \
222 rm "initrd.tmp" && \
223 cd .. && \
224 touch "$@"
225
226 %.irdbuild:
227 test -e "$(patsubst %$(suffix $*),%,$*).gz" || { \
228 cd $(suffix $*).irdmerge && \
229 find > ../files$(suffix $*).irdmerge && \
230 cpio -o < ../files$(suffix $*).irdmerge > "../$(patsubst \
231 %$(suffix $*),%,$*)" && \
232 cd .. ; }
233
234 %.gz: %
235 test -e "$@" || gzip -9 "$*"
236
237
238
239
240 $(STUFFIT):
241 wget $(STUFFITURL)
242
243 $(UNSTUFF): $(STUFFIT)
244 tar xzf $(STUFFIT) $(UNSTUFF)
245 touch $(UNSTUFF)
246
247 $(BOOTX):
248 wget $(BOOTXURL)
249
250 $(BOOTX_DIR): $(UNSTUFF) $(BOOTX)
251 $(UNSTUFF) -m=on $(BOOTX)
252 mv "$(subst _, ,$@)" "$@"
253
254 $(BOOTX_DIR_KRNL): $(BOOTX_DIR)
255 mv "$(subst Linux_,Linux ,$@)" "$@"
256 touch "$@"
257
258 $(APPDISK):
259 wget $(APPDISKURL)
260
261 $(APPDISK_DIR): $(UNSTUFF) $(APPDISK)
262 $(UNSTUFF) -m=on $(APPDISK)
263 mv "$(subst _, ,$@)" "$@"
264
265 $(RESEDIT):
266 wget $(RESEDITURL)
267
268 $(RSEDPDF):
269 wget $(RSEDPDFURL)
270
271 $(TOMEVIEW):
272 wget $(TOMEVIEWURL)
273
274 $(TOMEVIEW_DIR): $(UNSTUFF) $(TOMEVIEW)
275 $(UNSTUFF) -m=on $(TOMEVIEW)
276 mv "$(subst _, ,$@)" "$@"
277
278 $(XPOSTFACTO):
279 wget $(XPOSTFACTOURL)
280
281 $(XPOSTFACTO_DIR): $(UNSTUFF) $(XPOSTFACTO)
282 $(UNSTUFF) -m=on $(XPOSTFACTO)
283
284
285
286
287 $(GEN_IMG):
288 wget $(GENURL)
289
290 $(GEN_IMG).mount: $(GEN_IMG)
291 mkdir -p genloop && \
292 mount -o loop $(GEN_IMG) genloop
293
294 $(BOOTX_DIR_KRNL)/genliveird.gz: genloop/boot/$(GEN_IMG_KRNL).igz
295 cp "genloop/boot/$(GEN_IMG_KRNL).igz" "$@"
296
297 # .gen.irdmerge/image.squashfs: genloop/image.squashfs
298 # cp "genloop/image.squashfs" "$@"
299
300 INITDEFAULTS = real_root=/dev/ram3 cdroot console=tty0 loop=image.squashfs \
301 looptype=squashfs
302 $(BOOTX_DIR_KRNL)/genallinitrd: $(BOOTX_DIR_KRNL)/genliveird.gz
303 test -e "$@.gz" || { \
304 gunzip -c "$<" > "$@" && \
305 mkdir -p .gen.irdmerge && cd .gen.irdmerge && \
306 dd if="../$@" skip=5 | cpio -i && cat init | sed -e \
307 's^bootstrapCD^mv /$${LOOP} $${NEW_ROOT}/mnt/cdrom > /dev/null 2>\&1^' -e \
308 's:^REAL_ROOT=.*:CMDLINE="$(INITDEFAULTS) $$CMDLINE":' > in && \
309 cat <in >init && \
310 echo "init" | cpio -o -H newc >> "../$@" && \
311 cd .. && \
312 cd genloop && \
313 echo "image.squashfs" | cpio -o -H newc >> "../$@" && \
314 cd .. ; }
315 # live.gen.irdmerge \
316 # .gen.irdmerge/image.squashfs \
317 # $(BOOTX_DIR_KRNL)/genallinitrd.gen.irdbuild
318
319 $(BOOTX_DIR_KRNL)/genvmlinux: genloop/boot/$(GEN_IMG_KRNL)
320 test -e "$@.gz" || cp "genloop/boot/$(GEN_IMG_KRNL)" "$@"
321
322 gentoostuff: $(GEN_IMG).mount \
323 $(BOOTX_DIR_KRNL) \
324 $(BOOTX_DIR_KRNL)/genliveird.gz \
325 $(BOOTX_DIR_KRNL)/genallinitrd.gz \
326 $(BOOTX_DIR_KRNL)/genvmlinux
327 umount -d genloop
328
329
330
331
332 $(BOOTX_DIR_KRNL)/deb%ird.gz:
333 wget -O "$@" $(DEBURL)/$*/initrd.gz
334
335 $(BOOTX_DIR_KRNL)/deballinitrd: $(BOOTX_DIR_KRNL)/debnetbootird.gz \
336 $(BOOTX_DIR_KRNL)/debcdromird.gz \
337 $(BOOTX_DIR_KRNL)/debhd-mediaird.gz \
338 netboot.deb.irdmerge \
339 cdrom.deb.irdmerge \
340 hd-media.deb.irdmerge \
341 $(BOOTX_DIR_KRNL)/deballinitrd.deb.irdbuild
342
343 $(BOOTX_DIR_KRNL)/debvmlinux:
344 test -e "$@.gz" || wget -O "$@" $(DEBURL)/cdrom/vmlinux
345
346 debianstuff: $(BOOTX_DIR_KRNL) \
347 $(BOOTX_DIR_KRNL)/debnetbootird.gz \
348 $(BOOTX_DIR_KRNL)/debcdromird.gz \
349 $(BOOTX_DIR_KRNL)/debhd-mediaird.gz \
350 $(BOOTX_DIR_KRNL)/deballinitrd.gz \
351 $(BOOTX_DIR_KRNL)/debvmlinux
352
353
354
355
356 $(SYSDISK):
357 wget $(SYSDISKURL)
358
359
360 EOF

Attachments

File name MIME type
Makefile text/plain