Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Jul 2018 22:51:48 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335876 - head/tools/boot
Message-ID:  <201807022251.w62MpmlW015047@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Mon Jul  2 22:51:48 2018
New Revision: 335876
URL: https://svnweb.freebsd.org/changeset/base/335876

Log:
  Allow making just one flavor of boot-test image based on cmdline args.

Modified:
  head/tools/boot/rootgen.sh

Modified: head/tools/boot/rootgen.sh
==============================================================================
--- head/tools/boot/rootgen.sh	Mon Jul  2 21:20:36 2018	(r335875)
+++ head/tools/boot/rootgen.sh	Mon Jul  2 22:51:48 2018	(r335876)
@@ -740,6 +740,25 @@ qemu_i386_both()
     echo "qemu-system-i386 -bios ~/bios/OVMF-X32.fd --drive file=${img},format=raw ${qser}" >> $sh
 }
 
+make_one_image()
+{
+    local arch=${1?}
+    local geli=${2?}
+    local scheme=${3?}
+    local fs=${4?}
+    local bios=${5?}
+
+    # Create sparse file and mount newly created filesystem(s) on it
+    img=${IMGDIR}/${arch}-${geli}-${scheme}-${fs}-${bios}.img
+    sh=${IMGDIR}/${arch}-${geli}-${scheme}-${fs}-${bios}.sh
+    echo "vvvvvvvvvvvvvv   Creating $img  vvvvvvvvvvvvvvv"
+    rm -f ${img}*
+    eval mk_${geli}_${scheme}_${fs}_${bios} ${DESTDIR} ${img} ${MNTPT} ${geli} ${scheme} ${fs} ${bios}
+    eval qemu_${arch}_${bios} ${img} ${sh}
+    [ -n "${SUDO_USER}" ] && chown ${SUDO_USER} ${img}*
+    echo "^^^^^^^^^^^^^^   Created $img   ^^^^^^^^^^^^^^^"
+}
+
 # mips
 # qemu-system-mips -kernel /path/to/rootfs/boot/kernel/kernel -nographic -hda /path/to/disk.img -m 2048
 
@@ -791,6 +810,13 @@ echo "RC COMMAND RUNNING -- SUCCESS!!!!!"
 halt -p
 EOF
 
+# If we were given exactly 5 args, go make that one image.
+
+if [ $# -eq 5 ]; then
+    make_one_image $*
+    exit
+fi
+
 # OK. Let the games begin
 
 for arch in amd64; do
@@ -798,15 +824,7 @@ for arch in amd64; do
 	for scheme in gpt mbr; do
 	    for fs in ufs zfs; do
 		for bios in legacy uefi both; do
-		    # Create sparse file and mount newly created filesystem(s) on it
-		    img=${IMGDIR}/${arch}-${geli}-${scheme}-${fs}-${bios}.img
-		    sh=${IMGDIR}/${arch}-${geli}-${scheme}-${fs}-${bios}.sh
-		    echo "vvvvvvvvvvvvvvvvvvvvvv   Creating $img  vvvvvvvvvvvvvvvvvvvvvvv"
-		    rm -f ${img}*
-		    eval mk_${geli}_${scheme}_${fs}_${bios} ${DESTDIR} ${img} ${MNTPT} ${geli} ${scheme} ${fs} ${bios}
-		    eval qemu_${arch}_${bios} ${img} ${sh}
-		    [ -n "${SUDO_USER}" ] && chown ${SUDO_USER} ${img}*
-		    echo "^^^^^^^^^^^^^^^^^^^^^^   Creating $img  ^^^^^^^^^^^^^^^^^^^^^^^"
+		    make_one_image ${arch} ${geli} ${scheme} ${fs} ${bios}
 		done
 	    done
 	done
@@ -824,15 +842,7 @@ for arch in i386; do
 	for scheme in gpt mbr; do
 	    for fs in ufs zfs; do
 		for bios in legacy; do
-		    # Create sparse file and mount newly created filesystem(s) on it
-		    img=${IMGDIR}/${arch}-${geli}-${scheme}-${fs}-${bios}.img
-		    sh=${IMGDIR}/${arch}-${geli}-${scheme}-${fs}-${bios}.sh
-		    echo "vvvvvvvvvvvvvvvvvvvvvv   Creating $img  vvvvvvvvvvvvvvvvvvvvvvv"
-		    rm -f ${img}*
-		    eval mk_${geli}_${scheme}_${fs}_${bios} ${DESTDIR} ${img} ${MNTPT} ${geli} ${scheme} ${fs} ${bios}
-		    eval qemu_${arch}_${bios} ${img} ${sh}
-		    [ -n "${SUDO_USER}" ] && chown ${SUDO_USER} ${img}*
-		    echo "^^^^^^^^^^^^^^^^^^^^^^   Creating $img  ^^^^^^^^^^^^^^^^^^^^^^^"
+		    make_one_image ${arch} ${geli} ${scheme} ${fs} ${bios}
 		done
 	    done
 	done
@@ -843,15 +853,7 @@ for arch in arm aarch64; do
     for scheme in gpt mbr; do
 	fs=ufs
 	for bios in uboot efi; do
-	    # Create sparse file and mount newly created filesystem(s) on it
-	    img=${IMGDIR}/${arch}-${geli}-${scheme}-${fs}-${bios}.img
-	    sh=${IMGDIR}/${arch}-${geli}-${scheme}-${fs}-${bios}.sh
-	    echo "vvvvvvvvvvvvvvvvvvvvvv   Creating $img  vvvvvvvvvvvvvvvvvvvvvvv"
-	    rm -f ${img}*
-	    eval mk_${geli}_${scheme}_${fs}_${bios} ${DESTDIR} ${img} ${MNTPT} ${geli} ${scheme} ${fs} ${bios}
-	    eval qemu_${arch}_${bios} ${img} ${sh}
-	    [ -n "${SUDO_USER}" ] && chown ${SUDO_USER} ${img}*
-	    echo "^^^^^^^^^^^^^^^^^^^^^^   Creating $img  ^^^^^^^^^^^^^^^^^^^^^^^"
+	    make_one_image ${arch} ${geli} ${scheme} ${fs} ${bios}
 	done
     done
 done
@@ -860,15 +862,7 @@ for arch in powerpc powerpc64; do
     for scheme in ppc-wtf; do
 	fs=ufs
 	for bios in ofw uboot chrp; do
-	    # Create sparse file and mount newly created filesystem(s) on it
-	    img=${IMGDIR}/${arch}-${geli}-${scheme}-${fs}-${bios}.img
-	    sh=${IMGDIR}/${arch}-${geli}-${scheme}-${fs}-${bios}.sh
-	    echo "vvvvvvvvvvvvvvvvvvvvvv   Creating $img  vvvvvvvvvvvvvvvvvvvvvvv"
-	    rm -f ${img}*
-	    eval mk_${geli}_${scheme}_${fs}_${bios} ${DESTDIR} ${img} ${MNTPT} ${geli} ${scheme} ${fs} ${bios}
-	    eval qemu_${arch}_${bios} ${img} ${sh}
-	    [ -n "${SUDO_USER}" ] && chown ${SUDO_USER} ${img}*
-	    echo "^^^^^^^^^^^^^^^^^^^^^^   Creating $img  ^^^^^^^^^^^^^^^^^^^^^^^"
+	    make_one_image ${arch} ${geli} ${scheme} ${fs} ${bios}
 	done
     done
 done
@@ -878,15 +872,7 @@ for arch in sparc64; do
 	for scheme in vtoc8; do
 	    for fs in ufs; do
 		for bios in ofw; do
-		    # Create sparse file and mount newly created filesystem(s) on it
-		    img=${IMGDIR}/${arch}-${geli}-${scheme}-${fs}-${bios}.img
-		    sh=${IMGDIR}/${arch}-${geli}-${scheme}-${fs}-${bios}.sh
-		    echo "vvvvvvvvvvvvvvvvvvvvvv   Creating $img  vvvvvvvvvvvvvvvvvvvvvvv"
-		    rm -f ${img}*
-		    eval mk_${arch}_${geli}_${scheme}_${fs}_${bios} ${DESTDIR} ${img} ${MNTPT} ${geli} ${scheme} ${fs} ${bios}
-		    eval qemu_${arch}_${bios} ${img} ${sh}
-		    [ -n "${SUDO_USER}" ] && chown ${SUDO_USER} ${img}*
-		    echo "^^^^^^^^^^^^^^^^^^^^^^   Creating $img  ^^^^^^^^^^^^^^^^^^^^^^^"
+		    make_one_image ${arch} ${geli} ${scheme} ${fs} ${bios}
 		done
 	    done
 	done



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