Author: nwhitehorn Date: Wed May 4 23:34:10 2011 New Revision: 221465 URL: http://svn.freebsd.org/changeset/base/221465
Log: Change the way powerpc bootable CDs are generated to work around a bug in hybrid image generation in cdrtools. This produces a small HFS partition containing loader, mapped in by an oddly-formed APM table using a new feature in makefs. This does not appear to work yet on early-model G3 systems, which will be fixed later, but produces bootable CDs on everything else. Added: head/release/powerpc/generate-hfs.sh - copied, changed from r219439, head/sys/boot/powerpc/boot1.chrp/generate-hfs.sh head/release/powerpc/hfs-boot.bz2.uu (contents, props changed) Deleted: head/release/powerpc/hfs.map Modified: head/release/powerpc/mkisoimages.sh Copied and modified: head/release/powerpc/generate-hfs.sh (from r219439, head/sys/boot/powerpc/boot1.chrp/generate-hfs.sh) ============================================================================== --- head/sys/boot/powerpc/boot1.chrp/generate-hfs.sh Wed Mar 9 23:11:30 2011 (r219439, copy source) +++ head/release/powerpc/generate-hfs.sh Wed May 4 23:34:10 2011 (r221465) @@ -12,16 +12,14 @@ # $FreeBSD$ -HFS_SIZE=1600 #Size in 512-byte blocks of the produced image - -CHRPBOOT_SIZE=2k -BOOT1_SIZE=30k +HFS_SIZE=400 #Size in 2048-byte blocks of the produced image +LOADER_SIZE=300k # Generate 800K HFS image -OUTPUT_FILE=hfs.tmpl +OUTPUT_FILE=hfs-boot -dd if=/dev/zero of=$OUTPUT_FILE bs=512 count=$HFS_SIZE -hformat -l "FreeBSD Bootstrap" $OUTPUT_FILE +dd if=/dev/zero of=$OUTPUT_FILE bs=2048 count=$HFS_SIZE +hformat -l "FreeBSD Install" $OUTPUT_FILE hmount $OUTPUT_FILE # Create and bless a directory for the boot loader @@ -29,33 +27,35 @@ hmkdir ppc hattrib -b ppc hcd ppc -# Make two dummy files for the the CHRP boot script and boot1 -echo 'Bootinfo START' | dd of=bootinfo.txt.tmp cbs=$CHRPBOOT_SIZE count=1 conv=block -echo 'Boot1 START' | dd of=boot1.elf.tmp cbs=$BOOT1_SIZE count=1 conv=block +# Make the CHRP boot script, which gets loader from the ISO9660 partition +cat > bootinfo.txt << EOF +<CHRP-BOOT> +<DESCRIPTION>FreeBSD/powerpc bootloader</DESCRIPTION> +<OS-NAME>FreeBSD</OS-NAME> +<VERSION> $FreeBSD: head/sys/boot/powerpc/boot1.chrp/bootinfo.txt 184490 2008-10 +-31 00:52:31Z nwhitehorn $ </VERSION> + +<COMPATIBLE> +MacRISC MacRISC3 MacRISC4 +</COMPATIBLE> +<BOOT-SCRIPT> +" screen" output +boot &device;:,\ppc\loader &device;:0 +</BOOT-SCRIPT> +</CHRP-BOOT> +EOF +echo 'Loader START' | dd of=loader.tmp cbs=$LOADER_SIZE count=1 conv=block -hcopy boot1.elf.tmp :boot1.elf -hcopy bootinfo.txt.tmp :bootinfo.txt +hcopy bootinfo.txt :bootinfo.txt +hcopy loader.tmp :loader hattrib -c chrp -t tbxi bootinfo.txt humount -rm bootinfo.txt.tmp -rm boot1.elf.tmp - -# Locate the offsets of the two fake files -BOOTINFO_OFFSET=$(hd $OUTPUT_FILE | grep 'Bootinfo START' | cut -f 1 -d ' ') -BOOT1_OFFSET=$(hd $OUTPUT_FILE | grep 'Boot1 START' | cut -f 1 -d ' ') - -# Convert to numbers of blocks -BOOTINFO_OFFSET=$(echo 0x$BOOTINFO_OFFSET | awk '{printf("%x\n",$1/512);}') -BOOT1_OFFSET=$(echo 0x$BOOT1_OFFSET | awk '{printf("%x\n",$1/512);}') - -echo '# This file autogenerated by generate-hfs.sh - DO NOT EDIT' > Makefile.hfs -echo '# $FreeBSD$' >> Makefile.hfs -echo "BOOTINFO_OFFSET=0x$BOOTINFO_OFFSET" >> Makefile.hfs -echo "BOOT1_OFFSET=0x$BOOT1_OFFSET" >> Makefile.hfs +rm bootinfo.txt +rm loader.tmp bzip2 $OUTPUT_FILE -echo 'HFS template boot filesystem created by generate-hfs.sh' > $OUTPUT_FILE.bz2.uu +echo 'HFS boot filesystem created by generate-hfs.sh' > $OUTPUT_FILE.bz2.uu echo 'DO NOT EDIT' >> $OUTPUT_FILE.bz2.uu echo '$FreeBSD$' >> $OUTPUT_FILE.bz2.uu Added: head/release/powerpc/hfs-boot.bz2.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/release/powerpc/hfs-boot.bz2.uu Wed May 4 23:34:10 2011 (r221465) @@ -0,0 +1,23 @@ +HFS boot filesystem created by generate-hfs.sh +DO NOT EDIT +$FreeBSD$ +begin 644 hfs-boot.bz2 +M0EIH.3%!62936=#$Y.(``"___?_O_G)7!_Y]OW??5#]U_^!`0`,@1`!!``!@ +M(0!`3,`"L"4.2U"2(H9%/:*>TFDVU3RGZID'J&C3U,@T-&@`/1!H>IZC1D#( +M`D24TTRFC1D]*;$@!IZ@Q!IH-````#0&33":?J@<:&AH:`:`Q`T!D``&F@`: +M`9````PDI1J>0Q,H/1J&@```!D-`````T-``#SZHHR(+Y*Y9J*Z:4KK=T]W@ +M4RV\LG/;0XDPC7^`9DO3/3&*].462T,NO#AA9C,O\0!)^Q@@S6";2`!);<W\ +MM\)T,GR:I$-V("3$9$B"&8,,*RS@L++(8KPP)-C!L0(22AH:=29JC18OSD@O +M&&`F8@M#$H:5#;%`Q)(22DF(/IB46IH0H?):$7!BU_SU=DL`+E*J,;0?%AW6 +M#\-_#^NL++6(CI"!)*#8N/S2"7!C_QAB8[(ZW3G$\`G81HL8.H^M8?#(Z"JL +M;J^PI=+>?8(B6BR1(-7Q*8?>>HPQSBQE>M$A9K6FFW<:#6[D931J%U.F8*`0 +MD(,M80A(0;]K'X'SI]G(C)Y).AK_/0)D(2$$]JB$]]F').M4RF8O%[IHK[0O +MMQ?'>O[U8EM;>U<P%^7)&#;>",KY^*%FO9C05_435?.4*F[6AIL%&9C<9W&& +M[ZMP(TG!'*4Z>@6TM)0BS.D._O,WR9OJ728V48I;DD=8QGBE7J-&L^?=0JEF +MV2`B/)/D\)83IS@32(;!P,152U()0VGQH>2F$UC:M!D5`F#1W$\:KKDR[TQB +MN;N<J=4-1'[HLG,!L^IJG53+[IORM_L7JB/:/<+:634`XD.R'",=M$A;C4E. +M$RRHL2;B)D:_ZJVK$Z*40?H'TATSF5$$%L@<LB4`\2$P90.50PWE:'REG6\D +ML%>5B1;P!7:AG#1BP2%-Q$7I6QE,Y?NHIK_LR+HA]22HW0.8(^G4/X`Z@!Z6 +8#PQ(0))/`A(0.'VUG_\7<D4X4)#0Q.3B +` +end Modified: head/release/powerpc/mkisoimages.sh ============================================================================== --- head/release/powerpc/mkisoimages.sh Wed May 4 23:07:30 2011 (r221464) +++ head/release/powerpc/mkisoimages.sh Wed May 4 23:34:10 2011 (r221465) @@ -23,9 +23,16 @@ # extra-bits-dir, if provided, contains additional files to be merged # into base-bits-dir as part of making the image. +publisher="The FreeBSD Project. http://www.freebsd.org/" if [ "x$1" = "x-b" ]; then - cp /usr/src/release/powerpc/boot.tbxi ${4}/boot - bootable="-hfs -hfs-bless ${4}/boot -map /usr/src/release/powerpc/hfs.map -hide-hfs ${4}/usr/share/man" + uudecode -o /tmp/hfs-boot-block.bz2 `dirname $0`/hfs-boot.bz2.uu + bzip2 -d /tmp/hfs-boot-block.bz2 + OFFSET=$(hd /tmp/hfs-boot-block | grep 'Loader START' | cut -f 1 -d ' ') + OFFSET=0x$(echo 0x$OFFSET | awk '{printf("%x\n",$1/512);}') + echo dd if=$4/boot/loader of=/tmp/hfs-boot-block seek=$OFFSET conv=notrunc + dd if=$4/boot/loader of=/tmp/hfs-boot-block seek=$OFFSET conv=notrunc + + bootable="-o bootimage=macppc;/tmp/hfs-boot-block -o no-emul-boot" shift else bootable="" @@ -33,28 +40,13 @@ fi if [ $# -lt 3 ]; then echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]' - rm -f ${IMG} exit 1 fi -type mkisofs 2>&1 | grep " is " >/dev/null -if [ $? -ne 0 ]; then - echo The cdrtools port is not installed. Trying to get it now. - if [ -f /usr/ports/sysutils/cdrtools/Makefile ]; then - cd /usr/ports/sysutils/cdrtools && make install BATCH=yes && make clean - else - if ! pkg_add -r cdrtools; then - echo "Could not get it via pkg_add - please go install this" - echo "from the ports collection and run this script again." - exit 2 - fi - fi -fi - LABEL=$1; shift NAME=$1; shift -echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab -mkisofs $bootable -l -r -part -no-desktop -V $LABEL -o $NAME $* +echo "/dev/iso9660/`echo $LABEL | tr '[:lower:]' '[:upper:]'` / cd9660 ro 0 0" > $1/etc/fstab +makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $* rm $1/etc/fstab - +rm /tmp/hfs-boot-block _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"