summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-02-06 14:07:17 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-02-06 14:07:17 +0000
commita49d8b6ecc0323b5ee7cf68348e49cc59b40296c (patch)
tree507ca5363411a344a7f2429839e2b97d05c39e10 /tools
parentf8ca070d3aeee9332d1843f5aa44945374b51b8e (diff)
parent7a308c64b4a440935d4afee181c04a6f17a54495 (diff)
downloadsrc-test2-a49d8b6ecc0323b5ee7cf68348e49cc59b40296c.tar.gz
src-test2-a49d8b6ecc0323b5ee7cf68348e49cc59b40296c.zip
Notes
Diffstat (limited to 'tools')
-rwxr-xr-xtools/tools/nanobsd/defaults.sh12
-rw-r--r--tools/tools/nanobsd/embedded/README2
-rw-r--r--tools/tools/nanobsd/embedded/common61
-rw-r--r--tools/tools/nanobsd/embedded/qemu-amd64-uefi-bios.cfg43
-rw-r--r--tools/tools/nanobsd/embedded/qemu-amd64-uefi.cfg43
5 files changed, 148 insertions, 13 deletions
diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh
index 8084bfaf0fcb..a0e6be580b9b 100755
--- a/tools/tools/nanobsd/defaults.sh
+++ b/tools/tools/nanobsd/defaults.sh
@@ -156,6 +156,8 @@ NANO_SLICE_ROOT=s1
NANO_SLICE_ALTROOT=s2
NANO_SLICE_CFG=s3
NANO_SLICE_DATA=s4
+NANO_ROOT=s1a
+NANO_ALTROOT=s2a
# Default ownwership for nopriv build
NANO_DEF_UNAME=root
@@ -569,7 +571,7 @@ setup_nanobsd_etc ( ) (
# save config file for scripts
echo "NANO_DRIVE=${NANO_DRIVE}" > etc/nanobsd.conf
- echo "/dev/${NANO_DRIVE}${NANO_SLICE_ROOT}a / ufs ro 1 1" > etc/fstab
+ echo "/dev/${NANO_DRIVE}${NANO_ROOT} / ufs ro 1 1" > etc/fstab
echo "/dev/${NANO_DRIVE}${NANO_SLICE_CFG} /cfg ufs rw,noauto 2 2" >> etc/fstab
mkdir -p cfg
)
@@ -731,8 +733,8 @@ create_diskimage ( ) (
bsdlabel ${MD}${NANO_SLICE_ROOT}
# Create first image
- populate_slice /dev/${MD}${NANO_SLICE_ROOT}a ${NANO_WORLDDIR} ${MNT} "${NANO_SLICE_ROOT}a"
- mount /dev/${MD}${NANO_SLICE_ROOT}a ${MNT}
+ populate_slice /dev/${MD}${NANO_ROOT} ${NANO_WORLDDIR} ${MNT} "${NANO_ROOT}"
+ mount /dev/${MD}${NANO_ROOT} ${MNT}
echo "Generating mtree..."
( cd "${MNT}" && mtree -c ) > ${NANO_OBJ}/_.mtree
( cd "${MNT}" && du -k ) > ${NANO_OBJ}/_.du
@@ -742,7 +744,7 @@ create_diskimage ( ) (
# Duplicate to second image (if present)
echo "Duplicating to second image..."
dd conv=sparse if=/dev/${MD}${NANO_SLICE_ROOT} of=/dev/${MD}${NANO_SLICE_ALTROOT} bs=64k
- mount /dev/${MD}${NANO_SLICE_ALTROOT}a ${MNT}
+ mount /dev/${MD}${NANO_ALTROOT} ${MNT}
for f in ${MNT}/etc/fstab ${MNT}/conf/base/etc/fstab
do
sed -i "" "s=${NANO_DRIVE}${NANO_SLICE_ROOT}=${NANO_DRIVE}${NANO_SLICE_ALTROOT}=g" $f
@@ -751,7 +753,7 @@ create_diskimage ( ) (
# Override the label from the first partition so we
# don't confuse glabel with duplicates.
if [ -n "${NANO_LABEL}" ]; then
- tunefs -L ${NANO_LABEL}"${NANO_SLICE_ALTROOT}a" /dev/${MD}${NANO_SLICE_ALTROOT}a
+ tunefs -L ${NANO_LABEL}"${NANO_ALTROOT}" /dev/${MD}${NANO_ALTROOT}
fi
fi
diff --git a/tools/tools/nanobsd/embedded/README b/tools/tools/nanobsd/embedded/README
index e8b1c8c6506e..ebaba4c7c97a 100644
--- a/tools/tools/nanobsd/embedded/README
+++ b/tools/tools/nanobsd/embedded/README
@@ -10,8 +10,6 @@ and DHCPd.
This is a work in progress. Generally, to build this you should
cd tools/tools/nanobsd/embedded
sudo sh ../nanobsd.sh -c foo.cfg
-but do be careful if things are interrupted. There may still be
-bugs lurking that cause your entire FreeBSD tree to disappear.
Some features:
diff --git a/tools/tools/nanobsd/embedded/common b/tools/tools/nanobsd/embedded/common
index a1d401a03782..bbac16205304 100644
--- a/tools/tools/nanobsd/embedded/common
+++ b/tools/tools/nanobsd/embedded/common
@@ -76,6 +76,8 @@ fi
NANO_SLICE_FAT_SIZE=32m
NANO_SLICE_CFG_SIZE=32m
+NANO_BOOT2CFG="-D -h -S115200 comconsole_port=0x3e8"
+
NANO_RAM_ETCSIZE=8192
NANO_RAM_TMPVARSIZE=8192
NANO_IMAGES=2
@@ -292,7 +294,7 @@ create_diskimage_mbr ( ) (
bootbsd=${NANO_BOOT_BSD:+-b ${NANO_BOOT_BSD}}
skiparg=${NANO_MBR_FIRST_SKIP:+-S ${NANO_MBR_FIRST_SKIP}}
- for i in s1 s2 s3 s4 empty; do
+ for i in s1 s2 s3 s4 p1 p2 p3 p4 p5 empty; do
rm -fr ${NANO_OBJ}/_.${i}*
done
@@ -317,10 +319,10 @@ create_diskimage_mbr ( ) (
# bsd label
[ -z ${NANO_NOPRIV_BUILD} ] || extra="-F ${NANO_METALOG}"
sz=${NANO_SLICE_ROOT_SIZE:+-s ${NANO_SLICE_ROOT_SIZE}}
- eval "${NANO_MAKEFS_UFS}" ${extra} $sz "${NANO_OBJ}/_.${NANO_SLICE_ROOT}a" \
+ eval "${NANO_MAKEFS_UFS}" ${extra} $sz "${NANO_OBJ}/_.${NANO_SLICE_ROOT}" \
"${NANO_WORLDDIR}"
- mkimg -s bsd ${bootbsd} -p freebsd-ufs:=${NANO_OBJ}/_.${NANO_SLICE_ROOT}a \
- -o ${NANO_OBJ}/_.${NANO_SLICE_ROOT}
+# mkimg -s bsd ${bootbsd} -p freebsd-ufs:=${NANO_OBJ}/_.${NANO_SLICE_ROOT} \
+# -o ${NANO_OBJ}/_.${NANO_SLICE_ROOT}
# Populate the /cfg partition, empty if none given
if [ -z "${NANO_CFGDIR}" ]; then
@@ -339,8 +341,18 @@ create_diskimage_mbr ( ) (
if [ -n "$NANO_SLICE_FAT" ]; then
eval $NANO_SLICE_FAT=fat16b
fi
- eval $NANO_SLICE_CFG=freebsd
- eval $NANO_SLICE_ROOT=freebsd
+ case ${NANO_SLICE_CFG} in
+ s*)
+ echo slice
+ eval $NANO_SLICE_CFG=freebsd
+ eval $NANO_SLICE_ROOT=freebsd
+ ;;
+ p*)
+ echo part
+ eval $NANO_SLICE_CFG=freebsd-ufs
+ eval $NANO_SLICE_ROOT=freebsd-ufs
+ ;;
+ esac
# below depends on https://reviews.freebsd.org/D4403 not yet in the tree
# but there's problems: it marks all partitions as active, so you have to
# boot off parittion 3 or 2 by hand if you're playing around with this WIP
@@ -358,6 +370,25 @@ create_diskimage_mbr ( ) (
-p ${s2}:=${NANO_OBJ}/_.s2 \
-o ${NANO_OBJ}/_.disk.image.${NANO_NAME}${fmt}
;;
+ std-uefi)
+ # s1 is boot, s2 is cfg, s3 is /, not sure how to make that
+ # boot (marked as active) with mkimg yet
+ mkimg -a 2 ${fmtarg} ${bootmbr} -s mbr \
+ -p efi:=${NANO_WORLDDIR}/boot/boot1.efifat \
+ -p ${s2}:=${NANO_OBJ}/_.s2 \
+ -p ${s3}:=${NANO_OBJ}/_.s3 \
+ -o ${NANO_OBJ}/_.disk.image.${NANO_NAME}${fmt}
+ ;;
+ std-uefi-bios)
+ # p1 is boot for uefi, p2 is boot for gpt, p3 is cfg, p4 is /
+ # and p5 is alt-root (after resize)
+ mkimg -a 2 ${fmtarg} ${bootmbr} -s gpt \
+ -p efi:=${NANO_WORLDDIR}/boot/boot1.efifat \
+ -p freebsd-boot:=${NAANO_WORLDDIR}/boot/gptboot \
+ -p ${p3}:=${NANO_OBJ}/_.p3 \
+ -p ${p4}:=${NANO_OBJ}/_.p4 \
+ -o ${NANO_OBJ}/_.disk.image.${NANO_NAME}${fmt}
+ ;;
powerpc64-ibm)
# A lie to make the boot loader work, it boots the first BSD partition
# it finds, regardless of the active flag.
@@ -658,12 +689,30 @@ powerpc64-apple)
echo Not yet
exit 1
;;
+std-uefi)
+ NANO_SLICE_UEFI=s1
+ NANO_SLICE_CFG=s2
+ NANO_SLICE_ROOT=s3
+ NANO_SLICE_ALTROOT=s4
+ ;;
+std-uefi-bios)
+ NANO_SLICE_UEFI=p1
+ NANO_SLICE_BOOT=p2
+ NANO_SLICE_CFG=p3
+ NANO_SLICE_ROOT=p4
+ NANO_SLICE_ALTROOT=p5
+ ;;
*)
echo Unknown Layout ${NANO_LAYOUT}
exit 1
;;
esac
+# For this config, no BSD labels so NANO_ROOT and NANO_ALTROOT need to be
+# adjusted
+NANO_ROOT=${NANO_SLICE_ROOT}
+NANO_ALTROOT=${NANO_SLICE_ALTROOT}
+
NANO_SLICE_DATA= # Not included
# Each major disk scheme has its own routine. Generally
diff --git a/tools/tools/nanobsd/embedded/qemu-amd64-uefi-bios.cfg b/tools/tools/nanobsd/embedded/qemu-amd64-uefi-bios.cfg
new file mode 100644
index 000000000000..7f4f4276bb90
--- /dev/null
+++ b/tools/tools/nanobsd/embedded/qemu-amd64-uefi-bios.cfg
@@ -0,0 +1,43 @@
+# $FreeBSD$
+
+#-
+# Copyright (c) 2015 Warner Losh. All Rights Reserved.
+# Copyright (c) 2010-2011 iXsystems, Inc., All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc. OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+
+NANO_ARCH=amd64
+NANO_NAME=qemu-amd64-uefi-bios
+NANO_LAYOUT=std-uefi-bios
+
+. common # Pull in common definitions
+
+qemu_env
+
+#
+# Run with
+# qemu-system-x86_64 -serial stdio -bios OVMF.fd \
+# -hda _.disk.image.qemu-amd64-uefi.qcow2
+# OVMF.fd is from
+# http://sourceforge.net/projects/edk2/files/OVMF/OVMF-X64-r15214.zip
+#
diff --git a/tools/tools/nanobsd/embedded/qemu-amd64-uefi.cfg b/tools/tools/nanobsd/embedded/qemu-amd64-uefi.cfg
new file mode 100644
index 000000000000..a88e459a50c0
--- /dev/null
+++ b/tools/tools/nanobsd/embedded/qemu-amd64-uefi.cfg
@@ -0,0 +1,43 @@
+# $FreeBSD$
+
+#-
+# Copyright (c) 2015 Warner Losh. All Rights Reserved.
+# Copyright (c) 2010-2011 iXsystems, Inc., All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc. OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+
+NANO_ARCH=amd64
+NANO_NAME=qemu-amd64-uefi
+NANO_LAYOUT=std-uefi
+
+. common # Pull in common definitions
+
+qemu_env
+
+#
+# Run with
+# qemu-system-x86_64 -serial stdio -bios OVMF.fd \
+# -hda _.disk.image.qemu-amd64-uefi.qcow2
+# OVMF.fd is from
+# http://sourceforge.net/projects/edk2/files/OVMF/OVMF-X64-r15214.zip
+#