xref: /freebsd/release/powerpc/generate-hfs.sh (revision f39bffc62c1395bde25d152c7f68fdf7cbaab414)
1#!/bin/sh
2
3# This script generates the dummy HFS filesystem used for the PowerPC boot
4# blocks. It uses hfsutils (emulators/hfsutils) to generate a template
5# filesystem with the relevant interesting files. These are then found by
6# grep, and the offsets written to a Makefile snippet.
7#
8# Because of licensing concerns, and because it is overkill, we do not
9# distribute hfsutils as a build tool. If you need to regenerate the HFS
10# template (e.g. because the boot block or the CHRP script have grown),
11# you must install it from ports.
12
13# $FreeBSD$
14
15HFS_SIZE=400		#Size in 2048-byte blocks of the produced image
16LOADER_SIZE=300k
17
18# Generate 800K HFS image
19OUTPUT_FILE=hfs-boot
20
21dd if=/dev/zero of=$OUTPUT_FILE bs=2048 count=$HFS_SIZE
22hformat -l "FreeBSD Install" $OUTPUT_FILE
23hmount $OUTPUT_FILE
24
25# Create and bless a directory for the boot loader
26hmkdir ppc
27hattrib -b ppc
28hcd ppc
29
30# Make the CHRP boot script, which gets loader from the ISO9660 partition
31cat > bootinfo.txt << EOF
32<CHRP-BOOT>
33<DESCRIPTION>FreeBSD/powerpc bootloader</DESCRIPTION>
34<OS-NAME>FreeBSD</OS-NAME>
35<VERSION> $FreeBSD: head/stand/powerpc/boot1.chrp/bootinfo.txt 184490 2008-10
36-31 00:52:31Z nwhitehorn $ </VERSION>
37
38<COMPATIBLE>
39MacRISC MacRISC3 MacRISC4
40</COMPATIBLE>
41<BOOT-SCRIPT>
42" screen" output
43boot &device;:,\ppc\loader &device;:0
44</BOOT-SCRIPT>
45</CHRP-BOOT>
46EOF
47echo 'Loader START' | dd of=loader.tmp cbs=$LOADER_SIZE count=1 conv=block
48
49hcopy bootinfo.txt :bootinfo.txt
50hcopy loader.tmp :loader
51hattrib -c chrp -t tbxi bootinfo.txt
52humount
53
54rm bootinfo.txt
55rm loader.tmp
56
57bzip2 $OUTPUT_FILE
58echo 'HFS boot filesystem created by generate-hfs.sh' > $OUTPUT_FILE.bz2.uu
59echo 'DO NOT EDIT' >> $OUTPUT_FILE.bz2.uu
60echo '$FreeBSD$' >> $OUTPUT_FILE.bz2.uu
61
62uuencode $OUTPUT_FILE.bz2 $OUTPUT_FILE.bz2 >> $OUTPUT_FILE.bz2.uu
63rm $OUTPUT_FILE.bz2
64
65