aboutsummaryrefslogtreecommitdiffstats
path: root/release
diff options
context:
space:
mode:
authorMitchell Horne <mhorne@FreeBSD.org>2020-10-30 18:16:10 +0000
committerMitchell Horne <mhorne@FreeBSD.org>2020-10-30 18:16:10 +0000
commit027b4efccff8b55333c657ec6c9fb5f276fd837a (patch)
treea99888401b6c11ff3dfe69cc4776c7e8607a8844 /release
parentd588dc7d84c081c0be8c2e6170a3997726bf0328 (diff)
downloadsrc-027b4efccff8b55333c657ec6c9fb5f276fd837a.tar.gz
src-027b4efccff8b55333c657ec6c9fb5f276fd837a.zip
Slight refactor in vmimage.subr
De-duplicate the invocation of mkimg(1). No functional change. Reviewed by: gjb MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26984
Notes
Notes: svn path=/head/; revision=367175
Diffstat (limited to 'release')
-rw-r--r--release/tools/vmimage.subr54
1 files changed, 30 insertions, 24 deletions
diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr
index 2e32a732cc1a..a7fe65ac5e59 100644
--- a/release/tools/vmimage.subr
+++ b/release/tools/vmimage.subr
@@ -24,34 +24,23 @@ write_partition_layout() {
case "${TARGET}:${TARGET_ARCH}" in
amd64:amd64 | i386:i386)
- # Create an ESP
- espfilename=$(mktemp /tmp/efiboot.XXXXXX)
- make_esp_file ${espfilename} ${fat32min} ${BOOTFILES}/efi/loader_lua/loader_lua.efi
- mkimg -s gpt -f ${VMFORMAT} \
- -b ${BOOTFILES}/i386/pmbr/pmbr \
- -p freebsd-boot/bootfs:=${BOOTFILES}/i386/gptboot/gptboot \
- -p efi:=${espfilename} \
- ${SWAPOPT} \
- -p freebsd-ufs/rootfs:=${VMBASE} \
- -o ${VMIMAGE}
- rm ${espfilename}
+ ESP=yes
+ SCHEME=gpt
+ BOOTPARTS="-b ${BOOTFILES}/i386/pmbr/pmbr \
+ -p freebsd-boot/bootfs:=${BOOTFILES}/i386/gptboot/gptboot"
+ ROOTFSPART="-p freebsd-ufs/rootfs:=${VMBASE}"
;;
arm64:aarch64)
- # Create an ESP
- espfilename=$(mktemp /tmp/efiboot.XXXXXX)
- make_esp_file ${espfilename} ${fat32min} ${BOOTFILES}/efi/loader_lua/loader_lua.efi
- mkimg -s mbr -f ${VMFORMAT} \
- -p efi:=${espfilename} \
- -p freebsd:=${VMBASE} \
- -o ${VMIMAGE}
- rm ${espfilename}
+ ESP=yes
+ SCHEME=mbr
+ BOOTPARTS=
+ ROOTFSPART="-p freebsd:=${VMBASE}"
;;
powerpc:powerpc*)
- mkimg -s apm -f ${VMFORMAT} \
- -p apple-boot/bootfs:=${BOOTFILES}/powerpc/boot1.chrp/boot1.hfs \
- ${SWAPOPT} \
- -p freebsd-ufs/rootfs:=${VMBASE} \
- -o ${VMIMAGE}
+ ESP=no
+ SCHEME=apm
+ BOOTPARTS="-p apple-boot/bootfs:=${BOOTFILES}/powerpc/boot1.chrp/boot1.hfs"
+ ROOTFSPART="-p freebsd-ufs/rootfs:=${VMBASE}"
;;
*)
# ENOTSUPP
@@ -59,6 +48,23 @@ write_partition_layout() {
;;
esac
+ if [ ${ESP} = "yes" ]; then
+ # Create an ESP
+ espfilename=$(mktemp /tmp/efiboot.XXXXXX)
+ make_esp_file ${espfilename} ${fat32min} ${BOOTFILES}/efi/loader_lua/loader_lua.efi
+ BOOTPARTS="${BOOTPARTS} -p efi:=${espfilename}"
+ fi
+
+ mkimg -s ${SCHEME} -f ${VMFORMAT} \
+ ${BOOTPARTS} \
+ ${SWAPOPT} \
+ ${ROOTFSPART} \
+ -o ${VMIMAGE}
+
+ if [ ${ESP} = "yes" ]; then
+ rm ${espfilename}
+ fi
+
return 0
}