Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/evbarm evbarm: Add build.sh live-image support for a...



details:   https://anonhg.NetBSD.org/src/rev/52e551dccf53
branches:  trunk
changeset: 1022520:52e551dccf53
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Jul 23 21:53:33 2021 +0000

description:
evbarm: Add build.sh live-image support for armv7/aarch64

diffstat:

 distrib/evbarm/Makefile                         |   6 ++++-
 distrib/evbarm/liveimage/Makefile               |   7 +++++
 distrib/evbarm/liveimage/Makefile.liveimage     |  16 ++++++++++++
 distrib/evbarm/liveimage/armimage/Makefile      |  22 +++++++++++++++++
 distrib/evbarm/liveimage/armimage/dhcpcd        |   3 ++
 distrib/evbarm/liveimage/armimage/ec2_init      |  31 +++++++++++++++++++++++++
 distrib/evbarm/liveimage/armimage/resize_gpt    |   3 ++
 distrib/evbarm/liveimage/armimage/resize_root   |   5 ++++
 distrib/evbarm/liveimage/armimage/spec.armimage |   8 ++++++
 distrib/evbarm/liveimage/armimage/sshd          |   3 ++
 10 files changed, 103 insertions(+), 1 deletions(-)

diffs (161 lines):

diff -r 72588fecbae6 -r 52e551dccf53 distrib/evbarm/Makefile
--- a/distrib/evbarm/Makefile   Fri Jul 23 21:33:35 2021 +0000
+++ b/distrib/evbarm/Makefile   Fri Jul 23 21:53:33 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.15 2020/11/16 11:38:29 rin Exp $
+#      $NetBSD: Makefile,v 1.16 2021/07/23 21:53:33 jmcneill Exp $
 
 .include <bsd.own.mk>
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -8,6 +8,7 @@
 SUBDIR=                gzboot instkernel
 .if !empty(MACHINE_ARCH:Maarch64*) || !empty(MACHINE_ARCH:Mearmv7hf*)
 SUBDIR+=       installimage
+SUBDIR+=       liveimage
 .endif
 .if !empty(MACHINE_ARCH:Maarch64*)
 SUBDIR+=       isoimage
@@ -27,6 +28,9 @@
        ${MAKEDIRTARGET} isoimage iso_image
 .endif
 
+live_image:
+       ${MAKEDIRTARGET} liveimage live_image
+
 install_image:
        ${MAKEDIRTARGET} installimage install_image
 
diff -r 72588fecbae6 -r 52e551dccf53 distrib/evbarm/liveimage/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/evbarm/liveimage/Makefile Fri Jul 23 21:53:33 2021 +0000
@@ -0,0 +1,7 @@
+# $NetBSD: Makefile,v 1.1 2021/07/23 21:53:33 jmcneill Exp $
+
+SUBDIR=                armimage
+
+TARGETS+=      release live_image
+
+.include <bsd.subdir.mk>
diff -r 72588fecbae6 -r 52e551dccf53 distrib/evbarm/liveimage/Makefile.liveimage
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/evbarm/liveimage/Makefile.liveimage       Fri Jul 23 21:53:33 2021 +0000
@@ -0,0 +1,16 @@
+#      $NetBSD: Makefile.liveimage,v 1.1 2021/07/23 21:53:33 jmcneill Exp $
+
+.include <bsd.own.mk>
+
+.if !empty(MACHINE_ARCH:Maarch64*)
+KERN_SET=              kern-GENERIC64
+EFIBOOT=               ${WORKDIR}/usr/mdec/bootaa64.efi
+.else
+KERN_SET=              kern-GENERIC
+EFIBOOT=               ${WORKDIR}/usr/mdec/bootarm.efi
+.endif
+
+USE_MBR=               yes
+USE_GPT=               yes
+
+.include "${.CURDIR}/../../../common/bootimage/Makefile.liveimage"
diff -r 72588fecbae6 -r 52e551dccf53 distrib/evbarm/liveimage/armimage/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/evbarm/liveimage/armimage/Makefile        Fri Jul 23 21:53:33 2021 +0000
@@ -0,0 +1,22 @@
+#      $NetBSD: Makefile,v 1.1 2021/07/23 21:53:34 jmcneill Exp $
+
+LIVEIMGBASE=   NetBSD-${DISTRIBVER}-${MACHINE_ARCH}-live       # gives ${IMGBASE}.img
+
+EMUIMAGEMB?=   1907                    # 2GB USB flash memories aren't 2GiB
+LIVEIMAGEMB=   ${EMUIMAGEMB}
+SWAPMB=                0                       # No swap
+IMAGEHOSTNAME= netbsd
+
+FILESDIR!=     cd ${.CURDIR}/../../../utils/embedded/files ; pwd
+
+SPEC_EXTRA=    ${.CURDIR}/spec.armimage
+IMGFILE_EXTRA=                                                         \
+       ${FILESDIR}/ec2_init            etc/rc.d/ec2_init               \
+       ${FILESDIR}/resize_gpt          etc/rc.d/resize_gpt             \
+       ${.CURDIR}/dhcpcd               etc/rc.conf.d/dhcpcd            \
+       ${.CURDIR}/ec2_init             etc/rc.conf.d/ec2_init          \
+       ${.CURDIR}/resize_gpt           etc/rc.conf.d/resize_gpt        \
+       ${.CURDIR}/resize_root          etc/rc.conf.d/resize_root       \
+       ${.CURDIR}/sshd                 etc/rc.conf.d/sshd
+
+.include "${.CURDIR}/../Makefile.liveimage"
diff -r 72588fecbae6 -r 52e551dccf53 distrib/evbarm/liveimage/armimage/dhcpcd
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/evbarm/liveimage/armimage/dhcpcd  Fri Jul 23 21:53:33 2021 +0000
@@ -0,0 +1,3 @@
+# $NetBSD: dhcpcd,v 1.1 2021/07/23 21:53:34 jmcneill Exp $
+
+dhcpcd=YES
diff -r 72588fecbae6 -r 52e551dccf53 distrib/evbarm/liveimage/armimage/ec2_init
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/evbarm/liveimage/armimage/ec2_init        Fri Jul 23 21:53:33 2021 +0000
@@ -0,0 +1,31 @@
+# $NetBSD: ec2_init,v 1.1 2021/07/23 21:53:34 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
+}
+
+# Don't override /etc/rc.conf
+if [ -z "$ec2_init" ]
+then
+       ec2_init=$(is_ec2)
+fi
+
diff -r 72588fecbae6 -r 52e551dccf53 distrib/evbarm/liveimage/armimage/resize_gpt
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/evbarm/liveimage/armimage/resize_gpt      Fri Jul 23 21:53:33 2021 +0000
@@ -0,0 +1,3 @@
+# $NetBSD: resize_gpt,v 1.1 2021/07/23 21:53:34 jmcneill Exp $
+
+resize_gpt=YES
diff -r 72588fecbae6 -r 52e551dccf53 distrib/evbarm/liveimage/armimage/resize_root
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/evbarm/liveimage/armimage/resize_root     Fri Jul 23 21:53:33 2021 +0000
@@ -0,0 +1,5 @@
+# $NetBSD: resize_root,v 1.1 2021/07/23 21:53:34 jmcneill Exp $
+
+resize_root=YES
+resize_root_flags="-p"
+resize_root_postcmd="/sbin/reboot -n"
diff -r 72588fecbae6 -r 52e551dccf53 distrib/evbarm/liveimage/armimage/spec.armimage
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/evbarm/liveimage/armimage/spec.armimage   Fri Jul 23 21:53:33 2021 +0000
@@ -0,0 +1,8 @@
+# $NetBSD: spec.armimage,v 1.1 2021/07/23 21:53:34 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_gpt             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
+./etc/rc.d/ec2_init                    type=file mode=0555 uname=root gname=wheel
+./etc/rc.d/resize_gpt                  type=file mode=0555 uname=root gname=wheel
diff -r 72588fecbae6 -r 52e551dccf53 distrib/evbarm/liveimage/armimage/sshd
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/evbarm/liveimage/armimage/sshd    Fri Jul 23 21:53:33 2021 +0000
@@ -0,0 +1,3 @@
+# $NetBSD: sshd,v 1.1 2021/07/23 21:53:34 jmcneill Exp $
+
+sshd=YES



Home | Main Index | Thread Index | Old Index