head	1.14;
access;
symbols
	netbsd-11-0-RC5:1.13
	netbsd-11-0-RC4:1.13
	netbsd-11-0-RC3:1.13
	netbsd-11-0-RC2:1.13
	netbsd-11-0-RC1:1.13
	perseant-exfatfs-base-20250801:1.13
	netbsd-11:1.13.0.2
	netbsd-11-base:1.13
	netbsd-10-1-RELEASE:1.10.2.1
	perseant-exfatfs-base-20240630:1.11
	perseant-exfatfs:1.11.0.2
	perseant-exfatfs-base:1.11
	netbsd-8-3-RELEASE:1.7
	netbsd-9-4-RELEASE:1.8
	netbsd-10-0-RELEASE:1.10.2.1
	netbsd-10-0-RC6:1.10.2.1
	netbsd-10-0-RC5:1.10.2.1
	netbsd-10-0-RC4:1.10.2.1
	netbsd-10-0-RC3:1.10.2.1
	netbsd-10-0-RC2:1.10.2.1
	netbsd-10-0-RC1:1.10.2.1
	netbsd-10:1.10.0.2
	netbsd-10-base:1.10
	netbsd-9-3-RELEASE:1.8
	cjep_sun2x-base1:1.9
	cjep_sun2x:1.9.0.4
	cjep_sun2x-base:1.9
	cjep_staticlib_x-base1:1.9
	netbsd-9-2-RELEASE:1.8
	cjep_staticlib_x:1.9.0.2
	cjep_staticlib_x-base:1.9
	netbsd-9-1-RELEASE:1.8
	phil-wifi-20200421:1.8
	phil-wifi-20200411:1.8
	is-mlppp:1.8.0.8
	is-mlppp-base:1.8
	phil-wifi-20200406:1.8
	netbsd-8-2-RELEASE:1.7
	netbsd-9-0-RELEASE:1.8
	netbsd-9-0-RC2:1.8
	netbsd-9-0-RC1:1.8
	phil-wifi-20191119:1.8
	netbsd-9:1.8.0.6
	netbsd-9-base:1.8
	phil-wifi-20190609:1.8
	netbsd-8-1-RELEASE:1.7
	netbsd-8-1-RC1:1.7
	pgoyette-compat-merge-20190127:1.8
	pgoyette-compat-20190127:1.8
	pgoyette-compat-20190118:1.8
	pgoyette-compat-1226:1.8
	pgoyette-compat-1126:1.8
	pgoyette-compat-1020:1.8
	pgoyette-compat-0930:1.8
	pgoyette-compat-0906:1.8
	netbsd-7-2-RELEASE:1.4.6.3
	pgoyette-compat-0728:1.8
	netbsd-8-0-RELEASE:1.7
	phil-wifi:1.8.0.4
	phil-wifi-base:1.8
	pgoyette-compat-0625:1.8
	netbsd-8-0-RC2:1.7
	pgoyette-compat-0521:1.8
	pgoyette-compat-0502:1.8
	pgoyette-compat-0422:1.8
	netbsd-8-0-RC1:1.7
	pgoyette-compat-0415:1.8
	pgoyette-compat-0407:1.8
	pgoyette-compat-0330:1.8
	pgoyette-compat-0322:1.8
	pgoyette-compat-0315:1.8
	netbsd-7-1-2-RELEASE:1.4.6.3
	pgoyette-compat:1.8.0.2
	pgoyette-compat-base:1.8
	netbsd-7-1-1-RELEASE:1.4.6.3
	matt-nb8-mediatek:1.7.0.12
	matt-nb8-mediatek-base:1.7
	perseant-stdc-iso10646:1.7.0.10
	perseant-stdc-iso10646-base:1.7
	netbsd-8:1.7.0.8
	netbsd-8-base:1.7
	prg-localcount2-base3:1.7
	prg-localcount2-base2:1.7
	prg-localcount2-base1:1.7
	prg-localcount2:1.7.0.6
	prg-localcount2-base:1.7
	pgoyette-localcount-20170426:1.7
	bouyer-socketcan-base1:1.7
	pgoyette-localcount-20170320:1.7
	netbsd-7-1:1.4.6.3.0.6
	netbsd-7-1-RELEASE:1.4.6.3
	netbsd-7-1-RC2:1.4.6.3
	netbsd-7-nhusb-base-20170116:1.4.6.3
	bouyer-socketcan:1.7.0.4
	bouyer-socketcan-base:1.7
	pgoyette-localcount-20170107:1.7
	netbsd-7-1-RC1:1.4.6.3
	pgoyette-localcount-20161104:1.7
	netbsd-7-0-2-RELEASE:1.4.6.3
	localcount-20160914:1.7
	netbsd-7-nhusb:1.4.6.3.0.4
	netbsd-7-nhusb-base:1.4.6.3
	pgoyette-localcount-20160806:1.7
	pgoyette-localcount-20160726:1.7
	pgoyette-localcount:1.7.0.2
	pgoyette-localcount-base:1.7
	netbsd-7-0-1-RELEASE:1.4.6.3
	netbsd-7-0:1.4.6.3.0.2
	netbsd-7-0-RELEASE:1.4.6.3
	netbsd-7-0-RC3:1.4.6.3
	netbsd-7-0-RC2:1.4.6.2
	netbsd-7-0-RC1:1.4.6.2
	tls-maxphys-base:1.4
	tls-maxphys:1.4.0.8
	netbsd-7:1.4.0.6
	netbsd-7-base:1.4
	yamt-pagecache:1.4.0.4
	yamt-pagecache-base9:1.4
	tls-earlyentropy:1.4.0.2
	tls-earlyentropy-base:1.4
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.3;
locks; strict;
comment	@# @;


1.14
date	2026.02.15.19.38.43;	author riastradh;	state Exp;
branches;
next	1.13;
commitid	OKwTBQhkDyJjAvuG;

1.13
date	2024.12.29.09.46.44;	author jmmv;	state Exp;
branches;
next	1.12;
commitid	SMRsHmmHTKgOBnDF;

1.12
date	2024.12.27.19.02.19;	author christos;	state Exp;
branches;
next	1.11;
commitid	lUKdBalraoedKaDF;

1.11
date	2023.09.27.00.24.13;	author riastradh;	state Exp;
branches
	1.11.2.1;
next	1.10;
commitid	k45BHG3lHtqEflGE;

1.10
date	2021.07.06.11.49.36;	author jmcneill;	state Exp;
branches
	1.10.2.1;
next	1.9;
commitid	zvJIidedlP6UaVZC;

1.9
date	2020.12.23.10.35.18;	author rin;	state Exp;
branches;
next	1.8;
commitid	UjUL16IWXrm42RAC;

1.8
date	2017.11.28.02.56.44;	author kre;	state Exp;
branches;
next	1.7;
commitid	YyX28ObBtFaovKgA;

1.7
date	2015.01.29.14.54.06;	author skrll;	state Exp;
branches;
next	1.6;
commitid	dFnZUnkpzEf2JV7y;

1.6
date	2015.01.23.15.17.58;	author skrll;	state Exp;
branches;
next	1.5;
commitid	LaUSni46C5eI2a7y;

1.5
date	2014.12.14.00.28.46;	author christos;	state Exp;
branches;
next	1.4;
commitid	QIiWDOWYpAbdqW1y;

1.4
date	2014.04.04.16.45.51;	author christos;	state Exp;
branches
	1.4.4.1
	1.4.6.1
	1.4.8.1;
next	1.3;
commitid	LRylJDDhgO9LZnvx;

1.3
date	2014.03.31.18.18.45;	author christos;	state Exp;
branches;
next	1.2;
commitid	faMcgsQimiCCDSux;

1.2
date	2014.03.31.17.05.03;	author christos;	state Exp;
branches;
next	1.1;
commitid	s5fzrHt1nRsieSux;

1.1
date	2014.03.31.16.20.49;	author christos;	state Exp;
branches;
next	;
commitid	zkF6OiMVD9sVYRux;

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

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

1.4.4.1
date	2014.04.04.16.45.51;	author yamt;	state dead;
branches;
next	1.4.4.2;
commitid	yqlfOuaAhYmASwBx;

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

1.4.6.1
date	2015.01.28.22.06.14;	author martin;	state Exp;
branches;
next	1.4.6.2;
commitid	zVHoex8OK6hA9Q7y;

1.4.6.2
date	2015.01.29.15.12.48;	author martin;	state Exp;
branches;
next	1.4.6.3;
commitid	VmbBB67APv43QV7y;

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

1.4.8.1
date	2014.04.04.16.45.51;	author tls;	state dead;
branches;
next	1.4.8.2;
commitid	jTnpym9Qu0o4R1Nx;

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


desc
@@


1.14
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: x86.conf,v 1.13 2024/12/29 09:46:44 jmmv Exp $
# x86 shared config
#

image=$HOME/${board}.img
MACHINE=${board}
kernel=$src/sys/arch/${board}/compile/GENERIC/netbsd
bootfile=$release/usr/mdec/boot

extra=8		# spare space
size=0		# autocompute
netbsdid=169
init=63
ffsoffset=${init}b

make_label() {
	# compute all sizes in terms of sectors
	local totalsize=$(( ${size} / 512 ))

	local aoffset=${init}
	local asize=$(( ${totalsize} - ${aoffset} ))

	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          #
 d:   ${totalsize} 0             unused      0     0          #
EOF
}

make_fstab() {
	make_fstab_default EFI
}

customize() {
	cp ${release}/etc/rc.conf ${mnt}/etc/rc.conf
	cat >> ${mnt}/etc/rc.conf << EOF
rc_configured=YES
hostname=${board}
sshd=YES
dhcpcd=YES
wscons=YES
devpubd=YES
certctl_init=YES
EOF
	echo "./etc/rc.conf type=file uname=root gname=wheel mode=0644" \
	    >> "$tmp/selected_sets"

	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"
}

populate() {
	if [ ! -f ${kernel} ]; then
		echo ${PROG}: Missing ${kernel} 1>&2
		exit 1
	fi

	echo "${bar} installing kernel ${bar}"
	cp ${kernel} ${mnt}/netbsd
	if [ ! -f ${bootfile} ]; then
		echo ${PROG}: Missing ${bootfile} 1>&2
		exit 1
	fi
	cp ${bootfile} ${mnt}/boot ||
	    fail "copy of ${bootfile} to ${mnt}/boot failed"

	echo "./netbsd type=file uname=root gname=wheel mode=0755" \
	    >> "$tmp/selected_sets"
	echo "./boot type=file uname=root gname=wheel mode=0444" \
	    >> "$tmp/selected_sets"
}
@


1.13
log
@Recognize MKPOSTFIX=no in mkimage
@
text
@d1 1
a1 1
# $NetBSD: x86.conf,v 1.12 2024/12/27 19:02:19 christos Exp $
a61 6
	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.12
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: x86.conf,v 1.11 2023/09/27 00:24:13 riastradh Exp $
d62 1
a62 1
	if $minwrites; then
@


1.11
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: x86.conf,v 1.10 2021/07/06 11:49:36 jmcneill Exp $
a55 30
make_fstab_normal() {
	cat > ${mnt}/etc/fstab << EOF
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
/dev/${rootdev}0a	/		ffs	rw,log	1 1
ptyfs		/dev/pts	ptyfs	rw
procfs		/proc		procfs	rw
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_minwrites() {
	cat > ${mnt}/etc/fstab << EOF
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
/dev/${rootdev}0a	/			ffs	rw,log,noatime,nodevmtime 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
EOF
}

d57 1
a57 10
	if $minwrites; then
		make_fstab_minwrites
	else
		make_fstab_normal
	fi
	echo "./etc/fstab type=file uname=root gname=wheel mode=0755" \
	    >> "$tmp/selected_sets"

	echo "./proc type=dir uname=root gname=wheel mode=0755" \
	    >> "$tmp/selected_sets"
@


1.11.2.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
# $NetBSD: x86.conf,v 1.13 2024/12/29 09:46:44 jmmv Exp $
d56 30
d87 10
a96 1
	make_fstab_default EFI
d101 1
a101 1
	if $minwrites && $postfix; then
@


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


1.10.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: x86.conf,v 1.10 2021/07/06 11:49:36 jmcneill Exp $
a113 1
certctl_init=YES
@


1.9
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: x86.conf,v 1.8 2017/11/28 02:56:44 kre Exp $
a60 1
kernfs		/kern		kernfs	rw
a73 1
kernfs		/kern			kernfs	rw
a96 2
	echo "./kern type=dir uname=root gname=wheel mode=0755" \
	    >> "$tmp/selected_sets"
@


1.8
log
@
Be more precise about exactly what fails when something does.

Relying upon set -e to abort things is sort of OK (it is not
a recommended option to use in general - too many odd special cases),
but only if user can work out from the "build failed" what actually
went wrong.

Tested only on amd64 build (for this, i386 is the same) - if anyone
has problems on builds for other systems, please let me know.  However
the changes affect only failure paths, the most likely problem would
be for a build to fail to halt on an error, and I hope I have avoided
that.  There should be no difference at all to error-free builds.
@
text
@d1 1
a1 1
# $NetBSD: x86.conf,v 1.7 2015/01/29 14:54:06 skrll Exp $
d18 1
a18 1
	local totalsize=$(( ${newsize} * 1024 * 2 / 512 ))
@


1.7
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: x86.conf,v 1.6 2015/01/23 15:17:58 skrll Exp $
d143 2
a144 1
	cp ${bootfile} ${mnt}/boot
@


1.6
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: x86.conf,v 1.5 2014/12/14 00:28:46 christos Exp $
d96 5
d119 3
a128 3

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


1.5
log
@fix image building:
	- round up the total size of the disk image
	- fix fdisk offset for netbsd ffs images
@
text
@d1 1
a1 1
# $NetBSD: x86.conf,v 1.4 2014/04/04 16:45:51 christos Exp $
a9 2
specialdirs="/kern /proc"

d94 2
d139 5
@


1.4
log
@merge more, and add an i386 image
@
text
@d1 1
a1 1
# $NetBSD: x86.conf,v 1.3 2014/03/31 18:18:45 christos Exp $
d15 2
a16 1
ffsoffset=63b
d22 1
a22 1
	local aoffset=63
@


1.4.6.1
log
@Pullup rev 1.6, requested by skrll in ticket #465
@
text
@d1 1
a1 1
# $NetBSD: x86.conf,v 1.4 2014/04/04 16:45:51 christos Exp $
d10 2
a94 2
	echo "./etc/fstab type=file uname=root gname=wheel mode=0755" \
	    >> "$tmp/selected_sets"
a137 5

	echo "./netbsd type=file uname=root gname=wheel mode=0755" \
	    >> "$tmp/selected_sets"
	echo "./boot type=file uname=root gname=wheel mode=0444" \
	    >> "$tmp/selected_sets"
@


1.4.6.2
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: x86.conf,v 1.4.6.1 2015/01/28 22:06:14 martin Exp $
a94 5

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

d120 3
@


1.4.6.3
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: x86.conf,v 1.4.6.2 2015/01/29 15:12:48 martin Exp $
d13 1
a13 2
init=63
ffsoffset=${init}b
d19 1
a19 1
	local aoffset=${init}
@


1.4.8.1
log
@file x86.conf was added on branch tls-maxphys on 2014-08-19 23:45:45 +0000
@
text
@d1 138
@


1.4.8.2
log
@Rebase to HEAD as of a few days ago.
@
text
@a0 138
# $NetBSD$
# x86 shared config
#

image=$HOME/${board}.img
MACHINE=${board}
kernel=$src/sys/arch/${board}/compile/GENERIC/netbsd
bootfile=$release/usr/mdec/boot

specialdirs="/kern /proc"

extra=8		# spare space
size=0		# autocompute
netbsdid=169
ffsoffset=63b

make_label() {
	# compute all sizes in terms of sectors
	local totalsize=$(( ${newsize} * 1024 * 2 / 512 ))

	local aoffset=63
	local asize=$(( ${totalsize} - ${aoffset} ))

	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          #
 d:   ${totalsize} 0             unused      0     0          #
EOF
}

make_fstab_normal() {
	cat > ${mnt}/etc/fstab << EOF
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
/dev/${rootdev}0a	/		ffs	rw,log	1 1
kernfs		/kern		kernfs	rw
ptyfs		/dev/pts	ptyfs	rw
procfs		/proc		procfs	rw
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_minwrites() {
	cat > ${mnt}/etc/fstab << EOF
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
/dev/${rootdev}0a	/			ffs	rw,log,noatime,nodevmtime 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() {
	if $minwrites; then
		make_fstab_minwrites
	else
		make_fstab_normal
	fi
}

customize() {
	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}
sshd=YES
dhcpcd=YES
wscons=YES
devpubd=YES
EOF
	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} creating directories ${bar}"
	mkdir ${mnt}/proc ${mnt}/kern
}

populate() {
	if [ ! -f ${kernel} ]; then
		echo ${PROG}: Missing ${kernel} 1>&2
		exit 1
	fi

	echo "${bar} installing kernel ${bar}"
	cp ${kernel} ${mnt}/netbsd
	if [ ! -f ${bootfile} ]; then
		echo ${PROG}: Missing ${bootfile} 1>&2
		exit 1
	fi
	cp ${bootfile} ${mnt}/boot
}
@


1.4.4.1
log
@file x86.conf was added on branch yamt-pagecache on 2014-05-22 12:01:34 +0000
@
text
@d1 138
@


1.4.4.2
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
@a0 138
# $NetBSD$
# x86 shared config
#

image=$HOME/${board}.img
MACHINE=${board}
kernel=$src/sys/arch/${board}/compile/GENERIC/netbsd
bootfile=$release/usr/mdec/boot

specialdirs="/kern /proc"

extra=8		# spare space
size=0		# autocompute
netbsdid=169
ffsoffset=63b

make_label() {
	# compute all sizes in terms of sectors
	local totalsize=$(( ${newsize} * 1024 * 2 / 512 ))

	local aoffset=63
	local asize=$(( ${totalsize} - ${aoffset} ))

	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          #
 d:   ${totalsize} 0             unused      0     0          #
EOF
}

make_fstab_normal() {
	cat > ${mnt}/etc/fstab << EOF
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
/dev/${rootdev}0a	/		ffs	rw,log	1 1
kernfs		/kern		kernfs	rw
ptyfs		/dev/pts	ptyfs	rw
procfs		/proc		procfs	rw
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_minwrites() {
	cat > ${mnt}/etc/fstab << EOF
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
/dev/${rootdev}0a	/			ffs	rw,log,noatime,nodevmtime 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() {
	if $minwrites; then
		make_fstab_minwrites
	else
		make_fstab_normal
	fi
}

customize() {
	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}
sshd=YES
dhcpcd=YES
wscons=YES
devpubd=YES
EOF
	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} creating directories ${bar}"
	mkdir ${mnt}/proc ${mnt}/kern
}

populate() {
	if [ ! -f ${kernel} ]; then
		echo ${PROG}: Missing ${kernel} 1>&2
		exit 1
	fi

	echo "${bar} installing kernel ${bar}"
	cp ${kernel} ${mnt}/netbsd
	if [ ! -f ${bootfile} ]; then
		echo ${PROG}: Missing ${bootfile} 1>&2
		exit 1
	fi
	cp ${bootfile} ${mnt}/boot
}
@


1.3
log
@remove swap; these days x86 machines don't need it.
@
text
@d1 1
a1 1
# $NetBSD: x86.conf,v 1.2 2014/03/31 17:05:03 christos Exp $
d4 1
d6 3
a12 1

a14 1

d17 1
a17 1
make_label_x86() {
d57 1
a57 1
make_fstab_x86_normal() {
d71 1
a71 1
make_fstab_x86_minwrites() {
d89 1
a89 1
make_fstab_x86() {
d91 1
a91 1
		make_fstab_x86_minwrites
d93 1
a93 1
		make_fstab_x86_normal
d97 1
a97 1
customize_x86() {
d110 2
d124 15
@


1.2
log
@these changes produce a bootable system under qemu, but its root is trashed.
@
text
@d1 1
a1 1
# $NetBSD: x86.conf,v 1.1 2014/03/31 16:20:49 christos Exp $
a7 1
swap=256
d13 1
a13 1
ffsoffset=$((63 * 512))
a18 2
	local swapsize=$(( ${swap} * 1024 ))

d20 1
a20 3
	local asize=$(( ${totalsize} - ${swapsize} - ${aoffset} ))

	local swapoffset=$(( ${aoffset} + ${asize} ))
a49 1
 b:   ${swapsize}  ${swapoffset} swap                         #
d59 1
a59 2
/dev/sd0a	/		ffs	rw,log	1 1
/dev/sd0b	none		swap	sw	0 0
d73 1
a73 2
/dev/sd0a	/			ffs	rw,log,noatime,nodevmtime 1 1
/dev/sd0b	none			swap	sw			  0 0
@


1.1
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: x86.conf,v 1.13 2013/11/22 11:13:54 skrll Exp $
d14 2
@

