Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Nov 2014 01:53:41 +0000 (UTC)
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r274771 - projects/release-vmimage/release/tools
Message-ID:  <201411210153.sAL1rf2c037578@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cperciva
Date: Fri Nov 21 01:53:40 2014
New Revision: 274771
URL: https://svnweb.freebsd.org/changeset/base/274771

Log:
  Add NOSWAP option which can be set by a vmimage.conf file to specify that
  no swap space should be created in the image.  This will be used by EC2
  builds, since FreeBSD/EC2 allocates swap space on "ephemeral" disks which
  are physically attached to the Xen host node.

Modified:
  projects/release-vmimage/release/tools/vmimage.subr

Modified: projects/release-vmimage/release/tools/vmimage.subr
==============================================================================
--- projects/release-vmimage/release/tools/vmimage.subr	Fri Nov 21 01:43:55 2014	(r274770)
+++ projects/release-vmimage/release/tools/vmimage.subr	Fri Nov 21 01:53:40 2014	(r274771)
@@ -10,19 +10,22 @@ export PATH="/bin:/usr/bin:/sbin:/usr/sb
 trap "cleanup" INT QUIT TRAP ABRT TERM
 
 write_partition_layout() {
+	if [ -z "${NOSWAP}" ]; then
+		SWAPOPT="-p freebsd-swap/swapfs::1G"
+	fi
 
 	case "${TARGET}:${TARGET_ARCH}" in
 		amd64:amd64 | i386:i386)
 			mkimg -s gpt -b /boot/pmbr \
 				-p freebsd-boot/bootfs:=/boot/gptboot \
-				-p freebsd-swap/swapfs::1G \
+				${SWAPOPT} \
 				-p freebsd-ufs/rootfs:=${VMBASE} \
 				-o ${VMIMAGE}
 			;;
 		powerpc:powerpc*)
 			mkimg -s apm \
 				-p apple-boot/bootfs:=/boot/boot1.hfs \
-				-p freebsd-swap/swapfs::1G \
+				${SWAPOPT} \
 				-p freebsd-ufs/rootfs:=${VMBASE} \
 				-o ${VMIMAGE}
 			;;
@@ -76,8 +79,10 @@ vm_install_base() {
 		> ${DESTDIR}/etc/fstab
 	echo '/dev/gpt/rootfs   /       ufs     rw      1       1' \
 		>> ${DESTDIR}/etc/fstab
-	echo '/dev/gpt/swapfs  none    swap    sw      0       0' \
-		>> ${DESTDIR}/etc/fstab
+	if [ -z "${NOSWAP}" ]; then
+		echo '/dev/gpt/swapfs  none    swap    sw      0       0' \
+			>> ${DESTDIR}/etc/fstab
+	fi
 
 	mkdir -p ${DESTDIR}/dev
 	mount -t devfs devfs ${DESTDIR}/dev



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411210153.sAL1rf2c037578>