diff options
author | imp <imp@FreeBSD.org> | 2016-02-07 16:43:55 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2016-02-07 16:43:55 +0000 |
commit | 569810426dcb2d1386c368aae016ca4cb0241bd9 (patch) | |
tree | 18b5c31099f9381fff7f6df8ca2590b4dc8ee586 | |
parent | 42c40e4f6e7c0c374aaab288e10b845f799892ca (diff) | |
download | FreeBSD-src-569810426dcb2d1386c368aae016ca4cb0241bd9.zip FreeBSD-src-569810426dcb2d1386c368aae016ca4cb0241bd9.tar.gz |
Various fixups:
o Make sure we create bsd label for MBR scheme (though we don't
really need it for the efi case, and boot1 can't read it). Add
notes about why we have to do this, at least for BIOS.
o Make the BIOS / UEFI with gpt config work.
o Remove now-moribund packaging stuff
-rw-r--r-- | tools/tools/nanobsd/embedded/common | 152 |
1 files changed, 35 insertions, 117 deletions
diff --git a/tools/tools/nanobsd/embedded/common b/tools/tools/nanobsd/embedded/common index bbac162..d10a36f 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 @@ -180,105 +180,14 @@ 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}" @@ -319,10 +228,20 @@ 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}" \ + eval "${NANO_MAKEFS_UFS}" ${extra} $sz "${NANO_OBJ}/_.${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_OBJ}/_.${NANO_ROOT} \ + -o ${NANO_OBJ}/_.${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 @@ -341,18 +260,7 @@ 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 + # 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 @@ -662,11 +570,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 +614,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 +630,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 |