summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-02-11 20:07:09 +0000
committerdim <dim@FreeBSD.org>2016-02-11 20:07:09 +0000
commitafa214d26dae14a294ff215b5a55e9acaf67d18f (patch)
treed5418788f5368ac552e6ffa543d661830d835dbb /tools
parent86bef0867f0389dc03d4cd4913f5dee79377226f (diff)
parent5183fdd185bc8709354de8b0b88b8925644c2a4b (diff)
downloadFreeBSD-src-afa214d26dae14a294ff215b5a55e9acaf67d18f.zip
FreeBSD-src-afa214d26dae14a294ff215b5a55e9acaf67d18f.tar.gz
Merge ^/head r295351 through r295543.
Diffstat (limited to 'tools')
-rw-r--r--tools/build/mk/OptionalObsoleteFiles.inc1
-rw-r--r--tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP3
-rw-r--r--tools/build/options/WITHOUT_ELFTOOLCHAIN_BOOTSTRAP7
-rw-r--r--tools/build/options/WITH_BINUTILS3
-rw-r--r--tools/build/options/WITH_BINUTILS_BOOTSTRAP3
-rw-r--r--tools/build/options/WITH_GDB3
-rw-r--r--tools/regression/sysvsem/semtest.c9
-rw-r--r--tools/tools/ath/athaggrstats/main.c2
-rw-r--r--tools/tools/ath/athdebug/athdebug.c4
-rw-r--r--tools/tools/ath/athradar/athradar.c4
-rw-r--r--tools/tools/ath/athratestats/main.c2
-rw-r--r--tools/tools/ath/athregs/dumpregs.c4
-rw-r--r--tools/tools/ath/athspectral/athspectral.c4
-rw-r--r--tools/tools/ath/athstats/main.c2
-rwxr-xr-xtools/tools/nanobsd/defaults.sh46
-rw-r--r--tools/tools/nanobsd/embedded/common233
-rw-r--r--tools/tools/nanobsd/embedded/i386.cfg34
-rw-r--r--tools/tools/nanobsd/embedded/qemu-armv7.cfg48
18 files changed, 220 insertions, 192 deletions
diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc
index 064d3f5..f33e7d2 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -7971,7 +7971,6 @@ OLD_FILES+=usr/sbin/unbound
OLD_FILES+=usr/sbin/unbound-anchor
OLD_FILES+=usr/sbin/unbound-checkconf
OLD_FILES+=usr/sbin/unbound-control
-OLD_FILES+=usr/sbin/unbound-control-setup
OLD_FILES+=usr/share/man/man5/unbound.conf.5.gz
OLD_FILES+=usr/share/man/man8/unbound-anchor.8.gz
OLD_FILES+=usr/share/man/man8/unbound-checkconf.8.gz
diff --git a/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP b/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP
index 84ae1a17..c64c469 100644
--- a/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP
+++ b/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP
@@ -1,6 +1,5 @@
.\" $FreeBSD$
-Set to not build binutils (as, c++-filt, gconv,
-ld, nm, objcopy, objdump, readelf, size and strip)
+Set to not build binutils (as, ld, objcopy and objdump)
as part of the bootstrap process.
.Bf -symbolic
The option does not work for build targets unless some alternative
diff --git a/tools/build/options/WITHOUT_ELFTOOLCHAIN_BOOTSTRAP b/tools/build/options/WITHOUT_ELFTOOLCHAIN_BOOTSTRAP
new file mode 100644
index 0000000..85fa01e
--- /dev/null
+++ b/tools/build/options/WITHOUT_ELFTOOLCHAIN_BOOTSTRAP
@@ -0,0 +1,7 @@
+.\" $FreeBSD$
+Set to not build ELF Tool Chain tools
+(addr2line, nm, size, strings and strip)
+as part of the bootstrap process.
+.Bf -symbolic
+An alternate bootstrap tool chain must be provided.
+.Ef
diff --git a/tools/build/options/WITH_BINUTILS b/tools/build/options/WITH_BINUTILS
new file mode 100644
index 0000000..619dc21
--- /dev/null
+++ b/tools/build/options/WITH_BINUTILS
@@ -0,0 +1,3 @@
+.\" $FreeBSD$
+Set to build and install binutils (as, ld, objcopy, and objdump) as part
+of the normal system build.
diff --git a/tools/build/options/WITH_BINUTILS_BOOTSTRAP b/tools/build/options/WITH_BINUTILS_BOOTSTRAP
new file mode 100644
index 0000000..f32cb06
--- /dev/null
+++ b/tools/build/options/WITH_BINUTILS_BOOTSTRAP
@@ -0,0 +1,3 @@
+.\" $FreeBSD$
+Set build binutils (as, ld, objcopy and objdump)
+as part of the bootstrap process.
diff --git a/tools/build/options/WITH_GDB b/tools/build/options/WITH_GDB
new file mode 100644
index 0000000..994942e
--- /dev/null
+++ b/tools/build/options/WITH_GDB
@@ -0,0 +1,3 @@
+.\" $FreeBSD$
+Set to build
+.Xr gdb 1 .
diff --git a/tools/regression/sysvsem/semtest.c b/tools/regression/sysvsem/semtest.c
index 8a997d0..39c4164 100644
--- a/tools/regression/sysvsem/semtest.c
+++ b/tools/regression/sysvsem/semtest.c
@@ -152,6 +152,15 @@ main(int argc, char *argv[])
print_semid_ds(&s_ds, 0600);
+ errno = 0;
+ if (semget(semkey, 1, IPC_CREAT | IPC_EXCL | 0600) != -1 ||
+ errno != EEXIST)
+ err(1, "semget IPC_EXCL 1 did not fail with [EEXIST]");
+ errno = 0;
+ if (semget(semkey, 2, IPC_CREAT | IPC_EXCL | 0600) != -1 ||
+ errno != EEXIST)
+ err(1, "semget IPC_EXCL 2 did not fail with [EEXIST]");
+
for (child_count = 0; child_count < 5; child_count++) {
switch ((child_pid = fork())) {
case -1:
diff --git a/tools/tools/ath/athaggrstats/main.c b/tools/tools/ath/athaggrstats/main.c
index 95e7917..6a0de98 100644
--- a/tools/tools/ath/athaggrstats/main.c
+++ b/tools/tools/ath/athaggrstats/main.c
@@ -89,7 +89,7 @@ main(int argc, char *argv[])
ifname = getenv("ATH");
if (ifname == NULL)
- ifname = "ath0";
+ ifname = ATH_DEFAULT;
wf = athaggrstats_new(ifname, getfmt("default"));
while ((c = getopt(argc, argv, "bi:lo:z")) != -1) {
switch (c) {
diff --git a/tools/tools/ath/athdebug/athdebug.c b/tools/tools/ath/athdebug/athdebug.c
index bcdbcc8..b28f043 100644
--- a/tools/tools/ath/athdebug/athdebug.c
+++ b/tools/tools/ath/athdebug/athdebug.c
@@ -31,7 +31,7 @@
/*
* athdebug [-i interface] flags
- * (default interface is ath0).
+ * (default interface is wlan0).
*/
#include <sys/param.h>
@@ -156,7 +156,7 @@ main(int argc, char *argv[])
ifname = getenv("ATH");
if (ifname == NULL)
- ifname = "ath0";
+ ifname = ATH_DEFAULT;
progname = argv[0];
if (argc > 1) {
if (strcmp(argv[1], "-i") == 0) {
diff --git a/tools/tools/ath/athradar/athradar.c b/tools/tools/ath/athradar/athradar.c
index f40e1bd..69f4416 100644
--- a/tools/tools/ath/athradar/athradar.c
+++ b/tools/tools/ath/athradar/athradar.c
@@ -30,10 +30,6 @@
#include "ah.h"
#include "ah_internal.h"
-#ifndef ATH_DEFAULT
-#define ATH_DEFAULT "ath0"
-#endif
-
#include <getopt.h>
#include <errno.h>
#include <err.h>
diff --git a/tools/tools/ath/athratestats/main.c b/tools/tools/ath/athratestats/main.c
index 3881e85..b3f85f7 100644
--- a/tools/tools/ath/athratestats/main.c
+++ b/tools/tools/ath/athratestats/main.c
@@ -310,7 +310,7 @@ main(int argc, char *argv[])
ifname = getenv("ATH");
if (ifname == NULL)
- ifname = "ath0";
+ ifname = ATH_DEFAULT;
while ((c = getopt(argc, argv, "ahi:m:s:")) != -1) {
switch (c) {
diff --git a/tools/tools/ath/athregs/dumpregs.c b/tools/tools/ath/athregs/dumpregs.c
index 4a50726..472df05 100644
--- a/tools/tools/ath/athregs/dumpregs.c
+++ b/tools/tools/ath/athregs/dumpregs.c
@@ -155,7 +155,7 @@ main(int argc, char *argv[])
atd.ad_out_data = (caddr_t) &state.revs;
atd.ad_out_size = sizeof(state.revs);
if (ioctl(s, SIOCGATHDIAG, &atd) < 0)
- err(1, atd.ad_name);
+ err(1, "%s", atd.ad_name);
if (ath_hal_setupregs(&atd, what) == 0)
errx(-1, "no registers are known for this part "
@@ -173,7 +173,7 @@ main(int argc, char *argv[])
}
atd.ad_id = HAL_DIAG_REGS | ATH_DIAG_IN | ATH_DIAG_DYN;
if (ioctl(s, SIOCGATHDIAG, &atd) < 0)
- err(1, atd.ad_name);
+ err(1, "%s", atd.ad_name);
/*
* Expand register data into global space that can be
diff --git a/tools/tools/ath/athspectral/athspectral.c b/tools/tools/ath/athspectral/athspectral.c
index 1ec9085..91045d0 100644
--- a/tools/tools/ath/athspectral/athspectral.c
+++ b/tools/tools/ath/athspectral/athspectral.c
@@ -30,10 +30,6 @@
#include "ah.h"
#include "ah_internal.h"
-#ifndef ATH_DEFAULT
-#define ATH_DEFAULT "ath0"
-#endif
-
#include <getopt.h>
#include <errno.h>
#include <err.h>
diff --git a/tools/tools/ath/athstats/main.c b/tools/tools/ath/athstats/main.c
index bf0323d..29e8636 100644
--- a/tools/tools/ath/athstats/main.c
+++ b/tools/tools/ath/athstats/main.c
@@ -94,7 +94,7 @@ main(int argc, char *argv[])
ifname = getenv("ATH");
if (ifname == NULL)
- ifname = "ath0";
+ ifname = ATH_DEFAULT;
wf = athstats_new(ifname, getfmt("default"));
while ((c = getopt(argc, argv, "bi:lo:z")) != -1) {
switch (c) {
diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh
index a0e6be5..9a5c5cb 100755
--- a/tools/tools/nanobsd/defaults.sh
+++ b/tools/tools/nanobsd/defaults.sh
@@ -356,7 +356,7 @@ clean_world ( ) (
rm -r ${NANO_OBJ}/
fi
mkdir -p "${NANO_OBJ}" "${NANO_WORLDDIR}"
- printenv > ${NANO_OBJ}/_.env
+ printenv > ${NANO_LOG}/_.env
else
pprint 2 "Clean and create world directory (${NANO_WORLDDIR})"
if ! rm -rf "${NANO_WORLDDIR}/" > /dev/null 2>&1 ; then
@@ -385,7 +385,7 @@ make_conf_install ( ) (
install_world ( ) (
pprint 2 "installworld"
- pprint 3 "log: ${NANO_OBJ}/_.iw"
+ pprint 3 "log: ${NANO_LOG}/_.iw"
(
nano_make_install_env
@@ -393,13 +393,13 @@ install_world ( ) (
cd "${NANO_SRC}"
${NANO_MAKE} installworld DESTDIR="${NANO_WORLDDIR}"
chflags -R noschg "${NANO_WORLDDIR}"
- ) > ${NANO_OBJ}/_.iw 2>&1
+ ) > ${NANO_LOG}/_.iw 2>&1
)
install_etc ( ) (
pprint 2 "install /etc"
- pprint 3 "log: ${NANO_OBJ}/_.etc"
+ pprint 3 "log: ${NANO_LOG}/_.etc"
(
nano_make_install_env
@@ -409,14 +409,14 @@ install_etc ( ) (
# make.conf doesn't get created by default, but some ports need it
# so they can spam it.
cp /dev/null "${NANO_WORLDDIR}"/etc/make.conf
- ) > ${NANO_OBJ}/_.etc 2>&1
+ ) > ${NANO_LOG}/_.etc 2>&1
)
install_kernel ( ) (
local extra
pprint 2 "install kernel ($NANO_KERNEL)"
- pprint 3 "log: ${NANO_OBJ}/_.ik"
+ pprint 3 "log: ${NANO_LOG}/_.ik"
(
@@ -432,12 +432,12 @@ install_kernel ( ) (
cd "${NANO_SRC}"
${NANO_MAKE} installkernel DESTDIR="${NANO_WORLDDIR}"
- ) > ${NANO_OBJ}/_.ik 2>&1
+ ) > ${NANO_LOG}/_.ik 2>&1
)
native_xtools ( ) (
print 2 "Installing the optimized native build tools for cross env"
- pprint 3 "log: ${NANO_OBJ}/_.native_xtools"
+ pprint 3 "log: ${NANO_LOG}/_.native_xtools"
(
@@ -446,7 +446,7 @@ native_xtools ( ) (
cd "${NANO_SRC}"
${NANO_MAKE} native-xtools DESTDIR="${NANO_WORLDDIR}"
- ) > ${NANO_OBJ}/_.native_xtools 2>&1
+ ) > ${NANO_LOG}/_.native_xtools 2>&1
)
#
@@ -460,9 +460,9 @@ run_customize ( ) (
for c in $NANO_CUSTOMIZE
do
pprint 2 "customize \"$c\""
- pprint 3 "log: ${NANO_OBJ}/_.cust.$c"
+ pprint 3 "log: ${NANO_LOG}/_.cust.$c"
pprint 4 "`type $c`"
- ( set -x ; $c ) > ${NANO_OBJ}/_.cust.$c 2>&1
+ ( set -x ; $c ) > ${NANO_LOG}/_.cust.$c 2>&1
done
)
@@ -476,9 +476,9 @@ run_late_customize ( ) (
for c in $NANO_LATE_CUSTOMIZE
do
pprint 2 "late customize \"$c\""
- pprint 3 "log: ${NANO_OBJ}/_.late_cust.$c"
+ pprint 3 "log: ${NANO_LOG}/_.late_cust.$c"
pprint 4 "`type $c`"
- ( set -x ; $c ) > ${NANO_OBJ}/_.late_cust.$c 2>&1
+ ( set -x ; $c ) > ${NANO_LOG}/_.late_cust.$c 2>&1
done
)
@@ -510,7 +510,7 @@ fixup_before_diskimage ( ) (
setup_nanobsd ( ) (
pprint 2 "configure nanobsd setup"
- pprint 3 "log: ${NANO_OBJ}/_.dl"
+ pprint 3 "log: ${NANO_LOG}/_.dl"
(
cd "${NANO_WORLDDIR}"
@@ -547,7 +547,7 @@ setup_nanobsd ( ) (
# Put /tmp on the /var ramdisk (could be symlink already)
tgt_dir2symlink tmp var/tmp
- ) > ${NANO_OBJ}/_.dl 2>&1
+ ) > ${NANO_LOG}/_.dl 2>&1
)
setup_nanobsd_etc ( ) (
@@ -630,7 +630,7 @@ populate_data_slice ( ) (
create_diskimage ( ) (
pprint 2 "build diskimage"
- pprint 3 "log: ${NANO_OBJ}/_.di"
+ pprint 3 "log: ${NANO_LOG}/_.di"
(
echo $NANO_MEDIASIZE $NANO_IMAGES \
@@ -699,7 +699,7 @@ create_diskimage ( ) (
# for booting the image from a USB device to work.
print "a 1"
}
- ' > ${NANO_OBJ}/_.fdisk
+ ' > ${NANO_LOG}/_.fdisk
IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
MNT=${NANO_OBJ}/_.mnt
@@ -718,7 +718,7 @@ create_diskimage ( ) (
trap "echo 'Running exit trap code' ; df -i ${MNT} ; nano_umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT
- fdisk -i -f ${NANO_OBJ}/_.fdisk ${MD}
+ fdisk -i -f ${NANO_LOG}/_.fdisk ${MD}
fdisk ${MD}
# XXX: params
# XXX: pick up cached boot* files, they may not be in image anymore.
@@ -736,8 +736,8 @@ create_diskimage ( ) (
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
+ ( cd "${MNT}" && mtree -c ) > ${NANO_LOG}/_.mtree
+ ( cd "${MNT}" && du -k ) > ${NANO_LOG}/_.du
nano_umount "${MNT}"
if [ $NANO_IMAGES -gt 1 -a $NANO_INIT_IMG2 -gt 0 ] ; then
@@ -792,7 +792,7 @@ create_diskimage ( ) (
trap - 1 2 15
trap nano_cleanup EXIT
- ) > ${NANO_OBJ}/_.di 2>&1
+ ) > ${NANO_LOG}/_.di 2>&1
)
last_orders ( ) (
@@ -1026,7 +1026,8 @@ set_defaults_and_export ( ) {
: ${NANO_OBJ:=/usr/obj/nanobsd.${NANO_NAME}}
: ${MAKEOBJDIRPREFIX:=${NANO_OBJ}}
: ${NANO_DISKIMGDIR:=${NANO_OBJ}}
- NANO_WORLDDIR=${NANO_OBJ}/_.w
+ : ${NANO_WORLDDIR:=${NANO_OBJ}/_.w}
+ : ${NANO_LOG:=${NANO_OBJ}}
NANO_MAKE_CONF_BUILD=${MAKEOBJDIRPREFIX}/make.conf.build
NANO_MAKE_CONF_INSTALL=${NANO_OBJ}/make.conf.install
@@ -1070,6 +1071,7 @@ set_defaults_and_export ( ) {
export_var NANO_MODULES
export_var NANO_NOPRIV_BUILD
export_var NANO_METALOG
+ export_var NANO_LOG
export_var SRCCONF
export_var SRC_ENV_CONF
}
diff --git a/tools/tools/nanobsd/embedded/common b/tools/tools/nanobsd/embedded/common
index bbac162..50e507f 100644
--- a/tools/tools/nanobsd/embedded/common
+++ b/tools/tools/nanobsd/embedded/common
@@ -76,7 +76,7 @@ fi
NANO_SLICE_FAT_SIZE=32m
NANO_SLICE_CFG_SIZE=32m
-NANO_BOOT2CFG="-D -h -S115200 comconsole_port=0x3e8"
+NANO_BOOT2CFG="-P -S115200"
NANO_RAM_ETCSIZE=8192
NANO_RAM_TMPVARSIZE=8192
@@ -88,23 +88,32 @@ NANO_CFG_BASE=$(pwd)
NANO_CFG_BASE=$(realpath ${NANO_CFG_BASE}/..)
NANO_SRC=$(realpath ${NANO_CFG_BASE}/../../..)
#### XXX share obj
-NANO_OBJ=${NANO_SRC}/../$NANO_NAME/obj
-# Where cust_pkg() finds packages to install
-#XXX: Is this the right place?
-#NANO_PORTS=$(realpath ${NANO_SRC}/../ports)
-NANO_PORTS=/usr/ports
-NANO_PACKAGE_DIR=${NANO_SRC}/${NANO_TOOLS}/Pkg
+if [ -z ${NANO_CPUTYPE} ]; then
+ NANO_OBJ=${NANO_SRC}/../embedded/obj
+else
+ # Alas, I can't set OBJTREE to ${MACHINE}.${MACHINE_ARCH}.${CPUTYPE}
+ # so this will have to do until I can.
+ NANO_OBJ=${NANO_SRC}/../embedded/obj.${NANO_CPUTYPE}
+fi
+NANO_LOG=${NANO_OBJ}/../${NANO_NAME}
+NANO_DISKIMGDIR=${NANO_OBJ}/../images
+NANO_WORLDDIR=${NANO_LOG}/_.w
NANO_INIT_IMG2=0
NANO_NOPRIV_BUILD=t
unset MAKEOBJDIRPREFIX
-# this to go into nanobsd.sh
-NANO_PORTS=${NANO_PORTS:-/usr/ports}
-
mkdir -p ${NANO_OBJ}
NANO_OBJ=$(realpath ${NANO_OBJ})
+mkdir -p ${NANO_LOG}
+NANO_LOG=$(realpath ${NANO_LOG})
+mkdir -p ${NANO_IMAGES}
+NANO_IMAGES=$(realpath ${NANO_IMAGES})
+mkdir -p ${NANO_WORLDDIR}
+NANO_WORLDDIR=$(realpath ${NANO_WORLDDIR})
+mkdir -p ${NANO_DISKIMGDIR}
+NANO_DISKIMGDIR=$(realpath ${NANO_DISKIMGDIR})
-NANO_FAT_DIR=${NANO_OBJ}/_.fat
+NANO_FAT_DIR=${NANO_LOG}/_.fat
customize_cmd cust_allow_ssh_root
@@ -180,109 +189,18 @@ WITHOUT_RCS=true
NANO_PACKAGE_ONLY=1
-# install a package from a pre-built binary
-do_add_pkg ( ) (
- # Need to create ${NANO_OBJ}/ports in this add_pkg_${port} function
- set -x
- mkdir -p ${NANO_OBJ}/ports/distfiles
- mkdir -p ${NANO_OBJ}/ports/packages
- mkdir -p ${NANO_WORLDDIR}/usr/ports/packages
- mkdir -p ${NANO_WORLDDIR}/usr/ports/distfiles
- mount -t nullfs -o noatime ${NANO_OBJ}/ports/packages \
- ${NANO_WORLDDIR}/usr/ports/packages
- mount -t nullfs -o noatime ${NANO_OBJ}/ports/distfiles \
- ${NANO_WORLDDIR}/usr/ports/distfiles
- CR env ASSUME_ALWAYS_YES=YES SIGNATURE_TYPE=none /usr/sbin/pkg add /usr/ports/packages/All/$1.txz
- umount ${NANO_WORLDDIR}/usr/ports/distfiles
- umount ${NANO_WORLDDIR}/usr/ports/packages
- rmdir ${NANO_WORLDDIR}/usr/ports/packages
- rmdir ${NANO_WORLDDIR}/usr/ports/distfiles
- rmdir ${NANO_WORLDDIR}/usr/ports
- set +x
-)
+# Creates images for all the formats that use MBR / GPT
+# split later if the #ifdef soup gets too bad.
+create_diskimage_gpt ( ) (
+ pprint 2 "build diskimage gpt ${NANO_NAME}"
-# Build a port (with the side effect of creating a package)
-do_add_port ( ) (
- local port_path
- port_path=$1
- shift
- set -x
- # Need to create ${NANO_OBJ}/ports in this add_port_${port} function
- mkdir -p ${NANO_OBJ}/ports/distfiles
- mkdir -p ${NANO_OBJ}/ports/packages
- mkdir -p ${NANO_PORTS}/packages
- mkdir -p ${NANO_PORTS}/distfiles
- mkdir -p ${NANO_WORLDDIR}/usr/src
- mkdir -p ${NANO_WORLDDIR}/usr/ports
- mount -t nullfs -o noatime ${NANO_SRC} ${NANO_WORLDDIR}/usr/src
- mount -t nullfs -o noatime ${NANO_PORTS} ${NANO_WORLDDIR}/usr/ports
- mount -t nullfs -o noatime ${NANO_OBJ}/ports/packages \
- ${NANO_WORLDDIR}/usr/ports/packages
- mount -t nullfs -o noatime ${NANO_OBJ}/ports/distfiles \
- ${NANO_WORLDDIR}/usr/ports/distfiles
- mkdir -p ${NANO_WORLDDIR}/dev
- mount -t devfs devfs ${NANO_WORLDDIR}/dev
- mkdir -p ${NANO_WORLDDIR}/usr/workdir
- cp /etc/resolv.conf ${NANO_WORLDDIR}/etc/resolv.conf
- # OK, a little inefficient, but likely not enough to worry about.
- CR ldconfig /lib /usr/lib /usr/local/lib
- CR ldconfig -R
- CR ldconfig -r
-# Improvement: Don't know why package-recursive don't works here
- CR "env UNAME_p=${NANO_ARCH} TARGET=${NANO_ARCH} \
- TARGET_ARCH=${NANO_ARCH} PORTSDIR=${NANO_PORTS} make \
- __MAKE_CONF=${NANO_MAKE_CONF_BUILD} \
- WRKDIRPREFIX=/usr/workdir -C /usr/ports/$port_path \
- package-recursive BATCH=yes $* clean FORCE_PKG_REGISTER=t"
- rm ${NANO_WORLDDIR}/etc/resolv.conf
- rm -rf ${NANO_WORLDDIR}/usr/obj
- rm -rf ${NANO_WORLDDIR}/usr/workdir
- umount ${NANO_WORLDDIR}/dev
- umount ${NANO_WORLDDIR}/usr/ports/packages
- umount ${NANO_WORLDDIR}/usr/ports/distfiles
- umount ${NANO_WORLDDIR}/usr/ports
- umount ${NANO_WORLDDIR}/usr/src
- set +x
+ create_diskimage_mbr $*
)
-# Need to check if this function works with cross-compiling architecture!!!!
-# Recursive complex fonction: Generate one function for each ports
-# writes shell functions called later, so don't do in subshell.
-add_port ( ) {
- local port_path=$1
- local port=`echo $1 | sed -e 's/\//_/'`
- shift
- # Check if package allready exist
- # Need to:
- # 1. check ARCH of this package!
- # 2. Add a trap
- cd ${NANO_PORTS}/${port_path}
- PKG_NAME=`env PORTSDIR=${NANO_PORTS} make __MAKE_CONF=${NANO_MAKE_CONF_BUILD} package-name`
- if [ -f ${NANO_OBJ}/ports/packages/All/${PKG_NAME}.txz ]; then
- # Pkg file found: Generate add_pkg_NAME function
- eval "
- add_pkg_${port} ( ) {
- do_add_pkg ${PKG_NAME}
- }
- customize_cmd add_pkg_${port}
- "
- else
- # No pkg file: Generate add_port_NAME function
- eval "
- add_port_${port} ( ) {
- do_add_port ${port_path} $*
- }
- customize_cmd add_port_${port}
- "
- NANO_PACKAGE_ONLY=0
- fi
-}
-
-# Creates images for all the formats that use MBR
create_diskimage_mbr ( ) (
pprint 2 "build diskimage ${NANO_NAME}"
- pprint 3 "log: ${NANO_OBJ}/_.di"
+ pprint 3 "log: ${NANO_LOG}/_.di"
(
local extra i sz fmt fmtarg bootmbr bootbsd skiparg
@@ -295,44 +213,54 @@ create_diskimage_mbr ( ) (
skiparg=${NANO_MBR_FIRST_SKIP:+-S ${NANO_MBR_FIRST_SKIP}}
for i in s1 s2 s3 s4 p1 p2 p3 p4 p5 empty; do
- rm -fr ${NANO_OBJ}/_.${i}*
+ rm -fr ${NANO_LOG}/_.${i}*
done
# Populate the FAT partition, if needed
if [ -n "${NANO_SLICE_FAT}" ]; then
echo Creating MSDOS partition for kernel
newfs_msdos -C ${NANO_SLICE_FAT_SIZE} -F 16 -L ${NANO_NAME} \
- ${NANO_OBJ}/_.${NANO_SLICE_FAT}
+ ${NANO_LOG}/_.${NANO_SLICE_FAT}
if [ -d ${NANO_FAT_DIR} ]; then
# Need to copy files from ${NANO_FATDIR} with mtools, or use
# makefs -t msdos once that's supported
- mcopy -i ${NANO_OBJ}/_.${NANO_SLICE_FAT} ${NANO_FAT_DIR}/* ::
+ mcopy -i ${NANO_LOG}/_.${NANO_SLICE_FAT} ${NANO_FAT_DIR}/* ::
fi
fi
# Populate the Powerpc boot image, if needed
if [ "${NANO_LAYOUT}" = powerpc64-ibm ]; then
- dd if=${NANO_WORLDDIR}/boot/boot1.elf of=${NANO_OBJ}/_.s1 bs=800k count=1 conv=sync
+ dd if=${NANO_WORLDDIR}/boot/boot1.elf of=${NANO_LOG}/_.s1 bs=800k count=1 conv=sync
fi
# Populate the / partition, and place it into a slice with a
# 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}" \
+ eval "${NANO_MAKEFS_UFS}" ${extra} $sz "${NANO_LOG}/_.${NANO_ROOT}" \
"${NANO_WORLDDIR}"
-# mkimg -s bsd ${bootbsd} -p freebsd-ufs:=${NANO_OBJ}/_.${NANO_SLICE_ROOT} \
-# -o ${NANO_OBJ}/_.${NANO_SLICE_ROOT}
+ case ${NANO_DISK_SCHEME} in
+ mbr)
+ mkimg -s bsd ${bootbsd} -p freebsd-ufs:=${NANO_LOG}/_.${NANO_ROOT} \
+ -o ${NANO_LOG}/_.${NANO_SLICE_ROOT}
+ eval $NANO_SLICE_CFG=freebsd
+ eval $NANO_SLICE_ROOT=freebsd
+ ;;
+ gpt)
+ eval $NANO_SLICE_CFG=freebsd-ufs
+ eval $NANO_SLICE_ROOT=freebsd-ufs
+ ;;
+ esac
# Populate the /cfg partition, empty if none given
if [ -z "${NANO_CFGDIR}" ]; then
echo "Faking cfg dir, it's empty"
- NANO_CFGDIR=${NANO_OBJ}/_.empty
+ NANO_CFGDIR=${NANO_LOG}/_.empty
mkdir -p ${NANO_CFGDIR}
fi
# XXX -F cfg-mtree
eval "${NANO_MAKEFS_UFS}" -s ${NANO_SLICE_CFG_SIZE} \
- "${NANO_OBJ}/_.${NANO_SLICE_CFG}" "${NANO_CFGDIR}"
+ "${NANO_LOG}/_.${NANO_SLICE_CFG}" "${NANO_CFGDIR}"
# data slice not supported since we need the part for FAT for
# booting
@@ -341,43 +269,33 @@ create_diskimage_mbr ( ) (
if [ -n "$NANO_SLICE_FAT" ]; then
eval $NANO_SLICE_FAT=fat16b
fi
- 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
+
+ out=${NANO_DISKIMGDIR}/_.disk.image.${NANO_NAME}${fmt}
# 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
case ${NANO_LAYOUT} in
std-embedded)
- mkimg -a 3 ${skiparg} ${fmtarg} ${bootmbr} -s mbr -p ${s1}:=${NANO_OBJ}/_.s1 \
- -p ${s2}:=${NANO_OBJ}/_.s2 \
- -p ${s3}:=${NANO_OBJ}/_.s3 \
- -o ${NANO_OBJ}/_.disk.image.${NANO_NAME}${fmt}
+ mkimg -a 3 ${skiparg} ${fmtarg} ${bootmbr} -s mbr -p ${s1}:=${NANO_LOG}/_.s1 \
+ -p ${s2}:=${NANO_LOG}/_.s2 \
+ -p ${s3}:=${NANO_LOG}/_.s3 \
+ -o ${out}
;;
std-x86)
# s1 is cfg, s2 is /, not sure how to make that
# boot (marked as active) with mkimg yet
- mkimg -a 2 ${fmtarg} ${bootmbr} -s mbr -p ${s1}:=${NANO_OBJ}/_.s1 \
- -p ${s2}:=${NANO_OBJ}/_.s2 \
- -o ${NANO_OBJ}/_.disk.image.${NANO_NAME}${fmt}
+ mkimg -a 2 ${fmtarg} ${bootmbr} -s mbr -p ${s1}:=${NANO_LOG}/_.s1 \
+ -p ${s2}:=${NANO_LOG}/_.s2 \
+ -o ${out}
;;
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}
+ -p ${s2}:=${NANO_LOG}/_.s2 \
+ -p ${s3}:=${NANO_LOG}/_.s3 \
+ -o ${out}
;;
std-uefi-bios)
# p1 is boot for uefi, p2 is boot for gpt, p3 is cfg, p4 is /
@@ -385,9 +303,9 @@ create_diskimage_mbr ( ) (
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}
+ -p ${p3}:=${NANO_LOG}/_.p3 \
+ -p ${p4}:=${NANO_LOG}/_.p4 \
+ -o ${out}
;;
powerpc64-ibm)
# A lie to make the boot loader work, it boots the first BSD partition
@@ -396,13 +314,14 @@ create_diskimage_mbr ( ) (
# boot image is on a special partition, ala std-embedded, but that
# partition isn't FAT with special files, but a copy of the boot
# loader itself.
- mkimg -a 1 ${fmtarg} -s mbr -p prepboot:=${NANO_OBJ}/_.s1 \
- -p ${s2}:=${NANO_OBJ}/_.s2 \
- -p ${s3}:=${NANO_OBJ}/_.s3a \
- -o ${NANO_OBJ}/_.disk.image.${NANO_NAME}${fmt}
+ mkimg -a 1 ${fmtarg} -s mbr -p prepboot:=${NANO_LOG}/_.s1 \
+ -p ${s2}:=${NANO_LOG}/_.s2 \
+ -p ${s3}:=${NANO_LOG}/_.s3a \
+ -o ${out}
;;
esac
- ) > ${NANO_OBJ}/_.di 2>&1
+ xz -9 --keep ${out}
+ ) > ${NANO_LOG}/_.di 2>&1
)
die( ) {
@@ -662,11 +581,21 @@ eval std_${NANO_ARCH}
# off the top. We also resize the 'a' partion on first boot
# to the size of the partition for the ping/pong upgrade.
# This feature needs support in the rc.d bootup script.
+#
+# Ideally, we'd not put BSD labels on the MBR disks.
+# However, we can't boot off raw MBR disks. First,
+# boot2 defaults to 'a' partition, and freaks out
+# unless you tell it to use 'c'. But even if we
+# hack that, then /boot/loader wants to load off
+# of 'c' partition. If you fix that, then we'll
+# try to mount root, but sanity checks prevent
+# slices from working.
+#
: ${NANO_ENDIAN:=little} # make -V something to figure it out?
: ${NANO_LAYOUT:=std-embedded}
: ${NANO_MAKEFS_UFS:=makefs -t ffs -B ${NANO_ENDIAN}}
-: ${NANO_DISK_SCHEME:=mbr} # No others really supported ATM
+: ${NANO_DISK_SCHEME:=mbr} # No others really supported ATM (well, gpt)
case ${NANO_LAYOUT} in
std-embedded)
NANO_SLICE_FAT=s1
@@ -696,11 +625,15 @@ std-uefi)
NANO_SLICE_ALTROOT=s4
;;
std-uefi-bios)
+ NANO_DISK_SCHEME=gpt
NANO_SLICE_UEFI=p1
NANO_SLICE_BOOT=p2
NANO_SLICE_CFG=p3
NANO_SLICE_ROOT=p4
NANO_SLICE_ALTROOT=p5
+ # override root name
+ NANO_ROOT=${NANO_SLICE_ROOT}
+ NANO_ALTROOT=${NANO_SLICE_ALTROOT}
;;
*)
echo Unknown Layout ${NANO_LAYOUT}
@@ -708,10 +641,6 @@ std-uefi-bios)
;;
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
diff --git a/tools/tools/nanobsd/embedded/i386.cfg b/tools/tools/nanobsd/embedded/i386.cfg
new file mode 100644
index 0000000..7fd9a528
--- /dev/null
+++ b/tools/tools/nanobsd/embedded/i386.cfg
@@ -0,0 +1,34 @@
+# $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=i386
+NANO_KERNEL=GENERIC
+NANO_DRIVE=ada0
+NANO_NAME=i386
+
+. common # Pull in common definitions, keep last
diff --git a/tools/tools/nanobsd/embedded/qemu-armv7.cfg b/tools/tools/nanobsd/embedded/qemu-armv7.cfg
new file mode 100644
index 0000000..dd85c8f
--- /dev/null
+++ b/tools/tools/nanobsd/embedded/qemu-armv7.cfg
@@ -0,0 +1,48 @@
+# $FreeBSD$
+
+#-
+# Copyright (c) 2016 Andrew Turner. All Rights Reserved.
+# 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=armv6
+NANO_DRIVE=vtbd0
+NANO_KERNEL=VIRT
+NANO_NAME=qemu-armv7
+NANO_LAYOUT=std-uefi-bios
+NANO_CPUTYPE=cortexa
+
+. common # Pull in common definitions
+
+qemu_env
+
+#
+# Run with
+# qemu-system-arm -M virt -serial stdio -bios QEMU_EFI.fd \
+# -drive if=none,file=_.disk.image.qemu-armv7.qcow2,id=hd0 \
+# -device virtio-blk-device,drive=hd0
+# QEMU_EFI.fd is from
+# http://releases.linaro.org/components/kernel/uefi-linaro/15.12/release/qemu/
+#
OpenPOWER on IntegriCloud