Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Dec 2015 19:40:34 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r292616 - head/tools/tools/nanobsd/embedded
Message-ID:  <201512221940.tBMJeYo0027500@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Tue Dec 22 19:40:34 2015
New Revision: 292616
URL: https://svnweb.freebsd.org/changeset/base/292616

Log:
  Delete the DOS dir to mirror what we do with NANO_WORLDDIR.
  Copy ubldr and ubldr.bin to the dos partition when we're making it.
  Minor style fixes.

Modified:
  head/tools/tools/nanobsd/embedded/common

Modified: head/tools/tools/nanobsd/embedded/common
==============================================================================
--- head/tools/tools/nanobsd/embedded/common	Tue Dec 22 19:34:21 2015	(r292615)
+++ head/tools/tools/nanobsd/embedded/common	Tue Dec 22 19:40:34 2015	(r292616)
@@ -106,18 +106,16 @@ NANO_FAT_DIR=${NANO_OBJ}/_.fat
 
 customize_cmd cust_allow_ssh_root
 
-add_etc_make_conf()
-{
+add_etc_make_conf ( ) (
 	touch ${NANO_WORLDDIR}/etc/make.conf
-}
+)
 customize_cmd add_etc_make_conf
 
-cust_install_machine_files()
-{
+cust_install_machine_files ( ) (
 	echo "cd ${NANO_CFG_BASE}/Files"
 	cd ${NANO_CFG_BASE}/Files
 	find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)' | cpio -dumpv ${NANO_WORLDDIR}
-}
+)
 customize_cmd cust_install_files
 customize_cmd cust_install_machine_files 
 
@@ -181,8 +179,7 @@ WITHOUT_RCS=true
 NANO_PACKAGE_ONLY=1
 
 # install a package from a pre-built binary
-do_add_pkg ()
-{
+do_add_pkg ( ) (
 	# Need to create ${NANO_OBJ}/ports in this add_pkg_${port} function
 	set -x
 	mkdir -p ${NANO_OBJ}/ports/distfiles
@@ -200,11 +197,10 @@ do_add_pkg ()
 	rmdir ${NANO_WORLDDIR}/usr/ports/distfiles
 	rmdir ${NANO_WORLDDIR}/usr/ports
 	set +x
-}
+)
 
 # Build a port (with the side effect of creating a package)
-do_add_port ()
-{
+do_add_port ( ) (
 	local port_path
 	port_path=$1
 	shift
@@ -245,11 +241,12 @@ do_add_port ()
 	umount ${NANO_WORLDDIR}/usr/ports
 	umount ${NANO_WORLDDIR}/usr/src
 	set +x
-}
+)
 
 # Need to check if this function works with cross-compiling architecture!!!!
 # Recursive complex fonction: Generate one function for each ports
-add_port () {
+# 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
@@ -262,7 +259,7 @@ add_port () {
     if [ -f ${NANO_OBJ}/ports/packages/All/${PKG_NAME}.txz ]; then
 	# Pkg file found: Generate add_pkg_NAME function
 	eval "
-	    add_pkg_${port} () {
+	    add_pkg_${port} ( ) {
 	        do_add_pkg ${PKG_NAME}
 	    }
             customize_cmd add_pkg_${port}
@@ -270,7 +267,7 @@ add_port () {
     else
 	# No pkg file: Generate add_port_NAME function
         eval "
-            add_port_${port} () {
+            add_port_${port} ( ) {
 	        do_add_port ${port_path} $*
 	    }
 	    customize_cmd add_port_${port}
@@ -329,7 +326,7 @@ create_diskimage_mbr ( ) (
 	if [ -z "${NANO_CFGDIR}" ]; then
 		echo "Faking cfg dir, it's empty"
 		NANO_CFGDIR=${NANO_OBJ}/_.empty
-		mkdir ${NANO_CFGDIR}
+		mkdir -p ${NANO_CFGDIR}
 	fi
 	# XXX -F cfg-mtree
 	eval "${NANO_MAKEFS_UFS}" -s ${NANO_SLICE_CFG_SIZE} \
@@ -377,8 +374,7 @@ create_diskimage_mbr ( ) (
 	) > ${NANO_OBJ}/_.di 2>&1
 )
 
-die()
-{
+die( ) {
 	echo "$*"
 	exit 1
 }
@@ -435,19 +431,17 @@ $var=$val"
 	fi
 done
 
-save_build ( )
-{
+save_build ( ) (
 	VERSION_FILE=${NANO_WORLDDIR}/etc/version
 	if [ "${SVNREVISION}" = "${REVISION}" ]; then
 		echo "${NANO_NAME}" > "${VERSION_FILE}"
 	else
 		echo "${NANO_NAME} (${SVNREVISION})" > "${VERSION_FILE}"
 	fi
-}
+)
 customize_cmd save_build
 
-shrink_md_fbsize ( )
-{
+shrink_md_fbsize ( ) (
 	# We have a lot of little files on our memory disks. Let's decrease
 	# the block and frag size to fit more little files on them (this
 	# halves our space requirement by ~50% on /etc and /var on 8.x --
@@ -455,17 +449,25 @@ shrink_md_fbsize ( )
 	# are 4 times larger).
 	sed -i '' -e 's,-S -i 4096,-S -i 4096 -b 4096 -f 512,' \
 		${NANO_WORLDDIR}/etc/rc.initdiskless
-}
+)
 customize_cmd shrink_md_fbsize
 
 customize_cmd cust_comconsole
 
-dos_boot_part ( )
-(
+dos_boot_part ( ) (
 	local d=/usr/local/share/u-boot/${NANO_BOOT_PKG}
 
+	# For now, just copy all the files. However, for iMX6 and Allwinner,
+	# we'll need to put a special boot block at a fixed location
+	# on the disk as well.
+	rm -rf ${NANO_FAT_DIR}
 	mkdir ${NANO_FAT_DIR}
-	cp ${d}/* ${NANO_FAT_DIR}	
+	cp ${d}/* ${NANO_FAT_DIR}
+
+	# Also copy ubldr. u-boot will load it and it will load the kernel
+	# from the ufs partition
+	cp ${NANO_WORLDDIR}/boot/ubldr ${NANO_FAT_DIR}
+	cp ${NANO_WORLDDIR}/boot/ubldr.bin ${NANO_FAT_DIR}
 )
 
 if [ -n "$NANO_BOOT_PKG" ]; then
@@ -480,8 +482,7 @@ if [ -n "$NANO_BOOT_PKG" ]; then
 	customize_cmd dos_boot_part
 fi
 
-product_custom ( )
-(
+product_custom ( ) (
 	# not quie ready to tweak these in nopriv build
 	if [ -z ${NANO_NOPRIV_BUILD} ]; then
 		# Last second tweaks -- generally not needed
@@ -493,6 +494,12 @@ product_custom ( )
 		chown root:wheel ${NANO_WORLDDIR}/
 		chown root:wheel ${NANO_WORLDDIR}/usr
 	fi
+	local rc=${NANO_WORLDDIR}/etc/rc.conf
+	echo "hostname=nanobsd-${NANO_NAME}" > $rc
+	echo "growfs_enable=YES" >> $rc
+	echo "growfs_type=nanobsd-pingpong" >> $rc
+	echo "ntpdate_enable=YES" >> $rc
+	echo "ntpdate_hosts=0.freebsd.pool.ntp.org 1.freebsd.pool.ntp.org" >> $rc
 )
 late_customize_cmd product_custom
 
@@ -504,7 +511,8 @@ late_customize_cmd product_custom
 # For each architecture, we have a standard set of settings to the extent
 # it makes sense. For architectures that don't have a standard environment
 # cfg files need to either define a lot of settings, provide their own disk
-# imaging, or set which of the variants we support.
+# imaging, or set which of the variants we support. No subshells, since we
+# set global variables
 #
 
 std_aarch64 ( ) {



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