History log of /netbsd-current/distrib/utils/embedded/mkimage
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.82 09-Apr-2024 nia

Add new sets: base32, debug32, manhtml

- base32 contains (when MKCOMPAT=yes) shared libraries for 32-bit
compatibility, previously included in base

- debug32 contains (when MKCOMPAT=yes) debug symbols and static libraries
containing debug symbols for 32-bit compatiblity, previously included
in debug

- manhtml contains (when MKHTML=yes) the HTML files previously included
in 'man', which are of limited utility without third-party software.

The motivation for this change is to be able to easily exclude sets
from CD-ROM images that go over the size limit without xz compression
(which many NetBSD platforms struggle to extract at acceptable speeds).


# 1.81 12-Feb-2024 mlelstv

Quote argument to -n as required. [ -n ] is not a syntax error but
evaluates to true.


# 1.80 11-Feb-2024 christos

PR/57925: Jan-Benedict Glaw: Honor $MKREPRO_TIMESTAMP, don't embed name and
stamp in gzip.


# 1.79 20-Jan-2024 jmcneill

evbppc: Add initial support for the Nintendo Wii


Revision tags: netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base
# 1.78 25-Sep-2021 maya

branches: 1.78.2;
Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.77 23-Dec-2020 rin

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.


# 1.76 21-Dec-2020 riastradh

embedded/mkimage: Pad image with zeros to multiple of 4 MB plus 1 MB.

Otherwise, there may not be enough space after the ffs partition for a
gpt, leading to very confusing results.


# 1.75 17-Jul-2020 jmcneill

Create an "octeon.img.gz" bootable image for evbmips64-eb release builds.


# 1.74 24-May-2020 jmcneill

Add support for hybrid MBR/GPT images.


# 1.73 24-May-2020 jmcneill

Add GPT support to mkimage.


# 1.72 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 30-Oct-2019 martin

Derive the FAT type from the MBR partition type and pass it on to makefs
when crating a msdos file system.


# 1.70 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


Revision tags: netbsd-9-base phil-wifi-20190609 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.69 28-Nov-2017 kre

branches: 1.69.4; 1.69.6;

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.


# 1.68 28-Nov-2017 kre

Handle use of TMPDIR in cleanup as well.


# 1.67 28-Nov-2017 kre

Honour ${TMPDIR} if set for location of image, rather than always
simply using /tmp


Revision tags: perseant-stdc-iso10646-base
# 1.66 06-Jul-2017 jmcneill

Replace HUMMINGBIRD_A31 with SUNXI kernel on armv7.img and include .dtb
files for SUNXI and TEGRA kernels on the MSDOS partition.


# 1.65 10-Jun-2017 christos

add the tests set.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.64 11-Apr-2017 jmcneill

branches: 1.64.4;
Now that FAT+FFS images include the BSD partition in the MBR partition
table, install the disklabel after setting up MBR partitions. This moves
the disklabel to the BSD partition from the start of the disk, avoiding
a conflict with the ODROID-C1 bootloader.


# 1.63 11-Apr-2017 jmcneill

Improvements and fixes for FAT+FFS images:
- Add a "NETBSD" volume label to the MSDOS file-system.
- Explicitly initialize boot sector.
- Correct an issue where the MSDOS file-system was larger than the
partition table entry.
- Add NetBSD partition to the MBR partition table.


Revision tags: pgoyette-localcount-20170320
# 1.62 14-Mar-2017 skrll

Mark the msdos parition active for boards like the BeagleBone Black


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.61 01-Aug-2015 jmcneill

branches: 1.61.2; 1.61.4;
use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 18-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 14-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 31-Mar-2014 christos

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.


Revision tags: riastradh-drm2-base3
# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 27-Jun-2013 christos

explain -m better


# 1.41 27-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 28-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


Revision tags: agc-symver-base
# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 15-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 10-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 10-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 10-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


Revision tags: yamt-pagecache-base8
# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 15-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 15-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
# 1.3 29-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
# 1.2 20-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 15-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


# 1.81 12-Feb-2024 mlelstv

Quote argument to -n as required. [ -n ] is not a syntax error but
evaluates to true.


# 1.80 11-Feb-2024 christos

PR/57925: Jan-Benedict Glaw: Honor $MKREPRO_TIMESTAMP, don't embed name and
stamp in gzip.


# 1.79 20-Jan-2024 jmcneill

evbppc: Add initial support for the Nintendo Wii


Revision tags: netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base
# 1.78 25-Sep-2021 maya

branches: 1.78.2;
Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.77 23-Dec-2020 rin

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.


# 1.76 21-Dec-2020 riastradh

embedded/mkimage: Pad image with zeros to multiple of 4 MB plus 1 MB.

Otherwise, there may not be enough space after the ffs partition for a
gpt, leading to very confusing results.


# 1.75 17-Jul-2020 jmcneill

Create an "octeon.img.gz" bootable image for evbmips64-eb release builds.


# 1.74 24-May-2020 jmcneill

Add support for hybrid MBR/GPT images.


# 1.73 24-May-2020 jmcneill

Add GPT support to mkimage.


# 1.72 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 30-Oct-2019 martin

Derive the FAT type from the MBR partition type and pass it on to makefs
when crating a msdos file system.


# 1.70 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


Revision tags: netbsd-9-base phil-wifi-20190609 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.69 28-Nov-2017 kre

branches: 1.69.4; 1.69.6;

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.


# 1.68 28-Nov-2017 kre

Handle use of TMPDIR in cleanup as well.


# 1.67 28-Nov-2017 kre

Honour ${TMPDIR} if set for location of image, rather than always
simply using /tmp


Revision tags: perseant-stdc-iso10646-base
# 1.66 06-Jul-2017 jmcneill

Replace HUMMINGBIRD_A31 with SUNXI kernel on armv7.img and include .dtb
files for SUNXI and TEGRA kernels on the MSDOS partition.


# 1.65 10-Jun-2017 christos

add the tests set.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.64 11-Apr-2017 jmcneill

branches: 1.64.4;
Now that FAT+FFS images include the BSD partition in the MBR partition
table, install the disklabel after setting up MBR partitions. This moves
the disklabel to the BSD partition from the start of the disk, avoiding
a conflict with the ODROID-C1 bootloader.


# 1.63 11-Apr-2017 jmcneill

Improvements and fixes for FAT+FFS images:
- Add a "NETBSD" volume label to the MSDOS file-system.
- Explicitly initialize boot sector.
- Correct an issue where the MSDOS file-system was larger than the
partition table entry.
- Add NetBSD partition to the MBR partition table.


Revision tags: pgoyette-localcount-20170320
# 1.62 14-Mar-2017 skrll

Mark the msdos parition active for boards like the BeagleBone Black


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.61 01-Aug-2015 jmcneill

branches: 1.61.2; 1.61.4;
use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 18-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 14-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 31-Mar-2014 christos

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.


Revision tags: riastradh-drm2-base3
# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 27-Jun-2013 christos

explain -m better


# 1.41 27-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 28-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


Revision tags: agc-symver-base
# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 15-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 10-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 10-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 10-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


Revision tags: yamt-pagecache-base8
# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 15-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 15-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
# 1.3 29-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
# 1.2 20-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 15-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


# 1.79 20-Jan-2024 jmcneill

evbppc: Add initial support for the Nintendo Wii


Revision tags: netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base
# 1.78 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.77 23-Dec-2020 rin

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.


# 1.76 21-Dec-2020 riastradh

embedded/mkimage: Pad image with zeros to multiple of 4 MB plus 1 MB.

Otherwise, there may not be enough space after the ffs partition for a
gpt, leading to very confusing results.


# 1.75 17-Jul-2020 jmcneill

Create an "octeon.img.gz" bootable image for evbmips64-eb release builds.


# 1.74 24-May-2020 jmcneill

Add support for hybrid MBR/GPT images.


# 1.73 24-May-2020 jmcneill

Add GPT support to mkimage.


# 1.72 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 30-Oct-2019 martin

Derive the FAT type from the MBR partition type and pass it on to makefs
when crating a msdos file system.


# 1.70 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


Revision tags: netbsd-9-base phil-wifi-20190609 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.69 28-Nov-2017 kre

branches: 1.69.4; 1.69.6;

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.


# 1.68 28-Nov-2017 kre

Handle use of TMPDIR in cleanup as well.


# 1.67 28-Nov-2017 kre

Honour ${TMPDIR} if set for location of image, rather than always
simply using /tmp


Revision tags: perseant-stdc-iso10646-base
# 1.66 06-Jul-2017 jmcneill

Replace HUMMINGBIRD_A31 with SUNXI kernel on armv7.img and include .dtb
files for SUNXI and TEGRA kernels on the MSDOS partition.


# 1.65 10-Jun-2017 christos

add the tests set.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.64 11-Apr-2017 jmcneill

branches: 1.64.4;
Now that FAT+FFS images include the BSD partition in the MBR partition
table, install the disklabel after setting up MBR partitions. This moves
the disklabel to the BSD partition from the start of the disk, avoiding
a conflict with the ODROID-C1 bootloader.


# 1.63 11-Apr-2017 jmcneill

Improvements and fixes for FAT+FFS images:
- Add a "NETBSD" volume label to the MSDOS file-system.
- Explicitly initialize boot sector.
- Correct an issue where the MSDOS file-system was larger than the
partition table entry.
- Add NetBSD partition to the MBR partition table.


Revision tags: pgoyette-localcount-20170320
# 1.62 14-Mar-2017 skrll

Mark the msdos parition active for boards like the BeagleBone Black


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.61 01-Aug-2015 jmcneill

branches: 1.61.2; 1.61.4;
use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 18-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 14-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 31-Mar-2014 christos

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.


Revision tags: riastradh-drm2-base3
# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 27-Jun-2013 christos

explain -m better


# 1.41 27-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 28-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


Revision tags: agc-symver-base
# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 15-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 10-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 10-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 10-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


Revision tags: yamt-pagecache-base8
# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 15-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 15-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
# 1.3 29-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
# 1.2 20-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 15-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


# 1.78 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.77 23-Dec-2020 rin

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.


# 1.76 21-Dec-2020 riastradh

embedded/mkimage: Pad image with zeros to multiple of 4 MB plus 1 MB.

Otherwise, there may not be enough space after the ffs partition for a
gpt, leading to very confusing results.


# 1.75 17-Jul-2020 jmcneill

Create an "octeon.img.gz" bootable image for evbmips64-eb release builds.


# 1.74 24-May-2020 jmcneill

Add support for hybrid MBR/GPT images.


# 1.73 24-May-2020 jmcneill

Add GPT support to mkimage.


# 1.72 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 30-Oct-2019 martin

Derive the FAT type from the MBR partition type and pass it on to makefs
when crating a msdos file system.


# 1.70 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


Revision tags: netbsd-9-base phil-wifi-20190609 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.69 28-Nov-2017 kre

branches: 1.69.4; 1.69.6;

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.


# 1.68 28-Nov-2017 kre

Handle use of TMPDIR in cleanup as well.


# 1.67 28-Nov-2017 kre

Honour ${TMPDIR} if set for location of image, rather than always
simply using /tmp


Revision tags: perseant-stdc-iso10646-base
# 1.66 06-Jul-2017 jmcneill

Replace HUMMINGBIRD_A31 with SUNXI kernel on armv7.img and include .dtb
files for SUNXI and TEGRA kernels on the MSDOS partition.


# 1.65 10-Jun-2017 christos

add the tests set.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.64 11-Apr-2017 jmcneill

branches: 1.64.4;
Now that FAT+FFS images include the BSD partition in the MBR partition
table, install the disklabel after setting up MBR partitions. This moves
the disklabel to the BSD partition from the start of the disk, avoiding
a conflict with the ODROID-C1 bootloader.


# 1.63 11-Apr-2017 jmcneill

Improvements and fixes for FAT+FFS images:
- Add a "NETBSD" volume label to the MSDOS file-system.
- Explicitly initialize boot sector.
- Correct an issue where the MSDOS file-system was larger than the
partition table entry.
- Add NetBSD partition to the MBR partition table.


Revision tags: pgoyette-localcount-20170320
# 1.62 14-Mar-2017 skrll

Mark the msdos parition active for boards like the BeagleBone Black


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.61 01-Aug-2015 jmcneill

branches: 1.61.2; 1.61.4;
use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 18-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 14-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 31-Mar-2014 christos

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.


Revision tags: riastradh-drm2-base3
# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 27-Jun-2013 christos

explain -m better


# 1.41 27-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 28-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


Revision tags: agc-symver-base
# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 15-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 10-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 10-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 10-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


Revision tags: yamt-pagecache-base8
# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 15-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 15-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
# 1.3 29-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
# 1.2 20-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 15-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


# 1.77 23-Dec-2020 rin

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.


# 1.76 21-Dec-2020 riastradh

embedded/mkimage: Pad image with zeros to multiple of 4 MB plus 1 MB.

Otherwise, there may not be enough space after the ffs partition for a
gpt, leading to very confusing results.


# 1.75 17-Jul-2020 jmcneill

Create an "octeon.img.gz" bootable image for evbmips64-eb release builds.


# 1.74 24-May-2020 jmcneill

Add support for hybrid MBR/GPT images.


# 1.73 24-May-2020 jmcneill

Add GPT support to mkimage.


# 1.72 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 30-Oct-2019 martin

Derive the FAT type from the MBR partition type and pass it on to makefs
when crating a msdos file system.


# 1.70 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


Revision tags: netbsd-9-base phil-wifi-20190609 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.69 28-Nov-2017 kre

branches: 1.69.4; 1.69.6;

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.


# 1.68 28-Nov-2017 kre

Handle use of TMPDIR in cleanup as well.


# 1.67 28-Nov-2017 kre

Honour ${TMPDIR} if set for location of image, rather than always
simply using /tmp


Revision tags: perseant-stdc-iso10646-base
# 1.66 06-Jul-2017 jmcneill

Replace HUMMINGBIRD_A31 with SUNXI kernel on armv7.img and include .dtb
files for SUNXI and TEGRA kernels on the MSDOS partition.


# 1.65 10-Jun-2017 christos

add the tests set.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.64 11-Apr-2017 jmcneill

branches: 1.64.4;
Now that FAT+FFS images include the BSD partition in the MBR partition
table, install the disklabel after setting up MBR partitions. This moves
the disklabel to the BSD partition from the start of the disk, avoiding
a conflict with the ODROID-C1 bootloader.


# 1.63 11-Apr-2017 jmcneill

Improvements and fixes for FAT+FFS images:
- Add a "NETBSD" volume label to the MSDOS file-system.
- Explicitly initialize boot sector.
- Correct an issue where the MSDOS file-system was larger than the
partition table entry.
- Add NetBSD partition to the MBR partition table.


Revision tags: pgoyette-localcount-20170320
# 1.62 14-Mar-2017 skrll

Mark the msdos parition active for boards like the BeagleBone Black


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.61 01-Aug-2015 jmcneill

branches: 1.61.2; 1.61.4;
use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 18-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 14-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 31-Mar-2014 christos

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.


Revision tags: riastradh-drm2-base3
# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 27-Jun-2013 christos

explain -m better


# 1.41 27-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 28-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


Revision tags: agc-symver-base
# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 15-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 10-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 10-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 10-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


Revision tags: yamt-pagecache-base8
# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 15-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 15-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
# 1.3 29-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
# 1.2 20-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 15-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


# 1.76 21-Dec-2020 riastradh

embedded/mkimage: Pad image with zeros to multiple of 4 MB plus 1 MB.

Otherwise, there may not be enough space after the ffs partition for a
gpt, leading to very confusing results.


# 1.75 17-Jul-2020 jmcneill

Create an "octeon.img.gz" bootable image for evbmips64-eb release builds.


# 1.74 24-May-2020 jmcneill

Add support for hybrid MBR/GPT images.


# 1.73 24-May-2020 jmcneill

Add GPT support to mkimage.


# 1.72 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 30-Oct-2019 martin

Derive the FAT type from the MBR partition type and pass it on to makefs
when crating a msdos file system.


# 1.70 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


Revision tags: netbsd-9-base phil-wifi-20190609 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.69 28-Nov-2017 kre

branches: 1.69.4; 1.69.6;

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.


# 1.68 28-Nov-2017 kre

Handle use of TMPDIR in cleanup as well.


# 1.67 28-Nov-2017 kre

Honour ${TMPDIR} if set for location of image, rather than always
simply using /tmp


Revision tags: perseant-stdc-iso10646-base
# 1.66 06-Jul-2017 jmcneill

Replace HUMMINGBIRD_A31 with SUNXI kernel on armv7.img and include .dtb
files for SUNXI and TEGRA kernels on the MSDOS partition.


# 1.65 10-Jun-2017 christos

add the tests set.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.64 11-Apr-2017 jmcneill

branches: 1.64.4;
Now that FAT+FFS images include the BSD partition in the MBR partition
table, install the disklabel after setting up MBR partitions. This moves
the disklabel to the BSD partition from the start of the disk, avoiding
a conflict with the ODROID-C1 bootloader.


# 1.63 11-Apr-2017 jmcneill

Improvements and fixes for FAT+FFS images:
- Add a "NETBSD" volume label to the MSDOS file-system.
- Explicitly initialize boot sector.
- Correct an issue where the MSDOS file-system was larger than the
partition table entry.
- Add NetBSD partition to the MBR partition table.


Revision tags: pgoyette-localcount-20170320
# 1.62 14-Mar-2017 skrll

Mark the msdos parition active for boards like the BeagleBone Black


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.61 01-Aug-2015 jmcneill

branches: 1.61.2; 1.61.4;
use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 18-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 14-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 31-Mar-2014 christos

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.


Revision tags: riastradh-drm2-base3
# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 27-Jun-2013 christos

explain -m better


# 1.41 27-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 28-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


Revision tags: agc-symver-base
# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 15-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 10-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 10-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 10-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


Revision tags: yamt-pagecache-base8
# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 15-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 15-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
# 1.3 29-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
# 1.2 20-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 15-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


# 1.75 17-Jul-2020 jmcneill

Create an "octeon.img.gz" bootable image for evbmips64-eb release builds.


# 1.74 24-May-2020 jmcneill

Add support for hybrid MBR/GPT images.


# 1.73 24-May-2020 jmcneill

Add GPT support to mkimage.


# 1.72 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 30-Oct-2019 martin

Derive the FAT type from the MBR partition type and pass it on to makefs
when crating a msdos file system.


# 1.70 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


Revision tags: netbsd-9-base phil-wifi-20190609 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.69 28-Nov-2017 kre

branches: 1.69.4; 1.69.6;

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.


# 1.68 28-Nov-2017 kre

Handle use of TMPDIR in cleanup as well.


# 1.67 28-Nov-2017 kre

Honour ${TMPDIR} if set for location of image, rather than always
simply using /tmp


Revision tags: perseant-stdc-iso10646-base
# 1.66 06-Jul-2017 jmcneill

Replace HUMMINGBIRD_A31 with SUNXI kernel on armv7.img and include .dtb
files for SUNXI and TEGRA kernels on the MSDOS partition.


# 1.65 10-Jun-2017 christos

add the tests set.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.64 11-Apr-2017 jmcneill

branches: 1.64.4;
Now that FAT+FFS images include the BSD partition in the MBR partition
table, install the disklabel after setting up MBR partitions. This moves
the disklabel to the BSD partition from the start of the disk, avoiding
a conflict with the ODROID-C1 bootloader.


# 1.63 11-Apr-2017 jmcneill

Improvements and fixes for FAT+FFS images:
- Add a "NETBSD" volume label to the MSDOS file-system.
- Explicitly initialize boot sector.
- Correct an issue where the MSDOS file-system was larger than the
partition table entry.
- Add NetBSD partition to the MBR partition table.


Revision tags: pgoyette-localcount-20170320
# 1.62 14-Mar-2017 skrll

Mark the msdos parition active for boards like the BeagleBone Black


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.61 01-Aug-2015 jmcneill

branches: 1.61.2; 1.61.4;
use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 18-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 14-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 31-Mar-2014 christos

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.


Revision tags: riastradh-drm2-base3
# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 27-Jun-2013 christos

explain -m better


# 1.41 27-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 28-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


Revision tags: agc-symver-base
# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 15-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 10-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 10-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 10-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


Revision tags: yamt-pagecache-base8
# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 15-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 15-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
# 1.3 29-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
# 1.2 20-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 15-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


# 1.74 24-May-2020 jmcneill

Add support for hybrid MBR/GPT images.


# 1.73 24-May-2020 jmcneill

Add GPT support to mkimage.


# 1.72 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 30-Oct-2019 martin

Derive the FAT type from the MBR partition type and pass it on to makefs
when crating a msdos file system.


# 1.70 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


Revision tags: netbsd-9-base phil-wifi-20190609 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.69 28-Nov-2017 kre

branches: 1.69.4; 1.69.6;

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.


# 1.68 28-Nov-2017 kre

Handle use of TMPDIR in cleanup as well.


# 1.67 28-Nov-2017 kre

Honour ${TMPDIR} if set for location of image, rather than always
simply using /tmp


Revision tags: perseant-stdc-iso10646-base
# 1.66 06-Jul-2017 jmcneill

Replace HUMMINGBIRD_A31 with SUNXI kernel on armv7.img and include .dtb
files for SUNXI and TEGRA kernels on the MSDOS partition.


# 1.65 10-Jun-2017 christos

add the tests set.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.64 11-Apr-2017 jmcneill

branches: 1.64.4;
Now that FAT+FFS images include the BSD partition in the MBR partition
table, install the disklabel after setting up MBR partitions. This moves
the disklabel to the BSD partition from the start of the disk, avoiding
a conflict with the ODROID-C1 bootloader.


# 1.63 11-Apr-2017 jmcneill

Improvements and fixes for FAT+FFS images:
- Add a "NETBSD" volume label to the MSDOS file-system.
- Explicitly initialize boot sector.
- Correct an issue where the MSDOS file-system was larger than the
partition table entry.
- Add NetBSD partition to the MBR partition table.


Revision tags: pgoyette-localcount-20170320
# 1.62 14-Mar-2017 skrll

Mark the msdos parition active for boards like the BeagleBone Black


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.61 01-Aug-2015 jmcneill

branches: 1.61.2; 1.61.4;
use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 18-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 14-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 31-Mar-2014 christos

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.


Revision tags: riastradh-drm2-base3
# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 27-Jun-2013 christos

explain -m better


# 1.41 27-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 28-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


Revision tags: agc-symver-base
# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 15-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 10-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 10-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 10-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


Revision tags: yamt-pagecache-base8
# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 15-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 15-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
# 1.3 29-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
# 1.2 20-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 15-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


# 1.72 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 30-Oct-2019 martin

Derive the FAT type from the MBR partition type and pass it on to makefs
when crating a msdos file system.


# 1.70 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


Revision tags: netbsd-9-base phil-wifi-20190609 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.69 28-Nov-2017 kre

branches: 1.69.4; 1.69.6;

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.


# 1.68 28-Nov-2017 kre

Handle use of TMPDIR in cleanup as well.


# 1.67 28-Nov-2017 kre

Honour ${TMPDIR} if set for location of image, rather than always
simply using /tmp


Revision tags: perseant-stdc-iso10646-base
# 1.66 06-Jul-2017 jmcneill

Replace HUMMINGBIRD_A31 with SUNXI kernel on armv7.img and include .dtb
files for SUNXI and TEGRA kernels on the MSDOS partition.


# 1.65 10-Jun-2017 christos

add the tests set.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.64 11-Apr-2017 jmcneill

branches: 1.64.4;
Now that FAT+FFS images include the BSD partition in the MBR partition
table, install the disklabel after setting up MBR partitions. This moves
the disklabel to the BSD partition from the start of the disk, avoiding
a conflict with the ODROID-C1 bootloader.


# 1.63 11-Apr-2017 jmcneill

Improvements and fixes for FAT+FFS images:
- Add a "NETBSD" volume label to the MSDOS file-system.
- Explicitly initialize boot sector.
- Correct an issue where the MSDOS file-system was larger than the
partition table entry.
- Add NetBSD partition to the MBR partition table.


Revision tags: pgoyette-localcount-20170320
# 1.62 14-Mar-2017 skrll

Mark the msdos parition active for boards like the BeagleBone Black


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.61 01-Aug-2015 jmcneill

branches: 1.61.2; 1.61.4;
use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 18-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 14-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 31-Mar-2014 christos

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.


Revision tags: riastradh-drm2-base3
# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 27-Jun-2013 christos

explain -m better


# 1.41 27-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 28-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


Revision tags: agc-symver-base
# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 15-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 10-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 10-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 10-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


Revision tags: yamt-pagecache-base8
# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 15-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 15-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
# 1.3 29-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
# 1.2 20-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 15-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


# 1.71 30-Oct-2019 martin

Derive the FAT type from the MBR partition type and pass it on to makefs
when crating a msdos file system.


# 1.70 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


Revision tags: netbsd-9-base phil-wifi-20190609 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.69 28-Nov-2017 kre

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.


# 1.68 28-Nov-2017 kre

Handle use of TMPDIR in cleanup as well.


# 1.67 28-Nov-2017 kre

Honour ${TMPDIR} if set for location of image, rather than always
simply using /tmp


Revision tags: perseant-stdc-iso10646-base
# 1.66 06-Jul-2017 jmcneill

Replace HUMMINGBIRD_A31 with SUNXI kernel on armv7.img and include .dtb
files for SUNXI and TEGRA kernels on the MSDOS partition.


# 1.65 10-Jun-2017 christos

add the tests set.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.64 11-Apr-2017 jmcneill

branches: 1.64.4;
Now that FAT+FFS images include the BSD partition in the MBR partition
table, install the disklabel after setting up MBR partitions. This moves
the disklabel to the BSD partition from the start of the disk, avoiding
a conflict with the ODROID-C1 bootloader.


# 1.63 11-Apr-2017 jmcneill

Improvements and fixes for FAT+FFS images:
- Add a "NETBSD" volume label to the MSDOS file-system.
- Explicitly initialize boot sector.
- Correct an issue where the MSDOS file-system was larger than the
partition table entry.
- Add NetBSD partition to the MBR partition table.


Revision tags: pgoyette-localcount-20170320
# 1.62 14-Mar-2017 skrll

Mark the msdos parition active for boards like the BeagleBone Black


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.61 01-Aug-2015 jmcneill

branches: 1.61.2; 1.61.4;
use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 18-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 14-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 31-Mar-2014 christos

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.


Revision tags: riastradh-drm2-base3
# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 27-Jun-2013 christos

explain -m better


# 1.41 27-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 28-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


Revision tags: agc-symver-base
# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 15-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 10-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 10-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 10-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


Revision tags: yamt-pagecache-base8
# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 15-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 15-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
# 1.3 29-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
# 1.2 20-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 15-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


# 1.70 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


Revision tags: netbsd-9-base phil-wifi-20190609 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.69 28-Nov-2017 kre

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.


# 1.68 28-Nov-2017 kre

Handle use of TMPDIR in cleanup as well.


# 1.67 28-Nov-2017 kre

Honour ${TMPDIR} if set for location of image, rather than always
simply using /tmp


Revision tags: perseant-stdc-iso10646-base
# 1.66 06-Jul-2017 jmcneill

Replace HUMMINGBIRD_A31 with SUNXI kernel on armv7.img and include .dtb
files for SUNXI and TEGRA kernels on the MSDOS partition.


# 1.65 10-Jun-2017 christos

add the tests set.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.64 11-Apr-2017 jmcneill

branches: 1.64.4;
Now that FAT+FFS images include the BSD partition in the MBR partition
table, install the disklabel after setting up MBR partitions. This moves
the disklabel to the BSD partition from the start of the disk, avoiding
a conflict with the ODROID-C1 bootloader.


# 1.63 11-Apr-2017 jmcneill

Improvements and fixes for FAT+FFS images:
- Add a "NETBSD" volume label to the MSDOS file-system.
- Explicitly initialize boot sector.
- Correct an issue where the MSDOS file-system was larger than the
partition table entry.
- Add NetBSD partition to the MBR partition table.


Revision tags: pgoyette-localcount-20170320
# 1.62 14-Mar-2017 skrll

Mark the msdos parition active for boards like the BeagleBone Black


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.61 01-Aug-2015 jmcneill

branches: 1.61.2; 1.61.4;
use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 18-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 14-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 31-Mar-2014 christos

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.


Revision tags: riastradh-drm2-base3
# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 27-Jun-2013 christos

explain -m better


# 1.41 27-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 28-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


Revision tags: agc-symver-base
# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 15-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 10-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 10-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 10-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


Revision tags: yamt-pagecache-base8
# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 15-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 15-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
# 1.3 29-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
# 1.2 20-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 15-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


# 1.69 28-Nov-2017 kre

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.


# 1.68 28-Nov-2017 kre

Handle use of TMPDIR in cleanup as well.


# 1.67 28-Nov-2017 kre

Honour ${TMPDIR} if set for location of image, rather than always
simply using /tmp


Revision tags: perseant-stdc-iso10646-base
# 1.66 06-Jul-2017 jmcneill

Replace HUMMINGBIRD_A31 with SUNXI kernel on armv7.img and include .dtb
files for SUNXI and TEGRA kernels on the MSDOS partition.


# 1.65 10-Jun-2017 christos

add the tests set.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.64 11-Apr-2017 jmcneill

branches: 1.64.4;
Now that FAT+FFS images include the BSD partition in the MBR partition
table, install the disklabel after setting up MBR partitions. This moves
the disklabel to the BSD partition from the start of the disk, avoiding
a conflict with the ODROID-C1 bootloader.


# 1.63 11-Apr-2017 jmcneill

Improvements and fixes for FAT+FFS images:
- Add a "NETBSD" volume label to the MSDOS file-system.
- Explicitly initialize boot sector.
- Correct an issue where the MSDOS file-system was larger than the
partition table entry.
- Add NetBSD partition to the MBR partition table.


Revision tags: pgoyette-localcount-20170320
# 1.62 14-Mar-2017 skrll

Mark the msdos parition active for boards like the BeagleBone Black


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.61 01-Aug-2015 jmcneill

branches: 1.61.2; 1.61.4;
use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 18-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 14-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 31-Mar-2014 christos

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.


Revision tags: riastradh-drm2-base3
# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 27-Jun-2013 christos

explain -m better


# 1.41 27-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 28-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


Revision tags: agc-symver-base
# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 15-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 10-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 10-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 10-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


Revision tags: yamt-pagecache-base8
# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 15-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 15-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
# 1.3 29-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
# 1.2 20-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 15-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


# 1.66 06-Jul-2017 jmcneill

Replace HUMMINGBIRD_A31 with SUNXI kernel on armv7.img and include .dtb
files for SUNXI and TEGRA kernels on the MSDOS partition.


# 1.65 10-Jun-2017 christos

add the tests set.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.64 11-Apr-2017 jmcneill

Now that FAT+FFS images include the BSD partition in the MBR partition
table, install the disklabel after setting up MBR partitions. This moves
the disklabel to the BSD partition from the start of the disk, avoiding
a conflict with the ODROID-C1 bootloader.


# 1.63 11-Apr-2017 jmcneill

Improvements and fixes for FAT+FFS images:
- Add a "NETBSD" volume label to the MSDOS file-system.
- Explicitly initialize boot sector.
- Correct an issue where the MSDOS file-system was larger than the
partition table entry.
- Add NetBSD partition to the MBR partition table.


Revision tags: pgoyette-localcount-20170320
# 1.62 14-Mar-2017 skrll

Mark the msdos parition active for boards like the BeagleBone Black


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.61 01-Aug-2015 jmcneill

branches: 1.61.2; 1.61.4;
use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 18-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 14-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 31-Mar-2014 christos

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.


Revision tags: riastradh-drm2-base3
# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 27-Jun-2013 christos

explain -m better


# 1.41 27-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 28-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


Revision tags: agc-symver-base
# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 15-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 10-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 10-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 10-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


Revision tags: yamt-pagecache-base8
# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 15-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 15-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
# 1.3 29-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
# 1.2 20-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 15-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


# 1.65 10-Jun-2017 christos

add the tests set.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.64 11-Apr-2017 jmcneill

Now that FAT+FFS images include the BSD partition in the MBR partition
table, install the disklabel after setting up MBR partitions. This moves
the disklabel to the BSD partition from the start of the disk, avoiding
a conflict with the ODROID-C1 bootloader.


# 1.63 11-Apr-2017 jmcneill

Improvements and fixes for FAT+FFS images:
- Add a "NETBSD" volume label to the MSDOS file-system.
- Explicitly initialize boot sector.
- Correct an issue where the MSDOS file-system was larger than the
partition table entry.
- Add NetBSD partition to the MBR partition table.


Revision tags: pgoyette-localcount-20170320
# 1.62 14-Mar-2017 skrll

Mark the msdos parition active for boards like the BeagleBone Black


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.61 01-Aug-2015 jmcneill

branches: 1.61.2; 1.61.4;
use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 18-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 14-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 31-Mar-2014 christos

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.


Revision tags: riastradh-drm2-base3
# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 27-Jun-2013 christos

explain -m better


# 1.41 27-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 28-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


Revision tags: agc-symver-base
# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 15-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 10-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 10-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 10-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


Revision tags: yamt-pagecache-base8
# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 15-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 15-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
# 1.3 29-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
# 1.2 20-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 15-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.64 11-Apr-2017 jmcneill

Now that FAT+FFS images include the BSD partition in the MBR partition
table, install the disklabel after setting up MBR partitions. This moves
the disklabel to the BSD partition from the start of the disk, avoiding
a conflict with the ODROID-C1 bootloader.


# 1.63 11-Apr-2017 jmcneill

Improvements and fixes for FAT+FFS images:
- Add a "NETBSD" volume label to the MSDOS file-system.
- Explicitly initialize boot sector.
- Correct an issue where the MSDOS file-system was larger than the
partition table entry.
- Add NetBSD partition to the MBR partition table.


Revision tags: pgoyette-localcount-20170320
# 1.62 14-Mar-2017 skrll

Mark the msdos parition active for boards like the BeagleBone Black


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.61 01-Aug-2015 jmcneill

branches: 1.61.2; 1.61.4;
use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 18-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 14-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 31-Mar-2014 christos

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.


Revision tags: riastradh-drm2-base3
# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 27-Jun-2013 christos

explain -m better


# 1.41 27-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 28-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


Revision tags: agc-symver-base
# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 15-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 10-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 10-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 10-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


Revision tags: yamt-pagecache-base8
# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 15-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 15-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
# 1.3 29-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
# 1.2 20-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 15-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


# 1.62 14-Mar-2017 skrll

Mark the msdos parition active for boards like the BeagleBone Black


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.61 01-Aug-2015 jmcneill

use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 18-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 14-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 31-Mar-2014 christos

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.


Revision tags: riastradh-drm2-base3
# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 27-Jun-2013 christos

explain -m better


# 1.41 27-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 28-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


Revision tags: agc-symver-base
# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 15-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 10-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 10-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 10-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


Revision tags: yamt-pagecache-base8
# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 15-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 15-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
# 1.3 29-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
# 1.2 20-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 15-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


# 1.61 01-Aug-2015 jmcneill

use a larger (64KB) block size, this helps SD card performance


# 1.60 15-Jul-2015 martin

Add a new endianes flag to mkimage and pass it on big endian arm builds.
From Rin Okuyama.


# 1.59 24-May-2015 christos

fix mkubootimage


# 1.58 19-Apr-2015 hubertf

Add some documentation:
Tell what this does, and what it expects from conf files


# 1.57 18-Apr-2015 hubertf

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


# 1.56 06-Apr-2015 jmcneill

initialize resize before pulling in board config


# 1.55 06-Apr-2015 jmcneill

Add support for auto-growing the root partition. Enable it for rpi.img.


# 1.54 06-Apr-2015 jmcneill

resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.53 05-Apr-2015 jmcneill

Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.52 29-Jan-2015 skrll

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


# 1.51 23-Jan-2015 skrll

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.


# 1.50 17-Jan-2015 skrll

Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.


# 1.49 13-Dec-2014 christos

fix image building:
- round up the total size of the disk image
- fix fdisk offset for netbsd ffs images


# 1.48 03-Apr-2014 christos

branches: 1.48.4;
now that fdisk has optional arguments, don't pass -1


# 1.47 31-Mar-2014 christos

provide a -r rootdev option to handle the wd/sd/ld lossage.


# 1.46 31-Mar-2014 christos

these changes produce a bootable system under qemu, but its root is trashed.


# 1.45 30-Mar-2014 christos

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.


# 1.44 14-Sep-2013 ast

Fix build release of evbarm which had been failing in mkimage
beagleboard_smp with the elusive message:

"gzip: can't stat: gzip: No such file or directory"

This was due to GZIP=gzip being defined in mkimage; we now use:

GZIP_CMD=${TOOL_GZIP:-gzip} # ${GZIP} is special to gzip(1)

as distrib/sets/sets.subr already does in these files as well:

distrib/utils/embedded/mkimage
distrib/utils/embedded/conf/beagleboard.conf
distrib/utils/embedded/conf/rpi.conf
distrib/utils/embedded/conf/rpi_inst.conf


# 1.43 27-Jun-2013 christos

SSD cards is stupid.


# 1.42 26-Jun-2013 christos

explain -m better


# 1.41 26-Jun-2013 christos

tidy up, fix usage


# 1.40 16-Jun-2013 jakllsch

Use TOOL_GZIP in mkimage, and pass the TOOL_GZIP into it.


# 1.39 20-May-2013 christos

- explanations for single letter flags
- flag to add debug sets
- flag to minimize writes to sd's


# 1.38 03-Apr-2013 htodd

Double extra to fix image size to fix build.


# 1.37 27-Mar-2013 jmcneill

For ffs, set bytes per inode to 4K. Otherwise we get a density based on
the contents of the image, which aren't very useful after the file-system
has been resized -- for rpi.img, this was 22K per inode!


# 1.36 19-Mar-2013 garbled

Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.


# 1.35 14-Feb-2013 christos

don't use [ -f $i ] && cat $i, since we are using -e


# 1.34 12-Feb-2013 jmcneill

add extra space to root partition


# 1.33 11-Feb-2013 jmcneill

set -e


# 1.32 10-Feb-2013 jmcneill

set src= before pulling in host config


# 1.31 10-Feb-2013 jmcneill

no sh -x


# 1.30 10-Feb-2013 jmcneill

fix msdos mbr partition size calculation


# 1.29 10-Feb-2013 christos

don't dup -F


# 1.28 10-Feb-2013 christos

add -F to fdisk


# 1.27 10-Feb-2013 christos

mass -N db to makefs too


# 1.26 10-Feb-2013 christos

specify a database for mtree.


# 1.25 10-Feb-2013 jmcneill

dont call mtree directly


# 1.24 09-Feb-2013 christos

really calling disklabel with the arguments of fdisk does not work.


# 1.23 09-Feb-2013 christos

- remove dup trap
- compare size to 0 for autosizing
- remove .gz file before compressing.


# 1.22 09-Feb-2013 christos

add compression support.


# 1.21 09-Feb-2013 christos

add tool hooks.


# 1.20 09-Feb-2013 jmcneill

fix usage again -- -D specifies destdir not releasedir
include conf/${h}.conf not conf/rpi.conf
fix ./mkimage: line 110: "7" - 1 : syntax error: operand expected (error token is ""7" - 1 ")


# 1.19 09-Feb-2013 jmcneill

fix usage


# 1.18 08-Feb-2013 christos

fix options


# 1.17 03-Feb-2013 christos

switch to makefs


# 1.16 30-Jan-2013 skrll

Add the tests sets by default. Tweak the usage output.


# 1.15 21-Jan-2013 skrll

More usage updates


# 1.14 21-Jan-2013 skrll

Update usage output a little


# 1.13 16-Jan-2013 christos

- Add support for xsets
- Factor out common evbarm code


# 1.12 16-Jan-2013 christos

tidy up some more by factoring out the sizing code.


# 1.11 15-Jan-2013 christos

Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


# 1.10 14-Jan-2013 christos

first step at autosizing, still does not work.


# 1.9 14-Jan-2013 jmcneill

expand set name to path when checking to see if the tgz exists


# 1.8 14-Jan-2013 jmcneill

move 'trap' after command args are parsed


# 1.7 13-Jan-2013 christos

honor ${TMPDIR}


# 1.6 13-Jan-2013 christos

complain on unknown options


# 1.5 13-Jan-2013 christos

move configuration to new place.


# 1.4 13-Jan-2013 christos

Adjust mkimage to handle RPI. From skrll@


# 1.3 28-Feb-2012 agc

branches: 1.3.2; 1.3.4;
consolidate all of the volatile /var.* directories which are mounted as tmpfs
into a single one for /var - same as /root, /etc


# 1.2 19-Jan-2012 agc

While the resulting image from mkimage can always be mounted with vnd,
and then modified, it is much easier to let this late, user-oriented
customisation be done automatically. These mods let mkimage change
information based on files in a "custom" directory, which can be set
in mkimage using -c customdir.

After all other configuration, the files under custom/ will be copied
into the main image. The files under custom/ are taken into account
when performing autosizing.

Also, generalise the sets directory to point to the current machine
architecture, although this can be overwritten from the command line
by anyone making cross-images.

An example to make a user image with an embedded read-only 100 MB
iSCSI target:

% ./mkimage -c custom
=== making a new 272 MB image in usermode.img ===
272+0 records in
272+0 records out
285212672 bytes transferred in 7.616 secs (37449142 bytes/sec)
=== mounting image via vnd vnd0 ===
/dev/rvnd0a: 272.0MB (557056 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 45.34MB, 5803 blks, 11264 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 92880, 185728, 278576, 371424, 464272,
=== installing sets ===
base
etc
modules
=== performing customisations ===
=== making extra directories ===
=== customising /var/tmp ===
=== user customisations from files in custom ===
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/vnd0a 269967 263958 -7489 102% /mnt
% ls -l -R custom
total 8
drwxr-xr-x 3 agc agc 512 Jan 18 03:58 etc
drwxr-xr-x 2 agc agc 512 Jan 18 04:00 iscsi

custom/etc:
total 8
drwxr-xr-x 2 agc agc 512 Jan 18 03:58 iscsi
-rw-r--r-- 1 agc agc 564 Jan 18 03:58 rc.conf

custom/etc/iscsi:
total 6
-r--r--r-- 1 agc agc 799 Jan 18 04:27 targets

custom/iscsi:
total 102484
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 iscsi-target0
% sudo vnconfig vnd0 usermode.img
% sudo mount /dev/vnd0a /mnt
% cat /mnt/etc/iscsi/targets
# $NetBSD: targets,v 1.2 2006/02/16 19:30:57 agc Exp $
#
# Structure of this file:
#
# + an extent is a straight (offset, length) pair of a file or device
# it's the lowest common storage denominator
# at least one is needed
# + a device is made up of one or more extents or other devices
# devices can be added in a hierachical manner, to enhance resilience
# + in this example, no device definitions are necessary, as the target
# will just use a simple extent for persistent storage
# + a target is made up of 1 or more devices
# The code does not support RAID1 recovery at present

# Simple file showing 1 extent, mapped straight into 1 target

# extent file or device start length
extent0 /iscsi/iscsi-target0 0 100MB

# target flags storage netmask
target0 ro extent0 0.0.0.0/0
% ls -l /mnt/iscsi/iscsi-target0
-rw-r--r-- 1 agc agc 104857600 Jan 18 04:00 /mnt/iscsi/iscsi-target0
% diff custom/etc/iscsi/targets /mnt/etc/iscsi/targets
%


# 1.1 14-Jan-2012 agc

Add 3 scripts which are useful for making images for usermode, or any
embedded platform in particular.

+ mkimage will make an autosized image in a file (using vnd) from sets
the resulting image can be mounted read-only, with tmpfs used for volatile
files on top of read-only bases

+ mkpkgs will make an autosized image in a file (using vnd) from binary
packages

+ usermode is an easy way to invoke usermode, making sure that bridging
is set up properly, and that the host syscallemu module is loaded. This
script then runs usermode with two file images (as produced by mkimage
and mkpkgs)


# 1.3.4.3 19-Aug-2014 tls

Rebase to HEAD as of a few days ago.


# 1.3.4.2 23-Jun-2013 tls

resync from head


# 1.3.4.1 24-Feb-2013 tls

resync with head


# 1.3.2.4 22-May-2014 yamt

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


# 1.3.2.3 22-Jan-2013 yamt

sync with head


# 1.3.2.2 16-Apr-2012 yamt

sync with head


# 1.3.2.1 28-Feb-2012 yamt

file mkimage was added on branch yamt-pagecache on 2012-04-17 00:02:49 +0000


# 1.48.4.6 06-Aug-2015 snj

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


# 1.48.4.5 06-Apr-2015 snj

Pull up following revision(s) (requested by jmcneill in ticket #667):
distrib/utils/embedded/mkimage: revision 1.54
resizing of ffsv2 still doesn't work well, so revert previous, and instead
explicitly set fsize=2048/bsize=16384, which gives a pretty decent boost
to resize_ffs performance on its own


# 1.48.4.4 05-Apr-2015 snj

Pull up following revision(s) (requested by jmcneill in ticket #664):
distrib/utils/embedded/mkimage: revision 1.53
Use FFSv2 instead of FFSv1 for the root file-system. This should fix the
"resize_ffs takes forever" issues with evbarm images -- growing a v2
file-system is much faster than v1.


# 1.48.4.3 29-Jan-2015 martin

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


# 1.48.4.2 28-Jan-2015 martin

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.


# 1.48.4.1 20-Jan-2015 martin

Pull up following revision(s) (requested by skrll in ticket #437):
distrib/utils/embedded/mkimage: revision 1.50
Use [dx]sets_p as flag for debug/X sets inclusion. xsets is the list of
sets.