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