Module Name: src
Committed By: jmcneill
Date: Fri Jul 17 15:16:34 UTC 2020
Modified Files:
src/distrib/utils/embedded: mkimage
src/distrib/utils/embedded/conf: arm64.conf evbarm.conf
src/etc/etc.evbmips: Makefile.inc
Added Files:
src/distrib/utils/embedded/conf: evbmips.conf octeon.conf
Log Message:
Create an "octeon.img.gz" bootable image for evbmips64-eb release builds.
To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/distrib/utils/embedded/mkimage
cvs rdiff -u -r1.11 -r1.12 src/distrib/utils/embedded/conf/arm64.conf
cvs rdiff -u -r1.36 -r1.37 src/distrib/utils/embedded/conf/evbarm.conf
cvs rdiff -u -r0 -r1.1 src/distrib/utils/embedded/conf/evbmips.conf \
src/distrib/utils/embedded/conf/octeon.conf
cvs rdiff -u -r1.23 -r1.24 src/etc/etc.evbmips/Makefile.inc
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.74 src/distrib/utils/embedded/mkimage:1.75
--- src/distrib/utils/embedded/mkimage:1.74 Sun May 24 18:43:39 2020
+++ src/distrib/utils/embedded/mkimage Fri Jul 17 15:16:34 2020
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: mkimage,v 1.74 2020/05/24 18:43:39 jmcneill Exp $
+# $NetBSD: mkimage,v 1.75 2020/07/17 15:16:34 jmcneill Exp $
#
# Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -284,7 +284,7 @@ if $gpt; then
echo ${bar} Creating partitions ${bar}
${GPT} ${gpt_flags} ${image} create ${gpt_create_flags}
- ${GPT} ${gpt_flags} ${image} add -b ${initsecs} -s ${bootsecs} -l ${gpt_label_efi:-EFI} -t efi
+ ${GPT} ${gpt_flags} ${image} add -b ${initsecs} -s ${bootsecs} -l ${gpt_label_boot:-EFI} -t ${gpt_boot_type:-efi}
${GPT} ${gpt_flags} ${image} set -a required -i 1
${GPT} ${gpt_flags} ${image} add -a 4m -b ${ffsstart} -l ${gpt_label_ffs:-netbsd-root} -t ffs
${GPT} ${gpt_flags} ${image} show
Index: src/distrib/utils/embedded/conf/arm64.conf
diff -u src/distrib/utils/embedded/conf/arm64.conf:1.11 src/distrib/utils/embedded/conf/arm64.conf:1.12
--- src/distrib/utils/embedded/conf/arm64.conf:1.11 Sun May 24 18:44:46 2020
+++ src/distrib/utils/embedded/conf/arm64.conf Fri Jul 17 15:16:34 2020
@@ -1,4 +1,4 @@
-# $NetBSD: arm64.conf,v 1.11 2020/05/24 18:44:46 jmcneill Exp $
+# $NetBSD: arm64.conf,v 1.12 2020/07/17 15:16:34 jmcneill Exp $
# ARM64 customization script used by mkimage
#
board=arm64
@@ -7,7 +7,7 @@ resize=true
gpt=true
gpt_hybrid=true
gpt_create_flags="-p 16"
-gpt_label_efi="EFI"
+gpt_label_boot="EFI"
gpt_label_ffs="netbsd-root"
. ${DIR}/conf/evbarm.conf
Index: src/distrib/utils/embedded/conf/evbarm.conf
diff -u src/distrib/utils/embedded/conf/evbarm.conf:1.36 src/distrib/utils/embedded/conf/evbarm.conf:1.37
--- src/distrib/utils/embedded/conf/evbarm.conf:1.36 Thu May 28 10:19:02 2020
+++ src/distrib/utils/embedded/conf/evbarm.conf Fri Jul 17 15:16:34 2020
@@ -1,4 +1,4 @@
-# $NetBSD: evbarm.conf,v 1.36 2020/05/28 10:19:02 jmcneill Exp $
+# $NetBSD: evbarm.conf,v 1.37 2020/07/17 15:16:34 jmcneill Exp $
# evbarm shared config
#
image=$HOME/${board}.img
@@ -70,7 +70,7 @@ make_fstab_evbarm_gpt() {
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
NAME=${gpt_label_ffs:-netbsd-root} / ffs rw,noatime 1 1
-NAME=${gpt_label_efi:-EFI} /boot msdos rw 1 1
+NAME=${gpt_label_boot:-EFI} /boot msdos rw 1 1
kernfs /kern kernfs rw
ptyfs /dev/pts ptyfs rw
procfs /proc procfs rw
Index: src/etc/etc.evbmips/Makefile.inc
diff -u src/etc/etc.evbmips/Makefile.inc:1.23 src/etc/etc.evbmips/Makefile.inc:1.24
--- src/etc/etc.evbmips/Makefile.inc:1.23 Wed Jul 15 12:15:30 2020
+++ src/etc/etc.evbmips/Makefile.inc Fri Jul 17 15:16:34 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.23 2020/07/15 12:15:30 simonb Exp $
+# $NetBSD: Makefile.inc,v 1.24 2020/07/17 15:16:34 jmcneill Exp $
#
# etc.evbmips/Makefile.inc -- evbmips-specific etc Makefile targets
#
@@ -37,3 +37,42 @@ BUILD_KERNELS= INSTALL_MALTA
# SBMIPS has a kernel for all targets
KERNEL_SETS+= SBMIPS${MACHINE_ARCH:S/mips//:C/e[lb]//}
+
+# Support for mkimage
+MKIMAGE= ${NETBSDSRCDIR}/distrib/utils/embedded/mkimage
+IMAGE.rel= ${RELEASEDIR}/${RELEASEMACHINEDIR}
+IMAGE.dir= ${IMAGE.rel}/binary/gzimg
+IMAGE.kern= ${IMAGE.rel}/binary/kernel
+.if !empty(MACHINE_ARCH:M*eb)
+IMAGEENDIAN= be
+.else
+IMAGEENDIAN= le
+.endif
+
+__mkimage: .USE
+ TOOL_MAKE=${MAKE} \
+ TOOL_MAKEFS=${TOOL_MAKEFS} \
+ TOOL_DISKLABEL=${TOOL_DISKLABEL} \
+ TOOL_FDISK=${TOOL_FDISK} \
+ TOOL_GPT=${TOOL_GPT} \
+ TOOL_GZIP=${TOOL_GZIP} \
+ TOOL_MKNOD=${TOOL_MKNOD} \
+ TOOL_PAX=${TOOL_PAX} \
+ TOOL_MKUBOOTIMAGE=${TOOL_MKUBOOTIMAGE} \
+ TOOL_MTREE=${TOOL_MTREE} \
+ HOST_SH=${HOST_SH} \
+ KERNOBJDIR=${KERNOBJDIR} \
+ MACHINE=${MACHINE} \
+ MKDTB=${MKDTB} \
+ ${HOST_SH} ${MKIMAGE} -h ${.TARGET:S/smp_//} -D ${DESTDIR} \
+ -S ${NETBSDSRCDIR} -B ${IMAGEENDIAN} ${MKI_OPTS.${.TARGET}} \
+ ${IMAGE.dir}/${.TARGET:S/smp_//}.img.gz
+
+.if ${MACHINE_ARCH} == "mips64eb"
+smp_octeon: __mkimage
+MKI_OPTS.smp_octeon= -K ${IMAGE.kern}
+SNAP_MD_POST_DEPS+= smp_octeon
+INSTALLATION_DIRS+= binary/gzimg
+.endif
+
+snap_md_post: check_DESTDIR check_RELEASEDIR snap_post .WAIT ${SNAP_MD_POST_DEPS}
Added files:
Index: src/distrib/utils/embedded/conf/evbmips.conf
diff -u /dev/null src/distrib/utils/embedded/conf/evbmips.conf:1.1
--- /dev/null Fri Jul 17 15:16:34 2020
+++ src/distrib/utils/embedded/conf/evbmips.conf Fri Jul 17 15:16:34 2020
@@ -0,0 +1,195 @@
+# $NetBSD: evbmips.conf,v 1.1 2020/07/17 15:16:34 jmcneill Exp $
+# evbmips shared config
+#
+image=$HOME/${board}.img
+
+MACHINE=evbmips
+
+extra=48 # spare space
+init=32
+boot=$((192 - ${init}))
+ffsoffset=$(( (${init} + ${boot}) / 2 ))m
+
+size=0 # autocompute
+msdosid=12
+
+if $gpt; then
+ partition_type="gpt"
+else
+ partition_type="disklabel"
+fi
+
+mkdir -p ${mnt}/boot
+
+make_label_evbmips() {
+ # compute all sizes in terms of sectors
+ local totalsize=$(( ${newsize} * 1024 * 2 / 512 ))
+
+ local bootsize=$(( ${boot} * 1024 ))
+
+ local bootoffset=$(( ${init} * 1024 ))
+
+ local asize=$(( ${totalsize} - ${bootsize} - ${bootoffset} ))
+ local aoffset=$(( ${bootoffset} + ${bootsize} ))
+
+ local bps=512
+ local spt=32
+ local tpc=64
+ local spc=2048
+ local cylinders=$(( ${totalsize} / ${spc} ))
+
+ cat << EOF
+type: SCSI
+disk: STORAGE DEVICE
+label: fictitious
+flags: removable
+bytes/sector: ${bps}
+sectors/track: ${spt}
+tracks/cylinder: ${tpc}
+sectors/cylinder: ${spc}
+cylinders: ${cylinders}
+total sectors: ${totalsize}
+rpm: 3600
+interleave: 1
+trackskew: 0
+cylinderskew: 0
+headswitch: 0 # microseconds
+track-to-track seek: 0 # microseconds
+drivedata: 0
+
+8 partitions:
+# size offset fstype [fsize bsize cpg/sgs]
+ a: ${asize} ${aoffset} 4.2BSD ${fsize} ${bsize} 0 #
+ c: ${totalsize} 0 unused 0 0 #
+ e: ${bootsize} ${bootoffset} MSDOS #
+EOF
+}
+
+make_fstab_evbmips_gpt() {
+ cat > ${mnt}/etc/fstab << EOF
+# NetBSD /etc/fstab
+# See /usr/share/examples/fstab/ for more examples.
+NAME=${gpt_label_ffs:-netbsd-root} / ffs rw,noatime 1 1
+NAME=${gpt_label_boot:-boot} /boot msdos rw 1 1
+kernfs /kern kernfs rw
+ptyfs /dev/pts ptyfs rw
+procfs /proc procfs rw
+tmpfs /var/shm tmpfs rw,-m1777,-sram%25
+EOF
+}
+
+make_fstab_evbmips_normal() {
+ cat > ${mnt}/etc/fstab << EOF
+# NetBSD /etc/fstab
+# See /usr/share/examples/fstab/ for more examples.
+ROOT.a / ffs rw,noatime 1 1
+ROOT.e /boot msdos rw 1 1
+kernfs /kern kernfs rw
+ptyfs /dev/pts ptyfs rw
+procfs /proc procfs rw
+tmpfs /var/shm tmpfs rw,-m1777,-sram%25
+EOF
+}
+
+# From Richard Neswold's:
+# http://rich-tbp.blogspot.com/2013/03/netbsd-on-rpi-minimizing-disk-writes.html
+# Also for the postfix stuff below
+make_fstab_evbmips_minwrites() {
+ cat > ${mnt}/etc/fstab << EOF
+# NetBSD /etc/fstab
+# See /usr/share/examples/fstab/ for more examples.
+ROOT.a / ffs rw,log,noatime,nodevmtime 1 1
+ROOT.e /boot msdos rw 1 1
+kernfs /kern kernfs rw
+ptyfs /dev/pts ptyfs rw
+procfs /proc procfs rw
+tmpfs /tmp tmpfs rw,-s32M
+tmpfs /var/log tmpfs rw,union,-s32M
+tmpfs /var/run tmpfs rw,union,-s1M
+tmpfs /var/mail tmpfs rw,union,-s10M
+tmpfs /var/spool/postfix tmpfs rw,union,-s20M
+tmpfs /var/db/postfix tmpfs rw,union,-s1M
+tmpfs /var/chroot tmpfs rw,union,-s10M
+tmpfs /var/shm tmpfs rw,-m1777,-sram%25
+EOF
+}
+
+make_fstab_evbmips() {
+ if $gpt; then
+ make_fstab_evbmips_gpt
+ elif $minwrites; then
+ make_fstab_evbmips_minwrites
+ else
+ make_fstab_evbmips_normal
+ fi
+ echo "./etc/fstab type=file uname=root gname=wheel mode=0644" \
+ >> "$tmp/selected_sets"
+
+ # Missing mount points from fstab
+ echo "./proc type=dir uname=root gname=wheel mode=0755" \
+ >> "$tmp/selected_sets"
+ echo "./kern type=dir uname=root gname=wheel mode=0755" \
+ >> "$tmp/selected_sets"
+}
+
+customize_evbmips() {
+ if $minwrites; then
+ mkdir ${mnt}/etc/postfix
+ (umask 022
+ sed -e 's/fifo/unix/' < ${release}/etc/postfix/master.cf > \
+ ${mnt}/etc/postfix/master.cf)
+ fi
+
+ cp ${release}/etc/rc.conf ${mnt}/etc/rc.conf
+ cat >> ${mnt}/etc/rc.conf << EOF
+dev_exists() {
+ if /sbin/drvctl -l \$1 >/dev/null 2>&1 ; then
+ printf YES
+ else
+ printf NO
+ fi
+}
+
+rc_configured=YES
+hostname=${hostname:-${board}}
+no_swap=YES
+savecore=NO
+sshd=YES
+dhcpcd=YES
+ntpd=YES
+ntpd_flags="-g"
+creds_msdos=YES
+creds_msdos_partition=/boot
+EOF
+
+ if $resize; then
+ cat >> ${mnt}/etc/rc.conf << EOF
+resize_${partition_type}=YES
+resize_root=YES
+resize_root_flags="-p"
+resize_root_postcmd="/sbin/reboot -n"
+EOF
+ fi
+
+ echo "./etc/rc.conf type=file uname=root gname=wheel mode=0644" \
+ >> "$tmp/selected_sets"
+
+ mkdir ${mnt}/etc/rc.d
+ for _f in resize_${partition_type} 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
+ exit 1
+ fi
+ echo "${bar} running MAKEDEV ${bar}"
+ ${HOST_SH} ${release}/dev/MAKEDEV -s all | sed -e 's:^\./:\./dev/:' \
+ >> "$tmp/selected_sets"
+
+ echo "${bar} fixing up permissions"
+ echo "./boot type=dir uname=root gname=wheel mode=0755" \
+ >> "$tmp/selected_sets"
+}
Index: src/distrib/utils/embedded/conf/octeon.conf
diff -u /dev/null src/distrib/utils/embedded/conf/octeon.conf:1.1
--- /dev/null Fri Jul 17 15:16:34 2020
+++ src/distrib/utils/embedded/conf/octeon.conf Fri Jul 17 15:16:34 2020
@@ -0,0 +1,38 @@
+# $NetBSD: octeon.conf,v 1.1 2020/07/17 15:16:34 jmcneill Exp $
+# Cavium OCTEON MIPS customization script used by mkimage
+#
+board=octeon
+sets="base etc rescue"
+resize=true
+gpt=true
+gpt_hybrid=true
+gpt_boot_type="windows"
+gpt_label_boot="octeon-boot"
+gpt_label_ffs="octeon-root"
+
+. ${DIR}/conf/evbmips.conf
+
+kernel_config="OCTEON"
+
+make_label() {
+ make_label_evbmips
+}
+
+make_fstab() {
+ make_fstab_evbmips
+}
+
+customize() {
+ customize_evbmips
+}
+
+populate() {
+ echo "${bar} looking for kernel in ${kernel} ${bar}"
+
+ # ELF kernel
+ kernel_elf="${kernel}/netbsd-${kernel_config}.gz"
+
+ # Install kernel to FAT partition
+ echo "${bar} installing ${kernel_elf} to /boot/netbsd ${bar}"
+ ${GZIP_CMD} -dc "${kernel_elf}" > "${mnt}/boot/netbsd"
+}