Skip to content

Commit

Permalink
Reorganize macppc_installboot to make macppccd.iso image actually boo…
Browse files Browse the repository at this point in the history
…table

on (some) OpenFirmware 2.x machines.

Current macppccd.iso image doesn't boot on Openfirmware 2.x
(and probably 1.0.5) machines because it uses pre-compiled binary
which is based on old (and customized) bootxx.
It causes version mismatch against newer ofwboot whose load address
has been changed from 0x600000 to 0xe00000, as mentioned in the
following post:
http://mail-index.netbsd.org/port-macppc/2004/12/14/0020.html
There was also an raw binary which was passed to mkisofs as -boot-hfs-file.

To fix these issue, prepare a simple mkhfsboot program which creates
a boothfs file with the Apple partition map info for mkisofs,
and modify macppc_installboot to search the secondary ofwboot from isofs
and to put and modify the primary bootxx accordingly.
See PR toolchain/30245 for more details.

There are still some machines which don't boot from an iso image created
by this method (G3 machines with OF 2.0f1 etc.), but it's still better
than to keep ugly and obsolete hacks.

Ok'ed by macallan, and there is no other particular comment about this PR.
  • Loading branch information
tsutsui committed Sep 17, 2006
1 parent aca43cd commit 42f593a
Show file tree
Hide file tree
Showing 15 changed files with 1,028 additions and 293 deletions.
25 changes: 12 additions & 13 deletions distrib/cdrom/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.28 2006/09/17 03:20:46 tsutsui Exp $
# $NetBSD: Makefile,v 1.29 2006/09/17 03:56:03 tsutsui Exp $
#
# Consult "*.conf" for the configuration variables; this Makefile is typically
# not edited for basic configuration changes.
Expand Down Expand Up @@ -58,7 +58,7 @@ ALL_PORTS:= ${ALL_PORTS} ${BASE_PORTS.${image}}
SUBDIR=

.if !empty(ALL_PORTS:Mmacppc)
SUBDIR+= macppc_installboot
SUBDIR+= macppc_mkboothfs macppc_installboot
.endif

.if !empty(SUBDIR)
Expand All @@ -77,6 +77,7 @@ PMAX_IBOOT?= ${TOOL_INSTALLBOOT} -m pmax -o sunsum,append
VAX_IBOOT?= ${TOOL_INSTALLBOOT} -m vax -o sunsum,append
.if !empty(ALL_PORTS:Mmacppc)
MACPPC_IBOOTDIR!= cd ${.CURDIR}/macppc_installboot && ${PRINTOBJDIR}
MACPPC_MKBOOTHFSDIR!= cd ${.CURDIR}/macppc_mkboothfs && ${PRINTOBJDIR}
.endif

RSYNC_SITE?= rsync://rsync.NetBSD.org/NetBSD/${RELEASENAME}/
Expand Down Expand Up @@ -228,7 +229,7 @@ MKISOFS_ARGS.${image}+= -b ${BOOTFILE.amd64} -c boot.catalog
.if !empty(ports:Mmacppc)
MKISOFS_ARGS.${image}+= -hfs -part -hide-hfs-list ${.CURDIR}/hide-hfs.lst \
--macbin -map ${.CURDIR}/hfsmap.lst \
-boot-hfs-file ${MACPPC_IBOOTDIR}/macppcboot.raw
-boot-hfs-file ${MACPPC_MKBOOTHFSDIR}/boothfs
.elif defined(USE_APPLE_ISO) || !empty(ports:Mmac68k)
MKISOFS_ARGS.${image}+= -apple --macbin -map ${.CURDIR}/hfsmap.lst
.endif
Expand Down Expand Up @@ -358,12 +359,11 @@ ${file:C/^.*://}: .PHONY
# 1. Size the image produced by mkisofs.
# 2. Add images added by distrib/common/sunbootcd.sh by rounding to a 320k
# boundary and adding each Sun image rounded to a 320k boundary.
# 3. Add 64k if macppc is included (ofwboot munged to one 64k block).
# 4. Add bootfile sizes rounded up to 512 bytes for pmax and vax.
# 5. Round up to a 32k boundary, then add another 32k for TAO padding.
# 3. Add bootfile sizes rounded up to 512 bytes for pmax and vax.
# 4. Round up to a 32k boundary, then add another 32k for TAO padding.

.if !empty(BASE_PORTS.${image}:Mmacppc)
size-${image}: all-macppc_installboot
size-${image}: all-macppc_mkboothfs all-macppc_installboot
.endif
.if !empty(BASE_PORTS.${image}:Msgimips) && defined(EXTFILES.sgimips)
SGIVOLHDR.size= ( fgrep SGI_BOOT_BLOCK_SIZE_VOLHDR \
Expand All @@ -374,6 +374,9 @@ SGIVOLHDR.size= echo 0
.endif

size-${image}: stage-${image} extfileprep fileprep-${image}
.if !empty(BASE_PORTS.${image}:Mmacppc)
${MACPPC_MKBOOTHFSDIR}/macppc_mkboothfs ${MACPPC_MKBOOTHFSDIR}/boothfs
.endif
@size=$$((`cd ${STAGEDIR}/${image} && ${MKISOFS} ${MKISOFS_ARGS} ${MKISOFS_ARGS.${image}} -print-size . 2>&1 | tee /dev/stderr | sed '/=/!d;s/^[^=]*=//'` * 2048)) && \
if [ "${SUN_BOOT_ARGS.${image}}" != "" ]; then \
size=$$(($$(($$size + 327679)) / 327680 * 327680)) && \
Expand All @@ -383,9 +386,6 @@ size-${image}: stage-${image} extfileprep fileprep-${image}
size=$$(($$size + $$(($$(($$bfsize + 327679)) / 327680 * 327680)))); \
done; \
fi && \
if [ "${BASE_PORTS.${image}:Mmacppc}" != "" ]; then \
size=$$(($$size + 65536)); \
fi && \
if [ "${BASE_PORTS.${image}:Mpmax}" != "" ]; then \
size=$$(($$size + $$(($$((`ls -l ${BOOTFILE.pmax} | awk '{print $$5}'` + 511)) / 512 * 512)))); \
fi && \
Expand Down Expand Up @@ -416,9 +416,8 @@ ${IMAGEDIR}/${image}.iso: size-${image}
${.TARGET} ${SUN_BOOT_ARGS.${image}}
.endif
.if !empty(BASE_PORTS.${image}:Mmacppc)
@blknum=$$((`ls -l $@ | awk '{print $$5}'` / 512)) && \
${MACPPC_IBOOTDIR}/macppc_installboot $@ $$blknum 756
dd if=${EXTFILEDIR}/macppc.ofwboot bs=64k count=1 conv=sync >>$@ 2>/dev/null
${MACPPC_IBOOTDIR}/macppc_installboot \
$@ ${EXTFILEDIR}/macppc.bootxx /ofwboot
.endif
.if !empty(BASE_PORTS.${image}:Mpmax)
${PMAX_IBOOT} $@ ${BOOTFILE.pmax}
Expand Down
6 changes: 4 additions & 2 deletions distrib/cdrom/NetBSD-3.1.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: NetBSD-3.1.mk,v 1.1 2006/08/21 21:14:24 ghen Exp $
# $NetBSD: NetBSD-3.1.mk,v 1.2 2006/09/17 03:56:03 tsutsui Exp $
#
# Configuration file for the NetBSD 3.1 binary release.

Expand All @@ -23,8 +23,10 @@ BOOTFILE.amd64= boot.amd64
INTFILES.amd64= boot.amd64:amd64/installation/floppy/boot-big.fs,link

# macppc has external bootblock generation tool
EXTFILES.macppc= macppc.ofwboot:macppc/binary/sets/base.tgz,./usr/mdec/ofwboot
EXTFILES.macppc= macppc.bootxx:macppc/binary/sets/base.tgz,./usr/mdec/bootxx \
macppc.ofwboot:macppc/binary/sets/base.tgz,./usr/mdec/ofwboot
INTFILES.macppc= ofwboot.xcf:macppc/installation/ofwboot.xcf,link \
ofwboot:macppc/binary/sets/base.tgz,./usr/mdec/ofwboot \
netbsd.macppc:macppc/binary/kernel/netbsd-INSTALL.gz,link

# BOOTFILE.pmax is absolute
Expand Down
6 changes: 4 additions & 2 deletions distrib/cdrom/NetBSD-4.0.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: NetBSD-4.0.mk,v 1.1 2006/08/24 18:15:08 riz Exp $
# $NetBSD: NetBSD-4.0.mk,v 1.2 2006/09/17 03:56:03 tsutsui Exp $
#
# Configuration file for the NetBSD-4.0 binary release.

Expand All @@ -23,8 +23,10 @@ BOOTFILE.amd64= boot.amd64
INTFILES.amd64= boot.amd64:amd64/installation/floppy/boot-big.fs,link

# macppc has external bootblock generation tool
EXTFILES.macppc= macppc.ofwboot:macppc/binary/sets/base.tgz,./usr/mdec/ofwboot
EXTFILES.macppc= macppc.bootxx:macppc/binary/sets/base.tgz,./usr/mdec/booxx \
macppc.ofwboot:macppc/binary/sets/base.tgz,./usr/mdec/ofwboot
INTFILES.macppc= ofwboot.xcf:macppc/installation/ofwboot.xcf,link \
ofwboot:macppc/binary/sets/base.tgz,./usr/mdec/ofwboot \
netbsd.macppc:macppc/binary/kernel/netbsd-INSTALL.gz,link

# BOOTFILE.pmax is absolute
Expand Down
6 changes: 4 additions & 2 deletions distrib/cdrom/NetBSD-current.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: NetBSD-current.mk,v 1.4 2005/12/08 21:12:18 riz Exp $
# $NetBSD: NetBSD-current.mk,v 1.5 2006/09/17 03:56:03 tsutsui Exp $
#
# Configuration file for NetBSD-current.

Expand All @@ -23,8 +23,10 @@ BOOTFILE.amd64= boot.amd64
INTFILES.amd64= boot.amd64:amd64/installation/floppy/boot-big.fs,link

# macppc has external bootblock generation tool
EXTFILES.macppc= macppc.ofwboot:macppc/binary/sets/base.tgz,./usr/mdec/ofwboot
EXTFILES.macppc= macppc.bootxx:macppc/binary/sets/base.tgz,./usr/mdec/bootxx \
macppc.ofwboot:macppc/binary/sets/base.tgz,./usr/mdec/ofwboot
INTFILES.macppc= ofwboot.xcf:macppc/installation/ofwboot.xcf,link \
ofwboot:macppc/binary/sets/base.tgz,./usr/mdec/ofwboot \
netbsd.macppc:macppc/binary/kernel/netbsd-INSTALL.gz,link

# BOOTFILE.pmax is absolute
Expand Down
23 changes: 5 additions & 18 deletions distrib/cdrom/macppc_installboot/Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
# $NetBSD: Makefile,v 1.5 2004/03/19 08:07:28 jmc Exp $
# $NetBSD: Makefile,v 1.6 2006/09/17 03:56:03 tsutsui Exp $

HOSTPROG= macppc_installboot
SRCS= installboot.c cd9660.c cd9660_util.c
NOMAN= # defined

.include <bsd.own.mk>
HOST_CPPFLAGS+= -I${.CURDIR} -I${NETBSDSRCDIR}/sys
#HOST_CPPFLAGS+= -DDEBUG

HOSTPROG= macppc_installboot
HOST_CPPFLAGS+= -I${NETBSDSRCDIR}/sys/arch
UUDECODE_FILES= bootxx.raw macppcboot.raw

CLEANFILES+= mkmacppcboot

all: macppcboot.raw

.include <bsd.files.mk>
.include <bsd.hostprog.mk>

mkmacppcboot: mkmacppcboot.c
${LINK.c} -o ${.TARGET} ${.ALLSRC}

regen: mkmacppcboot bootxx.raw.uue
./mkmacppcboot <${.CURDIR}/bootxx.raw | \
uuencode macppcboot.raw > macppcboot.raw.uue
26 changes: 0 additions & 26 deletions distrib/cdrom/macppc_installboot/bootxx.raw.uue

This file was deleted.

0 comments on commit 42f593a

Please sign in to comment.