1183863Snwhitehorn#!/bin/sh 2183863Snwhitehorn 3183863Snwhitehorn# This script generates the dummy HFS filesystem used for the PowerPC boot 4183863Snwhitehorn# blocks. It uses hfsutils (emulators/hfsutils) to generate a template 5183863Snwhitehorn# filesystem with the relevant interesting files. These are then found by 6183863Snwhitehorn# grep, and the offsets written to a Makefile snippet. 7183863Snwhitehorn# 8183863Snwhitehorn# Because of licensing concerns, and because it is overkill, we do not 9183863Snwhitehorn# distribute hfsutils as a build tool. If you need to regenerate the HFS 10183863Snwhitehorn# template (e.g. because the boot block or the CHRP script have grown), 11183863Snwhitehorn# you must install it from ports. 12183863Snwhitehorn 13183863Snwhitehorn# $FreeBSD: stable/11/release/powerpc/generate-hfs.sh 329145 2018-02-12 01:08:44Z kevans $ 14183863Snwhitehorn 15221465SnwhitehornHFS_SIZE=400 #Size in 2048-byte blocks of the produced image 16221465SnwhitehornLOADER_SIZE=300k 17183863Snwhitehorn 18183863Snwhitehorn# Generate 800K HFS image 19221465SnwhitehornOUTPUT_FILE=hfs-boot 20183863Snwhitehorn 21221465Snwhitehorndd if=/dev/zero of=$OUTPUT_FILE bs=2048 count=$HFS_SIZE 22221465Snwhitehornhformat -l "FreeBSD Install" $OUTPUT_FILE 23183863Snwhitehornhmount $OUTPUT_FILE 24183863Snwhitehorn 25183863Snwhitehorn# Create and bless a directory for the boot loader 26183863Snwhitehornhmkdir ppc 27183863Snwhitehornhattrib -b ppc 28183863Snwhitehornhcd ppc 29183863Snwhitehorn 30221465Snwhitehorn# Make the CHRP boot script, which gets loader from the ISO9660 partition 31221465Snwhitehorncat > bootinfo.txt << EOF 32221465Snwhitehorn<CHRP-BOOT> 33221465Snwhitehorn<DESCRIPTION>FreeBSD/powerpc bootloader</DESCRIPTION> 34221465Snwhitehorn<OS-NAME>FreeBSD</OS-NAME> 35329145Skevans<VERSION> $FreeBSD: head/stand/powerpc/boot1.chrp/bootinfo.txt 184490 2008-10 36221465Snwhitehorn-31 00:52:31Z nwhitehorn $ </VERSION> 37183863Snwhitehorn 38221465Snwhitehorn<COMPATIBLE> 39221465SnwhitehornMacRISC MacRISC3 MacRISC4 40221465Snwhitehorn</COMPATIBLE> 41221465Snwhitehorn<BOOT-SCRIPT> 42221465Snwhitehorn" screen" output 43221465Snwhitehornboot &device;:,\ppc\loader &device;:0 44221465Snwhitehorn</BOOT-SCRIPT> 45221465Snwhitehorn</CHRP-BOOT> 46221465SnwhitehornEOF 47221465Snwhitehornecho 'Loader START' | dd of=loader.tmp cbs=$LOADER_SIZE count=1 conv=block 48221465Snwhitehorn 49221465Snwhitehornhcopy bootinfo.txt :bootinfo.txt 50221465Snwhitehornhcopy loader.tmp :loader 51183863Snwhitehornhattrib -c chrp -t tbxi bootinfo.txt 52183863Snwhitehornhumount 53183863Snwhitehorn 54221465Snwhitehornrm bootinfo.txt 55221465Snwhitehornrm loader.tmp 56183863Snwhitehorn 57183863Snwhitehornbzip2 $OUTPUT_FILE 58221465Snwhitehornecho 'HFS boot filesystem created by generate-hfs.sh' > $OUTPUT_FILE.bz2.uu 59183863Snwhitehornecho 'DO NOT EDIT' >> $OUTPUT_FILE.bz2.uu 60183863Snwhitehornecho '$FreeBSD: stable/11/release/powerpc/generate-hfs.sh 329145 2018-02-12 01:08:44Z kevans $' >> $OUTPUT_FILE.bz2.uu 61183863Snwhitehorn 62183863Snwhitehornuuencode $OUTPUT_FILE.bz2 $OUTPUT_FILE.bz2 >> $OUTPUT_FILE.bz2.uu 63183863Snwhitehornrm $OUTPUT_FILE.bz2 64183863Snwhitehorn 65