Page MenuHomeFreeBSD

D59232.diff
No OneTemporary

D59232.diff

diff --git a/tools/tools/nanobsd/gpt.sh b/tools/tools/nanobsd/gpt.sh
--- a/tools/tools/nanobsd/gpt.sh
+++ b/tools/tools/nanobsd/gpt.sh
@@ -148,22 +148,42 @@
fi
}
-# Create an EFI System Partition image file
-create_esp_partition() {
- local bootcode efibootname espdir esp_sects fat_type
-
- # Since sectors_per_cluster=1, assume 1 cluster = 1 sector
- MINCLS16=4085 # minimum FAT16 clusters (0xff5U)
- MINCLS32=65525 # minimum FAT32 clusters (0xfff5U)
- esp_sects=$(awk '$5 == "efiboot0" {print $4}' "${NANO_LOG}/_.partitioning")
- if [ "$esp_sects" -ge "$MINCLS32" ]; then
+# Create an MS-DOS (FAT) filesystem image
+create_msdos_partition() {
+ local label="$1"
+ local volume_label="$2"
+ local srcdir="$3"
+ local img="$4"
+ local fat_type sects
+ local MINCLS16=4085 # minimum FAT16 clusters (0xff5U)
+ local MINCLS32=65525 # minimum FAT32 clusters (0xfff5U)
+
+ sects=$(awk -v label="$label" '$5 == label {print $4}' "${NANO_LOG}/_.partitioning")
+ if [ -z "$sects" ] || [ "$sects" -le 0 ]; then
+ return
+ fi
+ if [ "$sects" -ge "$MINCLS32" ]; then
fat_type=32
- elif [ "$esp_sects" -ge "$MINCLS16" ]; then
+ elif [ "$sects" -ge "$MINCLS16" ]; then
fat_type=16
else
fat_type=12
fi
+ makefs -t msdos \
+ -o fat_type="$fat_type" \
+ -o sectors_per_cluster=1 \
+ -o volume_label="$volume_label" \
+ -o OEM_string="" \
+ -s "${sects}b" \
+ -T "$NANO_TIMESTAMP" \
+ "$img" "$srcdir"
+}
+
+# Create an EFI System Partition image file
+create_esp_partition() {
+ local bootcode efibootname espdir
+
espdir="${NANO_OBJ}/_.efi"
rm -rf "$espdir"
mkdir -p "${espdir}/EFI/BOOT"
@@ -177,46 +197,22 @@
cp -p "$bootcode" "${espdir}/EFI/BOOT/${efibootname}.EFI"
- makefs -t msdos \
- -o fat_type="$fat_type" \
- -o sectors_per_cluster=1 \
- -o volume_label="efiboot0" \
- -o OEM_string="" \
- -s "${esp_sects}b" \
- -T "$NANO_TIMESTAMP" \
- "${NANO_OBJ}/_.efiboot0.image" "$espdir"
+ # XXXJL https://wiki.archlinux.org/title/EFI_system_partition#Firmware_does_not_see_the_EFI_directory
+ # Other FreeBSD tools use EFISYS
+ create_msdos_partition "efiboot0" "EFI" "$espdir" "${NANO_OBJ}/_.efiboot0.image"
rm -rf "$espdir"
}
# Create an MS Basic Data Partition for nuageinit (cidata)
create_cidata_partition() {
- local cidatadir cidata_sects fat_type
-
- # Since sectors_per_cluster=1, assume 1 cluster = 1 sector
- MINCLS16=4085 # minimum FAT16 clusters (0xff5U)
- MINCLS32=65525 # minimum FAT32 clusters (0xfff5U)
- cidata_sects=$(awk -v label="cidata" '$5 == label {print $4}' "${NANO_LOG}/_.partitioning")
- if [ "$cidata_sects" -ge "$MINCLS32" ]; then
- fat_type=32
- elif [ "$cidata_sects" -ge "$MINCLS16" ]; then
- fat_type=16
- else
- fat_type=12
- fi
+ local cidatadir
cidatadir="${NANO_OBJ}/_.cidata"
rm -rf "$cidatadir"
mkdir -p "$cidatadir"
- makefs -t msdos \
- -o fat_type="$fat_type" \
- -o sectors_per_cluster=1 \
- -o volume_label="CIDATA" \
- -o OEM_string="" \
- -s "${cidata_sects}b" \
- -T "$NANO_TIMESTAMP" \
- "${NANO_OBJ}/_.cidata.image" "$cidatadir"
+ create_msdos_partition "cidata" "CIDATA" "$cidatadir" "${NANO_OBJ}/_.cidata.image"
rm -rf "$cidatadir"
}

File Metadata

Mime Type
text/plain
Expires
Thu, Sep 10, 11:48 PM (41 m, 5 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37588011
Default Alt Text
D59232.diff (3 KB)

Event Timeline