Re: CVS commit: src/distrib/amd64/liveimage/emuimage

2024-04-16 Thread Izumi Tsutsui
maya@ wrote:

> Module Name:  src
> Committed By: maya
> Date: Tue Apr 16 16:13:45 UTC 2024
> 
> Modified Files:
>   src/distrib/amd64/liveimage/emuimage: Makefile rc.conf.emuimage
>   spec.emuimage
> 
> Log Message:
> restore amd64 live image support for resize root after combined mbr/gpt commit
> 
> we need to resize_gpt now, as it takes precedence over mbr/disklabel
> this change brings us to behave like the evbarm images.
> 
> XXX: we don't seem to touch disklabel and MBR, but they exist. Not sure 
> whether
> that has any negative repercussions, maybe another system might regard MBR as 
> the
> sole source of truth when GPT also exists.

Actually disklabel or MBR does NOT exist in USE_GPT=YES case.

In src/distrib/common/bootimage/Makefile.bootimage,
both ${TOOL_FDISK} and ${TOOL_DISKLABEL} are only invoked
inside .if ${USE_GPT} == "no".

"${TOOL_GPT} biosboot -c /usr/mdec/gptmbr.bin" by USE_GPTMBR=yes
does all the tricks, i.e. gptmbr.bin in the MBR sector just reads
the first sector of the specified GPT partition:
 https://github.com/NetBSD/src/blob/124fe5e/sys/arch/i386/stand/mbr/gptmbr.S

and the loaded pbr.S in the primary bootxx checks a GPT partition table
and loads the whole (~8KB) the primary bootxx:
 
https://github.com/NetBSD/src/blob/124fe5e/sys/arch/i386/stand/bootxx/pbr.S#L134-L135
 
https://github.com/NetBSD/src/blob/124fe5e/sys/arch/i386/stand/bootxx/pbr.S#L372-L380

Maybe this is the reason why some odd machines cannot boot UEFI images
(such ugly implemantations might assume MBR partition really exists).

---
Izumi Tsutsui


CVS commit: src/distrib/amd64/liveimage/emuimage

2024-04-16 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Apr 16 16:13:45 UTC 2024

Modified Files:
src/distrib/amd64/liveimage/emuimage: Makefile rc.conf.emuimage
spec.emuimage

Log Message:
restore amd64 live image support for resize root after combined mbr/gpt commit

we need to resize_gpt now, as it takes precedence over mbr/disklabel
this change brings us to behave like the evbarm images.

XXX: we don't seem to touch disklabel and MBR, but they exist. Not sure whether
that has any negative repercussions, maybe another system might regard MBR as 
the
sole source of truth when GPT also exists.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/distrib/amd64/liveimage/emuimage/Makefile
cvs rdiff -u -r1.3 -r1.4 \
src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage
cvs rdiff -u -r1.2 -r1.3 src/distrib/amd64/liveimage/emuimage/spec.emuimage

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/distrib/amd64/liveimage/emuimage

2024-04-16 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Apr 16 16:13:45 UTC 2024

Modified Files:
src/distrib/amd64/liveimage/emuimage: Makefile rc.conf.emuimage
spec.emuimage

Log Message:
restore amd64 live image support for resize root after combined mbr/gpt commit

we need to resize_gpt now, as it takes precedence over mbr/disklabel
this change brings us to behave like the evbarm images.

XXX: we don't seem to touch disklabel and MBR, but they exist. Not sure whether
that has any negative repercussions, maybe another system might regard MBR as 
the
sole source of truth when GPT also exists.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/distrib/amd64/liveimage/emuimage/Makefile
cvs rdiff -u -r1.3 -r1.4 \
src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage
cvs rdiff -u -r1.2 -r1.3 src/distrib/amd64/liveimage/emuimage/spec.emuimage

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/amd64/liveimage/emuimage/Makefile
diff -u src/distrib/amd64/liveimage/emuimage/Makefile:1.9 src/distrib/amd64/liveimage/emuimage/Makefile:1.10
--- src/distrib/amd64/liveimage/emuimage/Makefile:1.9	Sat Jul 24 16:13:44 2021
+++ src/distrib/amd64/liveimage/emuimage/Makefile	Tue Apr 16 16:13:44 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2021/07/24 16:13:44 jmcneill Exp $
+#	$NetBSD: Makefile,v 1.10 2024/04/16 16:13:44 maya Exp $
 
 LIVEIMGBASE=	NetBSD-${DISTRIBVER}-amd64-live	# gives ${IMGBASE}.img
 
@@ -13,6 +13,6 @@ SPEC_EXTRA=	${.CURDIR}/spec.emuimage
 RC_CONF_EXTRA=	${.CURDIR}/rc.conf.emuimage
 IMGFILE_EXTRA=\
 	${FILESDIR}/ec2_init		etc/rc.d/ec2_init		\
-	${FILESDIR}/resize_disklabel	etc/rc.d/resize_disklabel
+	${FILESDIR}/resize_gpt		etc/rc.d/resize_gpt
 
 .include "${.CURDIR}/../Makefile.liveimage"

Index: src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage
diff -u src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage:1.3 src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage:1.4
--- src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage:1.3	Wed Sep 27 00:24:12 2023
+++ src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage	Tue Apr 16 16:13:44 2024
@@ -1,4 +1,4 @@
-# $NetBSD: rc.conf.emuimage,v 1.3 2023/09/27 00:24:12 riastradh Exp $
+# $NetBSD: rc.conf.emuimage,v 1.4 2024/04/16 16:13:44 maya Exp $
 
 is_ec2() {
 	val=NO
@@ -25,7 +25,7 @@ is_ec2() {
 }
 
 certctl_init=YES
-resize_disklabel=YES
+resize_gpt=YES
 resize_root=YES
 resize_root_flags="-p"
 resize_root_postcmd="/sbin/reboot -n"

Index: src/distrib/amd64/liveimage/emuimage/spec.emuimage
diff -u src/distrib/amd64/liveimage/emuimage/spec.emuimage:1.2 src/distrib/amd64/liveimage/emuimage/spec.emuimage:1.3
--- src/distrib/amd64/liveimage/emuimage/spec.emuimage:1.2	Sat Jul 24 16:13:44 2021
+++ src/distrib/amd64/liveimage/emuimage/spec.emuimage	Tue Apr 16 16:13:44 2024
@@ -1,3 +1,3 @@
-# $NetBSD: spec.emuimage,v 1.2 2021/07/24 16:13:44 jmcneill Exp $
+# $NetBSD: spec.emuimage,v 1.3 2024/04/16 16:13:44 maya Exp $
 ./etc/rc.d/ec2_init			type=file mode=0555 uname=root gname=wheel
-./etc/rc.d/resize_disklabel		type=file mode=0555 uname=root gname=wheel
+./etc/rc.d/resize_gpt			type=file mode=0555 uname=root gname=wheel



CVS commit: src/distrib/amd64/liveimage/emuimage

2022-07-13 Thread Harold Gutch
Module Name:src
Committed By:   hgutch
Date:   Wed Jul 13 18:51:03 UTC 2022

Modified Files:
src/distrib/amd64/liveimage/emuimage: rc.conf.emuimage

Log Message:
Check for right sysctl node to make live image work OOTB on OpenStack:

  machdep.dmi.system-product = OpenStack Compute


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/distrib/amd64/liveimage/emuimage

2022-07-13 Thread Harold Gutch
Module Name:src
Committed By:   hgutch
Date:   Wed Jul 13 18:51:03 UTC 2022

Modified Files:
src/distrib/amd64/liveimage/emuimage: rc.conf.emuimage

Log Message:
Check for right sysctl node to make live image work OOTB on OpenStack:

  machdep.dmi.system-product = OpenStack Compute


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage
diff -u src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage:1.1 src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage:1.2
--- src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage:1.1	Sat Jul 24 16:13:44 2021
+++ src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage	Wed Jul 13 18:51:03 2022
@@ -1,4 +1,4 @@
-# $NetBSD: rc.conf.emuimage,v 1.1 2021/07/24 16:13:44 jmcneill Exp $
+# $NetBSD: rc.conf.emuimage,v 1.2 2022/07/13 18:51:03 hgutch Exp $
 
 is_ec2() {
 	val=NO
@@ -6,6 +6,7 @@ is_ec2() {
 	for node in machdep.dmi.system-vendor \
 		machdep.dmi.system-version \
 		machdep.dmi.bios-version \
+		machdep.dmi.system-product \
 		machdep.xen.version ; do
 		if /sbin/sysctl -q $node; then
 			nodeval="$(/sbin/sysctl -n $node | tr '[A-Z]' '[a-z]')"



CVS commit: src/distrib/amd64/liveimage/emuimage

2021-07-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jul 24 16:13:45 UTC 2021

Modified Files:
src/distrib/amd64/liveimage/emuimage: Makefile spec.emuimage
Added Files:
src/distrib/amd64/liveimage/emuimage: rc.conf.emuimage
Removed Files:
src/distrib/amd64/liveimage/emuimage: dhcpcd ec2_init resize_disklabel
resize_root sshd

Log Message:
amd64: liveimage: use RC_CONF_EXTRA instead of rc.conf.d


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/distrib/amd64/liveimage/emuimage/Makefile
cvs rdiff -u -r1.1 -r0 src/distrib/amd64/liveimage/emuimage/dhcpcd \
src/distrib/amd64/liveimage/emuimage/resize_disklabel \
src/distrib/amd64/liveimage/emuimage/resize_root \
src/distrib/amd64/liveimage/emuimage/sshd
cvs rdiff -u -r1.4 -r0 src/distrib/amd64/liveimage/emuimage/ec2_init
cvs rdiff -u -r0 -r1.1 src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage
cvs rdiff -u -r1.1 -r1.2 src/distrib/amd64/liveimage/emuimage/spec.emuimage

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/amd64/liveimage/emuimage/Makefile
diff -u src/distrib/amd64/liveimage/emuimage/Makefile:1.8 src/distrib/amd64/liveimage/emuimage/Makefile:1.9
--- src/distrib/amd64/liveimage/emuimage/Makefile:1.8	Wed Aug  5 01:35:18 2020
+++ src/distrib/amd64/liveimage/emuimage/Makefile	Sat Jul 24 16:13:44 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2020/08/05 01:35:18 jmcneill Exp $
+#	$NetBSD: Makefile,v 1.9 2021/07/24 16:13:44 jmcneill Exp $
 
 LIVEIMGBASE=	NetBSD-${DISTRIBVER}-amd64-live	# gives ${IMGBASE}.img
 
@@ -10,13 +10,9 @@ IMAGEHOSTNAME=	netbsd
 FILESDIR!=	cd ${.CURDIR}/../../../utils/embedded/files ; pwd
 
 SPEC_EXTRA=	${.CURDIR}/spec.emuimage
+RC_CONF_EXTRA=	${.CURDIR}/rc.conf.emuimage
 IMGFILE_EXTRA=\
 	${FILESDIR}/ec2_init		etc/rc.d/ec2_init		\
-	${FILESDIR}/resize_disklabel	etc/rc.d/resize_disklabel	\
-	${.CURDIR}/dhcpcd		etc/rc.conf.d/dhcpcd		\
-	${.CURDIR}/ec2_init		etc/rc.conf.d/ec2_init		\
-	${.CURDIR}/resize_disklabel	etc/rc.conf.d/resize_disklabel	\
-	${.CURDIR}/resize_root		etc/rc.conf.d/resize_root	\
-	${.CURDIR}/sshd			etc/rc.conf.d/sshd
+	${FILESDIR}/resize_disklabel	etc/rc.d/resize_disklabel
 
 .include "${.CURDIR}/../Makefile.liveimage"

Index: src/distrib/amd64/liveimage/emuimage/spec.emuimage
diff -u src/distrib/amd64/liveimage/emuimage/spec.emuimage:1.1 src/distrib/amd64/liveimage/emuimage/spec.emuimage:1.2
--- src/distrib/amd64/liveimage/emuimage/spec.emuimage:1.1	Wed Aug  5 01:35:18 2020
+++ src/distrib/amd64/liveimage/emuimage/spec.emuimage	Sat Jul 24 16:13:44 2021
@@ -1,8 +1,3 @@
-# $NetBSD: spec.emuimage,v 1.1 2020/08/05 01:35:18 jmcneill Exp $
-./etc/rc.conf.d/dhcpcd			type=file mode=0644 uname=root gname=wheel
-./etc/rc.conf.d/ec2_init		type=file mode=0644 uname=root gname=wheel
-./etc/rc.conf.d/resize_disklabel	type=file mode=0644 uname=root gname=wheel
-./etc/rc.conf.d/resize_root		type=file mode=0644 uname=root gname=wheel
-./etc/rc.conf.d/sshd			type=file mode=0644 uname=root gname=wheel
+# $NetBSD: spec.emuimage,v 1.2 2021/07/24 16:13:44 jmcneill Exp $
 ./etc/rc.d/ec2_init			type=file mode=0555 uname=root gname=wheel
 ./etc/rc.d/resize_disklabel		type=file mode=0555 uname=root gname=wheel

Added files:

Index: src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage
diff -u /dev/null src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage:1.1
--- /dev/null	Sat Jul 24 16:13:45 2021
+++ src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage	Sat Jul 24 16:13:44 2021
@@ -0,0 +1,36 @@
+# $NetBSD: rc.conf.emuimage,v 1.1 2021/07/24 16:13:44 jmcneill Exp $
+
+is_ec2() {
+	val=NO
+	# Look for the string "amazon" in one of these sysctl nodes
+	for node in machdep.dmi.system-vendor \
+		machdep.dmi.system-version \
+		machdep.dmi.bios-version \
+		machdep.xen.version ; do
+		if /sbin/sysctl -q $node; then
+			nodeval="$(/sbin/sysctl -n $node | tr '[A-Z]' '[a-z]')"
+			case "$nodeval" in
+			*amazon*)
+val=YES
+;;
+			# OpenStack is not EC2 but it does have a metadata service.
+			*openstack*)
+val=YES
+;;
+			esac
+		fi
+	done
+	printf $val
+}
+
+resize_disklabel=YES
+resize_root=YES
+resize_root_flags="-p"
+resize_root_postcmd="/sbin/reboot -n"
+dhcpcd=YES
+sshd=YES
+ec2_init=$(is_ec2)
+
+if checkyesno ec2_init; then
+	dhcpcd_flags="$dhcpcd_flags -w"
+fi



CVS commit: src/distrib/amd64/liveimage/emuimage

2021-07-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jul 24 16:13:45 UTC 2021

Modified Files:
src/distrib/amd64/liveimage/emuimage: Makefile spec.emuimage
Added Files:
src/distrib/amd64/liveimage/emuimage: rc.conf.emuimage
Removed Files:
src/distrib/amd64/liveimage/emuimage: dhcpcd ec2_init resize_disklabel
resize_root sshd

Log Message:
amd64: liveimage: use RC_CONF_EXTRA instead of rc.conf.d


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/distrib/amd64/liveimage/emuimage/Makefile
cvs rdiff -u -r1.1 -r0 src/distrib/amd64/liveimage/emuimage/dhcpcd \
src/distrib/amd64/liveimage/emuimage/resize_disklabel \
src/distrib/amd64/liveimage/emuimage/resize_root \
src/distrib/amd64/liveimage/emuimage/sshd
cvs rdiff -u -r1.4 -r0 src/distrib/amd64/liveimage/emuimage/ec2_init
cvs rdiff -u -r0 -r1.1 src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage
cvs rdiff -u -r1.1 -r1.2 src/distrib/amd64/liveimage/emuimage/spec.emuimage

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/distrib/amd64/liveimage/emuimage

2021-07-20 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Tue Jul 20 19:27:51 UTC 2021

Modified Files:
src/distrib/amd64/liveimage/emuimage: ec2_init

Log Message:
Don't override /etc/rc.conf if it sets ec2_init.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/amd64/liveimage/emuimage/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/amd64/liveimage/emuimage

2021-07-20 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Tue Jul 20 19:27:51 UTC 2021

Modified Files:
src/distrib/amd64/liveimage/emuimage: ec2_init

Log Message:
Don't override /etc/rc.conf if it sets ec2_init.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/amd64/liveimage/emuimage/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/amd64/liveimage/emuimage/ec2_init
diff -u src/distrib/amd64/liveimage/emuimage/ec2_init:1.3 src/distrib/amd64/liveimage/emuimage/ec2_init:1.4
--- src/distrib/amd64/liveimage/emuimage/ec2_init:1.3	Thu Jul 15 17:20:25 2021
+++ src/distrib/amd64/liveimage/emuimage/ec2_init	Tue Jul 20 19:27:51 2021
@@ -1,4 +1,4 @@
-# $NetBSD: ec2_init,v 1.3 2021/07/15 17:20:25 rhialto Exp $
+# $NetBSD: ec2_init,v 1.4 2021/07/20 19:27:51 rhialto Exp $
 
 is_ec2() {
 	val=NO
@@ -23,4 +23,9 @@ is_ec2() {
 	printf $val
 }
 
-ec2_init=$(is_ec2)
+# Don't override /etc/rc.conf
+if [ -z "$ec2_init" ]
+then
+	ec2_init=$(is_ec2)
+fi
+



CVS commit: src/distrib/amd64/liveimage/emuimage

2021-07-15 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Thu Jul 15 17:20:25 UTC 2021

Modified Files:
src/distrib/amd64/liveimage/emuimage: ec2_init

Log Message:
Recognize OpenStack too (it also has a metadata service).

Typical values for machdep.dmi are:

machdep.dmi.system-vendor = OpenStack Foundation
machdep.dmi.system-product = OpenStack Nova
machdep.dmi.system-version = 17.0.12
machdep.dmi.system-serial = c46130fb-a56e-43f2-9d98-492d24656b9c
machdep.dmi.system-uuid = 680b8119-0d74-4f78-a6fd-e79dfede905c
machdep.dmi.bios-vendor = SeaBIOS
machdep.dmi.bios-version = 1.10.2-1ubuntu1
machdep.dmi.bios-date = 20140401
machdep.dmi.chassis-vendor = QEMU
machdep.dmi.chassis-type = QEMU
machdep.dmi.chassis-version = pc-i440fx-2.8
machdep.dmi.processor-vendor = QEMU
machdep.dmi.processor-version = pc-i440fx-2.8
machdep.dmi.processor-frequency = 2000 MHz


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/amd64/liveimage/emuimage/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/amd64/liveimage/emuimage

2021-07-15 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Thu Jul 15 17:20:25 UTC 2021

Modified Files:
src/distrib/amd64/liveimage/emuimage: ec2_init

Log Message:
Recognize OpenStack too (it also has a metadata service).

Typical values for machdep.dmi are:

machdep.dmi.system-vendor = OpenStack Foundation
machdep.dmi.system-product = OpenStack Nova
machdep.dmi.system-version = 17.0.12
machdep.dmi.system-serial = c46130fb-a56e-43f2-9d98-492d24656b9c
machdep.dmi.system-uuid = 680b8119-0d74-4f78-a6fd-e79dfede905c
machdep.dmi.bios-vendor = SeaBIOS
machdep.dmi.bios-version = 1.10.2-1ubuntu1
machdep.dmi.bios-date = 20140401
machdep.dmi.chassis-vendor = QEMU
machdep.dmi.chassis-type = QEMU
machdep.dmi.chassis-version = pc-i440fx-2.8
machdep.dmi.processor-vendor = QEMU
machdep.dmi.processor-version = pc-i440fx-2.8
machdep.dmi.processor-frequency = 2000 MHz


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/amd64/liveimage/emuimage/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/amd64/liveimage/emuimage/ec2_init
diff -u src/distrib/amd64/liveimage/emuimage/ec2_init:1.2 src/distrib/amd64/liveimage/emuimage/ec2_init:1.3
--- src/distrib/amd64/liveimage/emuimage/ec2_init:1.2	Wed Sep  9 13:25:48 2020
+++ src/distrib/amd64/liveimage/emuimage/ec2_init	Thu Jul 15 17:20:25 2021
@@ -1,4 +1,4 @@
-# $NetBSD: ec2_init,v 1.2 2020/09/09 13:25:48 jmcneill Exp $
+# $NetBSD: ec2_init,v 1.3 2021/07/15 17:20:25 rhialto Exp $
 
 is_ec2() {
 	val=NO
@@ -13,6 +13,10 @@ is_ec2() {
 			*amazon*)
 val=YES
 ;;
+			# OpenStack is not EC2 but it does have a metadata service.
+			*openstack*)
+val=YES
+;;
 			esac
 		fi
 	done



CVS commit: src/distrib/amd64/liveimage/emuimage

2020-09-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Sep  9 13:25:48 UTC 2020

Modified Files:
src/distrib/amd64/liveimage/emuimage: ec2_init

Log Message:
Look for the string "amazon" in a few different sysctl nodes. There doesn't
seem to be a single spot to check that works with both XenPVHVM and KVM
instances.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/distrib/amd64/liveimage/emuimage/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/amd64/liveimage/emuimage

2020-09-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Sep  9 13:25:48 UTC 2020

Modified Files:
src/distrib/amd64/liveimage/emuimage: ec2_init

Log Message:
Look for the string "amazon" in a few different sysctl nodes. There doesn't
seem to be a single spot to check that works with both XenPVHVM and KVM
instances.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/distrib/amd64/liveimage/emuimage/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/amd64/liveimage/emuimage/ec2_init
diff -u src/distrib/amd64/liveimage/emuimage/ec2_init:1.1 src/distrib/amd64/liveimage/emuimage/ec2_init:1.2
--- src/distrib/amd64/liveimage/emuimage/ec2_init:1.1	Wed Aug  5 01:35:18 2020
+++ src/distrib/amd64/liveimage/emuimage/ec2_init	Wed Sep  9 13:25:48 2020
@@ -1,15 +1,22 @@
-# $NetBSD: ec2_init,v 1.1 2020/08/05 01:35:18 jmcneill Exp $
+# $NetBSD: ec2_init,v 1.2 2020/09/09 13:25:48 jmcneill Exp $
 
 is_ec2() {
-	dmi_vendor="$(/sbin/sysctl -qn machdep.dmi.system-vendor | tr '[A-Z]' '[a-z]')"
-	case "$dmi_vendor" in
-	amazon*)
-		printf YES
-		;;
-	*)
-		printf NO
-		;;
-	esac
+	val=NO
+	# Look for the string "amazon" in one of these sysctl nodes
+	for node in machdep.dmi.system-vendor \
+		machdep.dmi.system-version \
+		machdep.dmi.bios-version \
+		machdep.xen.version ; do
+		if /sbin/sysctl -q $node; then
+			nodeval="$(/sbin/sysctl -n $node | tr '[A-Z]' '[a-z]')"
+			case "$nodeval" in
+			*amazon*)
+val=YES
+;;
+			esac
+		fi
+	done
+	printf $val
 }
 
 ec2_init=$(is_ec2)



CVS commit: src/distrib/amd64/liveimage/emuimage

2019-08-11 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sun Aug 11 11:00:30 UTC 2019

Modified Files:
src/distrib/amd64/liveimage/emuimage: Makefile

Log Message:
Live images built with MKDEBUG=yes fit in 2 GB since installing _pic.a
libraries was disabled in src/share/mk/bsd.own.mk 1.1150.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/distrib/amd64/liveimage/emuimage/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/amd64/liveimage/emuimage/Makefile
diff -u src/distrib/amd64/liveimage/emuimage/Makefile:1.6 src/distrib/amd64/liveimage/emuimage/Makefile:1.7
--- src/distrib/amd64/liveimage/emuimage/Makefile:1.6	Wed Aug  7 07:59:35 2019
+++ src/distrib/amd64/liveimage/emuimage/Makefile	Sun Aug 11 11:00:30 2019
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile,v 1.6 2019/08/07 07:59:35 gson Exp $
+#	$NetBSD: Makefile,v 1.7 2019/08/11 11:00:30 gson Exp $
 
 LIVEIMGBASE=	NetBSD-${DISTRIBVER}-amd64-live	# gives ${IMGBASE}.img
 
-EMUIMAGEMB?=	3725	# 4GB USB flash memories aren't 4GiB
+EMUIMAGEMB?=	1907	# 2GB USB flash memories aren't 2GiB
 LIVEIMAGEMB=	${EMUIMAGEMB}
 
 .include "${.CURDIR}/../Makefile.liveimage"



CVS commit: src/distrib/amd64/liveimage/emuimage

2019-08-11 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sun Aug 11 11:00:30 UTC 2019

Modified Files:
src/distrib/amd64/liveimage/emuimage: Makefile

Log Message:
Live images built with MKDEBUG=yes fit in 2 GB since installing _pic.a
libraries was disabled in src/share/mk/bsd.own.mk 1.1150.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/distrib/amd64/liveimage/emuimage/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/distrib/amd64/liveimage/emuimage

2019-08-09 Thread Greg Troxel
Martin Husemann  writes:

> On Thu, Aug 08, 2019 at 08:09:19PM -0400, Greg Troxel wrote:
>> In addition, I don't like it that images have stuff in /boot in the DOS
>> partition that can't be found in some obvious place, like /usr/mdec.
>> But I haven't gotten around to trying to fix it either so I get it that
>> ENOPATCH.
>
> Yes, but in this case the bug is that sysinst does not know how to properly
> fill the /boot things - which is on my TODO list.
>
> (and also, as you mention, that there is no obvious easy source for the 
> content)

I was talking about the first bug, that these things aren't in the
destdir of a build.  The following belong on /usr/mdec/RPI, or similar,
either for all arm build (or when MKRPI=yes if we want to split that
out).

-rwxr-xr-x  1 root  wheel 1494 Oct 26  2017 LICENCE.broadcom
-rwxr-xr-x  1 root  wheel17932 Oct 26  2017 bootcode.bin
-rwxr-xr-x  1 root  wheel  105 Nov  9  2018 cmdline.txt
-rwxr-xr-x  1 root  wheel 6624 Oct 26  2017 fixup.dat
-rwxr-xr-x  1 root  wheel 2533 Oct 26  2017 fixup_cd.dat
-rwxr-xr-x  1 root  wheel  2823716 Oct 26  2017 start.elf
-rwxr-xr-x  1 root  wheel   634948 Oct 26  2017 start_cd.elf

Arguably installboot should be taught to deal with this; it's a FAT
partition instead of blocks 0-15, but it strikes me as the same thing
logically.


Re: CVS commit: src/distrib/amd64/liveimage/emuimage

2019-08-09 Thread Andreas Gustafsson
Martin Husemann wrote:
> However - the whole idea boils down to:
> 
>  - what purpose do others use the USB install images for?

What others use the USB *install* image for is hardly relevant to
the present discussion.  The install image and the live image (aka
"emuimage") are two separate things, and the commit being discussed
affects only the latter:

  NetBSD-9.99.4-amd64-install.img1.4G
  NetBSD-9.99.4-amd64-live.img   3.6G

I'm guessing almost no one uses the amd64 live image presently, simply
because it is not included in the official binary releases - you have
to build it yourself.  But I think there is a clear trend away from
the 1980's concept of "installing" an operating system towards simply
running images - that's what ARM SBC users do, that's what you do on
Amazon EC2, etc.  Many other open source OSes distribute fully
functional live images for amd64, and I think NetBSD should, too.
-- 
Andreas Gustafsson, g...@netbsd.org


Re: CVS commit: src/distrib/amd64/liveimage/emuimage

2019-08-09 Thread Martin Husemann
On Fri, Aug 09, 2019 at 05:44:12AM +, m...@netbsd.org wrote:
> I guess not a lot of people use the amd64 .img files as an alternate
> sysinst for remote setups. where you reboot to rescue, dd it to disk,
> then reboot to a complete netbsd install.

Sorry, I am not sure I get your point here.

I have only ever used a virtual ISO for that (as that is trivial to add
in most virtual machine setups, whereas the USB images often need some
conversion and I always forget the details).

On machines with enough RAM the ramdisk module (or on other architctures
the monlithic ramdisk INSTALL kernel) is even better for simple recovery.

However - the whole idea boils down to:

 - what purpose do others use the USB install images for?

My proposition relied on the (obviously wrong) impression that it would be
mostly for:

 1) testing a new NetBSD version on some random (foreign) hardware (e.g.
a Notebook at a shop before buying it)
 2) quickly trying NetBSD (while usually running something else)
 3) installing NetBSD

None of this would require the ability to statically link code or realy debug
binaries in this (limited) setup.

If others use the images more broadly, the whole idea is moot, especially as
USB stick sizes are not exactly limited anywhere close to the size we need
right now.

Martin


Re: CVS commit: src/distrib/amd64/liveimage/emuimage

2019-08-09 Thread Martin Husemann
On Thu, Aug 08, 2019 at 08:09:19PM -0400, Greg Troxel wrote:
> In addition, I don't like it that images have stuff in /boot in the DOS
> partition that can't be found in some obvious place, like /usr/mdec.
> But I haven't gotten around to trying to fix it either so I get it that
> ENOPATCH.

Yes, but in this case the bug is that sysinst does not know how to properly
fill the /boot things - which is on my TODO list.

(and also, as you mention, that there is no obvious easy source for the 
content)

Martin


Re: CVS commit: src/distrib/amd64/liveimage/emuimage

2019-08-08 Thread maya
On Thu, Aug 08, 2019 at 08:22:21PM +0200, Martin Husemann wrote:
> On Thu, Aug 08, 2019 at 09:13:37PM +0300, Andreas Gustafsson wrote:
> > The image already has an empty /usr/libdata/debug.  The increase in
> > size when MKDEBUG is enabled is spread out over various other
> > directories, notably /usr/lib.  For example,
> > 
> >   /usr/lib  405182 kB -> 866276 kB
> >   /usr/bin   53426 kB ->  63140 kB
> > 
> > The largest file in /usr/lib is libstdc++_pic.a, which grows from
> > 4.3 MB to 27 MB.
> 
> Heh - nice, didn't think about that.
> 
> How about: remove all *.a files from those images?
> Is there a tool to strip CTF from binaries?
> 
> Martin

I guess not a lot of people use the amd64 .img files as an alternate
sysinst for remote setups. where you reboot to rescue, dd it to disk,
then reboot to a complete netbsd install.


re: CVS commit: src/distrib/amd64/liveimage/emuimage

2019-08-08 Thread matthew green
> Other libraries also have _pic.a files that are much larger than the
> others versions.  Is there a bug that causes them not to be CTF-converted,
> or is this deliberate?

the _pic.a libraries are special case we could choose to stop
shipping.  they're useful if someone wants to build a special
case application for some reason (tm), but almost never used
by the vast majority of people.

they're created as part of create the .so, and the .so has
its debug info moved out, but apparently we've never created
any makefile or sets infrastructure to do this for _pic.a.

perhaps we should choose not to install them by default.

you can turn it off already with MKPICINSTALL=no.


.mrg.


re: CVS commit: src/distrib/amd64/liveimage/emuimage

2019-08-08 Thread matthew green
Martin Husemann writes:
> On Thu, Aug 08, 2019 at 09:13:37PM +0300, Andreas Gustafsson wrote:
> > The image already has an empty /usr/libdata/debug.  The increase in
> > size when MKDEBUG is enabled is spread out over various other
> > directories, notably /usr/lib.  For example,
> > 
> >   /usr/lib  405182 kB -> 866276 kB
> >   /usr/bin   53426 kB ->  63140 kB
> > 
> > The largest file in /usr/lib is libstdc++_pic.a, which grows from
> > 4.3 MB to 27 MB.
> 
> Heh - nice, didn't think about that.
> 
> How about: remove all *.a files from those images?

start with *_pic.a? :)

those are really rarely used, even on normal installs.


.mrg.


Re: CVS commit: src/distrib/amd64/liveimage/emuimage

2019-08-08 Thread Greg Troxel
Andreas Gustafsson  writes:

> I really don't like the general idea of introducing differences
> between images and systems installed through sysinst.  It's confusing
> for users, and also means that testing of one is less likely to apply
> to the other.

Agreed strongly.

In addition, I don't like it that images have stuff in /boot in the DOS
partition that can't be found in some obvious place, like /usr/mdec.
But I haven't gotten around to trying to fix it either so I get it that
ENOPATCH.


Re: CVS commit: src/distrib/amd64/liveimage/emuimage

2019-08-08 Thread Andreas Gustafsson
Martin Husemann wrote:
> How about: remove all *.a files from those images?
> Is there a tool to strip CTF from binaries?

I really don't like the general idea of introducing differences
between images and systems installed through sysinst.  It's confusing
for users, and also means that testing of one is less likely to apply
to the other.

I see that libstdc++_pic.a is much larger than the other versions of
the same library:

   # cd /usr/lib
   # ls -al libstdc*
   -r--r--r--  1 root  wheel   4539634 Aug  8 14:00 libstdc++.a
   lrwxr-xr-x  1 root  wheel16 Aug  8 14:00 libstdc++.so -> 
libstdc++.so.9.0
   lrwxr-xr-x  1 root  wheel16 Aug  8 14:00 libstdc++.so.9 -> 
libstdc++.so.9.0
   -r--r--r--  1 root  wheel   2030136 Aug  8 14:00 libstdc++.so.9.0
   -r--r--r--  1 root  wheel   4787754 Aug  8 14:00 libstdc++_p.a
   -r--r--r--  1 root  wheel  28835160 Aug  8 14:00 libstdc++_pic.a

and that it contains .debug_info sections, which the others don't:

  # size -A -d libstdc++_pic.a | fgrep .debug_info | wc -l
   173
  # size -A -d libstdc++.a | fgrep .debug_info | wc -l
 0

Other libraries also have _pic.a files that are much larger than the
others versions.  Is there a bug that causes them not to be CTF-converted,
or is this deliberate?
-- 
Andreas Gustafsson, g...@netbsd.org


Re: CVS commit: src/distrib/amd64/liveimage/emuimage

2019-08-08 Thread Martin Husemann
On Thu, Aug 08, 2019 at 09:13:37PM +0300, Andreas Gustafsson wrote:
> The image already has an empty /usr/libdata/debug.  The increase in
> size when MKDEBUG is enabled is spread out over various other
> directories, notably /usr/lib.  For example,
> 
>   /usr/lib  405182 kB -> 866276 kB
>   /usr/bin   53426 kB ->  63140 kB
> 
> The largest file in /usr/lib is libstdc++_pic.a, which grows from
> 4.3 MB to 27 MB.

Heh - nice, didn't think about that.

How about: remove all *.a files from those images?
Is there a tool to strip CTF from binaries?

Martin


Re: CVS commit: src/distrib/amd64/liveimage/emuimage

2019-08-08 Thread Andreas Gustafsson
Martin Husemann wrote:
> I would like to see this images created w/o /usr/libdata/debug/ (as we
> do for ISO images, some of which we even strip more), but I have not
> yet found an easy way to hack that into the image creation process.

The image already has an empty /usr/libdata/debug.  The increase in
size when MKDEBUG is enabled is spread out over various other
directories, notably /usr/lib.  For example,

  /usr/lib  405182 kB -> 866276 kB
  /usr/bin   53426 kB ->  63140 kB

The largest file in /usr/lib is libstdc++_pic.a, which grows from
4.3 MB to 27 MB.

The largest file in /usr/bin is gdb, which grows from 7.8M to 12M.
"size -A -d" shows most of the growth is CTF.  Is there a corresponding
tool to look at the sizes of sections in a ".a" library?

In any case, the kernel has only grown from 23M to 26M, so this growth
looks like it's mostly a userland issue and unrelated to the removal of
"-U DEBUG" from etc/Makefile.
-- 
Andreas Gustafsson, g...@netbsd.org


Re: CVS commit: src/distrib/amd64/liveimage/emuimage

2019-08-08 Thread Martin Husemann
On Wed, Aug 07, 2019 at 07:59:36AM +, Andreas Gustafsson wrote:
> Module Name:  src
> Committed By: gson
> Date: Wed Aug  7 07:59:36 UTC 2019
> 
> Modified Files:
>   src/distrib/amd64/liveimage/emuimage: Makefile
> 
> Log Message:
> The amd64 live image no longer fits in 2 GB when built with with
> MKDEBUG, as releases are.  Bump the size to just under 4 GB (as in
> 4*10^9, not 4*2^30), the next larger common USB thumb drive size.

I would like to see this images created w/o /usr/libdata/debug/ (as we
do for ISO images, some of which we even strip more), but I have not
yet found an easy way to hack that into the image creation process.

Any pointers welcome ;-)

Or does someone see a good use for the debug info on them (by default)?
During testing I often gathererd cores on these images but could easily
analyze them on another machine.

Martin 


CVS commit: src/distrib/amd64/liveimage/emuimage

2019-08-07 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Wed Aug  7 07:59:36 UTC 2019

Modified Files:
src/distrib/amd64/liveimage/emuimage: Makefile

Log Message:
The amd64 live image no longer fits in 2 GB when built with with
MKDEBUG, as releases are.  Bump the size to just under 4 GB (as in
4*10^9, not 4*2^30), the next larger common USB thumb drive size.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/distrib/amd64/liveimage/emuimage/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/amd64/liveimage/emuimage/Makefile
diff -u src/distrib/amd64/liveimage/emuimage/Makefile:1.5 src/distrib/amd64/liveimage/emuimage/Makefile:1.6
--- src/distrib/amd64/liveimage/emuimage/Makefile:1.5	Sun Dec 16 08:58:21 2018
+++ src/distrib/amd64/liveimage/emuimage/Makefile	Wed Aug  7 07:59:35 2019
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile,v 1.5 2018/12/16 08:58:21 gson Exp $
+#	$NetBSD: Makefile,v 1.6 2019/08/07 07:59:35 gson Exp $
 
 LIVEIMGBASE=	NetBSD-${DISTRIBVER}-amd64-live	# gives ${IMGBASE}.img
 
-EMUIMAGEMB?=	1536	# 2GB USB flash memories aren't 2GiB
+EMUIMAGEMB?=	3725	# 4GB USB flash memories aren't 4GiB
 LIVEIMAGEMB=	${EMUIMAGEMB}
 
 .include "${.CURDIR}/../Makefile.liveimage"



CVS commit: src/distrib/amd64/liveimage/emuimage

2019-08-07 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Wed Aug  7 07:59:36 UTC 2019

Modified Files:
src/distrib/amd64/liveimage/emuimage: Makefile

Log Message:
The amd64 live image no longer fits in 2 GB when built with with
MKDEBUG, as releases are.  Bump the size to just under 4 GB (as in
4*10^9, not 4*2^30), the next larger common USB thumb drive size.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/distrib/amd64/liveimage/emuimage/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/distrib/amd64/liveimage/emuimage

2018-12-16 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sun Dec 16 08:58:21 UTC 2018

Modified Files:
src/distrib/amd64/liveimage/emuimage: Makefile

Log Message:
Fix previous: set EMUIMAGEMB, not USBIMAGEMB.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/distrib/amd64/liveimage/emuimage/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/amd64/liveimage/emuimage/Makefile
diff -u src/distrib/amd64/liveimage/emuimage/Makefile:1.4 src/distrib/amd64/liveimage/emuimage/Makefile:1.5
--- src/distrib/amd64/liveimage/emuimage/Makefile:1.4	Sat Dec 15 18:03:17 2018
+++ src/distrib/amd64/liveimage/emuimage/Makefile	Sun Dec 16 08:58:21 2018
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile,v 1.4 2018/12/15 18:03:17 gson Exp $
+#	$NetBSD: Makefile,v 1.5 2018/12/16 08:58:21 gson Exp $
 
 LIVEIMGBASE=	NetBSD-${DISTRIBVER}-amd64-live	# gives ${IMGBASE}.img
 
-USBIMAGEMB?=	1536	# 2GB USB flash memories aren't 2GiB
+EMUIMAGEMB?=	1536	# 2GB USB flash memories aren't 2GiB
 LIVEIMAGEMB=	${EMUIMAGEMB}
 
 .include "${.CURDIR}/../Makefile.liveimage"



CVS commit: src/distrib/amd64/liveimage/emuimage

2018-12-16 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sun Dec 16 08:58:21 UTC 2018

Modified Files:
src/distrib/amd64/liveimage/emuimage: Makefile

Log Message:
Fix previous: set EMUIMAGEMB, not USBIMAGEMB.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/distrib/amd64/liveimage/emuimage/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.