Deleted Added
full compact
generate-fat.sh (281238) generate-fat.sh (281526)
1#!/bin/sh
2
3# This script generates the dummy FAT filesystem used for the EFI boot
4# blocks. It uses newfs_msdos to generate a template filesystem with the
5# relevant interesting files. These are then found by grep, and the offsets
6# written to a Makefile snippet.
7#
8# Because it requires root, and because it is overkill, we do not
9# do this as part of the normal build. If makefs(8) grows workable FAT
10# support, this should be revisited.
11
1#!/bin/sh
2
3# This script generates the dummy FAT filesystem used for the EFI boot
4# blocks. It uses newfs_msdos to generate a template filesystem with the
5# relevant interesting files. These are then found by grep, and the offsets
6# written to a Makefile snippet.
7#
8# Because it requires root, and because it is overkill, we do not
9# do this as part of the normal build. If makefs(8) grows workable FAT
10# support, this should be revisited.
11
12# $FreeBSD: head/sys/boot/efi/boot1/generate-fat.sh 281238 2015-04-07 21:41:26Z emaste $
12# $FreeBSD: head/sys/boot/efi/boot1/generate-fat.sh 281526 2015-04-14 13:55:01Z andrew $
13
14FAT_SIZE=1600 #Size in 512-byte blocks of the produced image
15
16BOOT1_SIZE=128k
17
18#
19# Known filenames
20# amd64: BOOTx64.efi
13
14FAT_SIZE=1600 #Size in 512-byte blocks of the produced image
15
16BOOT1_SIZE=128k
17
18#
19# Known filenames
20# amd64: BOOTx64.efi
21# aarch64: BOOTaa64.efi
21# arm64: BOOTaa64.efi
22# arm: BOOTarm.efi
23# i386: BOOTia32.efi
24#
25if [ -z "$2" ]; then
26 echo "Usage: $0 arch boot-filename"
27 exit 1
28fi
29

--- 21 unchanged lines hidden (view full) ---

51
52# Locate the offset of the fake file
53BOOT1_OFFSET=$(hd $OUTPUT_FILE | grep 'Boot1 START' | cut -f 1 -d ' ')
54
55# Convert to number of blocks
56BOOT1_OFFSET=$(echo 0x$BOOT1_OFFSET | awk '{printf("%x\n",$1/512);}')
57
58echo '# This file autogenerated by generate-fat.sh - DO NOT EDIT' > Makefile.fat
22# arm: BOOTarm.efi
23# i386: BOOTia32.efi
24#
25if [ -z "$2" ]; then
26 echo "Usage: $0 arch boot-filename"
27 exit 1
28fi
29

--- 21 unchanged lines hidden (view full) ---

51
52# Locate the offset of the fake file
53BOOT1_OFFSET=$(hd $OUTPUT_FILE | grep 'Boot1 START' | cut -f 1 -d ' ')
54
55# Convert to number of blocks
56BOOT1_OFFSET=$(echo 0x$BOOT1_OFFSET | awk '{printf("%x\n",$1/512);}')
57
58echo '# This file autogenerated by generate-fat.sh - DO NOT EDIT' > Makefile.fat
59echo '# $FreeBSD: head/sys/boot/efi/boot1/generate-fat.sh 281238 2015-04-07 21:41:26Z emaste $' >> Makefile.fat
59echo '# $FreeBSD: head/sys/boot/efi/boot1/generate-fat.sh 281526 2015-04-14 13:55:01Z andrew $' >> Makefile.fat
60echo "BOOT1_OFFSET=0x$BOOT1_OFFSET" >> Makefile.fat
61
62bzip2 $OUTPUT_FILE
63echo 'FAT template boot filesystem created by generate-fat.sh' > $OUTPUT_FILE.bz2.uu
64echo 'DO NOT EDIT' >> $OUTPUT_FILE.bz2.uu
60echo "BOOT1_OFFSET=0x$BOOT1_OFFSET" >> Makefile.fat
61
62bzip2 $OUTPUT_FILE
63echo 'FAT template boot filesystem created by generate-fat.sh' > $OUTPUT_FILE.bz2.uu
64echo 'DO NOT EDIT' >> $OUTPUT_FILE.bz2.uu
65echo '$FreeBSD: head/sys/boot/efi/boot1/generate-fat.sh 281238 2015-04-07 21:41:26Z emaste $' >> $OUTPUT_FILE.bz2.uu
65echo '$FreeBSD: head/sys/boot/efi/boot1/generate-fat.sh 281526 2015-04-14 13:55:01Z andrew $' >> $OUTPUT_FILE.bz2.uu
66
67uuencode $OUTPUT_FILE.bz2 $OUTPUT_FILE.bz2 >> $OUTPUT_FILE.bz2.uu
68rm $OUTPUT_FILE.bz2
69
66
67uuencode $OUTPUT_FILE.bz2 $OUTPUT_FILE.bz2 >> $OUTPUT_FILE.bz2.uu
68rm $OUTPUT_FILE.bz2
69