Tue Apr 16 16:13:45 2024 UTC (24d)
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.


(maya)
diff -r1.9 -r1.10 src/distrib/amd64/liveimage/emuimage/Makefile
diff -r1.3 -r1.4 src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage
diff -r1.2 -r1.3 src/distrib/amd64/liveimage/emuimage/spec.emuimage

cvs diff -r1.9 -r1.10 src/distrib/amd64/liveimage/emuimage/Makefile (expand / switch to unified diff)

--- src/distrib/amd64/liveimage/emuimage/Makefile 2021/07/24 16:13:44 1.9
+++ src/distrib/amd64/liveimage/emuimage/Makefile 2024/04/16 16:13:44 1.10
@@ -1,18 +1,18 @@ @@ -1,18 +1,18 @@
1# $NetBSD: Makefile,v 1.9 2021/07/24 16:13:44 jmcneill Exp $ 1# $NetBSD: Makefile,v 1.10 2024/04/16 16:13:44 maya Exp $
2 2
3LIVEIMGBASE= NetBSD-${DISTRIBVER}-amd64-live # gives ${IMGBASE}.img 3LIVEIMGBASE= NetBSD-${DISTRIBVER}-amd64-live # gives ${IMGBASE}.img
4 4
5EMUIMAGEMB?= 1907 # 2GB USB flash memories aren't 2GiB 5EMUIMAGEMB?= 1907 # 2GB USB flash memories aren't 2GiB
6LIVEIMAGEMB= ${EMUIMAGEMB} 6LIVEIMAGEMB= ${EMUIMAGEMB}
7SWAPMB= 0 # No swap 7SWAPMB= 0 # No swap
8IMAGEHOSTNAME= netbsd 8IMAGEHOSTNAME= netbsd
9 9
10FILESDIR!= cd ${.CURDIR}/../../../utils/embedded/files ; pwd 10FILESDIR!= cd ${.CURDIR}/../../../utils/embedded/files ; pwd
11 11
12SPEC_EXTRA= ${.CURDIR}/spec.emuimage 12SPEC_EXTRA= ${.CURDIR}/spec.emuimage
13RC_CONF_EXTRA= ${.CURDIR}/rc.conf.emuimage 13RC_CONF_EXTRA= ${.CURDIR}/rc.conf.emuimage
14IMGFILE_EXTRA= \ 14IMGFILE_EXTRA= \
15 ${FILESDIR}/ec2_init etc/rc.d/ec2_init \ 15 ${FILESDIR}/ec2_init etc/rc.d/ec2_init \
16 ${FILESDIR}/resize_disklabel etc/rc.d/resize_disklabel 16 ${FILESDIR}/resize_gpt etc/rc.d/resize_gpt
17 17
18.include "${.CURDIR}/../Makefile.liveimage" 18.include "${.CURDIR}/../Makefile.liveimage"

cvs diff -r1.3 -r1.4 src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage (expand / switch to unified diff)

--- src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage 2023/09/27 00:24:12 1.3
+++ src/distrib/amd64/liveimage/emuimage/rc.conf.emuimage 2024/04/16 16:13:44 1.4
@@ -1,38 +1,38 @@ @@ -1,38 +1,38 @@
1# $NetBSD: rc.conf.emuimage,v 1.3 2023/09/27 00:24:12 riastradh Exp $ 1# $NetBSD: rc.conf.emuimage,v 1.4 2024/04/16 16:13:44 maya Exp $
2 2
3is_ec2() { 3is_ec2() {
4 val=NO 4 val=NO
5 # Look for the string "amazon" in one of these sysctl nodes 5 # Look for the string "amazon" in one of these sysctl nodes
6 for node in machdep.dmi.system-vendor \ 6 for node in machdep.dmi.system-vendor \
7 machdep.dmi.system-version \ 7 machdep.dmi.system-version \
8 machdep.dmi.bios-version \ 8 machdep.dmi.bios-version \
9 machdep.dmi.system-product \ 9 machdep.dmi.system-product \
10 machdep.xen.version ; do 10 machdep.xen.version ; do
11 if /sbin/sysctl -q $node; then 11 if /sbin/sysctl -q $node; then
12 nodeval="$(/sbin/sysctl -n $node | tr '[A-Z]' '[a-z]')" 12 nodeval="$(/sbin/sysctl -n $node | tr '[A-Z]' '[a-z]')"
13 case "$nodeval" in 13 case "$nodeval" in
14 *amazon*) 14 *amazon*)
15 val=YES 15 val=YES
16 ;; 16 ;;
17 # OpenStack is not EC2 but it does have a metadata service. 17 # OpenStack is not EC2 but it does have a metadata service.
18 *openstack*) 18 *openstack*)
19 val=YES 19 val=YES
20 ;; 20 ;;
21 esac 21 esac
22 fi 22 fi
23 done 23 done
24 printf $val 24 printf $val
25} 25}
26 26
27certctl_init=YES 27certctl_init=YES
28resize_disklabel=YES 28resize_gpt=YES
29resize_root=YES 29resize_root=YES
30resize_root_flags="-p" 30resize_root_flags="-p"
31resize_root_postcmd="/sbin/reboot -n" 31resize_root_postcmd="/sbin/reboot -n"
32dhcpcd=YES 32dhcpcd=YES
33sshd=YES 33sshd=YES
34ec2_init=$(is_ec2) 34ec2_init=$(is_ec2)
35 35
36if checkyesno ec2_init; then 36if checkyesno ec2_init; then
37 dhcpcd_flags="$dhcpcd_flags -w" 37 dhcpcd_flags="$dhcpcd_flags -w"
38fi 38fi

cvs diff -r1.2 -r1.3 src/distrib/amd64/liveimage/emuimage/spec.emuimage (expand / switch to unified diff)

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