Changeset View
Changeset View
Standalone View
Standalone View
head/release/tools/vmimage.subr
#!/bin/sh | #!/bin/sh | ||||
# | # | ||||
# $FreeBSD$ | # $FreeBSD$ | ||||
# | # | ||||
# | # | ||||
# Common functions for virtual machine image build scripts. | # Common functions for virtual machine image build scripts. | ||||
# | # | ||||
export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin" | export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin" | ||||
trap "cleanup" INT QUIT TRAP ABRT TERM | trap "cleanup" INT QUIT TRAP ABRT TERM | ||||
write_partition_layout() { | write_partition_layout() { | ||||
if [ -z "${NOSWAP}" ]; then | if [ -z "${NOSWAP}" ]; then | ||||
SWAPOPT="-p freebsd-swap/swapfs::${SWAPSIZE}" | SWAPOPT="-p freebsd-swap/swapfs::${SWAPSIZE}" | ||||
fi | fi | ||||
_OBJDIR="$(make -C ${WORLDDIR} -V .OBJDIR)" | BOOTFILES="$(env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ | ||||
_OBJDIR="$(realpath ${_OBJDIR})" | WITH_UNIFIED_OBJDIR=yes \ | ||||
if [ -d "${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}" ]; then | make -C ${WORLDDIR}/sys/boot -V .OBJDIR)" | ||||
BOOTFILES="/${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}/usr/src/sys/boot" | BOOTFILES="$(realpath ${BOOTFILES})" | ||||
else | |||||
BOOTFILES="/${_OBJDIR}/sys/boot" | |||||
fi | |||||
case "${TARGET}:${TARGET_ARCH}" in | case "${TARGET}:${TARGET_ARCH}" in | ||||
amd64:amd64 | i386:i386) | amd64:amd64 | i386:i386) | ||||
mkimg -s gpt -f ${VMFORMAT} \ | mkimg -s gpt -f ${VMFORMAT} \ | ||||
-b ${BOOTFILES}/i386/pmbr/pmbr \ | -b ${BOOTFILES}/i386/pmbr/pmbr \ | ||||
-p freebsd-boot/bootfs:=${BOOTFILES}/i386/gptboot/gptboot \ | -p freebsd-boot/bootfs:=${BOOTFILES}/i386/gptboot/gptboot \ | ||||
${SWAPOPT} \ | ${SWAPOPT} \ | ||||
-p freebsd-ufs/rootfs:=${VMBASE} \ | -p freebsd-ufs/rootfs:=${VMBASE} \ | ||||
▲ Show 20 Lines • Show All 222 Lines • Show Last 20 Lines |