aboutsummaryrefslogtreecommitdiff
path: root/release/tools/vmimage.subr
diff options
context:
space:
mode:
authorGlen Barber <gjb@FreeBSD.org>2014-11-07 01:48:12 +0000
committerGlen Barber <gjb@FreeBSD.org>2014-11-07 01:48:12 +0000
commitefeb11a772e65d88562140c9f0cf82504bdb1079 (patch)
treef8c574da077a4726e21223ba4db56068499f1c1b /release/tools/vmimage.subr
parent1e7c1f17428a0b342afd622fad341a389bed7a3f (diff)
downloadsrc-efeb11a772e65d88562140c9f0cf82504bdb1079.tar.gz
src-efeb11a772e65d88562140c9f0cf82504bdb1079.zip
Add write_partition_layout() used to populate the
final image. Fix duplicated mkimg(1) call in vm_create_disk(). Add primitive (untested) PowerPC/PowerPC64 VM image support. Note: As it is currently written, the /boot/pmbr and /boot/{gptboot,boot1.hfs} use the build host and not the target build. Fixing this is likely going to be a hack in itself. Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/projects/release-vmimage/; revision=274211
Diffstat (limited to 'release/tools/vmimage.subr')
-rw-r--r--release/tools/vmimage.subr40
1 files changed, 27 insertions, 13 deletions
diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr
index 622e0fc967ec..3cf19ff360ec 100644
--- a/release/tools/vmimage.subr
+++ b/release/tools/vmimage.subr
@@ -9,10 +9,31 @@
export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
trap "cleanup" INT QUIT TRAP ABRT TERM
-mkimg_bootcode="/boot/pmbr"
-mkimg_partitions="-p freebsd-boot/bootfs:=/boot/gptboot"
-mkimg_partitions="${mkimg_partitions} -p freebsd-swap/swapfs::1G"
-mkimg_partitions="${mkimg_partitions} freebsd-ufs/rootfs:=${VMBASE}"
+write_partition_layout() {
+
+ case "${TARGET}:${TARGET_ARCH}" in
+ amd64:amd64 | i386:i386)
+ mkimg -f gpt -b /boot/pmbr \
+ -p freebsd-boot/bootfs:=/boot/gptboot \
+ -p freebsd-swap/swapfs::1G \
+ -p freebsd-ufs/rootfs:=${VMBASE}
+ -o ${VMIMAGE}
+ ;;
+ powerpc:powerpc*)
+ mkimg -f apm \
+ -p freebsd-boot/bootfs:=/boot/boot1.hfs \
+ -p freebsd-swap/swapfs::1G \
+ -p freebsd-ufs/rootfs:=${VMBASE}
+ -o ${VMIMAGE}
+ ;;
+ *)
+ # ENOTSUPP
+ return 1
+ ;;
+ esac
+
+ return 0
+}
usage() {
echo "${0} usage:"
@@ -130,15 +151,8 @@ vm_create_disk() {
fi
echo "Creating image... Please wait."
echo
- mkimg -f ${mkimg_format} -s ${mkimg_scheme} \
- ${mkimg_bootcode} \
- ${mkimg_partitions} \
- ${mkimg_outfile}
-
- mkimg -b /boot/pmbr -p freebsd-boot/bootfs:=/boot/gptboot \
- -p freebsd-swap/swapfs::1G \
- -p freebsd-ufs/rootfs:=${VMBASE} \
- -o ${VMIMAGE}.raw
+
+ write_partition_layout || return 1
return 0
}