git: 97f2ecf59f8e - stable/15 - vmimage.subr: Support partition alignment
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 28 Oct 2026 05:52:37 UTC
The branch stable/15 has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=97f2ecf59f8e9666ab81cedb27e53246f7e14f8d
commit 97f2ecf59f8e9666ab81cedb27e53246f7e14f8d
Author: Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2026-10-08 00:52:01 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-10-28 01:13:01 +0000
vmimage.subr: Support partition alignment
If VM_PARTALIGN is set, pass %${VM_PARTALIGN} to mkimg in the
specification of swap, config, root, and ESP partitions. (Boot
partitions are not aligned, both because they're small and in
case firmware makes assumptions about their locations.)
Reviewed by: lwhsu, imp
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D60454
(cherry picked from commit f46269aba8a0bc2b60a0305bdafd8dfb42e0bb88)
---
release/tools/vmimage.subr | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr
index b8d2be965dde..e7e7b9607b15 100644
--- a/release/tools/vmimage.subr
+++ b/release/tools/vmimage.subr
@@ -369,10 +369,14 @@ umount_loop() {
}
vm_create_disk() {
- local BOOTFILES BOOTPARTSOFFSET FSPARTTYPE X86GPTBOOTFILE
+ local BOOTFILES BOOTPARTSOFFSET FSPARTTYPE PARTALIGN X86GPTBOOTFILE
+
+ if [ -n "${VM_PARTALIGN}" ]; then
+ PARTALIGN="%${VM_PARTALIGN}"
+ fi
if [ -z "${NOSWAP}" ]; then
- SWAPOPT="-p freebsd-swap/swapfs::${SWAPSIZE}"
+ SWAPOPT="-p freebsd-swap/swapfs::${SWAPSIZE}${PARTALIGN}"
fi
if [ -n "${VM_BOOTPARTSOFFSET}" ]; then
@@ -380,7 +384,7 @@ vm_create_disk() {
fi
if [ -n "${CONFIG_DRIVE}" ]; then
- CONFIG_DRIVE="-p freebsd/config-drive::${CONFIG_DRIVE_SIZE}"
+ CONFIG_DRIVE="-p freebsd/config-drive::${CONFIG_DRIVE_SIZE}${PARTALIGN}"
fi
case "${VMFS}" in
@@ -412,19 +416,19 @@ vm_create_disk() {
ESP=yes
BOOTPARTS="-b ${BOOTFILES}/i386/pmbr/pmbr \
-p freebsd-boot/bootfs:=${BOOTFILES}/${X86GPTBOOTFILE}${BOOTPARTSOFFSET}"
- ROOTFSPART="-p ${FSPARTTYPE}/rootfs:=${VMBASE}"
+ ROOTFSPART="-p ${FSPARTTYPE}/rootfs:=${VMBASE}${PARTALIGN}"
MAKEFSARGS="$MAKEFSARGS -B little"
;;
arm:armv7 | arm64:aarch64 | riscv:riscv64*)
ESP=yes
BOOTPARTS=
- ROOTFSPART="-p ${FSPARTTYPE}/rootfs:=${VMBASE}"
+ ROOTFSPART="-p ${FSPARTTYPE}/rootfs:=${VMBASE}${PARTALIGN}"
MAKEFSARGS="$MAKEFSARGS -B little"
;;
powerpc:powerpc*)
ESP=no
BOOTPARTS="-p prepboot:=${BOOTFILES}/powerpc/boot1.chrp/boot1.elf -a 1"
- ROOTFSPART="-p freebsd:=${VMBASE}"
+ ROOTFSPART="-p freebsd:=${VMBASE}${PARTALIGN}"
if [ ${TARGET_ARCH} = powerpc64le ]; then
MAKEFSARGS="$MAKEFSARGS -B little"
else
@@ -445,7 +449,7 @@ vm_create_disk() {
if [ -z "${BOOTPARTS}" ]; then
espsuffix="${BOOTPARTSOFFSET}"
fi
- BOOTPARTS="${BOOTPARTS} -p efi/efiboot0:=${espfilename}${espsuffix}"
+ BOOTPARTS="${BOOTPARTS} -p efi/efiboot0:=${espfilename}${espsuffix}${PARTALIGN}"
# Add this to fstab
mkdir -p ${DESTDIR}/boot/efi