Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Feb 2018 00:18:21 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r328865 - head/tools/boot
Message-ID:  <201802050018.w150ILoi047653@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Mon Feb  5 00:18:21 2018
New Revision: 328865
URL: https://svnweb.freebsd.org/changeset/base/328865

Log:
  Flesh out the creation of sparc64 UFS images. This has only been verified
  to yield working images in a native build as rootgen.sh generally doesn't
  support cross-testing so far.

Modified:
  head/tools/boot/install-boot.sh
  head/tools/boot/rootgen.sh

Modified: head/tools/boot/install-boot.sh
==============================================================================
--- head/tools/boot/install-boot.sh	Sun Feb  4 23:01:48 2018	(r328864)
+++ head/tools/boot/install-boot.sh	Mon Feb  5 00:18:21 2018	(r328865)
@@ -78,12 +78,22 @@ boot_nogeli_mbr_ufs_legacy() {
     doit gpart bootcode -b ${mbr0} ${dev}
     s=$(findpart $dev "freebsd-ufs")
     if [ -z "$s" ] ; then
-	die "No freebsd-zfs slice found"
+	die "No freebsd-ufs slice found"
     fi
     doit gpart bootcode -p ${mbr2} ${dev}s${s}
     exit 0
 }
 
+boot_nogeli_vtoc8_ufs_ofw() {
+    dev=$1
+    dst=$2
+
+    # For non-native builds, ensure that geom_part(4) supports VTOC8.
+    kldload geom_part_vtoc8.ko
+    doit gpart bootcode -p ${vtoc8} ${dev}
+    exit 0
+}
+
 DESTDIR=/
 
 # Note: we really don't support geli boot in this script yet.
@@ -127,6 +137,9 @@ gptzfs2=${DESTDIR}/boot/gptzfsboot
 # For MBR, we have lots of choices, but select boot0
 mbr0=${DESTDIR}/boot/boot0
 mbr2=${DESTDIR}/boot/boot
+
+# VTOC8
+vtoc8=${DESTDIR}/boot/boot1
 
 # sanity check here
 

Modified: head/tools/boot/rootgen.sh
==============================================================================
--- head/tools/boot/rootgen.sh	Sun Feb  4 23:01:48 2018	(r328864)
+++ head/tools/boot/rootgen.sh	Mon Feb  5 00:18:21 2018	(r328865)
@@ -193,6 +193,29 @@ mk_geli_mbr_zfs_both() {
 # u-boot
 # powerpc
 
+mk_sparc64_nogeli_vtoc8_ufs_ofw() {
+    src=$1
+    img=$2
+    mntpt=$3
+    geli=$4
+    scheme=$5
+    fs=$6
+    bios=$7
+
+    cat > ${src}/etc/fstab <<EOF
+/dev/ada0a	/		ufs	rw	1	1
+EOF
+    makefs -t ffs -B big -s 200m ${img} ${src}
+    md=$(mdconfig -f ${img})
+    # For non-native builds, ensure that geom_part(4) supports VTOC8.
+    kldload geom_part_vtoc8.ko
+    gpart create -s VTOC8 ${md}
+    gpart add -t freebsd-ufs ${md}
+    ${SRCTOP}/tools/boot/install-boot.sh -g ${geli} -s ${scheme} -f ${fs} -b ${bios} -d ${src} ${md}
+    mdconfig -d -u ${md}
+    rm -f ${src}/etc/fstab
+}
+
 qser="-serial telnet::4444,server -nographic"
 
 # https://wiki.freebsd.org/QemuRecipes
@@ -276,10 +299,8 @@ qemu_i386_both()
 # qemu-system-ppc64 -drive file=/path/to/disk.img,format=raw
 
 # sparc64
-# 10.3 works, 12-current (which one?) hangs
 # qemu-system-sparc64 -drive file=/path/to/disk.img,format=raw
 
-
 # Misc variables
 SRCTOP=$(make -v SRCTOP)
 cd ${SRCTOP}/stand
@@ -293,6 +314,9 @@ DESTDIR=${OBJDIR}/boot-tree
 rm -rf ${DESTDIR}
 mkdir -p ${DESTDIR}/boot/defaults
 mkdir -p ${DESTDIR}/boot/kernel
+# XXX boot1 exists only on sparc64
+cp /boot/boot1 ${DESTDIR}/boot
+cp /boot/loader ${DESTDIR}/boot
 cp /boot/kernel/kernel ${DESTDIR}/boot/kernel
 echo -h -D -S115200 > ${DESTDIR}/boot.config
 # XXX
@@ -396,18 +420,21 @@ for arch in powerpc powerpc64; do
 done
 
 for arch in sparc64; do
-    for scheme in sun; do
-	fs=ufs
-	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_${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  ^^^^^^^^^^^^^^^^^^^^^^^"
+    for geli in nogeli; 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  ^^^^^^^^^^^^^^^^^^^^^^^"
+		done
+	    done
 	done
     done
 done



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