]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - release/powerpc/generate-hfs.sh
zfs: merge openzfs/zfs@a03ebd9be
[FreeBSD/FreeBSD.git] / release / powerpc / generate-hfs.sh
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 HFS_SIZE=400            #Size in 2048-byte blocks of the produced image
14 LOADER_SIZE=500k
15
16 # Generate 800K HFS image
17 OUTPUT_FILE=hfs-boot
18
19 dd if=/dev/zero of=$OUTPUT_FILE bs=2048 count=$HFS_SIZE
20 hformat -l "FreeBSD Install" $OUTPUT_FILE
21 hmount $OUTPUT_FILE
22
23 # Create and bless a directory for the boot loader
24 hmkdir ppc
25 hattrib -b ppc
26 hcd ppc
27
28 # Make the CHRP boot script, which gets loader from the ISO9660 partition
29 cat > bootinfo.txt << EOF
30 <CHRP-BOOT>
31 <DESCRIPTION>FreeBSD/powerpc bootloader</DESCRIPTION>
32 <OS-NAME>FreeBSD</OS-NAME>
33 <VERSION> $FreeBSD: head/stand/powerpc/boot1.chrp/bootinfo.txt 184490 2008-10
34 -31 00:52:31Z nwhitehorn $ </VERSION>
35
36 <COMPATIBLE>
37 MacRISC MacRISC3 MacRISC4
38 </COMPATIBLE>
39 <BOOT-SCRIPT>
40 " screen" output
41 boot &device;:,\ppc\loader &device;:0
42 </BOOT-SCRIPT>
43 </CHRP-BOOT>
44 EOF
45 echo 'Loader START' | dd of=loader.tmp cbs=$LOADER_SIZE count=1 conv=block
46
47 hcopy bootinfo.txt :bootinfo.txt
48 hcopy loader.tmp :loader
49 hattrib -c chrp -t tbxi bootinfo.txt
50 humount
51
52 rm bootinfo.txt
53 rm loader.tmp
54
55 bzip2 $OUTPUT_FILE
56 echo 'HFS boot filesystem created by generate-hfs.sh' > $OUTPUT_FILE.bz2.uu
57 echo 'DO NOT EDIT' >> $OUTPUT_FILE.bz2.uu
58
59 uuencode $OUTPUT_FILE.bz2 $OUTPUT_FILE.bz2 >> $OUTPUT_FILE.bz2.uu
60 rm $OUTPUT_FILE.bz2
61