head	1.45;
access;
symbols
	netbsd-11-0-RC4:1.44
	netbsd-11-0-RC3:1.44
	netbsd-11-0-RC2:1.44
	netbsd-11-0-RC1:1.44
	perseant-exfatfs-base-20250801:1.44
	netbsd-11:1.44.0.2
	netbsd-11-base:1.44
	netbsd-10-1-RELEASE:1.41.2.1
	perseant-exfatfs-base-20240630:1.42
	perseant-exfatfs:1.42.0.2
	perseant-exfatfs-base:1.42
	netbsd-8-3-RELEASE:1.27
	netbsd-9-4-RELEASE:1.33.2.1
	netbsd-10-0-RELEASE:1.41.2.1
	netbsd-10-0-RC6:1.41.2.1
	netbsd-10-0-RC5:1.41.2.1
	netbsd-10-0-RC4:1.41.2.1
	netbsd-10-0-RC3:1.41.2.1
	netbsd-10-0-RC2:1.41.2.1
	netbsd-10-0-RC1:1.41.2.1
	netbsd-10:1.41.0.2
	netbsd-10-base:1.41
	netbsd-9-3-RELEASE:1.33.2.1
	cjep_sun2x-base1:1.38
	cjep_sun2x:1.38.0.4
	cjep_sun2x-base:1.38
	cjep_staticlib_x-base1:1.38
	netbsd-9-2-RELEASE:1.33.2.1
	cjep_staticlib_x:1.38.0.2
	cjep_staticlib_x-base:1.38
	netbsd-9-1-RELEASE:1.33.2.1
	phil-wifi-20200421:1.34
	phil-wifi-20200411:1.34
	is-mlppp:1.34.0.2
	is-mlppp-base:1.34
	phil-wifi-20200406:1.34
	netbsd-8-2-RELEASE:1.27
	netbsd-9-0-RELEASE:1.33.2.1
	netbsd-9-0-RC2:1.33.2.1
	netbsd-9-0-RC1:1.33
	phil-wifi-20191119:1.33
	netbsd-9:1.33.0.2
	netbsd-9-base:1.33
	phil-wifi-20190609:1.32
	netbsd-8-1-RELEASE:1.27
	netbsd-8-1-RC1:1.27
	pgoyette-compat-merge-20190127:1.27.8.3
	pgoyette-compat-20190127:1.32
	pgoyette-compat-20190118:1.32
	pgoyette-compat-1226:1.32
	pgoyette-compat-1126:1.30
	pgoyette-compat-1020:1.30
	pgoyette-compat-0930:1.28
	pgoyette-compat-0906:1.28
	netbsd-7-2-RELEASE:1.15.4.5
	pgoyette-compat-0728:1.28
	netbsd-8-0-RELEASE:1.27
	phil-wifi:1.28.0.2
	phil-wifi-base:1.28
	pgoyette-compat-0625:1.28
	netbsd-8-0-RC2:1.27
	pgoyette-compat-0521:1.27
	pgoyette-compat-0502:1.27
	pgoyette-compat-0422:1.27
	netbsd-8-0-RC1:1.27
	pgoyette-compat-0415:1.27
	pgoyette-compat-0407:1.27
	pgoyette-compat-0330:1.27
	pgoyette-compat-0322:1.27
	pgoyette-compat-0315:1.27
	netbsd-7-1-2-RELEASE:1.15.4.5
	pgoyette-compat:1.27.0.8
	pgoyette-compat-base:1.27
	netbsd-7-1-1-RELEASE:1.15.4.5
	matt-nb8-mediatek:1.27.0.6
	matt-nb8-mediatek-base:1.27
	perseant-stdc-iso10646:1.27.0.4
	perseant-stdc-iso10646-base:1.27
	netbsd-8:1.27.0.2
	netbsd-8-base:1.27
	prg-localcount2-base3:1.27
	prg-localcount2-base2:1.26
	prg-localcount2-base1:1.26
	prg-localcount2:1.26.0.2
	prg-localcount2-base:1.26
	pgoyette-localcount-20170426:1.26
	bouyer-socketcan-base1:1.26
	pgoyette-localcount-20170320:1.24
	netbsd-7-1:1.15.4.5.0.6
	netbsd-7-1-RELEASE:1.15.4.5
	netbsd-7-1-RC2:1.15.4.5
	netbsd-7-nhusb-base-20170116:1.15.4.5
	bouyer-socketcan:1.24.0.4
	bouyer-socketcan-base:1.24
	pgoyette-localcount-20170107:1.24
	netbsd-7-1-RC1:1.15.4.5
	pgoyette-localcount-20161104:1.24
	netbsd-7-0-2-RELEASE:1.15.4.5
	localcount-20160914:1.24
	netbsd-7-nhusb:1.15.4.5.0.4
	netbsd-7-nhusb-base:1.15.4.5
	pgoyette-localcount-20160806:1.24
	pgoyette-localcount-20160726:1.24
	pgoyette-localcount:1.24.0.2
	pgoyette-localcount-base:1.24
	netbsd-7-0-1-RELEASE:1.15.4.5
	netbsd-7-0:1.15.4.5.0.2
	netbsd-7-0-RELEASE:1.15.4.5
	netbsd-7-0-RC3:1.15.4.5
	netbsd-7-0-RC2:1.15.4.4
	netbsd-7-0-RC1:1.15.4.4
	netbsd-7:1.15.0.4
	netbsd-7-base:1.15
	yamt-pagecache-base9:1.15
	yamt-pagecache-tag8:1.2.2.2
	tls-earlyentropy:1.15.0.2
	tls-earlyentropy-base:1.15
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.15
	riastradh-drm2-base3:1.13
	riastradh-drm2-base2:1.12
	riastradh-drm2-base1:1.12
	riastradh-drm2:1.12.0.2
	riastradh-drm2-base:1.12
	khorben-n900:1.10.0.4
	agc-symver:1.10.0.2
	agc-symver-base:1.10
	tls-maxphys-base:1.15
	tls-maxphys:1.9.0.4
	yamt-pagecache:1.2.0.2
	yamt-pagecache-base8:1.2;
locks; strict;
comment	@# @;


1.45
date	2026.02.15.19.38.43;	author riastradh;	state Exp;
branches;
next	1.44;
commitid	OKwTBQhkDyJjAvuG;

1.44
date	2024.12.29.09.46.44;	author jmmv;	state Exp;
branches;
next	1.43;
commitid	SMRsHmmHTKgOBnDF;

1.43
date	2024.12.27.19.02.19;	author christos;	state Exp;
branches;
next	1.42;
commitid	lUKdBalraoedKaDF;

1.42
date	2023.09.27.00.24.13;	author riastradh;	state Exp;
branches
	1.42.2.1;
next	1.41;
commitid	k45BHG3lHtqEflGE;

1.41
date	2022.10.30.15.08.50;	author jmcneill;	state Exp;
branches
	1.41.2.1;
next	1.40;
commitid	uCaBatOtmIXMOKZD;

1.40
date	2022.10.15.18.32.30;	author jmcneill;	state Exp;
branches;
next	1.39;
commitid	8oUkXf39zTEsqQXD;

1.39
date	2021.07.06.11.49.36;	author jmcneill;	state Exp;
branches;
next	1.38;
commitid	zvJIidedlP6UaVZC;

1.38
date	2020.12.23.10.35.18;	author rin;	state Exp;
branches;
next	1.37;
commitid	UjUL16IWXrm42RAC;

1.37
date	2020.07.17.15.16.34;	author jmcneill;	state Exp;
branches;
next	1.36;
commitid	UXZW2Dqo4F3mHrgC;

1.36
date	2020.05.28.10.19.02;	author jmcneill;	state Exp;
branches;
next	1.35;
commitid	bAP84OsBp8N4FZ9C;

1.35
date	2020.05.24.14.45.49;	author jmcneill;	state Exp;
branches;
next	1.34;
commitid	D62nZek5KhWxgv9C;

1.34
date	2019.12.01.15.07.04;	author jmcneill;	state Exp;
branches;
next	1.33;
commitid	hUoj94VkSNQr01NB;

1.33
date	2019.06.11.10.50.57;	author mrg;	state Exp;
branches
	1.33.2.1;
next	1.32;
commitid	0vrgPoTQk5M08LqB;

1.32
date	2018.12.02.15.43.04;	author jmcneill;	state Exp;
branches;
next	1.31;
commitid	qi7WqG3St0hoUe2B;

1.31
date	2018.11.30.20.53.02;	author jmcneill;	state Exp;
branches;
next	1.30;
commitid	Y7xhCRLXw2UwG02B;

1.30
date	2018.10.06.13.11.22;	author jmcneill;	state Exp;
branches;
next	1.29;
commitid	BjAIrMEvWovWTTUA;

1.29
date	2018.10.06.09.58.55;	author jmcneill;	state Exp;
branches;
next	1.28;
commitid	kWS6yIjnNcWUPSUA;

1.28
date	2018.06.19.15.12.05;	author jmcneill;	state Exp;
branches
	1.28.2.1;
next	1.27;
commitid	4zxIANg2N7fq4UGA;

1.27
date	2017.05.13.10.44.58;	author hubertf;	state Exp;
branches
	1.27.8.1;
next	1.26;
commitid	LrfosF7zZG2GvdRz;

1.26
date	2017.04.12.23.32.11;	author jmcneill;	state Exp;
branches
	1.26.2.1;
next	1.25;
commitid	kdZ0zLkqCCt4KiNz;

1.25
date	2017.04.11.17.30.17;	author jmcneill;	state Exp;
branches;
next	1.24;
commitid	XIPY7Evp4HUOM8Nz;

1.24
date	2015.08.01.10.04.50;	author jmcneill;	state Exp;
branches
	1.24.2.1
	1.24.4.1;
next	1.23;
commitid	9izPq6D0Ww1Hdyvy;

1.23
date	2015.08.01.10.04.06;	author jmcneill;	state Exp;
branches;
next	1.22;
commitid	d3c4qRLgX4omdyvy;

1.22
date	2015.04.06.22.44.46;	author jmcneill;	state Exp;
branches;
next	1.21;
commitid	CbIxdRsyjCFzbAgy;

1.21
date	2015.04.06.20.19.28;	author jmcneill;	state Exp;
branches;
next	1.20;
commitid	tOifK7pY9bjAnzgy;

1.20
date	2015.01.29.14.54.06;	author skrll;	state Exp;
branches;
next	1.19;
commitid	dFnZUnkpzEf2JV7y;

1.19
date	2015.01.28.12.08.00;	author jmcneill;	state Exp;
branches;
next	1.18;
commitid	Y9APtLMBySVDQM7y;

1.18
date	2015.01.23.15.17.58;	author skrll;	state Exp;
branches;
next	1.17;
commitid	LaUSni46C5eI2a7y;

1.17
date	2014.11.25.13.42.31;	author jmcneill;	state Exp;
branches;
next	1.16;
commitid	dTjj23Ds8pUBqzZx;

1.16
date	2014.09.09.13.02.25;	author jmcneill;	state Exp;
branches;
next	1.15;
commitid	6eJ3AvlFy44jGFPx;

1.15
date	2014.03.31.17.05.03;	author christos;	state Exp;
branches
	1.15.4.1;
next	1.14;
commitid	s5fzrHt1nRsieSux;

1.14
date	2014.03.31.16.20.49;	author christos;	state Exp;
branches;
next	1.13;
commitid	zkF6OiMVD9sVYRux;

1.13
date	2013.11.22.11.13.54;	author skrll;	state Exp;
branches;
next	1.12;
commitid	pJgJ3ciDP70Hqgex;

1.12
date	2013.07.05.15.45.17;	author matt;	state Exp;
branches;
next	1.11;
commitid	mYVzHfDdkDQPqiWw;

1.11
date	2013.05.20.19.28.44;	author christos;	state Exp;
branches;
next	1.10;
commitid	dMjVjXdZA2E09pQw;

1.10
date	2013.03.01.14.28.22;	author htodd;	state Exp;
branches;
next	1.9;

1.9
date	2013.02.21.15.13.10;	author hans;	state Exp;
branches
	1.9.4.1;
next	1.8;

1.8
date	2013.02.12.12.04.39;	author jmcneill;	state Exp;
branches;
next	1.7;

1.7
date	2013.02.10.23.37.32;	author jmcneill;	state Exp;
branches;
next	1.6;

1.6
date	2013.02.10.23.28.19;	author christos;	state Exp;
branches;
next	1.5;

1.5
date	2013.02.03.09.16.25;	author christos;	state Exp;
branches;
next	1.4;

1.4
date	2013.01.28.09.06.19;	author skrll;	state Exp;
branches;
next	1.3;

1.3
date	2013.01.23.21.59.37;	author skrll;	state Exp;
branches;
next	1.2;

1.2
date	2013.01.21.16.59.23;	author skrll;	state Exp;
branches
	1.2.2.1;
next	1.1;

1.1
date	2013.01.16.23.27.34;	author christos;	state Exp;
branches;
next	;

1.42.2.1
date	2025.08.02.05.20.40;	author perseant;	state Exp;
branches;
next	;
commitid	23j6GFaDws3O875G;

1.41.2.1
date	2023.10.02.13.26.04;	author martin;	state Exp;
branches;
next	;
commitid	1NCiH2r23TKUp3HE;

1.33.2.1
date	2019.12.08.14.35.10;	author martin;	state Exp;
branches;
next	;
commitid	bV5zYUmqGA1JBUNB;

1.28.2.1
date	2019.06.10.21.42.37;	author christos;	state Exp;
branches;
next	1.28.2.2;
commitid	jtc8rnCzWiEEHGqB;

1.28.2.2
date	2020.04.08.14.03.55;	author martin;	state Exp;
branches;
next	1.28.2.3;
commitid	Qli2aW9E74UFuA3C;

1.28.2.3
date	2020.04.13.07.45.36;	author martin;	state Exp;
branches;
next	;
commitid	X01YhRUPVUDaec4C;

1.27.8.1
date	2018.06.25.07.25.11;	author pgoyette;	state Exp;
branches;
next	1.27.8.2;
commitid	8PtAu9af7VvhiDHA;

1.27.8.2
date	2018.10.20.06.58.18;	author pgoyette;	state Exp;
branches;
next	1.27.8.3;
commitid	mTSoqZEZ4arHnFWA;

1.27.8.3
date	2018.12.26.14.01.13;	author pgoyette;	state Exp;
branches;
next	;
commitid	xUhK8IAeBM1azj5B;

1.26.2.1
date	2017.05.19.00.22.52;	author pgoyette;	state Exp;
branches;
next	;
commitid	QNTxgGjVagwoSVRz;

1.24.2.1
date	2017.04.26.02.52.17;	author pgoyette;	state Exp;
branches;
next	;
commitid	ojV02aOSdzvBqZOz;

1.24.4.1
date	2017.04.21.16.51.15;	author bouyer;	state Exp;
branches;
next	;
commitid	dUG7nkTKALCadqOz;

1.15.4.1
date	2014.11.27.11.23.04;	author martin;	state Exp;
branches;
next	1.15.4.2;
commitid	vqoGqDCGqEEMAOZx;

1.15.4.2
date	2015.01.28.11.27.03;	author martin;	state Exp;
branches;
next	1.15.4.3;
commitid	0H3hSwdbxpwACM7y;

1.15.4.3
date	2015.01.28.18.37.45;	author martin;	state Exp;
branches;
next	1.15.4.4;
commitid	FotvngFVdbHl0P7y;

1.15.4.4
date	2015.01.29.15.12.48;	author martin;	state Exp;
branches;
next	1.15.4.5;
commitid	VmbBB67APv43QV7y;

1.15.4.5
date	2015.08.06.21.13.43;	author snj;	state Exp;
branches;
next	;
commitid	8DiUh5BbT1XZKfwy;

1.9.4.1
date	2013.02.21.15.13.10;	author tls;	state dead;
branches;
next	1.9.4.2;

1.9.4.2
date	2013.02.25.00.24.47;	author tls;	state Exp;
branches;
next	1.9.4.3;

1.9.4.3
date	2013.06.23.06.26.19;	author tls;	state Exp;
branches;
next	1.9.4.4;
commitid	OnlO1cBgtQRcIHUw;

1.9.4.4
date	2014.08.19.23.45.45;	author tls;	state Exp;
branches;
next	;
commitid	jTnpym9Qu0o4R1Nx;

1.2.2.1
date	2013.01.21.16.59.23;	author yamt;	state dead;
branches;
next	1.2.2.2;

1.2.2.2
date	2013.01.23.00.04.28;	author yamt;	state Exp;
branches;
next	1.2.2.3;

1.2.2.3
date	2014.05.22.12.01.34;	author yamt;	state Exp;
branches;
next	;
commitid	yqlfOuaAhYmASwBx;


desc
@@


1.45
log
@mkimage/conf/*.conf: Nix postfix minwrites customization.

This customization has been a no-op for a long time.

These config files previously had copied & pasted logic to replace
the `fifo' listener type (named pipes) by `unix' (local sockets)
/etc/postfix/master.cf, because notifying fifo listeners bumps mtime,
while notifying unix listeners does not, so changing from `fifo' to
`unix' would reduce disk writes.

But Postfix has had used `unix' for everything by default since 2.10,
released in 2012 and first shipped in NetBSD 7.0 in 2015.  So this
customization has been a no-op for over a decade.  Let's save readers
some pondering and just nix it.
@
text
@# $NetBSD: evbarm.conf,v 1.44 2024/12/29 09:46:44 jmmv Exp $
# evbarm shared config
#
image=$HOME/${board}.img

MACHINE=evbarm

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_evbarm() {
	# compute all sizes in terms of sectors
	local totalsize=$(( ${size} / 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_evbarm() {
	make_fstab_default EFI
}

customize_evbarm() {
	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
}

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 2>/dev/null)" in
	OracleCloud*)
		ret=YES
		;;
	esac

	printf \$ret
}

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
certctl_init=YES
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"
}
@


1.44
log
@Recognize MKPOSTFIX=no in mkimage
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.43 2024/12/27 19:02:19 christos Exp $
a72 7
	if $minwrites && $postfix; then
		mkdir ${mnt}/etc/postfix
		(umask 022
		sed -e 's/fifo/unix/' < ${release}/etc/postfix/master.cf > \
		    ${mnt}/etc/postfix/master.cf)
	fi
	
@


1.43
log
@Remove duplicated code, handle minwrites in _normal the same way we handle
it in _gpt. Initial patch from jmmv@@.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.42 2023/09/27 00:24:13 riastradh Exp $
d73 1
a73 1
	if $minwrites; then
@


1.42
log
@/etc/rc.d/cerctl_init: New script for certctl rehash in live images.

This is very limited -- it does not supplant postinstall to rehash
certificates on upgrade; it only runs certctl rehash if
/etc/openssl/certs is an empty directory, as you get in live images
not created with sysinst.

We could also have a more general-purpose way to run postinstall(8)
on first boot of an image, but that has a lot more moving parts to
think about, so let's start with this limited-scope low-risk
approach.

PR install/57629

XXX pullup-10
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.41 2022/10/30 15:08:50 jmcneill Exp $
a67 46
make_fstab_evbarm_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:-EFI}		/boot		msdos	rw	1 1
ptyfs		/dev/pts	ptyfs	rw
procfs		/proc		procfs	rw
tmpfs		/var/shm	tmpfs	rw,-m1777,-sram%25
EOF
}

make_fstab_evbarm_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
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_evbarm_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
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
}

d69 1
a69 13
	if $gpt; then
		make_fstab_evbarm_gpt
	elif $minwrites; then
		make_fstab_evbarm_minwrites
	else
		make_fstab_evbarm_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"
@


1.42.2.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.44 2024/12/29 09:46:44 jmmv Exp $
d68 46
d115 13
a127 1
	make_fstab_default EFI
d131 1
a131 1
	if $minwrites && $postfix; then
@


1.41
log
@Silence a warning when machdep.dmi.chassis-asset-tag is not present
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.40 2022/10/15 18:32:30 jmcneill Exp $
d176 1
@


1.41.2.1
log
@Pull up following revision(s) (requested by riastradh in ticket #381):

	distrib/utils/embedded/conf/evbarm.conf: revision 1.42
	distrib/sets/lists/etc/mi: revision 1.273
	etc/rc.d/Makefile: revision 1.118
	distrib/utils/embedded/conf/usermode.conf: revision 1.7
	etc/rc.d/certctl_init: revision 1.1
	distrib/evbarm/liveimage/armimage/rc.conf.armimage: revision 1.2
	etc/defaults/rc.conf: revision 1.166
	distrib/amd64/liveimage/emuimage/rc.conf.emuimage: revision 1.3
	distrib/utils/embedded/conf/x86.conf: revision 1.11
	distrib/utils/embedded/conf/evbmips.conf: revision 1.4

/etc/rc.d/cerctl_init: New script for certctl rehash in live images.

This is very limited -- it does not supplant postinstall to rehash
certificates on upgrade; it only runs certctl rehash if
/etc/openssl/certs is an empty directory, as you get in live images
not created with sysinst.

We could also have a more general-purpose way to run postinstall(8)
on first boot of an image, but that has a lot more moving parts to
think about, so let's start with this limited-scope low-risk
approach.

PR install/57629

/etc/rc.d/certctl_init: Default off.
Otherwise in systems without certctl_init=YES, such as systems
installed with sysinst(8) where it's unnecessary because the rehash
has already happened at install time, you'll get spurious warnings.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.41 2022/10/30 15:08:50 jmcneill Exp $
a175 1
certctl_init=YES
@


1.40
log
@ec2_init: Add support for Oracle Cloud
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.39 2021/07/06 11:49:36 jmcneill Exp $
d157 1
a157 1
	case "\$(/sbin/sysctl -n machdep.dmi.chassis-asset-tag)" in
@


1.39
log
@Disable kernfs on live images -- it is not required.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.38 2020/12/23 10:35:18 rin Exp $
d148 18
@


1.38
log
@Fix fallout from mkimage rev 1.76.

For mkimage:

- Update "size" if auto-calculated.
- Use "dd bs=1" instead of non-portable "head -c".
- Some style nits.

For MD make_label() functions:

- Stop using "newsize" as image size in MB, use "size" instead.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.37 2020/07/17 15:16:34 jmcneill Exp $
a73 1
kernfs		/kern		kernfs	rw
a85 1
kernfs		/kern		kernfs	rw
a100 1
kernfs		/kern			kernfs	rw
a127 2
	echo "./kern type=dir uname=root gname=wheel mode=0755" \
	    >> "$tmp/selected_sets"
@


1.37
log
@Create an "octeon.img.gz" bootable image for evbmips64-eb release builds.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.36 2020/05/28 10:19:02 jmcneill Exp $
d26 1
a26 1
	local totalsize=$(( ${newsize} * 1024 * 2 / 512 ))
@


1.36
log
@Allow config file to override hostname
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.35 2020/05/24 14:45:49 jmcneill Exp $
d73 1
a73 1
NAME=${gpt_label_efi:-EFI}		/boot		msdos	rw	1 1
@


1.35
log
@Add GPT support to mkimage.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.34 2019/12/01 15:07:04 jmcneill Exp $
d154 1
a154 1
hostname=${board}
@


1.34
log
@Remove the pretty much useless 128MB swap partition from the arm images.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.33 2019/06/11 10:50:57 mrg Exp $
d16 6
d68 13
d118 3
a120 1
	if $minwrites; then
d167 1
a167 1
resize_disklabel=YES
d178 1
a178 1
	for _f in resize_disklabel creds_msdos; do
@


1.33
log
@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 <user> <path on msdos>
	sshkey <user> <entry>
	useraddhash <user> <passwd hash>
	useradd <user> <passwd>

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@@.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.32 2018/12/02 15:43:04 jmcneill Exp $
a7 1
swap=256
d11 1
a11 1
ffsoffset=$(( (${init} + ${boot} + ${swap}) / 2 ))m
a21 1
	local swapsize=$(( ${swap} * 1024 ))
a24 1
	local swapoffset=$(( ${bootoffset} + ${bootsize} ))
d26 2
a27 2
	local asize=$(( ${totalsize} - ${swapsize} - ${bootsize} - ${bootoffset} ))
	local aoffset=$(( ${swapoffset} + ${swapsize} ))
a56 1
 b:   ${swapsize}  ${swapoffset} swap                         #
a66 1
ROOT.b		none		swap	sw	0 0
a82 1
ROOT.b		none			swap	sw			  0 0
d134 2
@


1.33.2.1
log
@Pull up following revision(s) (requested by jmcneill in ticket #511):

	distrib/utils/embedded/conf/evbarm.conf: revision 1.34

Remove the pretty much useless 128MB swap partition from the arm images.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.33 2019/06/11 10:50:57 mrg Exp $
d8 1
d12 1
a12 1
ffsoffset=$(( (${init} + ${boot}) / 2 ))m
d23 1
d27 1
d29 2
a30 2
	local asize=$(( ${totalsize} - ${bootsize} - ${bootoffset} ))
	local aoffset=$(( ${bootoffset} + ${bootsize} ))
d60 1
d71 1
d88 1
a139 2
no_swap=YES
savecore=NO
@


1.32
log
@Fix variable escaping in dev_exists()
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.31 2018/11/30 20:53:02 jmcneill Exp $
d144 2
d161 5
a165 3
	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"
@


1.31
log
@Add support for configuring Amazon.com EC2 SSH keys and hostnames. While
here, only set wscons=YES if a wsdisplay0 device is present.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.30 2018/10/06 13:11:22 jmcneill Exp $
d131 1
a131 1
	if /sbin/drvctl -l $1 >/dev/null 2>&1 ; then
@


1.30
log
@Use special ROOT. prefix in fstab entries instead of assuming ld0
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.29 2018/10/06 09:58:55 jmcneill Exp $
d130 8
@


1.29
log
@resize_disklabel: if disk and partition is not specified, use kern.root_device/kern.root_partition sysctls
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.28 2018/06/19 15:12:05 jmcneill Exp $
d70 3
a72 3
/dev/ld0a	/		ffs	rw,noatime	1 1
/dev/ld0b	none		swap	sw	0 0
/dev/ld0e	/boot		msdos	rw	1 1
d87 3
a89 3
/dev/ld0a	/			ffs	rw,log,noatime,nodevmtime 1 1
/dev/ld0b	none			swap	sw			  0 0
/dev/ld0e	/boot			msdos	rw			  1 1
@


1.28
log
@Increase reserved space at start of image from 4MB to 16MB to make room
for Rockchip bootloaders.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.27 2017/05/13 10:44:58 hubertf Exp $
a140 2
resize_disklabel_disk=ld0
resize_disklabel_part=a
@


1.28.2.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.32 2018/12/02 15:43:04 jmcneill Exp $
d70 3
a72 3
ROOT.a		/		ffs	rw,noatime	1 1
ROOT.b		none		swap	sw	0 0
ROOT.e		/boot		msdos	rw	1 1
d87 3
a89 3
ROOT.a		/			ffs	rw,log,noatime,nodevmtime 1 1
ROOT.b		none			swap	sw			  0 0
ROOT.e		/boot			msdos	rw			  1 1
a129 8
dev_exists() {
	if /sbin/drvctl -l \$1 >/dev/null 2>&1 ; then
		printf YES
	else
		printf NO
	fi
}

d141 2
@


1.28.2.2
log
@Merge changes from current as of 20200406
@
text
@d1 1
a1 1
# $NetBSD$
d8 1
d12 1
a12 1
ffsoffset=$(( (${init} + ${boot}) / 2 ))m
d23 1
d27 1
d29 2
a30 2
	local asize=$(( ${totalsize} - ${bootsize} - ${bootoffset} ))
	local aoffset=$(( ${bootoffset} + ${bootsize} ))
d60 1
d71 1
d88 1
a139 2
no_swap=YES
savecore=NO
@


1.28.2.3
log
@Mostly merge changes from HEAD upto 20200411
@
text
@a139 2
creds_msdos=YES
creds_msdos_partition=/boot
d155 3
a157 5
	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
@


1.27
log
@minor cleanup in customize_evbarm():
keep handling of /etc/rc.conf in one place
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.26 2017/04/12 23:32:11 jmcneill Exp $
d10 1
a10 1
init=8
@


1.27.8.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.28 2018/06/19 15:12:05 jmcneill Exp $
d10 1
a10 1
init=32
@


1.27.8.2
log
@Sync with head
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.30 2018/10/06 13:11:22 jmcneill Exp $
d70 3
a72 3
ROOT.a		/		ffs	rw,noatime	1 1
ROOT.b		none		swap	sw	0 0
ROOT.e		/boot		msdos	rw	1 1
d87 3
a89 3
ROOT.a		/			ffs	rw,log,noatime,nodevmtime 1 1
ROOT.b		none			swap	sw			  0 0
ROOT.e		/boot			msdos	rw			  1 1
d141 2
@


1.27.8.3
log
@Sync with HEAD, resolve a few conflicts
@
text
@d1 1
a1 1
# $NetBSD$
a129 8
dev_exists() {
	if /sbin/drvctl -l \$1 >/dev/null 2>&1 ; then
		printf YES
	else
		printf NO
	fi
}

@


1.26
log
@Slightly reduce the size of the MSDOS partition from 124M to 92M. With
the larger size, installing the ODROID-C1 bootloader causes the fs to
become unreadable. Not sure why..
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.25 2017/04/11 17:30:17 jmcneill Exp $
a120 1
	cp ${release}/etc/rc.conf ${mnt}/etc/rc.conf
d127 2
@


1.26.2.1
log
@Resolve conflicts from previous merge (all resulting from $NetBSD
keywork expansion)
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.27 2017/05/13 10:44:58 hubertf Exp $
d121 1
a127 2
	
	cp ${release}/etc/rc.conf ${mnt}/etc/rc.conf
@


1.25
log
@Increase the size of the boot partition and remove the 'd' part from the
disklabel.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.24 2015/08/01 10:04:50 jmcneill Exp $
d11 1
a11 1
boot=$((256 - ${init}))
@


1.24
log
@mount root partition with noatime
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.23 2015/08/01 10:04:06 jmcneill Exp $
a9 1
boot=120
d11 1
a61 1
 d:   ${totalsize} 0             unused      0     0          #
@


1.24.2.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.26 2017/04/12 23:32:11 jmcneill Exp $
d10 1
a11 1
boot=$((192 - ${init}))
d62 1
@


1.24.4.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.26 2017/04/12 23:32:11 jmcneill Exp $
d10 1
a11 1
boot=$((192 - ${init}))
d62 1
@


1.23
log
@Align partitions to 64MB for the benefit of SD cards > 32GB
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.22 2015/04/06 22:44:46 jmcneill Exp $
d71 1
a71 1
/dev/ld0a	/		ffs	rw	1 1
@


1.22
log
@show resize_ffs progress bar when resizing root partition
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.21 2015/04/06 20:19:28 jmcneill Exp $
d10 1
a10 1
boot=112
@


1.21
log
@Add support for auto-growing the root partition. Enable it for rpi.img.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.20 2015/01/29 14:54:06 skrll Exp $
d144 1
@


1.20
log
@Fix previous so that the new generated rc.conf is picked up and that
any new new mount points (e.g. /proc and /kern) are generated.

While here increate the fs size so that postfix can actually build
/etc/mail/aliases.db
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.19 2015/01/28 12:08:00 jmcneill Exp $
d137 11
d151 5
@


1.19
log
@add /var/shm tmpfs to fstab
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.18 2015/01/23 15:17:58 skrll Exp $
d9 1
a9 1
extra=8		# spare space
d113 6
d137 3
@


1.18
log
@PR/49596: mkimage: incorrect permissions on evbarm images

Use NetBSD.dist in our mtree specification to populate the top level
directories, etc.

For each generated file hand craft an mtree entry.

Remove specialdirs as NetBSD.dist creates /proc and /kern.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.17 2014/11/25 13:42:31 jmcneill Exp $
d77 1
d101 1
@


1.17
log
@disable wapbl for evbarm images until stability issues are sorted out
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.16 2014/09/09 13:02:25 jmcneill Exp $
a5 1
specialdirs="/kern /proc"
d109 2
d137 3
a139 2
	echo "${bar} creating directories ${bar}"
	mkdir ${mnt}/proc ${mnt}/kern
@


1.16
log
@turn on ntpd
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.15 2014/03/31 17:05:03 christos Exp $
d72 1
a72 1
/dev/ld0a	/		ffs	rw,log	1 1
@


1.15
log
@these changes produce a bootable system under qemu, but its root is trashed.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.14 2014/03/31 16:20:49 christos Exp $
d125 2
@


1.15.4.1
log
@Pull up following revision(s) (requested by jmcneill in ticket #268):
	distrib/utils/embedded/conf/evbarm.conf: revision 1.17
disable wapbl for evbarm images until stability issues are sorted out
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.15 2014/03/31 17:05:03 christos Exp $
d72 1
a72 1
/dev/ld0a	/		ffs	rw	1 1
@


1.15.4.2
log
@Pull up following revision(s) (requested by skrll in ticket #465):
	distrib/utils/embedded/conf/rpi_inst.conf: revision 1.6
	distrib/utils/embedded/conf/usermode.conf: revision 1.4
	distrib/utils/embedded/mkimage: revision 1.51
	distrib/utils/embedded/conf/x86.conf: revision 1.6
	distrib/utils/embedded/conf/evbarm.conf: revision 1.18
PR/49596: mkimage: incorrect permissions on evbarm images
Use NetBSD.dist in our mtree specification to populate the top level
directories, etc.
For each generated file hand craft an mtree entry.
Remove specialdirs as NetBSD.dist creates /proc and /kern.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.15.4.1 2014/11/27 11:23:04 martin Exp $
d6 1
a109 2
	echo "./etc/fstab type=file uname=root gname=wheel mode=0644" \
	    >> "$tmp/selected_sets"
d134 2
a135 3
	echo "${bar} fixing up permissions"
	echo "./boot type=dir uname=root gname=wheel mode=0755" \
	    >> "$tmp/selected_sets"
@


1.15.4.3
log
@Pull up following revision(s) (requested by jmcneill in ticket #466):
	distrib/utils/embedded/conf/evbarm.conf: revision 1.19
add /var/shm tmpfs to fstab
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.15.4.2 2015/01/28 11:27:03 martin Exp $
a76 1
tmpfs		/var/shm	tmpfs	rw,-m1777,-sram%25
a99 1
tmpfs		/var/shm		tmpfs	rw,-m1777,-sram%25
@


1.15.4.4
log
@Pull up following revision(s) (requested by skrll in ticket #470):
	distrib/utils/embedded/mkimage: revision 1.52
	distrib/utils/embedded/conf/x86.conf: revision 1.7
	distrib/utils/embedded/conf/evbarm.conf: revision 1.20
Fix previous so that the new generated rc.conf is picked up and that
any new new mount points (e.g. /proc and /kern) are generated.
While here increate the fs size so that postfix can actually build
/etc/mail/aliases.db
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.15.4.3 2015/01/28 18:37:45 martin Exp $
d9 1
a9 1
extra=48		# spare space
a112 6

	# 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"
a128 3
	echo "./etc/rc.conf type=file uname=root gname=wheel mode=0644" \
	    >> "$tmp/selected_sets"

@


1.15.4.5
log
@Pull up following revision(s) (requested by skrll in ticket #909):
	distrib/sets/lists/etc/mi: revision 1.237
	distrib/sets/lists/tests/mi: revision 1.613
	distrib/utils/embedded/conf/armv7.conf: revisions 1.1, 1.2
	distrib/utils/embedded/conf/beagleboard.conf: delete
	distrib/utils/embedded/conf/evbarm.conf: revisions 1.21, 1.22
	distrib/utils/embedded/conf/rpi.conf: revisions 1.28, 1.29
	distrib/utils/embedded/conf/rpi_inst.conf: revisions 1.7, 1.8
	distrib/utils/embedded/conf/usermode.conf: revision 1.5
	distrib/utils/embedded/conf/x86.conf: revision 1.5
	distrib/utils/embedded/files/resize_disklabel: revision 1.1
	distrib/utils/embedded/mkimage: revisions 1.49, 1.55-1.59
	etc/defaults/rc.conf: revision 1.133
	etc/etc.evbarm/Makefile.inc: revisions 1.72, 1.76
	etc/rc.d/Makefile: revision 1.93 via patch
	etc/rc.d/resize_root: revisions 1.1-1.3
	etc/rc.d/root: revision 1.5
	sbin/resize_ffs/Makefile: revision 1.5
	sbin/resize_ffs/resize_ffs.8: revisions 1.14-1.16
	sbin/resize_ffs/resize_ffs.c: revisions 1.39-1.44
	share/man/man5/rc.conf.5: revision 1.158, 1.159
	tests/sbin/resize_ffs/Makefile: revision 1.4
	tests/sbin/resize_ffs/common.sh: revision 1.14
	tests/sbin/resize_ffs/t_check.sh: revision 1.1
	tests/sbin/resize_ffs/t_grow.sh: revision 1.9
	tests/sbin/resize_ffs/t_grow_swapped.sh: revision 1.3
	tests/sbin/resize_ffs/t_shrink.sh: revision 1.8
	tests/sbin/resize_ffs/t_shrink_swapped.sh: revision 1.2
fix image building:
         - round up the total size of the disk image
         - fix fdisk offset for netbsd ffs images
--
Make get_dev_size work on regular files too.
--
Use `!= -1' instead of `== 0' out of paranoia.
--
- Add -c to check to see if grow/shrink is required
- Divide by DEV_BSIZE when returning size of file.
- Update manpage
--
New sentence, new line. Sort option descriptions.
--
Add resize_root boot operation. If resize_root=YES in rc.conf then
the system attempts to resize the root file system to fill it's
partition prior to mounting read-write. Useful for things like AMI
file system images. May eventually be used by arm images after
coming up with similar solution for increasing the parition size.
--
- Add new tests for -c check flag in resize_ffs
--
Bump date for previous.
it's -> its
--
Handle case in grow() where last cylinder group is too small for ufs2.
Align with code in shrink().
--
factor out geometry calculation and use this also in CheckOnly mode.
be a bit more verbose in Verbose mode.
--
Add support for auto-growing the root partition. Enable it for rpi.img.
--
initialize resize before pulling in board config
--
add KEYWORD: interactive, honour resize_root_flags and
resize_root_postcmd rc vars
--
if the -p flag is specified, display a progress bar while growing the
file-system
--
show resize_ffs progress bar when resizing root partition
--
fix typo in previous; pass -y unconditionally to resize_ffs, not -p
--
Rename beagleboard.img to armv7.img. The new image includes the same
kernels as beagleboard.img plus support for Raspberry Pi 2, ODROID-C1,
Cubieboard2, Cubietruck, Hummingbird A31, and Banana Pi.
--
Properly spell X' name. From X(7):
        The  X.Org  Foundation  requests  that the following names be
used when
        referring to this software:
                                           X
                                    X Window System
                                     X Version 11
                              X Window System, Version 11
                                          X11
--
Add some documentation:
Tell what this does, and what it expects from conf files
--
Cleanup: make_filesystems is not used any longer, purge remains
--
More cleanup:
Instead of first overwriting the *_evbarm functions with own code,
and then calling them from the regular functions, directly put the
code into the regular functions.
No more functions from evbarm.conf are used now.
Some variables are still used!
--
define TOOL_MKUBOOTIMAGE for mkimage
--
fix mkubootimage
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.15.4.4 2015/01/29 15:12:48 martin Exp $
a134 12

	if $resize; then
		cat >> ${mnt}/etc/rc.conf << EOF
resize_disklabel=YES
resize_disklabel_disk=ld0
resize_disklabel_part=a
resize_root=YES
resize_root_flags="-p"
resize_root_postcmd="/sbin/reboot -n"
EOF
	fi

a137 5
	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"

@


1.14
log
@Add preliminary support for creating x86 usb sticks with mkimage.
This is untested, and just a checkpoint of the work. Image looks
ok, but I have not tried if it boots.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.13 2013/11/22 11:13:54 skrll Exp $
d13 1
d18 2
@


1.13
log
@Fix /dev population of the evbarm images by using MAKEDEV -s and appending
to the mtree spec file passed to makefs.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.12 2013/07/05 15:45:17 matt Exp $
d7 1
@


1.12
log
@Keep both c: and d: paritions so this can work with systems that have
RAW_PART as 2 or 3.  Addresses PR/47688.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.11 2013/05/20 19:28:44 christos Exp $
d127 2
a128 1
	(cd ${mnt}/dev && ${HOST_SH} ${release}/dev/MAKEDEV all)
@


1.11
log
@If minwrites is set:
	- set noatime, nodevmtime for root
	- use tmpfs for frequently written files
	- use unix sockets instead of fifos for postfix
From:
http://rich-tbp.blogspot.com/2013/03/netbsd-on-rpi-minimizing-disk-writes.html
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.10 2013/03/01 14:28:22 htodd Exp $
d58 1
@


1.10
log
@Disklabel need to use sectors, not bytes. Thanks to agc.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.9 2013/02/21 15:13:10 hans Exp $
d63 1
a63 1
make_fstab_evbarm() {
d76 31
d109 6
@


1.9
log
@Use HOST_SH to run scripts. Makes mkimage work on SunOS.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.8 2013/02/12 12:04:39 jmcneill Exp $
d17 3
a19 1
	local totalsize=$(( ${newsize} * 1024 * 2 ))
@


1.9.4.1
log
@file evbarm.conf was added on branch tls-maxphys on 2013-02-25 00:24:47 +0000
@
text
@d1 91
@


1.9.4.2
log
@resync with head
@
text
@a0 91
# $NetBSD$
# evbarm shared config
#
image=$HOME/${board}.img

specialdirs="/kern /proc"

swap=256
extra=8		# spare space
boot=112
init=8

size=0		# autocompute
msdosid=12

make_label_evbarm() {
	local totalsize=$(( ${newsize} * 1024 * 2 ))
	local swapsize=$(( ${swap} * 1024 ))
	local bootsize=$(( ${boot} * 1024 ))

	local bootoffset=$(( ${init} * 1024 ))
	local swapoffset=$(( ${bootoffset} + ${bootsize} ))

	local asize=$(( ${totalsize} - ${swapsize} - ${bootsize} - ${bootoffset} ))
	local aoffset=$(( ${swapoffset} + ${swapsize} ))

	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  # 
 b:   ${swapsize}  ${swapoffset} swap                         #
 d:   ${totalsize} 0             unused      0     0          #
 e:   ${bootsize}  ${bootoffset} MSDOS                        #
EOF
}

make_fstab_evbarm() {
	cat > ${mnt}/etc/fstab << EOF
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
/dev/ld0a	/		ffs	rw,log	1 1
/dev/ld0b	none		swap	sw	0 0
/dev/ld0e	/boot		msdos	rw	1 1
kernfs		/kern		kernfs	rw
ptyfs		/dev/pts	ptyfs	rw
procfs		/proc		procfs	rw
EOF
}

customize_evbarm() {
	cp ${release}/etc/rc.conf ${mnt}/etc/rc.conf
	cat >> ${mnt}/etc/rc.conf << EOF
rc_configured=YES
hostname=${board}
sshd=YES
dhcpcd=YES
EOF
	if [ ! -f ${release}/dev/MAKEDEV ]; then
		echo ${PROG}: Missing ${release}/dev/MAKEDEV 1>&2
		exit 1
	fi
	echo "${bar} running MAKEDEV ${bar}"
	(cd ${mnt}/dev && ${HOST_SH} ${release}/dev/MAKEDEV all)

	echo "${bar} creating directories ${bar}"
	mkdir ${mnt}/proc ${mnt}/kern
}
@


1.9.4.3
log
@resync from head
@
text
@d17 1
a17 3
	# compute all sizes in terms of sectors
	local totalsize=$(( ${newsize} * 1024 * 2 / 512 ))

d61 1
a61 1
make_fstab_evbarm_normal() {
a73 31
# 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_evbarm_minwrites() {
	cat > ${mnt}/etc/fstab << EOF
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
/dev/ld0a	/			ffs	rw,log,noatime,nodevmtime 1 1
/dev/ld0b	none			swap	sw			  0 0
/dev/ld0e	/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
EOF
}

make_fstab_evbarm() {
	if $minwrites; then
		make_fstab_evbarm_minwrites
	else
		make_fstab_evbarm_normal
	fi
}

a75 6
	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
@


1.9.4.4
log
@Rebase to HEAD as of a few days ago.
@
text
@a6 1
MACHINE=evbarm
a11 1
ffsoffset=$(( (${init} + ${boot} + ${swap}) / 2 ))m
a15 2
mkdir -p ${mnt}/boot

a57 1
 c:   ${totalsize} 0             unused      0     0          #
d126 1
a126 2
	${HOST_SH} ${release}/dev/MAKEDEV -s all | sed -e 's:^\./:\./dev/:' \
	    >> "$tmp/selected_sets"
@


1.8
log
@create /proc and /kern
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.7 2013/02/10 23:37:32 jmcneill Exp $
d87 1
a87 1
	(cd ${mnt}/dev && sh ${release}/dev/MAKEDEV all)
@


1.7
log
@set rc_configured=YES and a hostname
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.6 2013/02/10 23:28:19 christos Exp $
d88 3
@


1.6
log
@start with the original rc.conf
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.5 2013/02/03 09:16:25 christos Exp $
d77 2
@


1.5
log
@switch to makefs
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.4 2013/01/28 09:06:19 skrll Exp $
d75 1
@


1.4
log
@Move mdnsd to beagleboard only. RPI doesn't like it at the moment.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.3 2013/01/23 21:59:37 skrll Exp $
a5 1
setsdir=$obj/evbarm/media/evbarm/binary/sets/
a14 5
overhead=$(( ${swap} + ${extra} + ${init} + ${boot} ))

tmp=/tmp/${board}.disklabel.$$

make_filesystems_evbarm() {
d16 1
d33 1
a33 1
	cat > ${tmp} << EOF
a58 7
	${sudo} disklabel -R ${vnddev} ${tmp}
	${sudo} fdisk -f -u -0 -s ${msdosid}/${bootoffset}/${bootsize} -F ${image}
	${sudo} newfs /dev/r${vnddev}a
	${sudo} newfs_msdos /dev/r${vnddev}e
	${sudo} mount -o async /dev/${vnddev}a ${mnt}
	${sudo} mkdir ${mnt}/boot
	${sudo} mount_msdos /dev/${vnddev}e ${mnt}/boot
d62 1
a62 1
	${sudo} cat > ${mnt}/etc/fstab << EOF
d75 1
a75 1
	${sudo} cat >> ${mnt}/etc/rc.conf << EOF
d79 2
a80 2
	if [ ! -f ${mnt}/dev/MAKEDEV ]; then
		echo ${PROG}: Missing ${mnt}/dev/MAKEDEV 1>&2
d84 1
a84 6
	(cd ${mnt}/dev && ${sudo} sh MAKEDEV all)
}

cleanup_evbarm() {
    rm -f ${tmp}
    ${sudo} umount ${mnt}/boot
@


1.3
log
@Size for 512 byte sectors and base ffs partition size on totalsize minus
others.
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.2 2013/01/21 16:59:23 skrll Exp $
a89 1
mdnsd=YES
@


1.2
log
@kernel.img is for rpi only
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.1 2013/01/16 23:27:34 christos Exp $
d22 1
a22 1
	local asize=$(( ${newsize} * 1024 ))
d26 1
a26 1
	local bootoffset=$((${init} * 1024 ))
d28 2
a31 1
	local totalsize=$(( ${asize} + ${swapsize} + ${bootsize} + ${bootoffset} ))
@


1.2.2.1
log
@file evbarm.conf was added on branch yamt-pagecache on 2013-01-23 00:04:28 +0000
@
text
@d1 102
@


1.2.2.2
log
@sync with head
@
text
@a0 102
# $NetBSD$
# evbarm shared config
#
image=$HOME/${board}.img

setsdir=$obj/evbarm/media/evbarm/binary/sets/
specialdirs="/kern /proc"

swap=256
extra=8		# spare space
boot=112
init=8

size=0		# autocompute
msdosid=12
overhead=$(( ${swap} + ${extra} + ${init} + ${boot} ))

tmp=/tmp/${board}.disklabel.$$

make_filesystems_evbarm() {

	local asize=$(( ${newsize} * 1024 ))
	local swapsize=$(( ${swap} * 1024 ))
	local bootsize=$(( ${boot} * 1024 ))

	local bootoffset=$((${init} * 1024 ))
	local swapoffset=$(( ${bootoffset} + ${bootsize} ))
	local aoffset=$(( ${swapoffset} + ${swapsize} ))

	local totalsize=$(( ${asize} + ${swapsize} + ${bootsize} + ${bootoffset} ))
	local bps=512
	local spt=32
	local tpc=64
	local spc=2048
	local cylinders=$(( ${totalsize} / ${spc} ))

	cat > ${tmp} << 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  # 
 b:   ${swapsize}  ${swapoffset} swap                         #
 d:   ${totalsize} 0             unused      0     0          #
 e:   ${bootsize}  ${bootoffset} MSDOS                        #
EOF
	${sudo} disklabel -R ${vnddev} ${tmp}
	${sudo} fdisk -f -u -0 -s ${msdosid}/${bootoffset}/${bootsize} -F ${image}
	${sudo} newfs /dev/r${vnddev}a
	${sudo} newfs_msdos /dev/r${vnddev}e
	${sudo} mount -o async /dev/${vnddev}a ${mnt}
	${sudo} mkdir ${mnt}/boot
	${sudo} mount_msdos /dev/${vnddev}e ${mnt}/boot
}

make_fstab_evbarm() {
	${sudo} cat > ${mnt}/etc/fstab << EOF
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
/dev/ld0a	/		ffs	rw,log	1 1
/dev/ld0b	none		swap	sw	0 0
/dev/ld0e	/boot		msdos	rw	1 1
kernfs		/kern		kernfs	rw
ptyfs		/dev/pts	ptyfs	rw
procfs		/proc		procfs	rw
EOF
}

customize_evbarm() {
	${sudo} cat >> ${mnt}/etc/rc.conf << EOF
sshd=YES
dhcpcd=YES
mdnsd=YES
EOF
	if [ ! -f ${mnt}/dev/MAKEDEV ]; then
		echo ${PROG}: Missing ${mnt}/dev/MAKEDEV 1>&2
		exit 1
	fi
	echo "${bar} running MAKEDEV ${bar}"
	(cd ${mnt}/dev && ${sudo} sh MAKEDEV all)
}

cleanup_evbarm() {
    rm -f ${tmp}
    ${sudo} umount ${mnt}/boot
}
@


1.2.2.3
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@d1 1
a1 1
# $NetBSD: evbarm.conf,v 1.2.2.2 2013/01/23 00:04:28 yamt Exp $
d6 1
a7 1
MACHINE=evbarm
a12 1
ffsoffset=$(( (${init} + ${boot} + ${swap}) / 2 ))m
d16 1
d18 1
a18 1
mkdir -p ${mnt}/boot
d20 1
a20 3
make_label_evbarm() {
	# compute all sizes in terms of sectors
	local totalsize=$(( ${newsize} * 1024 * 2 / 512 ))
d22 1
d26 1
a26 1
	local bootoffset=$(( ${init} * 1024 ))
a27 2

	local asize=$(( ${totalsize} - ${swapsize} - ${bootsize} - ${bootoffset} ))
d30 1
d37 1
a37 1
	cat << EOF
a59 1
 c:   ${totalsize} 0             unused      0     0          #
d63 7
d72 2
a73 2
make_fstab_evbarm_normal() {
	cat > ${mnt}/etc/fstab << EOF
a84 31
# 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_evbarm_minwrites() {
	cat > ${mnt}/etc/fstab << EOF
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
/dev/ld0a	/			ffs	rw,log,noatime,nodevmtime 1 1
/dev/ld0b	none			swap	sw			  0 0
/dev/ld0e	/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
EOF
}

make_fstab_evbarm() {
	if $minwrites; then
		make_fstab_evbarm_minwrites
	else
		make_fstab_evbarm_normal
	fi
}

d86 1
a86 10
	cp ${release}/etc/rc.conf ${mnt}/etc/rc.conf
	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
	cat >> ${mnt}/etc/rc.conf << EOF
rc_configured=YES
hostname=${board}
d89 1
d91 2
a92 2
	if [ ! -f ${release}/dev/MAKEDEV ]; then
		echo ${PROG}: Missing ${release}/dev/MAKEDEV 1>&2
d96 2
a97 2
	${HOST_SH} ${release}/dev/MAKEDEV -s all | sed -e 's:^\./:\./dev/:' \
	    >> "$tmp/selected_sets"
d99 3
a101 2
	echo "${bar} creating directories ${bar}"
	mkdir ${mnt}/proc ${mnt}/kern
@


1.1
log
@- Add support for xsets
- Factor out common evbarm code
@
text
@d1 1
a1 1
# $NetBSD: rpi.conf,v 1.8 2013/01/15 20:55:00 christos Exp $
a90 7
	if [ ! -f ${kerneldir}/kernel.img ]; then
		echo ${PROG}: Missing ${kerneldir}/kernel.img 1>&2
		exit 1
	fi
	echo "${bar} installing kernel ${bar}"
	${sudo} cp ${kerneldir}/kernel.img ${mnt}/boot

@

