Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Apr 2015 01:04:15 +0000 (UTC)
From:      Glen Barber <gjb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r281876 - in head/release: scripts tools
Message-ID:  <201504230104.t3N14FfQ011235@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gjb
Date: Thu Apr 23 01:04:14 2015
New Revision: 281876
URL: https://svnweb.freebsd.org/changeset/base/281876

Log:
  Create the arm64/aarch64 VM disk image as MBR instead of
  GPT scheme.  UEFI needs to know the unique partition GUID
  with GPT, which changes each time.  Specifically, the QEMU
  EFI BIOS file has this hard-coded.[1]
  
  Since the GPT labels are now unavailable, unconditionally
  label the root filesystem as 'rootfs' with newfs(8), since
  it does not hurt anything anywhere else.  For the arm64 case,
  '/' is mounted from /dev/ufs/rootfs; for all other VM images,
  '/' is mounted from /dev/gpt/rootfs.
  
  Unfortunately, since the /dev/gpt/swapfs label is also lost,
  set NOSWAP=1 for the arm64/aarch64 images.  This is temporary,
  until I figure out a scalable solution to this.  But, a certain
  piece of softare was written "very fast", and ended up living
  for 15 years.  We can deal with this for a week or so.
  
  Information from:	andrew, emaste [1]
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/release/scripts/mk-vmimage.sh
  head/release/tools/vmimage.subr

Modified: head/release/scripts/mk-vmimage.sh
==============================================================================
--- head/release/scripts/mk-vmimage.sh	Wed Apr 22 22:23:56 2015	(r281875)
+++ head/release/scripts/mk-vmimage.sh	Thu Apr 23 01:04:14 2015	(r281876)
@@ -93,6 +93,16 @@ main() {
 		. "${VMCONFIG}"
 	fi
 
+	case ${TARGET}:${TARGET_ARCH} in
+		arm64:aarch64)
+			ROOTLABEL="ufs"
+			NOSWAP=1
+			;;
+		*)
+			ROOTLABEL="gpt"
+			;;
+	esac
+
 	vm_create_base
 	vm_install_base
 	vm_extra_install_base

Modified: head/release/tools/vmimage.subr
==============================================================================
--- head/release/tools/vmimage.subr	Wed Apr 22 22:23:56 2015	(r281875)
+++ head/release/tools/vmimage.subr	Thu Apr 23 01:04:14 2015	(r281876)
@@ -30,10 +30,9 @@ write_partition_layout() {
 				-o ${VMIMAGE}
 			;;
 		arm64:aarch64)
-			mkimg -s gpt \
-				-p efi/efiboot:=${BOOTFILES}/efi/boot1/boot1.efifat \
-				${SWAPOPT} \
-				-p freebsd-ufs/rootfs:=${VMBASE} \
+			mkimg -s mbr \
+				-p efi:=${BOOTFILES}/efi/boot1/boot1.efifat \
+				-p freebsd:=${VMBASE} \
 				-o ${VMIMAGE}
 			;;
 		powerpc:powerpc*)
@@ -77,7 +76,7 @@ vm_create_base() {
 	mkdir -p ${DESTDIR}
 	truncate -s ${VMSIZE} ${VMBASE}
 	mddev=$(mdconfig -f ${VMBASE})
-	newfs /dev/${mddev}
+	newfs -L rootfs /dev/${mddev}
 	mount /dev/${mddev} ${DESTDIR}
 
 	return 0
@@ -97,7 +96,7 @@ vm_copy_base() {
 	truncate -s ${VMSIZE} ${VMBASE}.tmp
 	mkdir -p ${DESTDIR}/new
 	mdnew=$(mdconfig -f ${VMBASE}.tmp)
-	newfs /dev/${mdnew}
+	newfs -L rootfs /dev/${mdnew}
 	mount /dev/${mdnew} ${DESTDIR}/new
 
 	tar -cf- -C ${DESTDIR}/old . | tar -xUf- -C ${DESTDIR}/new
@@ -123,7 +122,7 @@ vm_install_base() {
 
 	echo '# Custom /etc/fstab for FreeBSD VM images' \
 		> ${DESTDIR}/etc/fstab
-	echo '/dev/gpt/rootfs   /       ufs     rw      1       1' \
+	echo "/dev/${ROOTLABEL}/rootfs   /       ufs     rw      1       1" \
 		>> ${DESTDIR}/etc/fstab
 	if [ -z "${NOSWAP}" ]; then
 		echo '/dev/gpt/swapfs  none    swap    sw      0       0' \



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