CVS commit: src/distrib/utils/embedded/conf

2024-03-14 Thread Christos Zoulas
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

2024-03-14 Thread Christos Zoulas
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

2024-02-12 Thread Michael van Elst
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

2024-02-12 Thread Michael van Elst
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

2024-02-11 Thread Christos Zoulas
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

2024-02-11 Thread Christos Zoulas
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

2024-01-28 Thread matthew green
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

2024-01-28 Thread matthew green
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

2024-01-21 Thread Jared D. McNeill
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

2024-01-21 Thread Jared D. McNeill
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

2024-01-21 Thread Jared D. McNeill
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

2024-01-21 Thread Jared D. McNeill
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

2023-09-26 Thread Taylor R Campbell
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

2023-09-26 Thread Taylor R Campbell
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

2023-04-19 Thread Brook Milligan
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

2023-04-19 Thread Brook Milligan
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

2023-03-18 Thread Michael van Elst
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

2023-03-18 Thread Michael van Elst
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

2023-02-17 Thread Michael van Elst
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

2023-02-17 Thread Michael van Elst
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

2022-11-19 Thread YAMAMOTO Takashi
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

2022-11-19 Thread YAMAMOTO Takashi
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

2022-10-30 Thread Jared D. McNeill
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

2022-10-30 Thread Jared D. McNeill
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

2022-10-15 Thread Jared D. McNeill
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

2022-10-15 Thread Jared D. McNeill
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

2021-10-16 Thread Jared D. McNeill
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

2021-10-16 Thread Jared D. McNeill
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/conf

2019-10-30 Thread Jared D. McNeill
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

2019-10-30 Thread Jared D. McNeill
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

2019-10-30 Thread Martin Husemann
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

2019-10-30 Thread Martin Husemann
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

2019-10-30 Thread Martin Husemann
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

2019-10-30 Thread Martin Husemann
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

2019-10-30 Thread Martin Husemann
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

2019-10-30 Thread Martin Husemann
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

2019-10-27 Thread Jared D. McNeill
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

2019-10-27 Thread Jared D. McNeill
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

2019-10-27 Thread Jared D. McNeill
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

2019-10-27 Thread Jared D. McNeill
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

2019-10-05 Thread Michael van Elst
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

2019-10-05 Thread Michael van Elst
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

2019-07-21 Thread Rin Okuyama
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

2019-07-21 Thread Rin Okuyama
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

2019-06-11 Thread matthew green
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

2019-06-11 Thread matthew green
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

2019-06-11 Thread matthew green
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

2019-06-11 Thread matthew green
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

2019-06-11 Thread matthew green
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 

Re: CVS commit: src/distrib/utils/embedded

2018-11-23 Thread Aymeric Vincent
Jared McNeill  writes:

> You shouldn't set fdtfile in this script because U-Boot already sets
> it. From socfpga_de0_nano_soc_defconfig:
>
> CONFIG_DEFAULT_FDT_FILE="socfpga_cyclone5_de0_nano_soc.dtb"
>
> This way, if you match on the SoC type in this file, you can run on
> any board using this SoC as long as you have a dtb for it. We
> shouldn't have to update the boot script to add new boards.

Thanks, agreed. The board has two names so I'll look into the problem in
the coming days to determine which files should be renamed to what in
order to be consistent.

Regards,
 Aymeric


Re: CVS commit: src/distrib/utils/embedded

2018-11-23 Thread Jared McNeill

On Thu, 22 Nov 2018, Aymeric Vincent wrote:


src/distrib/utils/embedded/files: armv7_boot.cmd


You shouldn't set fdtfile in this script because U-Boot already sets it. 

From socfpga_de0_nano_soc_defconfig:


CONFIG_DEFAULT_FDT_FILE="socfpga_cyclone5_de0_nano_soc.dtb"

This way, if you match on the SoC type in this file, you can run on any 
board using this SoC as long as you have a dtb for it. We shouldn't have 
to update the boot script to add new boards.


Re: CVS commit: src/distrib/utils/embedded/conf

2015-05-22 Thread Matt Thomas

 On May 22, 2015, at 11:07 AM, Christos Zoulas chris...@astron.com wrote:
 
 In article 20150522011822.807e...@cvs.netbsd.org,
 Jared D. McNeill source-changes-d@NetBSD.org wrote:
 -=-=-=-=-=-
 
 Module Name: src
 Committed By:jmcneill
 Date:Fri May 22 01:18:22 UTC 2015
 
 Modified Files:
  src/distrib/utils/embedded/conf: armv7.conf
 
 Log Message:
 add JETSONTK1 to armv7.img
 
 Please double-quote all variable expansions...

No, use the :Q modifier


Re: CVS commit: src/distrib/utils/embedded/conf

2015-05-22 Thread Christos Zoulas
On May 22,  1:26pm, m...@3am-software.com (Matt Thomas) wrote:
-- Subject: Re: CVS commit: src/distrib/utils/embedded/conf

| No, use the :Q modifier

This is not make(1) it is sh(1) :-)

christos


Re: CVS commit: src/distrib/utils/embedded/conf

2015-05-22 Thread Christos Zoulas
In article 20150522011822.807e...@cvs.netbsd.org,
Jared D. McNeill source-changes-d@NetBSD.org wrote:
-=-=-=-=-=-

Module Name:   src
Committed By:  jmcneill
Date:  Fri May 22 01:18:22 UTC 2015

Modified Files:
   src/distrib/utils/embedded/conf: armv7.conf

Log Message:
add JETSONTK1 to armv7.img

Please double-quote all variable expansions...

christos



Re: CVS commit: src/distrib/utils/embedded/conf

2015-02-12 Thread Takahiro HAYASHI

On 2015/02/07 00:15, Jared D. McNeill wrote:

Module Name:src
Committed By:   jmcneill
Date:   Fri Feb  6 15:15:02 UTC 2015

Modified Files:
src/distrib/utils/embedded/conf: rpi.conf

Log Message:
By default, RPI firmware sets the max CPU frequency to 600MHz. This can be
overridden by setting arm_freq in config.txt, but the default freq at boot
is still 600MHz.

Add logic to rc.local to compare the current vs. max CPU frequency; if they
differ, set the target frequency to the maximum.



+   cat  /tmp/a  EOF


This overrides /tmp/a if it exists, and surprises original owner.
Is this change intended? AFAICS this file is not used.


regards,
--
t-hash


Re: CVS commit: src/distrib/utils/embedded/conf

2015-02-12 Thread Jared McNeill
Thank you for catching this mistake, it should have been appending to 
${mnt}/etc/rc.local. I have checked in a fix.


On Thu, 12 Feb 2015, Takahiro HAYASHI wrote:


On 2015/02/07 00:15, Jared D. McNeill wrote:

Module Name:src
Committed By:   jmcneill
Date:   Fri Feb  6 15:15:02 UTC 2015

Modified Files:
src/distrib/utils/embedded/conf: rpi.conf

Log Message:
By default, RPI firmware sets the max CPU frequency to 600MHz. This can be
overridden by setting arm_freq in config.txt, but the default freq at boot
is still 600MHz.

Add logic to rc.local to compare the current vs. max CPU frequency; if they
differ, set the target frequency to the maximum.



+   cat  /tmp/a  EOF


This overrides /tmp/a if it exists, and surprises original owner.
Is this change intended? AFAICS this file is not used.


regards,
--
t-hash




Re: CVS commit: src/distrib/utils/embedded/conf

2014-04-04 Thread Izumi Tsutsui
 make a swap file?

Swap space in the distributed image is just annoying
for users to rawwrite it into devices.

To use resize_ffs(8), users have to edit disklabel anyway,
so I'm using a dumb script that checks disk size, updates labels,
and executes resize_ffs(8) for my custom images.

---
Izumi Tsutsui


Re: CVS commit: src/distrib/utils/embedded/conf

2014-04-03 Thread Christos Zoulas
In article 20140401184816.gq20...@snowdrop.l8s.co.uk,
David Laight  da...@l8s.co.uk wrote:
On Mon, Mar 31, 2014 at 02:18:45PM -0400, Christos Zoulas wrote:
 Module Name: src
 Committed By:christos
 Date:Mon Mar 31 18:18:45 UTC 2014
 
 Modified Files:
  src/distrib/utils/embedded/conf: x86.conf
 
 Log Message:
 remove swap; these days x86 machines don't need it.

What about for dumps?

Although I'm not at all sure what this particular file is for...

From the diff it looks like it needs for TLC in order to get sane
partition offsets.

The main reason I removed it is because it makes it easier to resize
the ffs to the disk size, if it is the last thing on the disk, and I
did not want to put swap first. But I could put swap back. /etc/rc.d/swap2
complains otherwise, and it should not :-)

christos



re: CVS commit: src/distrib/utils/embedded/conf

2014-04-03 Thread matthew green

make a swap file?


.mrg.


Re: CVS commit: src/distrib/utils/embedded/conf

2014-04-01 Thread David Laight
On Mon, Mar 31, 2014 at 02:18:45PM -0400, Christos Zoulas wrote:
 Module Name:  src
 Committed By: christos
 Date: Mon Mar 31 18:18:45 UTC 2014
 
 Modified Files:
   src/distrib/utils/embedded/conf: x86.conf
 
 Log Message:
 remove swap; these days x86 machines don't need it.

What about for dumps?

Although I'm not at all sure what this particular file is for...

From the diff it looks like it needs for TLC in order to get sane
partition offsets.

David

-- 
David Laight: da...@l8s.co.uk


Re: CVS commit: src/distrib/utils/embedded

2013-09-16 Thread Christos Zoulas
On Sep 15,  8:54pm, a...@netbsd.org (Adrian Steinmann) wrote:
-- Subject: Re: CVS commit: src/distrib/utils/embedded

| So you're suggesting I remove the
| 
| GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

Leave that definition in mkimage and remove them from the .conf files
where is now duplicated.

Thanks,

christos


Re: CVS commit: src/distrib/utils/embedded/conf

2013-09-16 Thread Christos Zoulas
In article 20130916152357.883d...@cvs.netbsd.org,
Adrian Steinmann source-changes-d@NetBSD.org wrote:
-=-=-=-=-=-

Module Name:   src
Committed By:  ast
Date:  Mon Sep 16 15:23:57 UTC 2013

Modified Files:
   src/distrib/utils/embedded/conf: beagleboard.conf rpi.conf
   rpi_inst.conf

Log Message:
After discussions with cristos regarding the previous commit, he
convinced me it was sufficient to define GZIP_CMD only in
distrib/utils/embedded/mkimage and not again in the config files
beagleboard.conf, rpi.conf, and rpi_inst.conf similar to how the
other variables $src, $release, $mnt, ... are only defined there.

Many thanks!

christos



Re: CVS commit: src/distrib/utils/embedded

2013-09-15 Thread Christos Zoulas
In article 20130914125127.7648...@cvs.netbsd.org,
Adrian Steinmann source-changes-d@NetBSD.org wrote:

1. This is useless in the .conf files since mkimage sets it alreay.
+GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)
+
2. You might as well rename the rest of the variables _CMD for conistency.

christos



Re: CVS commit: src/distrib/utils/embedded

2013-09-15 Thread Adrian Steinmann
On Sun, Sep 15, 2013 at 01:26:51PM +, Christos Zoulas wrote:
 In article 20130914125127.7648...@cvs.netbsd.org,
 Adrian Steinmann source-changes-d@NetBSD.org wrote:
 
 1. This is useless in the .conf files since mkimage sets it alreay.
 +GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)
Well yes, but it is not said that this config file might eventually
be pulled in by something else not defining TOOL_GZIP. I could have
indeed left the naked gzip in there, but I would think that when
TOOL_GZIP is defined, it is what should be used.  In other words,
I thought about it a bit and found this to be the best choice.

 2. You might as well rename the rest of the variables _CMD for conistency.
I used distrib/sets/sets.subr as an example, which does this:

: ${AWK:=awk}
: ${CKSUM:=cksum}
: ${COMM:=comm}
: ${DATE:=date}
: ${DB:=db}
: ${EGREP:=egrep}
: ${ENV_CMD:=env}   # ${ENV} is special to sh(1), ksh(1), etc.
: ${FGREP:=fgrep}
: ${FIND:=find}
: ${GREP:=grep}
: ${GZIP_CMD:=gzip} # ${GZIP} is special to gzip(1)
: ${HOSTNAME_CMD:=hostname} # ${HOSTNAME} is special to bash(1)
: ${HOST_SH:=sh}
: ${IDENT:=ident}
: ${JOIN:=join}
: ${LS:=ls}
: ${MAKE:=make}
: ${MKTEMP:=mktemp}
: ${MTREE:=mtree}
: ${PASTE:=paste}
: ${PAX:=pax}
: ${PRINTF:=printf}
: ${SED:=sed}
: ${SORT:=sort}
: ${STAT:=stat}
: ${TSORT:=tsort}
: ${UNAME:=uname}
: ${WC:=wc}
: ${XARGS:=xargs}

Ast


Re: CVS commit: src/distrib/utils/embedded

2013-09-15 Thread Christos Zoulas
On Sep 15,  5:59pm, a...@netbsd.org (Adrian Steinmann) wrote:
-- Subject: Re: CVS commit: src/distrib/utils/embedded

| On Sun, Sep 15, 2013 at 01:26:51PM +, Christos Zoulas wrote:
|  In article 20130914125127.7648...@cvs.netbsd.org,
|  Adrian Steinmann source-changes-d@NetBSD.org wrote:
|  
|  1. This is useless in the .conf files since mkimage sets it alreay.
|  +GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)
| Well yes, but it is not said that this config file might eventually
| be pulled in by something else not defining TOOL_GZIP. I could have
| indeed left the naked gzip in there, but I would think that when
| TOOL_GZIP is defined, it is what should be used.  In other words,
| I thought about it a bit and found this to be the best choice.

Yes, so go ahead and define all the other variables those scripts
assume that are set, like release srcs etc. Preferably with a
different definition than the one we have in mkimage to make
debugging more interesting. There is a reason those are called .conf;
they are not and they were not meant to be standalone -- by design.
Duplicating definitions should be always the solution of last resort.

|  2. You might as well rename the rest of the variables _CMD for conistency.
| I used distrib/sets/sets.subr as an example, which does this:
| 
| : ${AWK:=awk}
| : ${CKSUM:=cksum}
| : ${COMM:=comm}
| : ${DATE:=date}
| : ${DB:=db}
| : ${EGREP:=egrep}
| : ${ENV_CMD:=env}   # ${ENV} is special to sh(1), ksh(1), etc.
| : ${FGREP:=fgrep}
| : ${FIND:=find}
| : ${GREP:=grep}
| : ${GZIP_CMD:=gzip} # ${GZIP} is special to gzip(1)
| : ${HOSTNAME_CMD:=hostname} # ${HOSTNAME} is special to bash(1)
| : ${HOST_SH:=sh}
| : ${IDENT:=ident}
| : ${JOIN:=join}
| : ${LS:=ls}
| : ${MAKE:=make}
| : ${MKTEMP:=mktemp}
| : ${MTREE:=mtree}
| : ${PASTE:=paste}
| : ${PAX:=pax}
| : ${PRINTF:=printf}
| : ${SED:=sed}
| : ${SORT:=sort}
| : ${STAT:=stat}
| : ${TSORT:=tsort}
| : ${UNAME:=uname}
| : ${WC:=wc}

That's ok then, as long as there is some prior art...

christos


Re: CVS commit: src/distrib/utils/embedded

2013-09-15 Thread Adrian Steinmann
On Sun, Sep 15, 2013 at 02:05:59PM -0400, Christos Zoulas wrote:
 On Sep 15,  5:59pm, a...@netbsd.org (Adrian Steinmann) wrote:
 -- Subject: Re: CVS commit: src/distrib/utils/embedded
 
 | On Sun, Sep 15, 2013 at 01:26:51PM +, Christos Zoulas wrote:
 |  In article 20130914125127.7648...@cvs.netbsd.org,
 |  Adrian Steinmann source-changes-d@NetBSD.org wrote:
 |  
 |  1. This is useless in the .conf files since mkimage sets it alreay.
 |  +GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)
 | Well yes, but it is not said that this config file might eventually
 | be pulled in by something else not defining TOOL_GZIP. I could have
 | indeed left the naked gzip in there, but I would think that when
 | TOOL_GZIP is defined, it is what should be used.  In other words,
 | I thought about it a bit and found this to be the best choice.
 
 Yes, so go ahead and define all the other variables those scripts
 assume that are set, like release srcs etc. Preferably with a
 different definition than the one we have in mkimage to make
 debugging more interesting. There is a reason those are called .conf;
 they are not and they were not meant to be standalone -- by design.
 Duplicating definitions should be always the solution of last resort.

So you're suggesting I remove the

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

line and just use

${TOOL_GZIP} -dc ${bbone_kernel}  ${mnt}/boot/${bbone_kernelimg}

further below in beagleboard.conf, rpi.conf, and rpi_inst.conf ?

By that logic we should have also used ${TOOL_GZIP} for gzip instead
of the ${GZIP} indirection in mkimage which started this thread and
was actually causing a problem.

Tell me what you think is best.

Thanks
Ast


Re: CVS commit: src/distrib/utils/embedded

2013-04-08 Thread Jared McNeill

On Fri, 5 Apr 2013, Hisashi T Fujinaka wrote:


On Sat, 6 Apr 2013, Izumi Tsutsui wrote:


If the problem is overflow of the image, shouldn't the extra variable
in each config file be bumped instead of changing a unit?


Sorry for the messy commit. I just changed the -b line the way I did
because I'm not sure where extra comes from and version 1.37 broke every
img that I tried to build.


In such case, asking comitter (or filing PR) would be better.


I did, and heard no objections to my change.


As author of 1.37, just so it's clear that I didn't approve this commit, I 
don't recall being asked about it at all.


Re: CVS commit: src/distrib/utils/embedded

2013-04-08 Thread Hisashi T Fujinaka

On Mon, 8 Apr 2013, Jared McNeill wrote:


On Fri, 5 Apr 2013, Hisashi T Fujinaka wrote:


On Sat, 6 Apr 2013, Izumi Tsutsui wrote:


If the problem is overflow of the image, shouldn't the extra variable
in each config file be bumped instead of changing a unit?


Sorry for the messy commit. I just changed the -b line the way I did
because I'm not sure where extra comes from and version 1.37 broke every
img that I tried to build.


In such case, asking comitter (or filing PR) would be better.


I did, and heard no objections to my change.


As author of 1.37, just so it's clear that I didn't approve this commit, I 
don't recall being asked about it at all.


I asked you directly several times on IRC and you didn't reply, though
you were replying to others. I figured you didn't care.

--
Hisashi T Fujinaka - ht...@twofifty.com
BSEE(6/86) + BSChem(3/95) + BAEnglish(8/95) + MSCS(8/03) + $2.50 = latte


Re: CVS commit: src/distrib/utils/embedded

2013-04-08 Thread Valery Ushakov
On Mon, Apr 08, 2013 at 06:35:03 -0700, Hisashi T Fujinaka wrote:

 On Mon, 8 Apr 2013, Jared McNeill wrote:

 As author of 1.37, just so it's clear that I didn't approve this commit, I 
 don't recall being asked about it at all.
 
 I asked you directly several times on IRC and you didn't reply, though
 you were replying to others. I figured you didn't care.

IRC is not an official or reliable communication channel, it's a bad
idea to assume that lack of reaction on IRC means anything.

-uwe


Re: CVS commit: src/distrib/utils/embedded

2013-04-08 Thread Hisashi T Fujinaka

On Mon, 8 Apr 2013, Valery Ushakov wrote:


On Mon, Apr 08, 2013 at 06:35:03 -0700, Hisashi T Fujinaka wrote:


On Mon, 8 Apr 2013, Jared McNeill wrote:


As author of 1.37, just so it's clear that I didn't approve this commit, I
don't recall being asked about it at all.


I asked you directly several times on IRC and you didn't reply, though
you were replying to others. I figured you didn't care.


IRC is not an official or reliable communication channel, it's a bad
idea to assume that lack of reaction on IRC means anything.


Seeing as how I didn't revert someone else's commit and I fixed a build
break after reading the man pages and thought I wasn't actually
committing any egregious errors, why are we still talking about this?

I did fix my commit message to something more descriptive later. Sorry
for that.

--
Hisashi T Fujinaka - ht...@twofifty.com
BSEE(6/86) + BSChem(3/95) + BAEnglish(8/95) + MSCS(8/03) + $2.50 = latte


Re: CVS commit: src/distrib/utils/embedded

2013-04-08 Thread Valery Ushakov
On Mon, Apr 08, 2013 at 07:55:10 -0700, Hisashi T Fujinaka wrote:

 On Mon, 8 Apr 2013, Valery Ushakov wrote:
 
 On Mon, Apr 08, 2013 at 06:35:03 -0700, Hisashi T Fujinaka wrote:
 
 On Mon, 8 Apr 2013, Jared McNeill wrote:
 
 As author of 1.37, just so it's clear that I didn't approve this commit, 
 I
 don't recall being asked about it at all.
 
 I asked you directly several times on IRC and you didn't reply, though
 you were replying to others. I figured you didn't care.
 
 IRC is not an official or reliable communication channel, it's a bad
 idea to assume that lack of reaction on IRC means anything.
 
 Seeing as how I didn't revert someone else's commit and I fixed a build
 break after reading the man pages and thought I wasn't actually
 committing any egregious errors, why are we still talking about this?

My remark was not about your commit, but about your assumption that
IRC is a relibale channel.

-uwe


Re: CVS commit: src/distrib/utils/embedded

2013-04-05 Thread Izumi Tsutsui
 Module Name:  src
 Committed By: htodd
 Date: Wed Apr  3 19:37:43 UTC 2013
 
 Modified Files:
   src/distrib/utils/embedded: mkimage
 
 Log Message:
 Fix build.

What build problem did you try to fix?

--- mkimage 28 Mar 2013 00:20:02 -  1.37
+++ mkimage 3 Apr 2013 19:37:43 -   1.38
@@ -156,8 +156,8 @@ if [ -z $bootonly ]; then
echo ${bar} Populating ffs filesystem ${bar}
${MAKEFS} -N ${release}/etc -t ffs -rx \
-O $(((${init} + ${boot} + ${swap}) / 2))m \
-   -b $((${extra} / 2))m \
-   -o d=4096 \
+   -o d=4096 \
+   -b $((${extra}))m \
-F $tmp/selected_sets ${image} ${release} ${mnt}
 fi
---
 
If the problem is overflow of the image, shouldn't the extra variable
in each config file be bumped instead of changing a unit?

---
Izumi Tsutsui


Re: CVS commit: src/distrib/utils/embedded

2013-04-05 Thread Hisashi T Fujinaka

On Sat, 6 Apr 2013, Izumi Tsutsui wrote:


Module Name:src
Committed By:   htodd
Date:   Wed Apr  3 19:37:43 UTC 2013

Modified Files:
src/distrib/utils/embedded: mkimage

Log Message:
Fix build.


What build problem did you try to fix?

--- mkimage 28 Mar 2013 00:20:02 -  1.37
+++ mkimage 3 Apr 2013 19:37:43 -   1.38
@@ -156,8 +156,8 @@ if [ -z $bootonly ]; then
echo ${bar} Populating ffs filesystem ${bar}
${MAKEFS} -N ${release}/etc -t ffs -rx \
-O $(((${init} + ${boot} + ${swap}) / 2))m \
-   -b $((${extra} / 2))m \
-   -o d=4096 \
+   -o d=4096 \
+   -b $((${extra}))m \
-F $tmp/selected_sets ${image} ${release} ${mnt}
fi
---

If the problem is overflow of the image, shouldn't the extra variable
in each config file be bumped instead of changing a unit?


Sorry for the messy commit. I just changed the -b line the way I did
because I'm not sure where extra comes from and version 1.37 broke every
img that I tried to build.

If you think there's a better way to fix it, please do.

--
Hisashi T Fujinaka - ht...@twofifty.com
BSEE(6/86) + BSChem(3/95) + BAEnglish(8/95) + MSCS(8/03) + $2.50 = latte


Re: CVS commit: src/distrib/utils/embedded

2013-04-05 Thread Izumi Tsutsui
  If the problem is overflow of the image, shouldn't the extra variable
  in each config file be bumped instead of changing a unit?
 
 Sorry for the messy commit. I just changed the -b line the way I did
 because I'm not sure where extra comes from and version 1.37 broke every
 img that I tried to build.

In such case, asking comitter (or filing PR) would be better.

extra is defined in config files in src/distrib/utils/embedded/conf
and probably it's required because ffs size calculation in makefs(8)
is not so accurate.
http://nxr.netbsd.org/xref/src/usr.sbin/makefs/ffs.c#590

 If you think there's a better way to fix it, please do.

What actual problem did you get?

---
Izumi Tsutsui


Re: CVS commit: src/distrib/utils/embedded

2013-04-05 Thread Hisashi T Fujinaka

On Sat, 6 Apr 2013, Izumi Tsutsui wrote:


If the problem is overflow of the image, shouldn't the extra variable
in each config file be bumped instead of changing a unit?


Sorry for the messy commit. I just changed the -b line the way I did
because I'm not sure where extra comes from and version 1.37 broke every
img that I tried to build.


In such case, asking comitter (or filing PR) would be better.


I did, and heard no objections to my change.


extra is defined in config files in src/distrib/utils/embedded/conf
and probably it's required because ffs size calculation in makefs(8)
is not so accurate.
http://nxr.netbsd.org/xref/src/usr.sbin/makefs/ffs.c#590


I'm still not sure that the end-result (even though I didn't know where
EXTRA came from) was wrong.

As I said before, you can change it if you think it's wrong.

--
Hisashi T Fujinaka - ht...@twofifty.com
BSEE(6/86) + BSChem(3/95) + BAEnglish(8/95) + MSCS(8/03) + $2.50 = latte


Re: CVS commit: src/distrib/utils/embedded

2013-02-03 Thread Izumi Tsutsui
 Modified Files:
   src/distrib/utils/embedded: mkimage
   src/distrib/utils/embedded/conf: beagleboard.conf evbarm.conf rpi.conf
   usermode.conf
 
 Log Message:
 switch to makefs

Does this mean that tools makefs -t msdos is now functional?
If so I'd consider to prepare build.sh live-image targets for more ports.
(to build images without vnd(4) support)

---
Izumi Tsutsui


Re: CVS commit: src/distrib/utils/embedded

2013-02-03 Thread Christos Zoulas
On Feb 3,  7:02pm, tsut...@ceres.dti.ne.jp (Izumi Tsutsui) wrote:
-- Subject: Re: CVS commit: src/distrib/utils/embedded

| Does this mean that tools makefs -t msdos is now functional?
| If so I'd consider to prepare build.sh live-image targets for more ports.
| (to build images without vnd(4) support)

Yes, it is working just fine. No support for autosizing though (yet).
Go for it.

christos