From owner-svn-src-all@freebsd.org Tue Dec 22 19:40:35 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BAFDA4F75E; Tue, 22 Dec 2015 19:40:35 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AE8D1A8B; Tue, 22 Dec 2015 19:40:35 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBMJeYUO027501; Tue, 22 Dec 2015 19:40:34 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBMJeYo0027500; Tue, 22 Dec 2015 19:40:34 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201512221940.tBMJeYo0027500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 22 Dec 2015 19:40:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292616 - head/tools/tools/nanobsd/embedded X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2015 19:40:35 -0000 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 ( ) {