CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: christos Date: Thu Mar 14 15:41:54 UTC 2024 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Log Message: Fix reproducible build (Jan-Benedict Glaw) To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/distrib/utils/embedded/conf/armv7.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/armv7.conf diff -u src/distrib/utils/embedded/conf/armv7.conf:1.46 src/distrib/utils/embedded/conf/armv7.conf:1.47 --- src/distrib/utils/embedded/conf/armv7.conf:1.46 Wed Apr 19 14:39:18 2023 +++ src/distrib/utils/embedded/conf/armv7.conf Thu Mar 14 11:41:54 2024 @@ -1,4 +1,4 @@ -# $NetBSD: armv7.conf,v 1.46 2023/04/19 18:39:18 brook Exp $ +# $NetBSD: armv7.conf,v 1.47 2024/03/14 15:41:54 christos Exp $ # ARMv7 customization script used by mkimage # board=armv7 @@ -45,7 +45,11 @@ populate_common() { fi # Install boot script - "${MKUBOOTIMAGE}" -A arm -C none -O netbsd -T script -a 0 -n "NetBSD/armv7 boot" "${mnt}/boot/boot.cmd" "${mnt}/boot/boot.scr" + [ -n "${MKREPRO_TIMESTAMP}" ] && \ + MKUBOOTIMAGEARGS="-t ${MKREPRO_TIMESTAMP}" + "${MKUBOOTIMAGE}" -A arm -C none -O netbsd -T script \ + ${MKUBOOTIMAGEARGS} -a 0 -n "NetBSD/armv7 boot" \ + "${mnt}/boot/boot.cmd" "${mnt}/boot/boot.scr" } populate_rpi() {
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: christos Date: Thu Mar 14 15:41:54 UTC 2024 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Log Message: Fix reproducible build (Jan-Benedict Glaw) To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/distrib/utils/embedded/conf/armv7.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: mlelstv Date: Mon Feb 12 11:30:33 UTC 2024 Modified Files: src/distrib/utils/embedded: mkimage Log Message: Quote argument to -n as required. [ -n ] is not a syntax error but evaluates to true. To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/distrib/utils/embedded/mkimage Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/mkimage diff -u src/distrib/utils/embedded/mkimage:1.80 src/distrib/utils/embedded/mkimage:1.81 --- src/distrib/utils/embedded/mkimage:1.80 Sun Feb 11 17:29:50 2024 +++ src/distrib/utils/embedded/mkimage Mon Feb 12 11:30:33 2024 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mkimage,v 1.80 2024/02/11 17:29:50 christos Exp $ +# $NetBSD: mkimage,v 1.81 2024/02/12 11:30:33 mlelstv Exp $ # # Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -190,7 +190,7 @@ do *) usage;; esac done -if [ -n ${MKREPRO_TIMESTAMP} ]; then +if [ -n "${MKREPRO_TIMESTAMP}" ]; then timestamp_opt="-T ${MKREPRO_TIMESTAMP}" volume_opt=",volume_id=$((${MKREPRO_TIMESTAMP} & 0x))" fi
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: mlelstv Date: Mon Feb 12 11:30:33 UTC 2024 Modified Files: src/distrib/utils/embedded: mkimage Log Message: Quote argument to -n as required. [ -n ] is not a syntax error but evaluates to true. To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/distrib/utils/embedded/mkimage Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: christos Date: Sun Feb 11 17:29:50 UTC 2024 Modified Files: src/distrib/utils/embedded: mkimage Log Message: PR/57925: Jan-Benedict Glaw: Honor $MKREPRO_TIMESTAMP, don't embed name and stamp in gzip. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/distrib/utils/embedded/mkimage Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/mkimage diff -u src/distrib/utils/embedded/mkimage:1.79 src/distrib/utils/embedded/mkimage:1.80 --- src/distrib/utils/embedded/mkimage:1.79 Sat Jan 20 16:35:59 2024 +++ src/distrib/utils/embedded/mkimage Sun Feb 11 12:29:50 2024 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mkimage,v 1.79 2024/01/20 21:35:59 jmcneill Exp $ +# $NetBSD: mkimage,v 1.80 2024/02/11 17:29:50 christos Exp $ # # Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -190,6 +190,10 @@ do *) usage;; esac done +if [ -n ${MKREPRO_TIMESTAMP} ]; then + timestamp_opt="-T ${MKREPRO_TIMESTAMP}" + volume_opt=",volume_id=$((${MKREPRO_TIMESTAMP} & 0x))" +fi shift $(( $OPTIND - 1 )) if [ -n "$1" ]; then @@ -246,7 +250,7 @@ if [ -n "${msdosid}" ]; then *) fat_opt=;; esac ${MAKEFS} -N ${release}/etc -t msdos \ - -o "volume_label=NETBSD${fat_opt}" \ + -o "volume_label=NETBSD${fat_opt}${volume_opt}" ${timestamp_opt} \ -O $((${init} / 2))m -s $((${boot} / 2))m \ ${image} ${mnt}/boot fi @@ -254,7 +258,7 @@ fi if [ -z "${bootonly}" ]; then echo ${bar} Populating ffs filesystem ${bar} ${MAKEFS} -rx ${endian} -N ${release}/etc -t ffs \ - -O ${ffsoffset} \ + -O ${ffsoffset} ${timestamp_opt} \ -o d=4096,f=8192,b=65536 -b $((${extra}))m \ -F "$tmp/selected_sets" ${image} "${release}" "${mnt}" fi @@ -276,6 +280,7 @@ if $gpt; then if $gpt_hybrid; then gpt_flags="-H" fi + gpt_flags="${gpt_flags} ${timestamp_opt}" initsecs=$((${init} * 1024)) bootsecs=$((${boot} * 1024)) ffsstart="$(getsectors ${ffsoffset})" @@ -328,7 +333,7 @@ fi if $compress; then echo ${bar} Compressing image ${bar} rm -f "${image}.gz" - ${GZIP_CMD} -9 ${image} + ${GZIP_CMD} -n -9 ${image} image="${image}.gz" fi
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: christos Date: Sun Feb 11 17:29:50 UTC 2024 Modified Files: src/distrib/utils/embedded: mkimage Log Message: PR/57925: Jan-Benedict Glaw: Honor $MKREPRO_TIMESTAMP, don't embed name and stamp in gzip. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/distrib/utils/embedded/mkimage Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: mrg Date: Mon Jan 29 05:46:55 UTC 2024 Modified Files: src/distrib/utils/embedded/files: creds_msdos Log Message: properly quote arguments. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/distrib/utils/embedded/files/creds_msdos Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/files/creds_msdos diff -u src/distrib/utils/embedded/files/creds_msdos:1.5 src/distrib/utils/embedded/files/creds_msdos:1.6 --- src/distrib/utils/embedded/files/creds_msdos:1.5 Sat Dec 11 19:24:18 2021 +++ src/distrib/utils/embedded/files/creds_msdos Mon Jan 29 05:46:55 2024 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: creds_msdos,v 1.5 2021/12/11 19:24:18 mrg Exp $ +# $NetBSD: creds_msdos,v 1.6 2024/01/29 05:46:55 mrg Exp $ # # Copyright (c) 2019 Matthew R. Green # All rights reserved. @@ -153,7 +153,7 @@ creds_msdos_start() if [ -f "${creds_file}" ]; then while read type user args; do # strip cr - local clean_args=$(echo "$args" | tr -d '\015') + local clean_args="$(echo "$args" | tr -d '\015')" case "$type" in \#*|'') continue
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: mrg Date: Mon Jan 29 05:46:55 UTC 2024 Modified Files: src/distrib/utils/embedded/files: creds_msdos Log Message: properly quote arguments. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/distrib/utils/embedded/files/creds_msdos Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: jmcneill Date: Sun Jan 21 13:10:55 UTC 2024 Modified Files: src/distrib/utils/embedded/conf: wii.conf Added Files: src/distrib/utils/embedded/files: evbppc_wii_icon.png Log Message: wii: Add 128x48 icon to SD card image To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/distrib/utils/embedded/conf/wii.conf cvs rdiff -u -r0 -r1.1 src/distrib/utils/embedded/files/evbppc_wii_icon.png Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: jmcneill Date: Sun Jan 21 13:10:55 UTC 2024 Modified Files: src/distrib/utils/embedded/conf: wii.conf Added Files: src/distrib/utils/embedded/files: evbppc_wii_icon.png Log Message: wii: Add 128x48 icon to SD card image To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/distrib/utils/embedded/conf/wii.conf cvs rdiff -u -r0 -r1.1 src/distrib/utils/embedded/files/evbppc_wii_icon.png Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/wii.conf diff -u src/distrib/utils/embedded/conf/wii.conf:1.2 src/distrib/utils/embedded/conf/wii.conf:1.3 --- src/distrib/utils/embedded/conf/wii.conf:1.2 Sun Jan 21 10:28:25 2024 +++ src/distrib/utils/embedded/conf/wii.conf Sun Jan 21 13:10:55 2024 @@ -1,4 +1,4 @@ -# $NetBSD: wii.conf,v 1.2 2024/01/21 10:28:25 jmcneill Exp $ +# $NetBSD: wii.conf,v 1.3 2024/01/21 13:10:55 jmcneill Exp $ # Nintendo Wii customization script used by mkimage # board=wii @@ -52,6 +52,7 @@ populate() { # Metadata for HBC cp ${DIR}/files/evbppc_wii_meta.xml ${mnt}/boot/apps/netbsd/meta.xml + cp ${DIR}/files/evbppc_wii_icon.png ${mnt}/boot/apps/netbsd/icon.png # Add swap space rm -f ${mnt}${swap_file} Added files: Index: src/distrib/utils/embedded/files/evbppc_wii_icon.png Binary files are different
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Sun Jan 21 10:28:25 UTC 2024 Modified Files: src/distrib/utils/embedded/conf: wii.conf Log Message: build fix: use dd with count=1 for compat with NetBSD dd(1) To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/conf/wii.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/wii.conf diff -u src/distrib/utils/embedded/conf/wii.conf:1.1 src/distrib/utils/embedded/conf/wii.conf:1.2 --- src/distrib/utils/embedded/conf/wii.conf:1.1 Sat Jan 20 21:35:59 2024 +++ src/distrib/utils/embedded/conf/wii.conf Sun Jan 21 10:28:25 2024 @@ -1,4 +1,4 @@ -# $NetBSD: wii.conf,v 1.1 2024/01/20 21:35:59 jmcneill Exp $ +# $NetBSD: wii.conf,v 1.2 2024/01/21 10:28:25 jmcneill Exp $ # Nintendo Wii customization script used by mkimage # board=wii @@ -55,8 +55,8 @@ populate() { # Add swap space rm -f ${mnt}${swap_file} - dd if=/dev/zero of=${mnt}${swap_file} bs=1 count=0 \ - seek=$((${swap_size_MB} * 1024 * 1024)) + dd if=/dev/zero of=${mnt}${swap_file} bs=1 count=1 \ + seek=$((${swap_size_MB} * 1024 * 1024 - 1)) echo ".${swap_file} type=file uname=root gname=wheel mode=0600" \ >> "$tmp/selected_sets" }
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Sun Jan 21 10:28:25 UTC 2024 Modified Files: src/distrib/utils/embedded/conf: wii.conf Log Message: build fix: use dd with count=1 for compat with NetBSD dd(1) To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/conf/wii.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: riastradh Date: Wed Sep 27 00:27:07 UTC 2023 Modified Files: src/distrib/utils/embedded/files: ec2_init Log Message: ec2_init: Suppress error message for nonexistent sysctl. We're querying to see whether the sysctl node is available and if so what its text is, not interested in the error message. XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/distrib/utils/embedded/files/ec2_init Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/files/ec2_init diff -u src/distrib/utils/embedded/files/ec2_init:1.5 src/distrib/utils/embedded/files/ec2_init:1.6 --- src/distrib/utils/embedded/files/ec2_init:1.5 Sat Oct 15 18:32:30 2022 +++ src/distrib/utils/embedded/files/ec2_init Wed Sep 27 00:27:07 2023 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: ec2_init,v 1.5 2022/10/15 18:32:30 jmcneill Exp $ +# $NetBSD: ec2_init,v 1.6 2023/09/27 00:27:07 riastradh Exp $ # # PROVIDE: ec2_init # REQUIRE: NETWORKING @@ -15,7 +15,7 @@ stop_cmd=":" CLOUD_TYPE=EC2 # default -case "$(/sbin/sysctl -n machdep.dmi.chassis-asset-tag)" in +case "$(/sbin/sysctl -n machdep.dmi.chassis-asset-tag 2>/dev/null)" in OracleCloud*) CLOUD_TYPE=OCI ;;
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: riastradh Date: Wed Sep 27 00:27:07 UTC 2023 Modified Files: src/distrib/utils/embedded/files: ec2_init Log Message: ec2_init: Suppress error message for nonexistent sysctl. We're querying to see whether the sysctl node is available and if so what its text is, not interested in the error message. XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/distrib/utils/embedded/files/ec2_init Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: brook Date: Wed Apr 19 18:39:18 UTC 2023 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Added Files: src/distrib/utils/embedded/files: boot.cfg Log Message: Install /boot/boot.cfg with EFI bootloaders. On ARM ports, the EFI boot loader handles a boot.cfg file if it exists, but one is not installed by default. In contrast, both the i386 and amd64 ports do install boot.cfg by default. Bring these ports into agreement by installing boot.cfg on ARM ports with EFI boot loaders. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/distrib/utils/embedded/conf/armv7.conf cvs rdiff -u -r0 -r1.1 src/distrib/utils/embedded/files/boot.cfg Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/armv7.conf diff -u src/distrib/utils/embedded/conf/armv7.conf:1.45 src/distrib/utils/embedded/conf/armv7.conf:1.46 --- src/distrib/utils/embedded/conf/armv7.conf:1.45 Sat Nov 19 09:19:27 2022 +++ src/distrib/utils/embedded/conf/armv7.conf Wed Apr 19 18:39:18 2023 @@ -1,4 +1,4 @@ -# $NetBSD: armv7.conf,v 1.45 2022/11/19 09:19:27 yamt Exp $ +# $NetBSD: armv7.conf,v 1.46 2023/04/19 18:39:18 brook Exp $ # ARMv7 customization script used by mkimage # board=armv7 @@ -38,6 +38,7 @@ populate_common() { >> "$tmp/selected_sets" cp ${DIR}/files/armv7_boot.cmd ${mnt}/boot/boot.cmd + cp ${DIR}/files/boot.cfg ${mnt}/boot/boot.cfg else # Fallback to non-EFI boot command cp ${DIR}/files/armv7_boot_nonefi.cmd ${mnt}/boot/boot.cmd Added files: Index: src/distrib/utils/embedded/files/boot.cfg diff -u /dev/null src/distrib/utils/embedded/files/boot.cfg:1.1 --- /dev/null Wed Apr 19 18:39:19 2023 +++ src/distrib/utils/embedded/files/boot.cfg Wed Apr 19 18:39:18 2023 @@ -0,0 +1,6 @@ +menu=Boot normally:rndseed /var/db/entropy-file;boot +menu=Boot single user:rndseed /var/db/entropy-file;boot -s +menu=Drop to boot prompt:prompt +default=1 +timeout=5 +clear=1
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: brook Date: Wed Apr 19 18:39:18 UTC 2023 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Added Files: src/distrib/utils/embedded/files: boot.cfg Log Message: Install /boot/boot.cfg with EFI bootloaders. On ARM ports, the EFI boot loader handles a boot.cfg file if it exists, but one is not installed by default. In contrast, both the i386 and amd64 ports do install boot.cfg by default. Bring these ports into agreement by installing boot.cfg on ARM ports with EFI boot loaders. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/distrib/utils/embedded/conf/armv7.conf cvs rdiff -u -r0 -r1.1 src/distrib/utils/embedded/files/boot.cfg Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: mlelstv Date: Sat Mar 18 11:36:23 UTC 2023 Modified Files: src/distrib/utils/embedded/files: resize_disklabel Log Message: Can't use disklabel to find the real size of a disk since a fake disklabel read from disk is trusted. Revert to use drvctl again. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/distrib/utils/embedded/files/resize_disklabel Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/files/resize_disklabel diff -u src/distrib/utils/embedded/files/resize_disklabel:1.4 src/distrib/utils/embedded/files/resize_disklabel:1.5 --- src/distrib/utils/embedded/files/resize_disklabel:1.4 Sat Feb 18 07:58:34 2023 +++ src/distrib/utils/embedded/files/resize_disklabel Sat Mar 18 11:36:23 2023 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: resize_disklabel,v 1.4 2023/02/18 07:58:34 mlelstv Exp $ +# $NetBSD: resize_disklabel,v 1.5 2023/03/18 11:36:23 mlelstv Exp $ # # PROVIDE: resize_disklabel @@ -27,8 +27,7 @@ get_total_sectors() local disk disk=$1 - /sbin/disklabel -t "$disk" \ - | sed -ne 's/.*:su#\([0-9]*\):.*/\1/p' + /sbin/drvctl -p "$disk" disk-info/geometry/sectors-per-unit } get_rawpart_sectors()
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: mlelstv Date: Sat Mar 18 11:36:23 UTC 2023 Modified Files: src/distrib/utils/embedded/files: resize_disklabel Log Message: Can't use disklabel to find the real size of a disk since a fake disklabel read from disk is trusted. Revert to use drvctl again. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/distrib/utils/embedded/files/resize_disklabel Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: mlelstv Date: Sat Feb 18 07:58:35 UTC 2023 Modified Files: src/distrib/utils/embedded/files: resize_disklabel Log Message: Handle arbitrary raw partitions. Fetch geometry from disklabel to be consistent. Use disktab format instead of the normal human-readable output for parsing the disklabel. Avoid overflows in size computation. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/distrib/utils/embedded/files/resize_disklabel Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/files/resize_disklabel diff -u src/distrib/utils/embedded/files/resize_disklabel:1.3 src/distrib/utils/embedded/files/resize_disklabel:1.4 --- src/distrib/utils/embedded/files/resize_disklabel:1.3 Sat Oct 6 09:58:55 2018 +++ src/distrib/utils/embedded/files/resize_disklabel Sat Feb 18 07:58:34 2023 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: resize_disklabel,v 1.3 2018/10/06 09:58:55 jmcneill Exp $ +# $NetBSD: resize_disklabel,v 1.4 2023/02/18 07:58:34 mlelstv Exp $ # # PROVIDE: resize_disklabel @@ -16,25 +16,35 @@ stop_cmd=":" get_rawpart() { + local partno + partno=$(/sbin/sysctl -n kern.rawpartition) - test $partno = 2 && echo c || echo d + printf "$(printf %o $((partno + 97)))" } get_total_sectors() { + local disk + disk=$1 - /sbin/drvctl -p $disk disk-info/geometry/sectors-per-unit + /sbin/disklabel -t "$disk" \ + | sed -ne 's/.*:su#\([0-9]*\):.*/\1/p' } get_rawpart_sectors() { + local disk rawpart + disk=$1 rawpart=$2 - /sbin/disklabel $disk | grep "^ $rawpart:" | awk '{ print $2; }' + /sbin/disklabel -t "$disk" \ + | sed -ne 's/.*:p'"$rawpart"'#\([0-9]*\):.*/\1/p' } grow_mbrpart() { + local disk rawpart ts rs oldsize newsize + disk=$1 rawpart=$(get_rawpart) @@ -44,21 +54,23 @@ grow_mbrpart() return fi - ts=$(($(get_total_sectors $disk) - ${PART1START})) + ts=$((${DLSIZE} - ${PART1START})) rs=${PART1SIZE} if [ "$ts" = "$rs" ]; then return fi - oldsize=$(($rs * 512 / 1024 / 1024)) - newsize=$(($ts * 512 / 1024 / 1024)) + oldsize=$(($rs / 2048)) + newsize=$(($ts / 2048)) echo "Growing $disk MBR partition #1 (${oldsize}MB -> ${newsize}MB)" /sbin/fdisk -f -u -1 -s 169/${PART1START}/${ts} ${disk} } grow_disklabel() { + local disk part rawpart ts rs oldsize newsize + disk=$1 part=$2 rawpart=$(get_rawpart) @@ -70,8 +82,8 @@ grow_disklabel() return fi - oldsize=$(($rs * 512 / 1024 / 1024)) - newsize=$(($ts * 512 / 1024 / 1024)) + oldsize=$(($rs / 2048)) + newsize=$(($ts / 2048)) echo "Growing $disk disklabel (${oldsize}MB -> ${newsize}MB)" printf "A\ny\n$part\n\n\n\$\nc\n\n\n\$\nd\n\n\n\$\nW\ny\nQ\n" | \ disklabel -i $disk >/dev/null
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: mlelstv Date: Sat Feb 18 07:58:35 UTC 2023 Modified Files: src/distrib/utils/embedded/files: resize_disklabel Log Message: Handle arbitrary raw partitions. Fetch geometry from disklabel to be consistent. Use disktab format instead of the normal human-readable output for parsing the disklabel. Avoid overflows in size computation. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/distrib/utils/embedded/files/resize_disklabel Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: yamt Date: Sat Nov 19 09:19:28 UTC 2022 Modified Files: src/distrib/utils/embedded/conf: armv7.conf rpi.conf rpi_inst.conf Log Message: Update a few www.raspberrypi.com URLs To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/distrib/utils/embedded/conf/armv7.conf cvs rdiff -u -r1.39 -r1.40 src/distrib/utils/embedded/conf/rpi.conf cvs rdiff -u -r1.18 -r1.19 src/distrib/utils/embedded/conf/rpi_inst.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/armv7.conf diff -u src/distrib/utils/embedded/conf/armv7.conf:1.44 src/distrib/utils/embedded/conf/armv7.conf:1.45 --- src/distrib/utils/embedded/conf/armv7.conf:1.44 Wed May 27 21:53:04 2020 +++ src/distrib/utils/embedded/conf/armv7.conf Sat Nov 19 09:19:27 2022 @@ -1,4 +1,4 @@ -# $NetBSD: armv7.conf,v 1.44 2020/05/27 21:53:04 jmcneill Exp $ +# $NetBSD: armv7.conf,v 1.45 2022/11/19 09:19:27 yamt Exp $ # ARMv7 customization script used by mkimage # board=armv7 @@ -65,9 +65,9 @@ upstream_kernel=1 os_prefix=dtb/ cmdline=../cmdline.txt kernel=/netbsd-GENERIC.img -# Boot options, see https://www.raspberrypi.org/documentation/configuration/config-txt/boot.md +# Boot options, see https://www.raspberrypi.com/documentation/computers/config_txt.html#boot-options kernel_address=0x0140 -# UART settings, see https://www.raspberrypi.org/documentation/configuration/uart.md +# UART settings, see https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-uarts enable_uart=1 force_turbo=0 EOF Index: src/distrib/utils/embedded/conf/rpi.conf diff -u src/distrib/utils/embedded/conf/rpi.conf:1.39 src/distrib/utils/embedded/conf/rpi.conf:1.40 --- src/distrib/utils/embedded/conf/rpi.conf:1.39 Tue Dec 1 04:21:26 2020 +++ src/distrib/utils/embedded/conf/rpi.conf Sat Nov 19 09:19:27 2022 @@ -1,4 +1,4 @@ -# $NetBSD: rpi.conf,v 1.39 2020/12/01 04:21:26 rin Exp $ +# $NetBSD: rpi.conf,v 1.40 2022/11/19 09:19:27 yamt Exp $ # Raspberry Pi customization script used by mkimage # @@ -59,7 +59,7 @@ EOF upstream_kernel=1 os_prefix=dtb/ cmdline=../cmdline.txt -# UART settings, see https://www.raspberrypi.org/documentation/configuration/uart.md +# UART settings, see https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-uarts enable_uart=1 force_turbo=0 # Default kernel for BCM2836 and later Index: src/distrib/utils/embedded/conf/rpi_inst.conf diff -u src/distrib/utils/embedded/conf/rpi_inst.conf:1.18 src/distrib/utils/embedded/conf/rpi_inst.conf:1.19 --- src/distrib/utils/embedded/conf/rpi_inst.conf:1.18 Tue Jul 6 11:49:36 2021 +++ src/distrib/utils/embedded/conf/rpi_inst.conf Sat Nov 19 09:19:27 2022 @@ -1,4 +1,4 @@ -# $NetBSD: rpi_inst.conf,v 1.18 2021/07/06 11:49:36 jmcneill Exp $ +# $NetBSD: rpi_inst.conf,v 1.19 2022/11/19 09:19:27 yamt Exp $ # Raspberry Pi customization script used by mkimage # @@ -47,7 +47,7 @@ upstream_kernel=1 os_prefix=dtb/ cmdline=../cmdline.txt kernel=/kernel.img -# UART settings, see https://www.raspberrypi.org/documentation/configuration/uart.md +# UART settings, https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-uarts enable_uart=1 force_turbo=0 EOF
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: yamt Date: Sat Nov 19 09:19:28 UTC 2022 Modified Files: src/distrib/utils/embedded/conf: armv7.conf rpi.conf rpi_inst.conf Log Message: Update a few www.raspberrypi.com URLs To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/distrib/utils/embedded/conf/armv7.conf cvs rdiff -u -r1.39 -r1.40 src/distrib/utils/embedded/conf/rpi.conf cvs rdiff -u -r1.18 -r1.19 src/distrib/utils/embedded/conf/rpi_inst.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Sun Oct 30 15:08:50 UTC 2022 Modified Files: src/distrib/utils/embedded/conf: evbarm.conf Log Message: Silence a warning when machdep.dmi.chassis-asset-tag is not present To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/distrib/utils/embedded/conf/evbarm.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Sun Oct 30 15:08:50 UTC 2022 Modified Files: src/distrib/utils/embedded/conf: evbarm.conf Log Message: Silence a warning when machdep.dmi.chassis-asset-tag is not present To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/distrib/utils/embedded/conf/evbarm.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/evbarm.conf diff -u src/distrib/utils/embedded/conf/evbarm.conf:1.40 src/distrib/utils/embedded/conf/evbarm.conf:1.41 --- src/distrib/utils/embedded/conf/evbarm.conf:1.40 Sat Oct 15 18:32:30 2022 +++ src/distrib/utils/embedded/conf/evbarm.conf Sun Oct 30 15:08:50 2022 @@ -1,4 +1,4 @@ -# $NetBSD: evbarm.conf,v 1.40 2022/10/15 18:32:30 jmcneill Exp $ +# $NetBSD: evbarm.conf,v 1.41 2022/10/30 15:08:50 jmcneill Exp $ # evbarm shared config # image=$HOME/${board}.img @@ -154,7 +154,7 @@ is_cloud() { fi # Oracle OCI - case "\$(/sbin/sysctl -n machdep.dmi.chassis-asset-tag)" in + case "\$(/sbin/sysctl -n machdep.dmi.chassis-asset-tag 2>/dev/null)" in OracleCloud*) ret=YES ;;
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: jmcneill Date: Sat Oct 15 18:32:31 UTC 2022 Modified Files: src/distrib/utils/embedded/conf: arm64.conf evbarm.conf src/distrib/utils/embedded/files: ec2_init Log Message: ec2_init: Add support for Oracle Cloud To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/distrib/utils/embedded/conf/arm64.conf cvs rdiff -u -r1.39 -r1.40 src/distrib/utils/embedded/conf/evbarm.conf cvs rdiff -u -r1.4 -r1.5 src/distrib/utils/embedded/files/ec2_init Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/arm64.conf diff -u src/distrib/utils/embedded/conf/arm64.conf:1.14 src/distrib/utils/embedded/conf/arm64.conf:1.15 --- src/distrib/utils/embedded/conf/arm64.conf:1.14 Sat Oct 16 14:05:48 2021 +++ src/distrib/utils/embedded/conf/arm64.conf Sat Oct 15 18:32:30 2022 @@ -1,4 +1,4 @@ -# $NetBSD: arm64.conf,v 1.14 2021/10/16 14:05:48 jmcneill Exp $ +# $NetBSD: arm64.conf,v 1.15 2022/10/15 18:32:30 jmcneill Exp $ # ARM64 customization script used by mkimage # board=arm64 @@ -28,7 +28,7 @@ customize() { mdnsd=YES devpubd=YES wscons=\$(dev_exists wsdisplay0) -ec2_init=\$(dev_exists ena0) +ec2_init=\$(is_cloud) if checkyesno ec2_init ; then dhcpcd_flags="\$dhcpcd_flags -w" else Index: src/distrib/utils/embedded/conf/evbarm.conf diff -u src/distrib/utils/embedded/conf/evbarm.conf:1.39 src/distrib/utils/embedded/conf/evbarm.conf:1.40 --- src/distrib/utils/embedded/conf/evbarm.conf:1.39 Tue Jul 6 11:49:36 2021 +++ src/distrib/utils/embedded/conf/evbarm.conf Sat Oct 15 18:32:30 2022 @@ -1,4 +1,4 @@ -# $NetBSD: evbarm.conf,v 1.39 2021/07/06 11:49:36 jmcneill Exp $ +# $NetBSD: evbarm.conf,v 1.40 2022/10/15 18:32:30 jmcneill Exp $ # evbarm shared config # image=$HOME/${board}.img @@ -145,6 +145,24 @@ dev_exists() { fi } +is_cloud() { + ret=NO + + # AWS EC2 + if [ "\$(dev_exists ena0)" = "YES" ]; then + ret=YES + fi + + # Oracle OCI + case "\$(/sbin/sysctl -n machdep.dmi.chassis-asset-tag)" in + OracleCloud*) + ret=YES + ;; + esac + + printf \$ret +} + rc_configured=YES hostname=${hostname:-${board}} no_swap=YES Index: src/distrib/utils/embedded/files/ec2_init diff -u src/distrib/utils/embedded/files/ec2_init:1.4 src/distrib/utils/embedded/files/ec2_init:1.5 --- src/distrib/utils/embedded/files/ec2_init:1.4 Tue Jul 20 19:31:23 2021 +++ src/distrib/utils/embedded/files/ec2_init Sat Oct 15 18:32:30 2022 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: ec2_init,v 1.4 2021/07/20 19:31:23 rhialto Exp $ +# $NetBSD: ec2_init,v 1.5 2022/10/15 18:32:30 jmcneill Exp $ # # PROVIDE: ec2_init # REQUIRE: NETWORKING @@ -13,9 +13,27 @@ rcvar=${name} start_cmd="ec2_init" stop_cmd=":" -EC2_USER="ec2-user" -METADATA_URL="http://169.254.169.254/latest/meta-data/; -SSH_KEY_URL="public-keys/0/openssh-key" +CLOUD_TYPE=EC2 # default + +case "$(/sbin/sysctl -n machdep.dmi.chassis-asset-tag)" in +OracleCloud*) + CLOUD_TYPE=OCI + ;; +esac + +case ${CLOUD_TYPE} in +EC2) + EC2_USER="ec2-user" + METADATA_URL="http://169.254.169.254/latest/meta-data/; + SSH_KEY_URL="public-keys/0/openssh-key" + ;; +OCI) + EC2_USER="opc" + METADATA_URL="http://169.254.169.254/opc/v1/instance/; + SSH_KEY_URL="metadata/ssh_authorized_keys" + ;; +esac + HOSTNAME_URL="hostname" SSH_KEY_FILE="/home/${EC2_USER}/.ssh/authorized_keys" @@ -24,7 +42,7 @@ OS_METADATA_URL="http://169.254.169.254/ ec2_newuser() { - echo "Creating EC2 user account ${EC2_USER}" + echo "Creating ${CLOUD_TYPE} user account ${EC2_USER}" useradd -g users -G wheel,operator -m "${EC2_USER}" } @@ -39,25 +57,25 @@ ec2_init() umask 022 # set hostname; it may be 5-10 seconds for the metadata service - # to become reachable. + # to become reachable. try=0 while [ $((try++)) -lt 20 ] do HOSTNAME=$(ftp -o - -q 2 "${METADATA_URL}${HOSTNAME_URL}") if [ -n "$HOSTNAME" ]; then - echo "Setting EC2 hostname: ${HOSTNAME}" + echo "Setting ${CLOUD_TYPE} hostname: ${HOSTNAME}" echo "$HOSTNAME" > /etc/myname hostname "$HOSTNAME" break fi - echo "EC2 hostname not available yet (try $try)" + echo "${CLOUD_TYPE} hostname not available yet (try $try)" sleep 1 done - # create EC2 user + # create cloud user id "${EC2_USER}" >/dev/null 2>&1 || ec2_newuser - # fetch the public key from Amazon Web Services + # fetch the public key from the metadata service EC2_SSH_KEY=$(ftp -o - -q 2 "${METADATA_URL}${SSH_KEY_URL}") if [ -n "$EC2_SSH_KEY" ]; then @@ -71,7 +89,7 @@ ec2_init() grep -q "$EC2_SSH_KEY" "$SSH_KEY_FILE" if [ $? -ne 0 ]; then - echo "Setting EC2 SSH public key for user ${EC2_USER}: ${EC2_SSH_KEY##* }" + echo "Setting ${CLOUD_TYPE} SSH public key for user ${EC2_USER}: ${EC2_SSH_KEY##* }" echo "$EC2_SSH_KEY" >> "$SSH_KEY_FILE" fi fi
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: jmcneill Date: Sat Oct 15 18:32:31 UTC 2022 Modified Files: src/distrib/utils/embedded/conf: arm64.conf evbarm.conf src/distrib/utils/embedded/files: ec2_init Log Message: ec2_init: Add support for Oracle Cloud To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/distrib/utils/embedded/conf/arm64.conf cvs rdiff -u -r1.39 -r1.40 src/distrib/utils/embedded/conf/evbarm.conf cvs rdiff -u -r1.4 -r1.5 src/distrib/utils/embedded/files/ec2_init Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Sat Oct 16 14:05:48 UTC 2021 Modified Files: src/distrib/utils/embedded/conf: arm64.conf Log Message: Background dhcpcd if ec2_init is not enabled to speed up boot. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/distrib/utils/embedded/conf/arm64.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/arm64.conf diff -u src/distrib/utils/embedded/conf/arm64.conf:1.13 src/distrib/utils/embedded/conf/arm64.conf:1.14 --- src/distrib/utils/embedded/conf/arm64.conf:1.13 Thu Jul 1 17:32:07 2021 +++ src/distrib/utils/embedded/conf/arm64.conf Sat Oct 16 14:05:48 2021 @@ -1,4 +1,4 @@ -# $NetBSD: arm64.conf,v 1.13 2021/07/01 17:32:07 jmcneill Exp $ +# $NetBSD: arm64.conf,v 1.14 2021/10/16 14:05:48 jmcneill Exp $ # ARM64 customization script used by mkimage # board=arm64 @@ -31,6 +31,8 @@ wscons=\$(dev_exists wsdisplay0) ec2_init=\$(dev_exists ena0) if checkyesno ec2_init ; then dhcpcd_flags="\$dhcpcd_flags -w" +else + dhcpcd_flags="\$dhcpcd_flags -b" fi EOF }
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Sat Oct 16 14:05:48 UTC 2021 Modified Files: src/distrib/utils/embedded/conf: arm64.conf Log Message: Background dhcpcd if ec2_init is not enabled to speed up boot. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/distrib/utils/embedded/conf/arm64.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: rhialto Date: Tue Jul 20 19:31:23 UTC 2021 Modified Files: src/distrib/utils/embedded/files: ec2_init Log Message: Extract just the random bits to feed to /dev/urandom. This makes no difference in the randomness of the pool, but it improves on the estimation (if any) of how many random bits were obtained. Also make the ftp -q time out a bit longer since I got some time outs. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/distrib/utils/embedded/files/ec2_init Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: rhialto Date: Tue Jul 20 19:31:23 UTC 2021 Modified Files: src/distrib/utils/embedded/files: ec2_init Log Message: Extract just the random bits to feed to /dev/urandom. This makes no difference in the randomness of the pool, but it improves on the estimation (if any) of how many random bits were obtained. Also make the ftp -q time out a bit longer since I got some time outs. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/distrib/utils/embedded/files/ec2_init Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/files/ec2_init diff -u src/distrib/utils/embedded/files/ec2_init:1.3 src/distrib/utils/embedded/files/ec2_init:1.4 --- src/distrib/utils/embedded/files/ec2_init:1.3 Thu Jul 15 19:03:17 2021 +++ src/distrib/utils/embedded/files/ec2_init Tue Jul 20 19:31:23 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: ec2_init,v 1.3 2021/07/15 19:03:17 rhialto Exp $ +# $NetBSD: ec2_init,v 1.4 2021/07/20 19:31:23 rhialto Exp $ # # PROVIDE: ec2_init # REQUIRE: NETWORKING @@ -28,6 +28,11 @@ ec2_newuser() useradd -g users -G wheel,operator -m "${EC2_USER}" } +extract_random_seed() +{ + sed -n -e '/random_seed/s/.*"random_seed": *"\([A-Za-z0-9+/=]*\)".*/\1/p' +} + ec2_init() { ( @@ -38,7 +43,7 @@ ec2_init() try=0 while [ $((try++)) -lt 20 ] do - HOSTNAME=$(ftp -o - -q 1 "${METADATA_URL}${HOSTNAME_URL}") + HOSTNAME=$(ftp -o - -q 2 "${METADATA_URL}${HOSTNAME_URL}") if [ -n "$HOSTNAME" ]; then echo "Setting EC2 hostname: ${HOSTNAME}" echo "$HOSTNAME" > /etc/myname @@ -53,7 +58,7 @@ ec2_init() id "${EC2_USER}" >/dev/null 2>&1 || ec2_newuser # fetch the public key from Amazon Web Services - EC2_SSH_KEY=$(ftp -o - -q 1 "${METADATA_URL}${SSH_KEY_URL}") + EC2_SSH_KEY=$(ftp -o - -q 2 "${METADATA_URL}${SSH_KEY_URL}") if [ -n "$EC2_SSH_KEY" ]; then # A key pair is associated with this instance, add it @@ -71,10 +76,11 @@ ec2_init() fi fi - # May contain a "random_seed". Everything else doesn't matter. - OS_METADATA="$(ftp -o - -q 1 ${OS_METADATA_URL})" + # May contain a "random_seed". + OS_METADATA="$(ftp -o - -q 2 ${OS_METADATA_URL})" if echo "$OS_METADATA" | grep -q random_seed; then - echo "$OS_METADATA" >> /dev/urandom + echo "$OS_METADATA" | extract_random_seed | + base64 -di >> /dev/urandom fi ) }
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: rhialto Date: Thu Jul 15 19:03:17 UTC 2021 Modified Files: src/distrib/utils/embedded/files: ec2_init Log Message: Add some OpenStack support. I found that in the cloud I tried, by the time this script runs, there is no default route in effect yet. That takes some 5 to 10 seconds longer. So I added a retry loop, and to make that easier, changed the order of queries. To make sure it doesn't wait ~forever for a non-existent service I added the -q 1 option to ftp invocations. I also added OpenStack-specific metadata which contains a different random_seed of 512 bytes every time it is requested. See https://github.com/openstack/nova/blob/master/nova/api/metadata/base.py#L355 It may not be trusted data but only in the strictest sense of the word. The data can only be observed by people with access to the cloud's overlay network for the particular VM. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/distrib/utils/embedded/files/ec2_init Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/files/ec2_init diff -u src/distrib/utils/embedded/files/ec2_init:1.2 src/distrib/utils/embedded/files/ec2_init:1.3 --- src/distrib/utils/embedded/files/ec2_init:1.2 Thu Jul 1 18:05:45 2021 +++ src/distrib/utils/embedded/files/ec2_init Thu Jul 15 19:03:17 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: ec2_init,v 1.2 2021/07/01 18:05:45 jmcneill Exp $ +# $NetBSD: ec2_init,v 1.3 2021/07/15 19:03:17 rhialto Exp $ # # PROVIDE: ec2_init # REQUIRE: NETWORKING @@ -20,6 +20,8 @@ HOSTNAME_URL="hostname" SSH_KEY_FILE="/home/${EC2_USER}/.ssh/authorized_keys" +OS_METADATA_URL="http://169.254.169.254/openstack/latest/meta_data.json; + ec2_newuser() { echo "Creating EC2 user account ${EC2_USER}" @@ -31,11 +33,27 @@ ec2_init() ( umask 022 + # set hostname; it may be 5-10 seconds for the metadata service + # to become reachable. + try=0 + while [ $((try++)) -lt 20 ] + do + HOSTNAME=$(ftp -o - -q 1 "${METADATA_URL}${HOSTNAME_URL}") + if [ -n "$HOSTNAME" ]; then + echo "Setting EC2 hostname: ${HOSTNAME}" + echo "$HOSTNAME" > /etc/myname + hostname "$HOSTNAME" + break + fi + echo "EC2 hostname not available yet (try $try)" + sleep 1 + done + # create EC2 user id "${EC2_USER}" >/dev/null 2>&1 || ec2_newuser - # fetch the key pair from Amazon Web Services - EC2_SSH_KEY=$(ftp -o - "${METADATA_URL}${SSH_KEY_URL}") + # fetch the public key from Amazon Web Services + EC2_SSH_KEY=$(ftp -o - -q 1 "${METADATA_URL}${SSH_KEY_URL}") if [ -n "$EC2_SSH_KEY" ]; then # A key pair is associated with this instance, add it @@ -48,16 +66,16 @@ ec2_init() grep -q "$EC2_SSH_KEY" "$SSH_KEY_FILE" if [ $? -ne 0 ]; then - echo "Setting EC2 SSH key pair: ${EC2_SSH_KEY##* }" + echo "Setting EC2 SSH public key for user ${EC2_USER}: ${EC2_SSH_KEY##* }" echo "$EC2_SSH_KEY" >> "$SSH_KEY_FILE" fi fi - # set hostname - HOSTNAME=$(ftp -o - "${METADATA_URL}${HOSTNAME_URL}") - echo "Setting EC2 hostname: ${HOSTNAME}" - echo "$HOSTNAME" > /etc/myname - hostname "$HOSTNAME" + # May contain a "random_seed". Everything else doesn't matter. + OS_METADATA="$(ftp -o - -q 1 ${OS_METADATA_URL})" + if echo "$OS_METADATA" | grep -q random_seed; then + echo "$OS_METADATA" >> /dev/urandom + fi ) }
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: rhialto Date: Thu Jul 15 19:03:17 UTC 2021 Modified Files: src/distrib/utils/embedded/files: ec2_init Log Message: Add some OpenStack support. I found that in the cloud I tried, by the time this script runs, there is no default route in effect yet. That takes some 5 to 10 seconds longer. So I added a retry loop, and to make that easier, changed the order of queries. To make sure it doesn't wait ~forever for a non-existent service I added the -q 1 option to ftp invocations. I also added OpenStack-specific metadata which contains a different random_seed of 512 bytes every time it is requested. See https://github.com/openstack/nova/blob/master/nova/api/metadata/base.py#L355 It may not be trusted data but only in the strictest sense of the word. The data can only be observed by people with access to the cloud's overlay network for the particular VM. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/distrib/utils/embedded/files/ec2_init Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Tue Jul 6 11:49:36 UTC 2021 Modified Files: src/distrib/utils/embedded/conf: evbarm.conf evbmips.conf rpi_inst.conf usermode.conf x86.conf Log Message: Disable kernfs on live images -- it is not required. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/distrib/utils/embedded/conf/evbarm.conf cvs rdiff -u -r1.2 -r1.3 src/distrib/utils/embedded/conf/evbmips.conf cvs rdiff -u -r1.17 -r1.18 src/distrib/utils/embedded/conf/rpi_inst.conf cvs rdiff -u -r1.5 -r1.6 src/distrib/utils/embedded/conf/usermode.conf cvs rdiff -u -r1.9 -r1.10 src/distrib/utils/embedded/conf/x86.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/evbarm.conf diff -u src/distrib/utils/embedded/conf/evbarm.conf:1.38 src/distrib/utils/embedded/conf/evbarm.conf:1.39 --- src/distrib/utils/embedded/conf/evbarm.conf:1.38 Wed Dec 23 10:35:18 2020 +++ src/distrib/utils/embedded/conf/evbarm.conf Tue Jul 6 11:49:36 2021 @@ -1,4 +1,4 @@ -# $NetBSD: evbarm.conf,v 1.38 2020/12/23 10:35:18 rin Exp $ +# $NetBSD: evbarm.conf,v 1.39 2021/07/06 11:49:36 jmcneill Exp $ # evbarm shared config # image=$HOME/${board}.img @@ -71,7 +71,6 @@ make_fstab_evbarm_gpt() { # See /usr/share/examples/fstab/ for more examples. NAME=${gpt_label_ffs:-netbsd-root} / ffs rw,noatime 1 1 NAME=${gpt_label_boot:-EFI} /boot msdos rw 1 1 -kernfs /kern kernfs rw ptyfs /dev/pts ptyfs rw procfs /proc procfs rw tmpfs /var/shm tmpfs rw,-m1777,-sram%25 @@ -84,7 +83,6 @@ make_fstab_evbarm_normal() { # See /usr/share/examples/fstab/ for more examples. ROOT.a / ffs rw,noatime 1 1 ROOT.e /boot msdos rw 1 1 -kernfs /kern kernfs rw ptyfs /dev/pts ptyfs rw procfs /proc procfs rw tmpfs /var/shm tmpfs rw,-m1777,-sram%25 @@ -100,7 +98,6 @@ make_fstab_evbarm_minwrites() { # See /usr/share/examples/fstab/ for more examples. ROOT.a / ffs rw,log,noatime,nodevmtime 1 1 ROOT.e /boot msdos rw 1 1 -kernfs /kern kernfs rw ptyfs /dev/pts ptyfs rw procfs /proc procfs rw tmpfs /tmp tmpfs rw,-s32M @@ -128,8 +125,6 @@ make_fstab_evbarm() { # Missing mount points from fstab echo "./proc type=dir uname=root gname=wheel mode=0755" \ >> "$tmp/selected_sets" - echo "./kern type=dir uname=root gname=wheel mode=0755" \ - >> "$tmp/selected_sets" } customize_evbarm() { Index: src/distrib/utils/embedded/conf/evbmips.conf diff -u src/distrib/utils/embedded/conf/evbmips.conf:1.2 src/distrib/utils/embedded/conf/evbmips.conf:1.3 --- src/distrib/utils/embedded/conf/evbmips.conf:1.2 Wed Dec 23 10:35:18 2020 +++ src/distrib/utils/embedded/conf/evbmips.conf Tue Jul 6 11:49:36 2021 @@ -1,4 +1,4 @@ -# $NetBSD: evbmips.conf,v 1.2 2020/12/23 10:35:18 rin Exp $ +# $NetBSD: evbmips.conf,v 1.3 2021/07/06 11:49:36 jmcneill Exp $ # evbmips shared config # image=$HOME/${board}.img @@ -71,7 +71,6 @@ make_fstab_evbmips_gpt() { # See /usr/share/examples/fstab/ for more examples. NAME=${gpt_label_ffs:-netbsd-root} / ffs rw,noatime 1 1 NAME=${gpt_label_boot:-boot} /boot msdos rw 1 1 -kernfs /kern kernfs rw ptyfs /dev/pts ptyfs rw procfs /proc procfs rw tmpfs /var/shm tmpfs rw,-m1777,-sram%25 @@ -84,7 +83,6 @@ make_fstab_evbmips_normal() { # See /usr/share/examples/fstab/ for more examples. ROOT.a / ffs rw,noatime 1 1 ROOT.e /boot msdos rw 1 1 -kernfs /kern kernfs rw ptyfs /dev/pts ptyfs rw procfs /proc procfs rw tmpfs /var/shm tmpfs rw,-m1777,-sram%25 @@ -100,7 +98,6 @@ make_fstab_evbmips_minwrites() { # See /usr/share/examples/fstab/ for more examples. ROOT.a / ffs rw,log,noatime,nodevmtime 1 1 ROOT.e /boot msdos rw 1 1 -kernfs /kern kernfs rw ptyfs /dev/pts ptyfs rw procfs /proc procfs rw tmpfs /tmp tmpfs rw,-s32M @@ -128,8 +125,6 @@ make_fstab_evbmips() { # Missing mount points from fstab echo "./proc type=dir uname=root gname=wheel mode=0755" \ >> "$tmp/selected_sets" - echo "./kern type=dir uname=root gname=wheel mode=0755" \ - >> "$tmp/selected_sets" } customize_evbmips() { Index: src/distrib/utils/embedded/conf/rpi_inst.conf diff -u src/distrib/utils/embedded/conf/rpi_inst.conf:1.17 src/distrib/utils/embedded/conf/rpi_inst.conf:1.18 --- src/distrib/utils/embedded/conf/rpi_inst.conf:1.17 Tue Dec 1 04:21:10 2020 +++ src/distrib/utils/embedded/conf/rpi_inst.conf Tue Jul 6 11:49:36 2021 @@ -1,4 +1,4 @@ -# $NetBSD: rpi_inst.conf,v 1.17 2020/12/01 04:21:10 rin Exp $ +# $NetBSD: rpi_inst.conf,v 1.18 2021/07/06 11:49:36 jmcneill Exp $ # Raspberry Pi customization script used by mkimage # @@ -24,7 +24,7 @@ make_label() { customize() { echo "${bar} creating directories ${bar}" - mkdir ${mnt}/proc ${mnt}/kern + mkdir ${mnt}/proc } make_fstab() { Index: src/distrib/utils/embedded/conf/usermode.conf diff -u
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Tue Jul 6 11:49:36 UTC 2021 Modified Files: src/distrib/utils/embedded/conf: evbarm.conf evbmips.conf rpi_inst.conf usermode.conf x86.conf Log Message: Disable kernfs on live images -- it is not required. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/distrib/utils/embedded/conf/evbarm.conf cvs rdiff -u -r1.2 -r1.3 src/distrib/utils/embedded/conf/evbmips.conf cvs rdiff -u -r1.17 -r1.18 src/distrib/utils/embedded/conf/rpi_inst.conf cvs rdiff -u -r1.5 -r1.6 src/distrib/utils/embedded/conf/usermode.conf cvs rdiff -u -r1.9 -r1.10 src/distrib/utils/embedded/conf/x86.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: jmcneill Date: Thu Jul 1 18:05:45 UTC 2021 Modified Files: src/distrib/utils/embedded/files: ec2_init Log Message: AWS marketplace does not allow root ssh logins. Create an ec2-user account and install the ssh key in that user's home directory instead. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/files/ec2_init Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: jmcneill Date: Thu Jul 1 18:05:45 UTC 2021 Modified Files: src/distrib/utils/embedded/files: ec2_init Log Message: AWS marketplace does not allow root ssh logins. Create an ec2-user account and install the ssh key in that user's home directory instead. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/files/ec2_init Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/files/ec2_init diff -u src/distrib/utils/embedded/files/ec2_init:1.1 src/distrib/utils/embedded/files/ec2_init:1.2 --- src/distrib/utils/embedded/files/ec2_init:1.1 Fri Nov 30 20:53:02 2018 +++ src/distrib/utils/embedded/files/ec2_init Thu Jul 1 18:05:45 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: ec2_init,v 1.1 2018/11/30 20:53:02 jmcneill Exp $ +# $NetBSD: ec2_init,v 1.2 2021/07/01 18:05:45 jmcneill Exp $ # # PROVIDE: ec2_init # REQUIRE: NETWORKING @@ -13,24 +13,37 @@ rcvar=${name} start_cmd="ec2_init" stop_cmd=":" +EC2_USER="ec2-user" METADATA_URL="http://169.254.169.254/latest/meta-data/; SSH_KEY_URL="public-keys/0/openssh-key" HOSTNAME_URL="hostname" -SSH_KEY_FILE="/root/.ssh/authorized_keys" +SSH_KEY_FILE="/home/${EC2_USER}/.ssh/authorized_keys" + +ec2_newuser() +{ + echo "Creating EC2 user account ${EC2_USER}" + useradd -g users -G wheel,operator -m "${EC2_USER}" +} ec2_init() { ( umask 022 + + # create EC2 user + id "${EC2_USER}" >/dev/null 2>&1 || ec2_newuser + # fetch the key pair from Amazon Web Services EC2_SSH_KEY=$(ftp -o - "${METADATA_URL}${SSH_KEY_URL}") if [ -n "$EC2_SSH_KEY" ]; then # A key pair is associated with this instance, add it - # to root 'authorized_keys' file + # to EC2_USER's 'authorized_keys' file mkdir -p $(dirname "$SSH_KEY_FILE") + chown "${EC2_USER}:users" $(dirname "$SSH_KEY_FILE") touch "$SSH_KEY_FILE" + chown "${EC2_USER}:users" "$SSH_KEY_FILE" cd $(dirname "$SSH_KEY_FILE") grep -q "$EC2_SSH_KEY" "$SSH_KEY_FILE"
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Thu Jul 1 17:32:07 UTC 2021 Modified Files: src/distrib/utils/embedded/conf: arm64.conf Log Message: port-evbarm/56274: no network on ec2 arm64 9.99.85 Add -w to dhcpcd_flags when running on EC2, since we need to wait for the network to come up before contacting the metadata service. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/distrib/utils/embedded/conf/arm64.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Thu Jul 1 17:31:21 UTC 2021 Modified Files: src/distrib/utils/embedded/conf: arm64mbr.conf Log Message: No need for ec2_init on arm64mbr To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/conf/arm64mbr.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/arm64mbr.conf diff -u src/distrib/utils/embedded/conf/arm64mbr.conf:1.1 src/distrib/utils/embedded/conf/arm64mbr.conf:1.2 --- src/distrib/utils/embedded/conf/arm64mbr.conf:1.1 Thu May 28 10:22:49 2020 +++ src/distrib/utils/embedded/conf/arm64mbr.conf Thu Jul 1 17:31:21 2021 @@ -1,4 +1,4 @@ -# $NetBSD: arm64mbr.conf,v 1.1 2020/05/28 10:22:49 jmcneill Exp $ +# $NetBSD: arm64mbr.conf,v 1.2 2021/07/01 17:31:21 jmcneill Exp $ # ARM64 (MBR partitioning) customization script used by mkimage # board=arm64mbr @@ -24,16 +24,10 @@ customize() { mdnsd=YES devpubd=YES wscons=\$(dev_exists wsdisplay0) -ec2_init=\$(dev_exists ena0) EOF } populate_common() { - # Add EC2 init script - cp ${DIR}/files/ec2_init ${mnt}/etc/rc.d/ec2_init - echo "./etc/rc.d/ec2_init type=file uname=root gname=wheel mode=0555" \ - >> "$tmp/selected_sets" - # Rename kernel to netbsd.img mv "${mnt}/boot/netbsd-${kernel_GENERIC64}.img" "${mnt}/boot/netbsd.img"
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Thu Jul 1 17:32:07 UTC 2021 Modified Files: src/distrib/utils/embedded/conf: arm64.conf Log Message: port-evbarm/56274: no network on ec2 arm64 9.99.85 Add -w to dhcpcd_flags when running on EC2, since we need to wait for the network to come up before contacting the metadata service. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/distrib/utils/embedded/conf/arm64.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/arm64.conf diff -u src/distrib/utils/embedded/conf/arm64.conf:1.12 src/distrib/utils/embedded/conf/arm64.conf:1.13 --- src/distrib/utils/embedded/conf/arm64.conf:1.12 Fri Jul 17 15:16:34 2020 +++ src/distrib/utils/embedded/conf/arm64.conf Thu Jul 1 17:32:07 2021 @@ -1,4 +1,4 @@ -# $NetBSD: arm64.conf,v 1.12 2020/07/17 15:16:34 jmcneill Exp $ +# $NetBSD: arm64.conf,v 1.13 2021/07/01 17:32:07 jmcneill Exp $ # ARM64 customization script used by mkimage # board=arm64 @@ -29,6 +29,9 @@ mdnsd=YES devpubd=YES wscons=\$(dev_exists wsdisplay0) ec2_init=\$(dev_exists ena0) +if checkyesno ec2_init ; then + dhcpcd_flags="\$dhcpcd_flags -w" +fi EOF }
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Thu Jul 1 17:31:21 UTC 2021 Modified Files: src/distrib/utils/embedded/conf: arm64mbr.conf Log Message: No need for ec2_init on arm64mbr To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/conf/arm64mbr.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: rin Date: Wed Dec 23 10:35:18 UTC 2020 Modified Files: src/distrib/utils/embedded: mkimage src/distrib/utils/embedded/conf: evbarm.conf evbmips.conf x86.conf Log Message: Fix fallout from mkimage rev 1.76. For mkimage: - Update "size" if auto-calculated. - Use "dd bs=1" instead of non-portable "head -c". - Some style nits. For MD make_label() functions: - Stop using "newsize" as image size in MB, use "size" instead. To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/distrib/utils/embedded/mkimage cvs rdiff -u -r1.37 -r1.38 src/distrib/utils/embedded/conf/evbarm.conf cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/conf/evbmips.conf cvs rdiff -u -r1.8 -r1.9 src/distrib/utils/embedded/conf/x86.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/mkimage diff -u src/distrib/utils/embedded/mkimage:1.76 src/distrib/utils/embedded/mkimage:1.77 --- src/distrib/utils/embedded/mkimage:1.76 Mon Dec 21 16:38:02 2020 +++ src/distrib/utils/embedded/mkimage Wed Dec 23 10:35:18 2020 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mkimage,v 1.76 2020/12/21 16:38:02 riastradh Exp $ +# $NetBSD: mkimage,v 1.77 2020/12/23 10:35:18 rin Exp $ # # Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -259,15 +259,16 @@ if [ -z "${bootonly}" ]; then -F "$tmp/selected_sets" ${image} "${release}" "${mnt}" fi -cursize="$(getsize "${image}")" if [ "${size}" = 0 ]; then - size="${cursize}" + size="$(getsize "${image}")" # Round up to a multiple of 4m and add 1m of slop. alignunit=$((4*1024*1024)) - alignsize=$((alignunit*((cursize + alignunit - 1)/alignunit))) + alignsize=$((alignunit*((size + alignunit - 1)/alignunit))) alignsize=$((alignsize + 1024*1024)) - if [ $cursize -lt $alignsize ]; then - head -c "$((alignsize - cursize))" < /dev/zero >> "${image}" + if [ "${size}" -lt "${alignsize}" ]; then + dd bs=1 count="$((alignsize - size))" if=/dev/zero \ + >> "${image}" 2> /dev/null + size="${alignsize}" fi fi Index: src/distrib/utils/embedded/conf/evbarm.conf diff -u src/distrib/utils/embedded/conf/evbarm.conf:1.37 src/distrib/utils/embedded/conf/evbarm.conf:1.38 --- src/distrib/utils/embedded/conf/evbarm.conf:1.37 Fri Jul 17 15:16:34 2020 +++ src/distrib/utils/embedded/conf/evbarm.conf Wed Dec 23 10:35:18 2020 @@ -1,4 +1,4 @@ -# $NetBSD: evbarm.conf,v 1.37 2020/07/17 15:16:34 jmcneill Exp $ +# $NetBSD: evbarm.conf,v 1.38 2020/12/23 10:35:18 rin Exp $ # evbarm shared config # image=$HOME/${board}.img @@ -23,7 +23,7 @@ mkdir -p ${mnt}/boot make_label_evbarm() { # compute all sizes in terms of sectors - local totalsize=$(( ${newsize} * 1024 * 2 / 512 )) + local totalsize=$(( ${size} / 512 )) local bootsize=$(( ${boot} * 1024 )) Index: src/distrib/utils/embedded/conf/evbmips.conf diff -u src/distrib/utils/embedded/conf/evbmips.conf:1.1 src/distrib/utils/embedded/conf/evbmips.conf:1.2 --- src/distrib/utils/embedded/conf/evbmips.conf:1.1 Fri Jul 17 15:16:34 2020 +++ src/distrib/utils/embedded/conf/evbmips.conf Wed Dec 23 10:35:18 2020 @@ -1,4 +1,4 @@ -# $NetBSD: evbmips.conf,v 1.1 2020/07/17 15:16:34 jmcneill Exp $ +# $NetBSD: evbmips.conf,v 1.2 2020/12/23 10:35:18 rin Exp $ # evbmips shared config # image=$HOME/${board}.img @@ -23,7 +23,7 @@ mkdir -p ${mnt}/boot make_label_evbmips() { # compute all sizes in terms of sectors - local totalsize=$(( ${newsize} * 1024 * 2 / 512 )) + local totalsize=$(( ${size} / 512 )) local bootsize=$(( ${boot} * 1024 )) Index: src/distrib/utils/embedded/conf/x86.conf diff -u src/distrib/utils/embedded/conf/x86.conf:1.8 src/distrib/utils/embedded/conf/x86.conf:1.9 --- src/distrib/utils/embedded/conf/x86.conf:1.8 Tue Nov 28 02:56:44 2017 +++ src/distrib/utils/embedded/conf/x86.conf Wed Dec 23 10:35:18 2020 @@ -1,4 +1,4 @@ -# $NetBSD: x86.conf,v 1.8 2017/11/28 02:56:44 kre Exp $ +# $NetBSD: x86.conf,v 1.9 2020/12/23 10:35:18 rin Exp $ # x86 shared config # @@ -15,7 +15,7 @@ ffsoffset=${init}b make_label() { # compute all sizes in terms of sectors - local totalsize=$(( ${newsize} * 1024 * 2 / 512 )) + local totalsize=$(( ${size} / 512 )) local aoffset=${init} local asize=$(( ${totalsize} - ${aoffset} ))
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: rin Date: Wed Dec 23 10:35:18 UTC 2020 Modified Files: src/distrib/utils/embedded: mkimage src/distrib/utils/embedded/conf: evbarm.conf evbmips.conf x86.conf Log Message: Fix fallout from mkimage rev 1.76. For mkimage: - Update "size" if auto-calculated. - Use "dd bs=1" instead of non-portable "head -c". - Some style nits. For MD make_label() functions: - Stop using "newsize" as image size in MB, use "size" instead. To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/distrib/utils/embedded/mkimage cvs rdiff -u -r1.37 -r1.38 src/distrib/utils/embedded/conf/evbarm.conf cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/conf/evbmips.conf cvs rdiff -u -r1.8 -r1.9 src/distrib/utils/embedded/conf/x86.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: riastradh Date: Mon Dec 21 16:38:02 UTC 2020 Modified Files: src/distrib/utils/embedded: mkimage Log Message: embedded/mkimage: Pad image with zeros to multiple of 4 MB plus 1 MB. Otherwise, there may not be enough space after the ffs partition for a gpt, leading to very confusing results. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/distrib/utils/embedded/mkimage Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/mkimage diff -u src/distrib/utils/embedded/mkimage:1.75 src/distrib/utils/embedded/mkimage:1.76 --- src/distrib/utils/embedded/mkimage:1.75 Fri Jul 17 15:16:34 2020 +++ src/distrib/utils/embedded/mkimage Mon Dec 21 16:38:02 2020 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mkimage,v 1.75 2020/07/17 15:16:34 jmcneill Exp $ +# $NetBSD: mkimage,v 1.76 2020/12/21 16:38:02 riastradh Exp $ # # Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -259,17 +259,17 @@ if [ -z "${bootonly}" ]; then -F "$tmp/selected_sets" ${image} "${release}" "${mnt}" fi +cursize="$(getsize "${image}")" if [ "${size}" = 0 ]; then - size="$(getsize "${image}")" + size="${cursize}" + # Round up to a multiple of 4m and add 1m of slop. + alignunit=$((4*1024*1024)) + alignsize=$((alignunit*((cursize + alignunit - 1)/alignunit))) + alignsize=$((alignsize + 1024*1024)) + if [ $cursize -lt $alignsize ]; then + head -c "$((alignsize - cursize))" < /dev/zero >> "${image}" + fi fi -newsize=$((${size} / 2 / 1024)) -compare=$((${newsize} * 2 * 1024)) -while [ "${compare}" != "${size}" ] -do - size="$((size + size - compare))" - newsize="$((${size} / 2 / 1024))" - compare="$((${newsize} * 2 * 1024))" -done if $gpt; then if $gpt_hybrid; then
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: riastradh Date: Mon Dec 21 16:38:02 UTC 2020 Modified Files: src/distrib/utils/embedded: mkimage Log Message: embedded/mkimage: Pad image with zeros to multiple of 4 MB plus 1 MB. Otherwise, there may not be enough space after the ffs partition for a gpt, leading to very confusing results. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/distrib/utils/embedded/mkimage Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: rin Date: Tue Dec 1 04:21:26 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: rpi.conf Log Message: G/C unused. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/distrib/utils/embedded/conf/rpi.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/rpi.conf diff -u src/distrib/utils/embedded/conf/rpi.conf:1.38 src/distrib/utils/embedded/conf/rpi.conf:1.39 --- src/distrib/utils/embedded/conf/rpi.conf:1.38 Wed May 27 11:02:52 2020 +++ src/distrib/utils/embedded/conf/rpi.conf Tue Dec 1 04:21:26 2020 @@ -1,11 +1,10 @@ -# $NetBSD: rpi.conf,v 1.38 2020/05/27 11:02:52 jmcneill Exp $ +# $NetBSD: rpi.conf,v 1.39 2020/12/01 04:21:26 rin Exp $ # Raspberry Pi customization script used by mkimage # board=rpi kerneldir=$src/sys/arch/evbarm/compile/RPI/ kernel=$kerneldir/netbsd-RPI.bin -kernels_rpi="RPI RPI2" resize=true . ${DIR}/conf/evbarm.conf
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: rin Date: Tue Dec 1 04:21:26 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: rpi.conf Log Message: G/C unused. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/distrib/utils/embedded/conf/rpi.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: rin Date: Tue Dec 1 04:21:10 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: rpi_inst.conf Log Message: rpi.img: Bump boot partition in a similar manner to other images. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/distrib/utils/embedded/conf/rpi_inst.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/rpi_inst.conf diff -u src/distrib/utils/embedded/conf/rpi_inst.conf:1.16 src/distrib/utils/embedded/conf/rpi_inst.conf:1.17 --- src/distrib/utils/embedded/conf/rpi_inst.conf:1.16 Mon May 18 21:19:34 2020 +++ src/distrib/utils/embedded/conf/rpi_inst.conf Tue Dec 1 04:21:10 2020 @@ -1,4 +1,4 @@ -# $NetBSD: rpi_inst.conf,v 1.16 2020/05/18 21:19:34 jmcneill Exp $ +# $NetBSD: rpi_inst.conf,v 1.17 2020/12/01 04:21:10 rin Exp $ # Raspberry Pi customization script used by mkimage # @@ -12,8 +12,8 @@ image=$HOME/${board}.img swap=8 extra=8 # spare space -boot=112 init=8 +boot=$(( 192 - ${init} )) size=$(( 10485760 + ${swap} * 1024 * 512 + ${boot} * 1024 * 512 + ${init} * 1024 * 512 )) msdosid=14
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: rin Date: Tue Dec 1 04:21:10 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: rpi_inst.conf Log Message: rpi.img: Bump boot partition in a similar manner to other images. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/distrib/utils/embedded/conf/rpi_inst.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Thu May 28 10:19:02 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: evbarm.conf Log Message: Allow config file to override hostname To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/distrib/utils/embedded/conf/evbarm.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/evbarm.conf diff -u src/distrib/utils/embedded/conf/evbarm.conf:1.35 src/distrib/utils/embedded/conf/evbarm.conf:1.36 --- src/distrib/utils/embedded/conf/evbarm.conf:1.35 Sun May 24 14:45:49 2020 +++ src/distrib/utils/embedded/conf/evbarm.conf Thu May 28 10:19:02 2020 @@ -1,4 +1,4 @@ -# $NetBSD: evbarm.conf,v 1.35 2020/05/24 14:45:49 jmcneill Exp $ +# $NetBSD: evbarm.conf,v 1.36 2020/05/28 10:19:02 jmcneill Exp $ # evbarm shared config # image=$HOME/${board}.img @@ -151,7 +151,7 @@ dev_exists() { } rc_configured=YES -hostname=${board} +hostname=${hostname:-${board}} no_swap=YES savecore=NO sshd=YES
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Thu May 28 10:19:02 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: evbarm.conf Log Message: Allow config file to override hostname To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/distrib/utils/embedded/conf/evbarm.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Wed May 27 21:53:04 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Log Message: Move back to MBR based images for armv7 because Amlogic's bootloader (for Amlogic S805 based boards) needs to be installed to sector 1, which conflicts with the GPT header. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/distrib/utils/embedded/conf/armv7.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Wed May 27 21:53:04 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Log Message: Move back to MBR based images for armv7 because Amlogic's bootloader (for Amlogic S805 based boards) needs to be installed to sector 1, which conflicts with the GPT header. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/distrib/utils/embedded/conf/armv7.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/armv7.conf diff -u src/distrib/utils/embedded/conf/armv7.conf:1.43 src/distrib/utils/embedded/conf/armv7.conf:1.44 --- src/distrib/utils/embedded/conf/armv7.conf:1.43 Mon May 25 11:11:52 2020 +++ src/distrib/utils/embedded/conf/armv7.conf Wed May 27 21:53:04 2020 @@ -1,14 +1,9 @@ -# $NetBSD: armv7.conf,v 1.43 2020/05/25 11:11:52 jmcneill Exp $ +# $NetBSD: armv7.conf,v 1.44 2020/05/27 21:53:04 jmcneill Exp $ # ARMv7 customization script used by mkimage # board=armv7 console=fb resize=true -gpt=true -gpt_hybrid=true -gpt_create_flags="-p 16" -gpt_label_efi="EFI" -gpt_label_ffs="netbsd-root" . ${DIR}/conf/evbarm.conf @@ -59,7 +54,7 @@ populate_rpi() { # The GENERIC .img kernel img is used for RPI2 if [ -f "${mnt}/boot/netbsd-GENERIC.img" ]; then cat > "${mnt}/boot/cmdline.txt" << EOF -root=NAME=${gpt_label_ffs} console=${console} +root=ld0a console=${console} #fb=1280x1024 # to select a mode, otherwise try EDID #fb=disable # to disable fb completely EOF
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Wed May 27 11:02:52 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: rpi.conf Log Message: Fix kernel= order, add pi0w conditional and comments To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/distrib/utils/embedded/conf/rpi.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Wed May 27 11:02:52 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: rpi.conf Log Message: Fix kernel= order, add pi0w conditional and comments To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/distrib/utils/embedded/conf/rpi.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/rpi.conf diff -u src/distrib/utils/embedded/conf/rpi.conf:1.37 src/distrib/utils/embedded/conf/rpi.conf:1.38 --- src/distrib/utils/embedded/conf/rpi.conf:1.37 Wed May 27 10:56:59 2020 +++ src/distrib/utils/embedded/conf/rpi.conf Wed May 27 11:02:52 2020 @@ -1,4 +1,4 @@ -# $NetBSD: rpi.conf,v 1.37 2020/05/27 10:56:59 jmcneill Exp $ +# $NetBSD: rpi.conf,v 1.38 2020/05/27 11:02:52 jmcneill Exp $ # Raspberry Pi customization script used by mkimage # @@ -63,12 +63,17 @@ cmdline=../cmdline.txt # UART settings, see https://www.raspberrypi.org/documentation/configuration/uart.md enable_uart=1 force_turbo=0 +# Default kernel for BCM2836 and later +kernel=/kernel7.img +# Override kernel for BCM2835 based boards [pi0] kernel=/kernel.img +[pi0w] +kernel=/kernel.img [pi1] kernel=/kernel.img [all] -kernel=/kernel7.img +# EOF echo "${bar} kernel ${kernel} ${bar}"
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Wed May 27 10:56:59 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: rpi.conf Log Message: Conditionally boot kernel.img or kernel7.img depending on board To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/distrib/utils/embedded/conf/rpi.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Wed May 27 10:56:59 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: rpi.conf Log Message: Conditionally boot kernel.img or kernel7.img depending on board To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/distrib/utils/embedded/conf/rpi.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/rpi.conf diff -u src/distrib/utils/embedded/conf/rpi.conf:1.36 src/distrib/utils/embedded/conf/rpi.conf:1.37 --- src/distrib/utils/embedded/conf/rpi.conf:1.36 Mon May 18 21:19:34 2020 +++ src/distrib/utils/embedded/conf/rpi.conf Wed May 27 10:56:59 2020 @@ -1,4 +1,4 @@ -# $NetBSD: rpi.conf,v 1.36 2020/05/18 21:19:34 jmcneill Exp $ +# $NetBSD: rpi.conf,v 1.37 2020/05/27 10:56:59 jmcneill Exp $ # Raspberry Pi customization script used by mkimage # @@ -60,10 +60,15 @@ EOF upstream_kernel=1 os_prefix=dtb/ cmdline=../cmdline.txt -kernel=/kernel.img # UART settings, see https://www.raspberrypi.org/documentation/configuration/uart.md enable_uart=1 force_turbo=0 +[pi0] +kernel=/kernel.img +[pi1] +kernel=/kernel.img +[all] +kernel=/kernel7.img EOF echo "${bar} kernel ${kernel} ${bar}"
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Mon May 25 11:11:52 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Log Message: No need to rename netbsd-GENERIC.img to kernel7.img To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/distrib/utils/embedded/conf/armv7.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Mon May 25 11:11:52 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Log Message: No need to rename netbsd-GENERIC.img to kernel7.img To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/distrib/utils/embedded/conf/armv7.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/armv7.conf diff -u src/distrib/utils/embedded/conf/armv7.conf:1.42 src/distrib/utils/embedded/conf/armv7.conf:1.43 --- src/distrib/utils/embedded/conf/armv7.conf:1.42 Mon May 25 11:06:49 2020 +++ src/distrib/utils/embedded/conf/armv7.conf Mon May 25 11:11:52 2020 @@ -1,4 +1,4 @@ -# $NetBSD: armv7.conf,v 1.42 2020/05/25 11:06:49 jmcneill Exp $ +# $NetBSD: armv7.conf,v 1.43 2020/05/25 11:11:52 jmcneill Exp $ # ARMv7 customization script used by mkimage # board=armv7 @@ -56,11 +56,8 @@ populate_rpi() { firmwaredir="${src}/external/broadcom/rpi-firmware/dist" firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf" - # The GENERIC .img kernel needs to be installed as kernel7.img for RPI2 + # The GENERIC .img kernel img is used for RPI2 if [ -f "${mnt}/boot/netbsd-GENERIC.img" ]; then - echo "${bar} renaming netbsd-GENERIC.img to kernel7.img ${bar}" - mv "${mnt}/boot/netbsd-GENERIC.img" "${mnt}/boot/kernel7.img" - cat > "${mnt}/boot/cmdline.txt" << EOF root=NAME=${gpt_label_ffs} console=${console} #fb=1280x1024 # to select a mode, otherwise try EDID @@ -72,7 +69,7 @@ EOF upstream_kernel=1 os_prefix=dtb/ cmdline=../cmdline.txt -kernel=/kernel7.img +kernel=/netbsd-GENERIC.img # Boot options, see https://www.raspberrypi.org/documentation/configuration/config-txt/boot.md kernel_address=0x0140 # UART settings, see https://www.raspberrypi.org/documentation/configuration/uart.md
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Mon May 25 11:06:49 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Log Message: Switch to GPT w/ hybrid MBR for armv7 images To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/distrib/utils/embedded/conf/armv7.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/armv7.conf diff -u src/distrib/utils/embedded/conf/armv7.conf:1.41 src/distrib/utils/embedded/conf/armv7.conf:1.42 --- src/distrib/utils/embedded/conf/armv7.conf:1.41 Mon May 18 21:19:34 2020 +++ src/distrib/utils/embedded/conf/armv7.conf Mon May 25 11:06:49 2020 @@ -1,9 +1,14 @@ -# $NetBSD: armv7.conf,v 1.41 2020/05/18 21:19:34 jmcneill Exp $ +# $NetBSD: armv7.conf,v 1.42 2020/05/25 11:06:49 jmcneill Exp $ # ARMv7 customization script used by mkimage # board=armv7 console=fb resize=true +gpt=true +gpt_hybrid=true +gpt_create_flags="-p 16" +gpt_label_efi="EFI" +gpt_label_ffs="netbsd-root" . ${DIR}/conf/evbarm.conf @@ -57,7 +62,7 @@ populate_rpi() { mv "${mnt}/boot/netbsd-GENERIC.img" "${mnt}/boot/kernel7.img" cat > "${mnt}/boot/cmdline.txt" << EOF -root=ld0a console=${console} +root=NAME=${gpt_label_ffs} console=${console} #fb=1280x1024 # to select a mode, otherwise try EDID #fb=disable # to disable fb completely EOF
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Mon May 25 11:06:49 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Log Message: Switch to GPT w/ hybrid MBR for armv7 images To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/distrib/utils/embedded/conf/armv7.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Sun May 24 18:44:47 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: arm64.conf Log Message: Enable GPT support w/ hybrid MBR for Raspberry Pi compatibility. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/distrib/utils/embedded/conf/arm64.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/arm64.conf diff -u src/distrib/utils/embedded/conf/arm64.conf:1.10 src/distrib/utils/embedded/conf/arm64.conf:1.11 --- src/distrib/utils/embedded/conf/arm64.conf:1.10 Mon May 18 21:19:34 2020 +++ src/distrib/utils/embedded/conf/arm64.conf Sun May 24 18:44:46 2020 @@ -1,9 +1,14 @@ -# $NetBSD: arm64.conf,v 1.10 2020/05/18 21:19:34 jmcneill Exp $ +# $NetBSD: arm64.conf,v 1.11 2020/05/24 18:44:46 jmcneill Exp $ # ARM64 customization script used by mkimage # board=arm64 console=fb resize=true +gpt=true +gpt_hybrid=true +gpt_create_flags="-p 16" +gpt_label_efi="EFI" +gpt_label_ffs="netbsd-root" . ${DIR}/conf/evbarm.conf @@ -52,11 +57,7 @@ populate_rpi() { firmwarefiles="LICENCE.broadcom bootcode.bin fixup4cd.dat fixup4.dat fixup_cd.dat fixup.dat start4cd.elf start4.elf start_cd.elf start.elf" cat > "${mnt}/boot/cmdline.txt" << EOF -root=ld0a console=${console} -EOF - - cat > "${mnt}/boot/cmdline-pi4.txt" << EOF -root=ld1a console=${console} +root=NAME=${gpt_label_ffs} console=${console} EOF cat > "${mnt}/boot/config.txt" << EOF @@ -70,11 +71,6 @@ kernel=/netbsd.img kernel_address=0x20 enable_uart=1 force_turbo=0 -# -[pi4] -cmdline=../../cmdline-pi4.txt -# -[all] EOF echo "${bar} installing firmware files ${bar}"
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Sun May 24 18:44:47 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: arm64.conf Log Message: Enable GPT support w/ hybrid MBR for Raspberry Pi compatibility. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/distrib/utils/embedded/conf/arm64.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: jmcneill Date: Sun May 24 18:43:40 UTC 2020 Modified Files: src/distrib/utils/embedded: mkimage src/distrib/utils/embedded/files: resize_gpt Log Message: Add support for hybrid MBR/GPT images. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/distrib/utils/embedded/mkimage cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/files/resize_gpt Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/mkimage diff -u src/distrib/utils/embedded/mkimage:1.73 src/distrib/utils/embedded/mkimage:1.74 --- src/distrib/utils/embedded/mkimage:1.73 Sun May 24 14:45:49 2020 +++ src/distrib/utils/embedded/mkimage Sun May 24 18:43:39 2020 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mkimage,v 1.73 2020/05/24 14:45:49 jmcneill Exp $ +# $NetBSD: mkimage,v 1.74 2020/05/24 18:43:39 jmcneill Exp $ # # Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -149,6 +149,7 @@ fi resize=false gpt=false +gpt_hybrid=false . "${DIR}/conf/${h}.conf" release="/usr/obj/${MACHINE}/release" @@ -271,19 +272,28 @@ do done if $gpt; then + if $gpt_hybrid; then + gpt_flags="-H" + fi initsecs=$((${init} * 1024)) bootsecs=$((${boot} * 1024)) ffsstart="$(getsectors ${ffsoffset})" echo ${bar} Clearing existing partitions ${bar} - ${GPT} ${image} destroy || true + ${GPT} ${gpt_flags} ${image} destroy || true echo ${bar} Creating partitions ${bar} - ${GPT} ${image} create ${gpt_create_flags} - ${GPT} ${image} add -b ${initsecs} -s ${bootsecs} -l ${gpt_label_efi:-EFI} -t efi - ${GPT} ${image} set -a required -i 1 - ${GPT} ${image} add -a 4m -b ${ffsstart} -l ${gpt_label_ffs:-netbsd-root} -t ffs - ${GPT} ${image} show + ${GPT} ${gpt_flags} ${image} create ${gpt_create_flags} + ${GPT} ${gpt_flags} ${image} add -b ${initsecs} -s ${bootsecs} -l ${gpt_label_efi:-EFI} -t efi + ${GPT} ${gpt_flags} ${image} set -a required -i 1 + ${GPT} ${gpt_flags} ${image} add -a 4m -b ${ffsstart} -l ${gpt_label_ffs:-netbsd-root} -t ffs + ${GPT} ${gpt_flags} ${image} show + if $gpt_hybrid; then + echo ${bar} Creating hybrid MBR ${bar} + ${FDISK} -f -g -u -0 -a -s ${msdosid}/${initsecs}/${bootsecs} -F ${image} + ${FDISK} -f -g -u -3 -s 238/1/$((${initsecs} - 1)) -F ${image} + ${FDISK} -F ${image} + fi else if [ -n "${msdosid}" ]; then echo ${bar} Running fdisk ${bar} Index: src/distrib/utils/embedded/files/resize_gpt diff -u src/distrib/utils/embedded/files/resize_gpt:1.1 src/distrib/utils/embedded/files/resize_gpt:1.2 --- src/distrib/utils/embedded/files/resize_gpt:1.1 Sun May 24 14:45:49 2020 +++ src/distrib/utils/embedded/files/resize_gpt Sun May 24 18:43:39 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: resize_gpt,v 1.1 2020/05/24 14:45:49 jmcneill Exp $ +# $NetBSD: resize_gpt,v 1.2 2020/05/24 18:43:39 jmcneill Exp $ # # PROVIDE: resize_gpt @@ -28,8 +28,8 @@ resize_gpt_start() BLOCK_DEVICE=$(dkctl ${ROOT_DEVICE} getwedgeinfo | head -1 | sed 's/://' | awk '{ print $3; }') - gpt resizedisk -q ${BLOCK_DEVICE} - gpt resize -a 4m -i 2 -q ${BLOCK_DEVICE} + gpt -H resizedisk -q ${BLOCK_DEVICE} + gpt -H resize -a 4m -i 2 -q ${BLOCK_DEVICE} return }
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: jmcneill Date: Sun May 24 18:43:40 UTC 2020 Modified Files: src/distrib/utils/embedded: mkimage src/distrib/utils/embedded/files: resize_gpt Log Message: Add support for hybrid MBR/GPT images. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/distrib/utils/embedded/mkimage cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/files/resize_gpt Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: jmcneill Date: Sun May 24 14:45:49 UTC 2020 Modified Files: src/distrib/utils/embedded: mkimage src/distrib/utils/embedded/conf: evbarm.conf Added Files: src/distrib/utils/embedded/files: resize_gpt Log Message: Add GPT support to mkimage. To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/distrib/utils/embedded/mkimage cvs rdiff -u -r1.34 -r1.35 src/distrib/utils/embedded/conf/evbarm.conf cvs rdiff -u -r0 -r1.1 src/distrib/utils/embedded/files/resize_gpt Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: jmcneill Date: Sun May 24 14:45:49 UTC 2020 Modified Files: src/distrib/utils/embedded: mkimage src/distrib/utils/embedded/conf: evbarm.conf Added Files: src/distrib/utils/embedded/files: resize_gpt Log Message: Add GPT support to mkimage. To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/distrib/utils/embedded/mkimage cvs rdiff -u -r1.34 -r1.35 src/distrib/utils/embedded/conf/evbarm.conf cvs rdiff -u -r0 -r1.1 src/distrib/utils/embedded/files/resize_gpt Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/mkimage diff -u src/distrib/utils/embedded/mkimage:1.72 src/distrib/utils/embedded/mkimage:1.73 --- src/distrib/utils/embedded/mkimage:1.72 Mon May 18 21:19:34 2020 +++ src/distrib/utils/embedded/mkimage Sun May 24 14:45:49 2020 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mkimage,v 1.72 2020/05/18 21:19:34 jmcneill Exp $ +# $NetBSD: mkimage,v 1.73 2020/05/24 14:45:49 jmcneill Exp $ # # Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -54,6 +54,7 @@ PROG="$(basename "$0")" MAKE=${TOOL_MAKE:-make} DISKLABEL=${TOOL_DISKLABEL:-disklabel} FDISK=${TOOL_FDISK:-fdisk} +GPT=${TOOL_GPT:-gpt} MAKEFS=${TOOL_MAKEFS:-makefs} MTREE=${TOOL_MTREE:-mtree} INSTALLBOOT=${TOOL_INSTALLBOOT:-installboot} @@ -147,6 +148,7 @@ then fi resize=false +gpt=false . "${DIR}/conf/${h}.conf" release="/usr/obj/${MACHINE}/release" @@ -268,32 +270,48 @@ do compare="$((${newsize} * 2 * 1024))" done -if [ -n "${msdosid}" ]; then - echo ${bar} Running fdisk ${bar} +if $gpt; then initsecs=$((${init} * 1024)) bootsecs=$((${boot} * 1024)) - ${FDISK} -f -i ${image} - ${FDISK} -f -a -u -0 -s ${msdosid}/${initsecs}/${bootsecs} -F ${image} - if [ -z "${bootonly}" ]; then - ffsstart="$(getsectors ${ffsoffset})" - imagesize="$(getsize "${image}")" - imagesecs="$(getsectors ${imagesize})" - ffssize="$(expr ${imagesecs} - ${ffsstart})" - ${FDISK} -f -u -1 -s 169/${ffsstart}/${ffssize} -F ${image} - fi + ffsstart="$(getsectors ${ffsoffset})" + + echo ${bar} Clearing existing partitions ${bar} + ${GPT} ${image} destroy || true - echo ${bar} Adding label ${bar} - make_label > ${tmp}/label - ${DISKLABEL} -R -F ${image} ${tmp}/label -elif [ -n "${netbsdid}" ]; then - echo ${bar} Adding label ${bar} - make_label > ${tmp}/label - ${DISKLABEL} -R -F ${image} ${tmp}/label - - echo ${bar} Running fdisk ${bar} - ${FDISK} -f -i ${image} - ${FDISK} -f -a -u -0 -s 169/${init} ${image} - ${INSTALLBOOT} -f -v ${image} ${release}/usr/mdec/bootxx_ffsv1 + echo ${bar} Creating partitions ${bar} + ${GPT} ${image} create ${gpt_create_flags} + ${GPT} ${image} add -b ${initsecs} -s ${bootsecs} -l ${gpt_label_efi:-EFI} -t efi + ${GPT} ${image} set -a required -i 1 + ${GPT} ${image} add -a 4m -b ${ffsstart} -l ${gpt_label_ffs:-netbsd-root} -t ffs + ${GPT} ${image} show +else + if [ -n "${msdosid}" ]; then + echo ${bar} Running fdisk ${bar} + initsecs=$((${init} * 1024)) + bootsecs=$((${boot} * 1024)) + ${FDISK} -f -i ${image} + ${FDISK} -f -a -u -0 -s ${msdosid}/${initsecs}/${bootsecs} -F ${image} + if [ -z "${bootonly}" ]; then + ffsstart="$(getsectors ${ffsoffset})" + imagesize="$(getsize "${image}")" + imagesecs="$(getsectors ${imagesize})" + ffssize="$(expr ${imagesecs} - ${ffsstart})" + ${FDISK} -f -u -1 -s 169/${ffsstart}/${ffssize} -F ${image} + fi + + echo ${bar} Adding label ${bar} + make_label > ${tmp}/label + ${DISKLABEL} -R -F ${image} ${tmp}/label + elif [ -n "${netbsdid}" ]; then + echo ${bar} Adding label ${bar} + make_label > ${tmp}/label + ${DISKLABEL} -R -F ${image} ${tmp}/label + + echo ${bar} Running fdisk ${bar} + ${FDISK} -f -i ${image} + ${FDISK} -f -a -u -0 -s 169/${init} ${image} + ${INSTALLBOOT} -f -v ${image} ${release}/usr/mdec/bootxx_ffsv1 + fi fi if $compress; then Index: src/distrib/utils/embedded/conf/evbarm.conf diff -u src/distrib/utils/embedded/conf/evbarm.conf:1.34 src/distrib/utils/embedded/conf/evbarm.conf:1.35 --- src/distrib/utils/embedded/conf/evbarm.conf:1.34 Sun Dec 1 15:07:04 2019 +++ src/distrib/utils/embedded/conf/evbarm.conf Sun May 24 14:45:49 2020 @@ -1,4 +1,4 @@ -# $NetBSD: evbarm.conf,v 1.34 2019/12/01 15:07:04 jmcneill Exp $ +# $NetBSD: evbarm.conf,v 1.35 2020/05/24 14:45:49 jmcneill Exp $ # evbarm shared config # image=$HOME/${board}.img @@ -13,6 +13,12 @@ ffsoffset=$(( (${init} + ${boot}) / 2 )) size=0 # autocompute msdosid=12 +if $gpt; then + partition_type="gpt" +else + partition_type="disklabel" +fi + mkdir -p ${mnt}/boot make_label_evbarm() { @@ -59,6 +65,19 @@ drivedata: 0 EOF } +make_fstab_evbarm_gpt() { + cat > ${mnt}/etc/fstab << EOF +# NetBSD /etc/fstab +# See /usr/share/examples/fstab/ for more examples. +NAME=${gpt_label_ffs:-netbsd-root} / ffs rw,noatime 1 1
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Sun Feb 23 10:56:03 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: arm64.conf Log Message: RPi4 has a different root device, so use config.txt conditionals to load an alternate cmdline txt file (cmdline-pi4.txt) on these boards. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/distrib/utils/embedded/conf/arm64.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/arm64.conf diff -u src/distrib/utils/embedded/conf/arm64.conf:1.8 src/distrib/utils/embedded/conf/arm64.conf:1.9 --- src/distrib/utils/embedded/conf/arm64.conf:1.8 Mon Dec 16 11:00:30 2019 +++ src/distrib/utils/embedded/conf/arm64.conf Sun Feb 23 10:56:03 2020 @@ -1,4 +1,4 @@ -# $NetBSD: arm64.conf,v 1.8 2019/12/16 11:00:30 skrll Exp $ +# $NetBSD: arm64.conf,v 1.9 2020/02/23 10:56:03 jmcneill Exp $ # ARM64 customization script used by mkimage # board=arm64 @@ -73,6 +73,10 @@ populate_rpi() { root=ld0a console=${console} EOF + cat > "${mnt}/boot/cmdline-pi4.txt" << EOF +root=ld1a console=${console} +EOF + cat > "${mnt}/boot/config.txt" << EOF # upstream_kernel=1 @@ -82,6 +86,11 @@ kernel=netbsd.img kernel_address=0x20 enable_uart=1 force_turbo=0 +# +[pi4] +cmdline=cmdline-pi4.txt +# +[all] EOF echo "${bar} installing firmware files ${bar}"
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Sun Feb 23 10:56:03 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: arm64.conf Log Message: RPi4 has a different root device, so use config.txt conditionals to load an alternate cmdline txt file (cmdline-pi4.txt) on these boards. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/distrib/utils/embedded/conf/arm64.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: skrll Date: Wed Jan 8 20:49:22 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: rpi_inst.conf Log Message: Use fat16 as the partition is too small for fat32. from Harold Gutch To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/distrib/utils/embedded/conf/rpi_inst.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: skrll Date: Wed Jan 8 20:49:22 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: rpi_inst.conf Log Message: Use fat16 as the partition is too small for fat32. from Harold Gutch To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/distrib/utils/embedded/conf/rpi_inst.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/rpi_inst.conf diff -u src/distrib/utils/embedded/conf/rpi_inst.conf:1.14 src/distrib/utils/embedded/conf/rpi_inst.conf:1.15 --- src/distrib/utils/embedded/conf/rpi_inst.conf:1.14 Sun Jan 5 16:41:07 2020 +++ src/distrib/utils/embedded/conf/rpi_inst.conf Wed Jan 8 20:49:22 2020 @@ -1,4 +1,4 @@ -# $NetBSD: rpi_inst.conf,v 1.14 2020/01/05 16:41:07 skrll Exp $ +# $NetBSD: rpi_inst.conf,v 1.15 2020/01/08 20:49:22 skrll Exp $ # Raspberry Pi customization script used by mkimage # @@ -16,7 +16,7 @@ boot=112 init=8 size=$(( 10485760 + ${swap} * 1024 * 512 + ${boot} * 1024 * 512 + ${init} * 1024 * 512 )) -msdosid=12 +msdosid=14 make_label() { make_label_evbarm
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: skrll Date: Sun Jan 5 16:41:08 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: rpi_inst.conf Log Message: Use make_label_evbarm instead of home grown To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/distrib/utils/embedded/conf/rpi_inst.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/rpi_inst.conf diff -u src/distrib/utils/embedded/conf/rpi_inst.conf:1.13 src/distrib/utils/embedded/conf/rpi_inst.conf:1.14 --- src/distrib/utils/embedded/conf/rpi_inst.conf:1.13 Wed Jan 1 14:16:51 2020 +++ src/distrib/utils/embedded/conf/rpi_inst.conf Sun Jan 5 16:41:07 2020 @@ -1,4 +1,4 @@ -# $NetBSD: rpi_inst.conf,v 1.13 2020/01/01 14:16:51 skrll Exp $ +# $NetBSD: rpi_inst.conf,v 1.14 2020/01/05 16:41:07 skrll Exp $ # Raspberry Pi customization script used by mkimage # @@ -19,50 +19,7 @@ size=$(( 10485760 + ${swap} * 1024 * 512 msdosid=12 make_label() { - # compute all sizes in terms of sectors - local totalsize=$(( ${newsize} * 1024 * 2 / 512 )) - - local swapsize=$(( ${swap} * 1024 )) - local bootsize=$(( ${boot} * 1024 )) - - local bootoffset=$(( ${init} * 1024 )) - local swapoffset=$(( ${bootoffset} + ${bootsize} )) - - local asize=$(( ${totalsize} - ${swapsize} - ${bootsize} - ${bootoffset} )) - local aoffset=$(( ${swapoffset} + ${swapsize} )) - - local bps=512 - local spt=32 - local tpc=64 - local spc=2048 - local cylinders=$(( ${totalsize} / ${spc} )) - - cat << EOF -type: SCSI -disk: STORAGE DEVICE -label: fictitious -flags: removable -bytes/sector: ${bps} -sectors/track: ${spt} -tracks/cylinder: ${tpc} -sectors/cylinder: ${spc} -cylinders: ${cylinders} -total sectors: ${totalsize} -rpm: 3600 -interleave: 1 -trackskew: 0 -cylinderskew: 0 -headswitch: 0 # microseconds -track-to-track seek: 0 # microseconds -drivedata: 0 - -8 partitions: -# size offsetfstype [fsize bsize cpg/sgs] - a: ${asize} ${aoffset}4.2BSD ${fsize} ${bsize} 0 # - b: ${swapsize} ${swapoffset} swap # - d: ${totalsize} 0 unused 0 0 # - e: ${bootsize} ${bootoffset} MSDOS# -EOF + make_label_evbarm } customize() {
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: skrll Date: Sun Jan 5 16:41:08 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: rpi_inst.conf Log Message: Use make_label_evbarm instead of home grown To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/distrib/utils/embedded/conf/rpi_inst.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: skrll Date: Wed Jan 1 14:16:51 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: rpi_inst.conf Log Message: upstream_kernel=1 is required with new firmware/kernel. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/distrib/utils/embedded/conf/rpi_inst.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/rpi_inst.conf diff -u src/distrib/utils/embedded/conf/rpi_inst.conf:1.12 src/distrib/utils/embedded/conf/rpi_inst.conf:1.13 --- src/distrib/utils/embedded/conf/rpi_inst.conf:1.12 Mon Dec 16 11:00:30 2019 +++ src/distrib/utils/embedded/conf/rpi_inst.conf Wed Jan 1 14:16:51 2020 @@ -1,4 +1,4 @@ -# $NetBSD: rpi_inst.conf,v 1.12 2019/12/16 11:00:30 skrll Exp $ +# $NetBSD: rpi_inst.conf,v 1.13 2020/01/01 14:16:51 skrll Exp $ # Raspberry Pi customization script used by mkimage # @@ -86,6 +86,8 @@ root=ld0a console=fb EOF cat > ${mnt}/boot/config.txt << EOF +# +upstream_kernel=1 # UART settings, see https://www.raspberrypi.org/documentation/configuration/uart.md enable_uart=1 force_turbo=0
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: skrll Date: Wed Jan 1 14:16:51 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: rpi_inst.conf Log Message: upstream_kernel=1 is required with new firmware/kernel. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/distrib/utils/embedded/conf/rpi_inst.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: skrll Date: Mon Dec 16 08:01:20 UTC 2019 Modified Files: src/distrib/utils/embedded/conf: arm64.conf Log Message: Fix whitespace in a comment To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/distrib/utils/embedded/conf/arm64.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/arm64.conf diff -u src/distrib/utils/embedded/conf/arm64.conf:1.6 src/distrib/utils/embedded/conf/arm64.conf:1.7 --- src/distrib/utils/embedded/conf/arm64.conf:1.6 Sun Mar 3 11:44:18 2019 +++ src/distrib/utils/embedded/conf/arm64.conf Mon Dec 16 08:01:20 2019 @@ -1,4 +1,4 @@ -# $NetBSD: arm64.conf,v 1.6 2019/03/03 11:44:18 jmcneill Exp $ +# $NetBSD: arm64.conf,v 1.7 2019/12/16 08:01:20 skrll Exp $ # ARM64 customization script used by mkimage # board=arm64 @@ -101,7 +101,7 @@ populate() { kernels="" k="$kernel_GENERIC64" - # .imgkernel + # .img kernel f="${kernel}/netbsd-${k}.img.gz" test -f "${f}" && kernels="${kernels} ${f}"
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: skrll Date: Mon Dec 16 08:01:20 UTC 2019 Modified Files: src/distrib/utils/embedded/conf: arm64.conf Log Message: Fix whitespace in a comment To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/distrib/utils/embedded/conf/arm64.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Sun Dec 1 15:07:04 UTC 2019 Modified Files: src/distrib/utils/embedded/conf: evbarm.conf Log Message: Remove the pretty much useless 128MB swap partition from the arm images. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/distrib/utils/embedded/conf/evbarm.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/evbarm.conf diff -u src/distrib/utils/embedded/conf/evbarm.conf:1.33 src/distrib/utils/embedded/conf/evbarm.conf:1.34 --- src/distrib/utils/embedded/conf/evbarm.conf:1.33 Tue Jun 11 10:50:57 2019 +++ src/distrib/utils/embedded/conf/evbarm.conf Sun Dec 1 15:07:04 2019 @@ -1,15 +1,14 @@ -# $NetBSD: evbarm.conf,v 1.33 2019/06/11 10:50:57 mrg Exp $ +# $NetBSD: evbarm.conf,v 1.34 2019/12/01 15:07:04 jmcneill Exp $ # evbarm shared config # image=$HOME/${board}.img MACHINE=evbarm -swap=256 extra=48 # spare space init=32 boot=$((192 - ${init})) -ffsoffset=$(( (${init} + ${boot} + ${swap}) / 2 ))m +ffsoffset=$(( (${init} + ${boot}) / 2 ))m size=0 # autocompute msdosid=12 @@ -20,14 +19,12 @@ make_label_evbarm() { # compute all sizes in terms of sectors local totalsize=$(( ${newsize} * 1024 * 2 / 512 )) - local swapsize=$(( ${swap} * 1024 )) local bootsize=$(( ${boot} * 1024 )) local bootoffset=$(( ${init} * 1024 )) - local swapoffset=$(( ${bootoffset} + ${bootsize} )) - local asize=$(( ${totalsize} - ${swapsize} - ${bootsize} - ${bootoffset} )) - local aoffset=$(( ${swapoffset} + ${swapsize} )) + local asize=$(( ${totalsize} - ${bootsize} - ${bootoffset} )) + local aoffset=$(( ${bootoffset} + ${bootsize} )) local bps=512 local spt=32 @@ -57,7 +54,6 @@ drivedata: 0 8 partitions: # size offsetfstype [fsize bsize cpg/sgs] a: ${asize} ${aoffset}4.2BSD ${fsize} ${bsize} 0 # - b: ${swapsize} ${swapoffset} swap # c: ${totalsize} 0 unused 0 0 # e: ${bootsize} ${bootoffset} MSDOS# EOF @@ -68,7 +64,6 @@ make_fstab_evbarm_normal() { # NetBSD /etc/fstab # See /usr/share/examples/fstab/ for more examples. ROOT.a / ffs rw,noatime 1 1 -ROOT.b none swap sw 0 0 ROOT.e /boot msdos rw 1 1 kernfs /kern kernfs rw ptyfs /dev/pts ptyfs rw @@ -85,7 +80,6 @@ make_fstab_evbarm_minwrites() { # NetBSD /etc/fstab # See /usr/share/examples/fstab/ for more examples. ROOT.a / ffs rw,log,noatime,nodevmtime 1 1 -ROOT.b none swap sw 0 0 ROOT.e /boot msdos rw 1 1 kernfs /kern kernfs rw ptyfs /dev/pts ptyfs rw @@ -137,6 +131,8 @@ dev_exists() { rc_configured=YES hostname=${board} +no_swap=YES +savecore=NO sshd=YES dhcpcd=YES ntpd=YES
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Sun Dec 1 15:07:04 UTC 2019 Modified Files: src/distrib/utils/embedded/conf: evbarm.conf Log Message: Remove the pretty much useless 128MB swap partition from the arm images. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/distrib/utils/embedded/conf/evbarm.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Wed Oct 30 21:43:42 UTC 2019 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Log Message: Move omap3 dtb files to /boot/dtb To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/distrib/utils/embedded/conf/armv7.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/armv7.conf diff -u src/distrib/utils/embedded/conf/armv7.conf:1.38 src/distrib/utils/embedded/conf/armv7.conf:1.39 --- src/distrib/utils/embedded/conf/armv7.conf:1.38 Wed Oct 30 14:34:30 2019 +++ src/distrib/utils/embedded/conf/armv7.conf Wed Oct 30 21:43:42 2019 @@ -1,4 +1,4 @@ -# $NetBSD: armv7.conf,v 1.38 2019/10/30 14:34:30 martin Exp $ +# $NetBSD: armv7.conf,v 1.39 2019/10/30 21:43:42 jmcneill Exp $ # ARMv7 customization script used by mkimage # board=armv7 @@ -143,7 +143,7 @@ populate() { for k in ${kernels}; do tgt="$(basename ${k} | sed 's/\.gz$//')" case "${tgt}" in - sun*.dtb|am335x-*.dtb|meson8b-*.dtb|tegra*.dtb|vexpress*.dtb) + sun*.dtb|am335x-*.dtb|omap3-*.dtb|meson8b-*.dtb|tegra*.dtb|vexpress*.dtb) pfx="dtb/";; *) pfx=;;
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Wed Oct 30 21:43:42 UTC 2019 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Log Message: Move omap3 dtb files to /boot/dtb To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/distrib/utils/embedded/conf/armv7.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: martin Date: Wed Oct 30 14:34:30 UTC 2019 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Log Message: Remove debug output, fix a progress message To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/distrib/utils/embedded/conf/armv7.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: martin Date: Wed Oct 30 14:34:30 UTC 2019 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Log Message: Remove debug output, fix a progress message To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/distrib/utils/embedded/conf/armv7.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/armv7.conf diff -u src/distrib/utils/embedded/conf/armv7.conf:1.37 src/distrib/utils/embedded/conf/armv7.conf:1.38 --- src/distrib/utils/embedded/conf/armv7.conf:1.37 Wed Oct 30 12:28:32 2019 +++ src/distrib/utils/embedded/conf/armv7.conf Wed Oct 30 14:34:30 2019 @@ -1,4 +1,4 @@ -# $NetBSD: armv7.conf,v 1.37 2019/10/30 12:28:32 martin Exp $ +# $NetBSD: armv7.conf,v 1.38 2019/10/30 14:34:30 martin Exp $ # ARMv7 customization script used by mkimage # board=armv7 @@ -148,7 +148,7 @@ populate() { *) pfx=;; esac - echo "${bar} installing ${k} to /boot/${tgt} (on ${mnt}, pfx=${pfx}) ${bar}" + echo "${bar} installing ${k} to /boot/${pfx}${tgt} ${bar}" case "${k}" in *.gz) ${GZIP_CMD} -dc "${k}" > "${mnt}/boot/${pfx}${tgt}"
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: martin Date: Wed Oct 30 14:16:15 UTC 2019 Modified Files: src/distrib/utils/embedded: mkimage Log Message: Derive the FAT type from the MBR partition type and pass it on to makefs when crating a msdos file system. To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/distrib/utils/embedded/mkimage Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: martin Date: Wed Oct 30 14:16:15 UTC 2019 Modified Files: src/distrib/utils/embedded: mkimage Log Message: Derive the FAT type from the MBR partition type and pass it on to makefs when crating a msdos file system. To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/distrib/utils/embedded/mkimage Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/mkimage diff -u src/distrib/utils/embedded/mkimage:1.70 src/distrib/utils/embedded/mkimage:1.71 --- src/distrib/utils/embedded/mkimage:1.70 Wed Oct 2 11:16:00 2019 +++ src/distrib/utils/embedded/mkimage Wed Oct 30 14:16:15 2019 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mkimage,v 1.70 2019/10/02 11:16:00 maya Exp $ +# $NetBSD: mkimage,v 1.71 2019/10/30 14:16:15 martin Exp $ # # Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -217,7 +217,14 @@ populate if [ -n "${msdosid}" ]; then echo ${bar} Populating msdos filesystem ${bar} - ${MAKEFS} -N ${release}/etc -t msdos -o volume_label=NETBSD \ + case $(( ${msdosid} )) in + 1) fat_opt=",fat_type=12";; + 4|6|14) fat_opt=",fat_type=16";; + 11|12) fat_opt=",fat_type=32";; + *) fat_opt=;; + esac + ${MAKEFS} -N ${release}/etc -t msdos \ + -o "volume_label=NETBSD${fat_opt}" \ -O $((${init} / 2))m -s $((${boot} / 2))m \ ${image} ${mnt}/boot fi
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: martin Date: Wed Oct 30 12:28:32 UTC 2019 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Log Message: Move a lot of *.dtb files to a dtb/ subdirectory on the FAT partition. Mkimage (eroneously) creates a FAT16 partition (despite the configuration asking for FAT32), and that has a root directory size limit. Idea from Jared. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/distrib/utils/embedded/conf/armv7.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: martin Date: Wed Oct 30 12:28:32 UTC 2019 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Log Message: Move a lot of *.dtb files to a dtb/ subdirectory on the FAT partition. Mkimage (eroneously) creates a FAT16 partition (despite the configuration asking for FAT32), and that has a root directory size limit. Idea from Jared. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/distrib/utils/embedded/conf/armv7.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/armv7.conf diff -u src/distrib/utils/embedded/conf/armv7.conf:1.36 src/distrib/utils/embedded/conf/armv7.conf:1.37 --- src/distrib/utils/embedded/conf/armv7.conf:1.36 Sun Oct 27 21:38:58 2019 +++ src/distrib/utils/embedded/conf/armv7.conf Wed Oct 30 12:28:32 2019 @@ -1,4 +1,4 @@ -# $NetBSD: armv7.conf,v 1.36 2019/10/27 21:38:58 jmcneill Exp $ +# $NetBSD: armv7.conf,v 1.37 2019/10/30 12:28:32 martin Exp $ # ARMv7 customization script used by mkimage # board=armv7 @@ -106,7 +106,7 @@ populate_amlogic() { ODROIDC-UBOOT-CONFIG setenv bootargs "awge0.mac-address=\${ethaddr}" -setenv bootcmd "fatload mmc 0:1 0x2100 ${odroidc1_kernelimg}; fatload mmc 0:1 0x2000 meson8b-odroidc1.dtb; bootm 0x2100 - 0x2000" +setenv bootcmd "fatload mmc 0:1 0x2100 ${odroidc1_kernelimg}; fatload mmc 0:1 0x2000 dtb/meson8b-odroidc1.dtb; bootm 0x2100 - 0x2000" run bootcmd EOF } @@ -135,16 +135,26 @@ populate() { done done + # "kernels" includes some .dtb files that should go into a separate + # directory + mkdir -p "${mnt}/boot/dtb" + # install kernels to /boot partition for k in ${kernels}; do tgt="$(basename ${k} | sed 's/\.gz$//')" - echo "${bar} installing ${k} to /boot/${tgt} ${bar}" + case "${tgt}" in + sun*.dtb|am335x-*.dtb|meson8b-*.dtb|tegra*.dtb|vexpress*.dtb) + pfx="dtb/";; + *) + pfx=;; + esac + echo "${bar} installing ${k} to /boot/${tgt} (on ${mnt}, pfx=${pfx}) ${bar}" case "${k}" in *.gz) - ${GZIP_CMD} -dc "${k}" > "${mnt}/boot/${tgt}" + ${GZIP_CMD} -dc "${k}" > "${mnt}/boot/${pfx}${tgt}" ;; *) - cp "${k}" "${mnt}/boot/${tgt}" + cp "${k}" "${mnt}/boot/${pfx}${tgt}" ;; esac || fail "Copy of ${k} to ${mnt}/boot/${tgt} failed"
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: jmcneill Date: Sun Oct 27 21:38:58 UTC 2019 Modified Files: src/distrib/utils/embedded/conf: armv7.conf src/distrib/utils/embedded/files: armv7_boot.cmd Log Message: Switch to GENERIC kernels only. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/distrib/utils/embedded/conf/armv7.conf cvs rdiff -u -r1.14 -r1.15 src/distrib/utils/embedded/files/armv7_boot.cmd Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: jmcneill Date: Sun Oct 27 21:38:58 UTC 2019 Modified Files: src/distrib/utils/embedded/conf: armv7.conf src/distrib/utils/embedded/files: armv7_boot.cmd Log Message: Switch to GENERIC kernels only. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/distrib/utils/embedded/conf/armv7.conf cvs rdiff -u -r1.14 -r1.15 src/distrib/utils/embedded/files/armv7_boot.cmd Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/armv7.conf diff -u src/distrib/utils/embedded/conf/armv7.conf:1.35 src/distrib/utils/embedded/conf/armv7.conf:1.36 --- src/distrib/utils/embedded/conf/armv7.conf:1.35 Sun Jul 21 16:05:24 2019 +++ src/distrib/utils/embedded/conf/armv7.conf Sun Oct 27 21:38:58 2019 @@ -1,4 +1,4 @@ -# $NetBSD: armv7.conf,v 1.35 2019/07/21 16:05:24 rin Exp $ +# $NetBSD: armv7.conf,v 1.36 2019/10/27 21:38:58 jmcneill Exp $ # ARMv7 customization script used by mkimage # board=armv7 @@ -7,10 +7,7 @@ resize=true . ${DIR}/conf/evbarm.conf -# altera, exynos, sunxi, tegra kernels_generic="GENERIC" -# non-FDTised / special kernels -kernels_beagle="BEAGLEBOARD BEAGLEBONE" make_label() { make_label_evbarm @@ -50,10 +47,6 @@ populate_common() { "${MKUBOOTIMAGE}" -A arm -C none -O netbsd -T script -a 0 -n "NetBSD/armv7 boot" "${mnt}/boot/boot.cmd" "${mnt}/boot/boot.scr" } -populate_beagle() { - : -} - populate_rpi() { firmwaredir="${src}/external/broadcom/rpi-firmware/dist" firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf" @@ -105,10 +98,6 @@ EOF >> "$tmp/selected_sets" } -populate_altera() { - : -} - populate_amlogic() { odroidc1_kernelimg=netbsd-GENERIC.ub @@ -122,19 +111,11 @@ run bootcmd EOF } -populate_sunxi() { - : -} - -populate_tegra() { - : -} - populate() { echo "${bar} looking for kernels in ${kernel} ${bar}" kernels="" # .ub kernels - for k in $kernels_generic $kernels_beagle; do + for k in $kernels_generic; do f="${kernel}/netbsd-${k}.ub.gz" test -f "${f}" && kernels="${kernels} ${f}" done @@ -170,12 +151,8 @@ populate() { done # board specific configuration - populate_altera populate_amlogic - populate_beagle populate_rpi - populate_sunxi - populate_tegra # common configuration populate_common Index: src/distrib/utils/embedded/files/armv7_boot.cmd diff -u src/distrib/utils/embedded/files/armv7_boot.cmd:1.14 src/distrib/utils/embedded/files/armv7_boot.cmd:1.15 --- src/distrib/utils/embedded/files/armv7_boot.cmd:1.14 Thu Apr 4 14:26:39 2019 +++ src/distrib/utils/embedded/files/armv7_boot.cmd Sun Oct 27 21:38:58 2019 @@ -1,21 +1,8 @@ -if test "${board}" = "am335x" ; then - setenv kernel netbsd-BEAGLEBONE.ub - setenv mmcpart 0:1 - setenv bootargs root=ld0a -else - setenv use_efi 1 -fi - if test "${soc}" = "tegra210" ; then # enable PCIe pci enum fi -if test "${use_efi}" = "1" ; then - setenv boot_scripts - setenv boot_script_dhcp - run distro_bootcmd -else - fatload mmc ${mmcpart} ${kernel_addr_r} ${kernel} - bootm ${kernel_addr_r} ${bootargs} -fi +setenv boot_scripts +setenv boot_script_dhcp +run distro_bootcmd
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: jmcneill Date: Sun Oct 27 21:35:02 UTC 2019 Modified Files: src/distrib/utils/embedded/files: armv7_boot_nonefi.cmd Log Message: No support for tegra210 in armv7 kernel To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd diff -u src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd:1.1 src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd:1.2 --- src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd:1.1 Sun Jul 21 16:05:24 2019 +++ src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd Sun Oct 27 21:35:02 2019 @@ -33,15 +33,6 @@ if test "${soc}" = "tegra124" ; then setenv mmcpart 1:1 setenv use_fdt 1 fi -if test "${soc}" = "tegra210" ; then - setenv kernel netbsd.ub - setenv bootargs root=wd0a - setenv mmcpart 1:1 - setenv use_fdt 1 - setenv fdtfile ${soc}-${board}.dtb - # enable PCIe - pci enum -fi if test "${kernel}" = "" ; then echo '>>>'
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: jmcneill Date: Sun Oct 27 21:35:02 UTC 2019 Modified Files: src/distrib/utils/embedded/files: armv7_boot_nonefi.cmd Log Message: No support for tegra210 in armv7 kernel To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: mlelstv Date: Sat Oct 5 09:25:11 UTC 2019 Modified Files: src/distrib/utils/embedded/files: creds_msdos Log Message: Fix typo To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/distrib/utils/embedded/files/creds_msdos Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/files/creds_msdos diff -u src/distrib/utils/embedded/files/creds_msdos:1.3 src/distrib/utils/embedded/files/creds_msdos:1.4 --- src/distrib/utils/embedded/files/creds_msdos:1.3 Wed Jun 12 03:06:48 2019 +++ src/distrib/utils/embedded/files/creds_msdos Sat Oct 5 09:25:11 2019 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: creds_msdos,v 1.3 2019/06/12 03:06:48 mrg Exp $ +# $NetBSD: creds_msdos,v 1.4 2019/10/05 09:25:11 mlelstv Exp $ # # Copyright (c) 2019 Matthew R. Green # All rights reserved. @@ -135,7 +135,7 @@ creds_msdos_start() local fstab_file=/etc/fstab if [ -z "${creds_msdos_partition}" ]; then - echo "Not looking for credientials on msdos" + echo "Not looking for credentials on msdos" return fi while read junk1 mp fstype junk2; do
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: mlelstv Date: Sat Oct 5 09:25:11 UTC 2019 Modified Files: src/distrib/utils/embedded/files: creds_msdos Log Message: Fix typo To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/distrib/utils/embedded/files/creds_msdos Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: rin Date: Sun Jul 21 16:05:24 UTC 2019 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Added Files: src/distrib/utils/embedded/files: armv7_boot_nonefi.cmd Log Message: Fallback to non-EFI boot script if EFI bootloader is absent. Note that we do not currently build EFI bootloader for earmv7hf-eb, as it requires little-endian version of toolchain. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/distrib/utils/embedded/conf/armv7.conf cvs rdiff -u -r0 -r1.1 src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/armv7.conf diff -u src/distrib/utils/embedded/conf/armv7.conf:1.34 src/distrib/utils/embedded/conf/armv7.conf:1.35 --- src/distrib/utils/embedded/conf/armv7.conf:1.34 Sat May 18 07:33:10 2019 +++ src/distrib/utils/embedded/conf/armv7.conf Sun Jul 21 16:05:24 2019 @@ -1,4 +1,4 @@ -# $NetBSD: armv7.conf,v 1.34 2019/05/18 07:33:10 skrll Exp $ +# $NetBSD: armv7.conf,v 1.35 2019/07/21 16:05:24 rin Exp $ # ARMv7 customization script used by mkimage # board=armv7 @@ -30,8 +30,8 @@ EOF } populate_common() { - # Install EFI bootloader if [ -f "${release}/usr/mdec/bootarm.efi" ]; then + # Install EFI bootloader mkdir -p "${mnt}/boot/EFI/BOOT" cp "${release}/usr/mdec/bootarm.efi" "${mnt}/boot/EFI/BOOT/bootarm.efi" @@ -39,10 +39,14 @@ populate_common() { ${GZIP_CMD} -dc ${kernel}/netbsd-${kernels_generic}.gz > "${mnt}/netbsd" echo "./netbsd type=file uname=root gname=wheel mode=0755" \ >> "$tmp/selected_sets" + + cp ${DIR}/files/armv7_boot.cmd ${mnt}/boot/boot.cmd + else + # Fallback to non-EFI boot command + cp ${DIR}/files/armv7_boot_nonefi.cmd ${mnt}/boot/boot.cmd fi # Install boot script - cp ${DIR}/files/armv7_boot.cmd ${mnt}/boot/boot.cmd "${MKUBOOTIMAGE}" -A arm -C none -O netbsd -T script -a 0 -n "NetBSD/armv7 boot" "${mnt}/boot/boot.cmd" "${mnt}/boot/boot.scr" } Added files: Index: src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd diff -u /dev/null src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd:1.1 --- /dev/null Sun Jul 21 16:05:24 2019 +++ src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd Sun Jul 21 16:05:24 2019 @@ -0,0 +1,61 @@ +if test "${board}" = "am335x" ; then + setenv kernel netbsd.ub + setenv mmcpart 0:1 + setenv bootargs root=wd0a +fi +if test "${board}" = "de0-nano-soc" ; then + setenv kernel netbsd.ub + setenv bootargs 'root=wd0a' + setenv mmcpart 0:1 + setenv use_fdt 1 +fi +if test "${soc}" = "exynos" ; then + setenv kernel netbsd.ub + setenv bootargs 'root=wd0a' + setenv mmcpart 2:1 + setenv use_fdt 1 +fi +if test "${soc}" = "sunxi" ; then + setenv kernel netbsd.ub + setenv bootargs 'root=wd0a' + setenv mmcpart 0:1 + setenv use_fdt 1 +fi +if test "${soc}" = "tegra" ; then + setenv kernel netbsd.ub + setenv bootargs root=wd0a + setenv mmcpart 1:1 + setenv use_fdt 1 +fi +if test "${soc}" = "tegra124" ; then + setenv kernel netbsd.ub + setenv bootargs root=wd0a + setenv mmcpart 1:1 + setenv use_fdt 1 +fi +if test "${soc}" = "tegra210" ; then + setenv kernel netbsd.ub + setenv bootargs root=wd0a + setenv mmcpart 1:1 + setenv use_fdt 1 + setenv fdtfile ${soc}-${board}.dtb + # enable PCIe + pci enum +fi + +if test "${kernel}" = "" ; then + echo '>>>' + echo '>>> Target device is not supported by this script.' + echo '>>>' + exit +fi + +if test "${use_fdt}" = "1" ; then + fatload mmc ${mmcpart} ${kernel_addr_r} ${kernel} + fatload mmc ${mmcpart} ${fdt_addr_r} ${fdtfile} + fdt addr ${fdt_addr_r} + bootm ${kernel_addr_r} - ${fdt_addr_r} +else + fatload mmc ${mmcpart} ${kernel_addr_r} ${kernel} + bootm ${kernel_addr_r} ${bootargs} +fi
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: rin Date: Sun Jul 21 16:05:24 UTC 2019 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Added Files: src/distrib/utils/embedded/files: armv7_boot_nonefi.cmd Log Message: Fallback to non-EFI boot script if EFI bootloader is absent. Note that we do not currently build EFI bootloader for earmv7hf-eb, as it requires little-endian version of toolchain. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/distrib/utils/embedded/conf/armv7.conf cvs rdiff -u -r0 -r1.1 src/distrib/utils/embedded/files/armv7_boot_nonefi.cmd Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: mrg Date: Wed Jun 12 03:06:49 UTC 2019 Modified Files: src/distrib/utils/embedded/files: creds_msdos Log Message: various cleanups inspired by reviews: - clean up variable usage - be explicit that $ssh_userkeys is global - don't assig id output to a variable not used To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/distrib/utils/embedded/files/creds_msdos Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/files/creds_msdos diff -u src/distrib/utils/embedded/files/creds_msdos:1.2 src/distrib/utils/embedded/files/creds_msdos:1.3 --- src/distrib/utils/embedded/files/creds_msdos:1.2 Wed Jun 12 00:28:56 2019 +++ src/distrib/utils/embedded/files/creds_msdos Wed Jun 12 03:06:48 2019 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: creds_msdos,v 1.2 2019/06/12 00:28:56 mrg Exp $ +# $NetBSD: creds_msdos,v 1.3 2019/06/12 03:06:48 mrg Exp $ # # Copyright (c) 2019 Matthew R. Green # All rights reserved. @@ -46,35 +46,35 @@ $_rc_subr_loaded . /etc/rc.subr name="creds_msdos" start_cmd="creds_msdos_start" stop_cmd=":" -fstab_file=/etc/fstab fail() { echo "$@" 1>&2 exit 1 } +# This uses $ssh_userkeys global sshkey_setup() { local user="$1" local group="wheel" # don't create existing users - id=$(id -u $user 2>/dev/null) - if [ $? -ne 0 ]; then - useradd -m -G "${group}" "$user" || fail "Useradd failed." + if ! id -u "${user}" > /dev/null 2>&1; then + useradd -m -G "${group}" "${user}" || fail "Useradd failed." fi - eval sshdir=~"${user}/.ssh" - eval mkdir -p -m 755 "${sshdir}" || fail "mkdir ~/.ssh failed." - chown "${user}" "${sshdir}" - eval userkeys="${sshdir}/authorized_keys" + eval ssh_userdir=~"${user}/.ssh" + mkdir -p -m 755 "${ssh_userdir}" || fail "mkdir ~/.ssh failed." + chmod 755 "${ssh_userdir}" + chown "${user}" "${ssh_userdir}" + + ssh_userkeys="${ssh_userdir}/authorized_keys" } sshkey_finish() { local user="$1" - local userkeys="$2" - chmod 644 "${userkeys}" - chown "${user}" "${userkeys}" + chmod 644 "${ssh_userkeys}" + chown "${user}" "${ssh_userkeys}" } do_sshkeyfile() { @@ -85,28 +85,28 @@ do_sshkeyfile() { return fi - sshkey_setup "$user" + sshkey_setup "${user}" # check entry is not present while read type keydata name; do - if fgrep -q "${keydata}" "${userkeys}" 2>/dev/null; then + if fgrep -q "${keydata}" "${ssh_userkeys}" 2>/dev/null; then continue fi - echo "${type} ${keydata} ${name}" >> "${userkeys}" + echo "${type} ${keydata} ${name}" >> "${ssh_userkeys}" done < "${newkeys}" - sshkey_finish "$user" "${userkeys}" + sshkey_finish "${user}" } do_sshkey() { local user="$1" local newkey="$2" - sshkey_setup "$user" + sshkey_setup "${user}" - echo "${newkey}" >> "${userkeys}" + echo "${newkey}" >> "${ssh_userkeys}" - sshkey_finish "$user" "${userkeys}" + sshkey_finish "${user}" } do_useraddpwhash() { @@ -115,8 +115,7 @@ do_useraddpwhash() { local group="wheel" # don't add to existing users - id=$(id -u "${user}" 2>/dev/null) - if [ $? -eq 0 ]; then + if id -u "${user}" > /dev/null 2>&1; then return fi @@ -133,48 +132,49 @@ do_useradd() { creds_msdos_start() { + local fstab_file=/etc/fstab + if [ -z "${creds_msdos_partition}" ]; then echo "Not looking for credientials on msdos" - return; + return fi - check_fs= while read junk1 mp fstype junk2; do if [ "${mp}" != "${creds_msdos_partition}" ]; then continue fi if [ "${fstype}" != "msdos" ]; then echo "Not checking for creds on ${creds_msdos_partition}: not an msdos file system" - return; + return fi break done < "${fstab_file}" - delete_creds=no - creds_file="${creds_msdos_partition}/creds.txt" + local delete_creds=no + local creds_file="${creds_msdos_partition}/creds.txt" if [ -f "${creds_file}" ]; then - while read type user arg1; do + while read type user args; do # strip cr - arg1=$(echo "$arg1" | tr -d '\015') + local clean_args=$(echo "$args" | tr -d '\015') case "$type" in \#*|'') continue ;; sshkeyfile) echo "Added user ${user} via ssh key file method." -do_sshkeyfile "${user}" "${arg1}" +do_sshkeyfile "${user}" "${clean_args}" ;; sshkey) echo "Added user ${user} via ssh key string method." -do_sshkey "${user}" "${arg1}" +do_sshkey "${user}" "${clean_args}" ;; useraddpwhash) echo "Added user ${user} via password hash method." -do_useraddpwhash "${user}" "${arg1}" +do_useraddpwhash "${user}" "${clean_args}" ;; useradd) echo "Added user ${user} via password method, shredding credentials file." -do_useradd "${user}" "${arg1}" +do_useradd "${user}" "${clean_args}" delete_creds=yes ;; *)
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: mrg Date: Wed Jun 12 03:06:49 UTC 2019 Modified Files: src/distrib/utils/embedded/files: creds_msdos Log Message: various cleanups inspired by reviews: - clean up variable usage - be explicit that $ssh_userkeys is global - don't assig id output to a variable not used To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/distrib/utils/embedded/files/creds_msdos Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: mrg Date: Wed Jun 12 00:28:56 UTC 2019 Modified Files: src/distrib/utils/embedded/files: creds_msdos Log Message: explicitly strip carriage return so that non-unix text files work. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/files/creds_msdos Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/files/creds_msdos diff -u src/distrib/utils/embedded/files/creds_msdos:1.1 src/distrib/utils/embedded/files/creds_msdos:1.2 --- src/distrib/utils/embedded/files/creds_msdos:1.1 Tue Jun 11 10:50:57 2019 +++ src/distrib/utils/embedded/files/creds_msdos Wed Jun 12 00:28:56 2019 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: creds_msdos,v 1.1 2019/06/11 10:50:57 mrg Exp $ +# $NetBSD: creds_msdos,v 1.2 2019/06/12 00:28:56 mrg Exp $ # # Copyright (c) 2019 Matthew R. Green # All rights reserved. @@ -154,6 +154,8 @@ creds_msdos_start() if [ -f "${creds_file}" ]; then while read type user arg1; do + # strip cr + arg1=$(echo "$arg1" | tr -d '\015') case "$type" in \#*|'') continue
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: mrg Date: Wed Jun 12 00:28:56 UTC 2019 Modified Files: src/distrib/utils/embedded/files: creds_msdos Log Message: explicitly strip carriage return so that non-unix text files work. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/files/creds_msdos Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: mrg Date: Tue Jun 11 10:50:58 UTC 2019 Modified Files: src/distrib/utils/embedded/conf: evbarm.conf Added Files: src/distrib/utils/embedded/files: creds_msdos creds_msdos.8 Log Message: add a method to add user accounts or ssh keys to the embedded (installable) images which may be run entirely headless and have no current method to edit the installation without another netbsd host to modify the root (FFS) partition. creds_msdos reads the creds.txt file from the msdos boot partition and provides 4 basic methods: sshkeyfile sshkey useraddhash useradd the first two create a user with ssh key(s), and the second two create a user with a password. if the last method is used and raw passwords are given, the creds.txt file will be shredded and deleted by rm -P. inspired by a request from a pine64 user. ok jmcneill@. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/distrib/utils/embedded/conf/evbarm.conf cvs rdiff -u -r0 -r1.1 src/distrib/utils/embedded/files/creds_msdos \ src/distrib/utils/embedded/files/creds_msdos.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/evbarm.conf diff -u src/distrib/utils/embedded/conf/evbarm.conf:1.32 src/distrib/utils/embedded/conf/evbarm.conf:1.33 --- src/distrib/utils/embedded/conf/evbarm.conf:1.32 Sun Dec 2 15:43:04 2018 +++ src/distrib/utils/embedded/conf/evbarm.conf Tue Jun 11 10:50:57 2019 @@ -1,4 +1,4 @@ -# $NetBSD: evbarm.conf,v 1.32 2018/12/02 15:43:04 jmcneill Exp $ +# $NetBSD: evbarm.conf,v 1.33 2019/06/11 10:50:57 mrg Exp $ # evbarm shared config # image=$HOME/${board}.img @@ -141,6 +141,8 @@ sshd=YES dhcpcd=YES ntpd=YES ntpd_flags="-g" +creds_msdos=YES +creds_msdos_partition=/boot EOF if $resize; then @@ -156,9 +158,11 @@ EOF >> "$tmp/selected_sets" mkdir ${mnt}/etc/rc.d - cp ${DIR}/files/resize_disklabel ${mnt}/etc/rc.d/resize_disklabel - echo "./etc/rc.d/resize_disklabel type=file uname=root gname=wheel mode=0555" \ - >> "$tmp/selected_sets" + for _f in resize_disklabel creds_msdos; do + cp ${DIR}/files/${_f} ${mnt}/etc/rc.d/${_f} + echo "./etc/rc.d/${_f} type=file uname=root gname=wheel mode=0555" \ + >> "$tmp/selected_sets" + done if [ ! -f ${release}/dev/MAKEDEV ]; then echo ${PROG}: Missing ${release}/dev/MAKEDEV 1>&2 Added files: Index: src/distrib/utils/embedded/files/creds_msdos diff -u /dev/null src/distrib/utils/embedded/files/creds_msdos:1.1 --- /dev/null Tue Jun 11 10:50:58 2019 +++ src/distrib/utils/embedded/files/creds_msdos Tue Jun 11 10:50:57 2019 @@ -0,0 +1,192 @@ +#!/bin/sh +# +# $NetBSD: creds_msdos,v 1.1 2019/06/11 10:50:57 mrg Exp $ +# +# Copyright (c) 2019 Matthew R. Green +# 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. +# 3. The name of the author may not be used to endorse or promote products +#derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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. + +# +# If "creds_msdos_partition" is an msdos partition and has a creds.txt +# in it, perform these commands: +# "sshkeyfile " +# "sshkey " +# "useraddhash " +# "useradd " +# If the "useradd" method is used, this the creds.txt file will be +# shredded and deleted with rm -P. + +# PROVIDE: creds_msdos +# REQUIRE: mountall + +$_rc_subr_loaded . /etc/rc.subr + +name="creds_msdos" +start_cmd="creds_msdos_start" +stop_cmd=":" +fstab_file=/etc/fstab + +fail() { + echo "$@" 1>&2 + exit 1 +} + +sshkey_setup() { + local user="$1" + local group="wheel" + + # don't create existing users + id=$(id -u $user 2>/dev/null) + if [ $? -ne 0 ]; then + useradd -m -G "${group}" "$user" || fail
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: jmcneill Date: Thu Apr 4 14:26:40 UTC 2019 Modified Files: src/distrib/utils/embedded/files: armv7_boot.cmd Log Message: Re-enable efiboot for armv7 (thanks skrll@) To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/distrib/utils/embedded/files/armv7_boot.cmd Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/files/armv7_boot.cmd diff -u src/distrib/utils/embedded/files/armv7_boot.cmd:1.13 src/distrib/utils/embedded/files/armv7_boot.cmd:1.14 --- src/distrib/utils/embedded/files/armv7_boot.cmd:1.13 Tue Apr 2 10:00:32 2019 +++ src/distrib/utils/embedded/files/armv7_boot.cmd Thu Apr 4 14:26:39 2019 @@ -2,59 +2,19 @@ if test "${board}" = "am335x" ; then setenv kernel netbsd-BEAGLEBONE.ub setenv mmcpart 0:1 setenv bootargs root=ld0a +else + setenv use_efi 1 fi -if test "${board}" = "de0-nano-soc" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs 'root=ld0a' - setenv mmcpart 0:1 - setenv use_fdt 1 -fi -if test "${soc}" = "exynos" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs 'root=ld1a' - setenv mmcpart 2:1 - setenv use_fdt 1 -fi -if test "${soc}" = "sunxi" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs 'root=ld0a' - setenv mmcpart 0:1 - setenv use_fdt 1 -fi -if test "${soc}" = "tegra" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs root=ld1a - setenv mmcpart 1:1 - setenv use_fdt 1 -fi -if test "${soc}" = "tegra124" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs root=ld0a - setenv mmcpart 1:1 - setenv use_fdt 1 -fi + if test "${soc}" = "tegra210" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs root=ld0a - setenv mmcpart 1:1 - setenv use_fdt 1 - setenv fdtfile ${soc}-${board}.dtb # enable PCIe pci enum fi -if test "${kernel}" = "" ; then - echo '>>>' - echo '>>> Target device is not supported by this script.' - echo '>>>' - exit -fi - -if test "${use_fdt}" = "1" ; then - fatload mmc ${mmcpart} ${kernel_addr_r} ${kernel} - fatload mmc ${mmcpart} ${fdt_addr_r} ${fdtfile} - fdt addr ${fdt_addr_r} - bootm ${kernel_addr_r} - ${fdt_addr_r} +if test "${use_efi}" = "1" ; then + setenv boot_scripts + setenv boot_script_dhcp + run distro_bootcmd else fatload mmc ${mmcpart} ${kernel_addr_r} ${kernel} bootm ${kernel_addr_r} ${bootargs}