tech-userlevel archive

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

RFC: boot images config. file format



Please let me know what you think about this configuration file syntax
for NetBSD boot images.  The format derives from Lloyd Parkes' and my
work together on GSoC 2009.

ENTITIES

The entities specified by the configuration file specifies, in order
from the "atoms" to the final product, a disk image:

<fstab>: a list of filesystems to list in /etc/fstab.  An fstab is
    created with an 'fstab' statement.  An fstab is instantiated at
    /etc/fstab by including it in a <list>.

<passwd>: a list of password entries to add to the system.  A <passwd>
    is instantiated in files (/etc/passwd, /etc/master.passwd,
    /etc/pwd.db, /etc/spwd.db) by including it in a <list>.

<group>: a list of group entries to add to the system.  A <group>
    is instantiated in files (/etc/group) by including it in a <list>.

<list>: a list of directories, files, and the patches to apply to the
    files.  A list is built by adding/excluding syspkgs, adding files,
    copying another list, by installing /etc/fstab or /netbsd, and
    by specifying applicable patch directories.  Statements that can
    operate on or create a list include:

        syspkgs: add one or more syspkgs to a list
        exclude: delete one or more syspkgs from a list.
        copy: copy a list, possibly adding /netbsd, /etc/fstab,
            /etc/group, or password files
        files: add files listed by an mtree(5)-format file to a list

    See STATEMENTS.
 
<filesystem>: a subset of a <list>, rendered into a particular
    filesystem format.  The files and directories in a <list> are
    divided among its filesystems so that the files and directories
    in 'filesystem /' will not appear in 'filesystem /var'.

<partition>: a copy of binary data such as a kernel, filesystem, or
    ordinary file, with disk parameters such as size, offset, and label
    specified.

<disk>: an instantiation of zero or more <partitions> and disk partition
    tables in a disk image with a certain size and C/H/S geometry.

<tarroot>: an instantiation of a list in a .tgz file

<mdroot>: a copy of a kernel with a particular filesystem loaded
    into an embedded memory disk.

Configuration entities build up to a disk image roughly as follows:

file -> fstab | kernel | plainfile | group | passwd
list -> file | file list
filesystem -> list path fstype
partition -> filesystem | file
disk -> partition* bootopts

STATEMENTS

Here is the syntax for configuration file statements:

#
# filesystem <fsname> [at <path>] list <listname> type ffs|cd9660 \
#     [size <blocks>] <TBD: specification of makefs options>
#
Create a filesystem named <fsname> with the given type and (optional)
size, and fill it with files from <listname>.  If 'at <path>' is
given, fill the filesystem only with files in <listname> under
<path>. <path> must be a pathname starting with '/'. If <fsname>
is a pathname starting with '/', fill the filesystem only with
files in <listname> under path <fsname>.  If neither <path> nor
<fsname> is a pathname starting with '/', the filesystem statement
is invalid.

#
# partition <partname> [start <block>] [size <blocks>] \
#   [bsd [part <letter>] fstype <type>] [gpt type <UUID> [name <name>]] \
#   [mbr [part [ext] 0|1|2|3] [sysid <id>] [active]] \
#   { kernel <kernelname> | filesystem <fsname> | file <filename> | zero }
#
Create a partition named <partname>.  Optionally set its parameters in
the BSD disklabel, Master Boot Record, and GUID Partition Table.  Fill
it either with zeroes or with the given kernel, filesystem, or ordinary
file.

#
# disk <diskname> sectors <sectors> \
#    [geometry <cylinders> <heads> <sectors/track>] {partition <partname>}*
#
Write a disk image to <diskname>.img. <diskname> is not a disktab(5)
entry name.

#
# tarroot <tgzname> list <listname>
#
Create a gzipped tape archive file, <tgzname>.tgz, and add to it
all of the files in <listname>.

#
# mdroot <mdname> kernel <kernelname> filesystem <fsname>
#
Copy the kernel configuration <kernelname>.  Configure the copy to
mount the root filesystem from an embedded memory disk.  Build a
kernel, <mdname>, from the copied configuration, and embed the
filesystem <fsname>.

#
# fstab <fstabname> {filesystem <fsname> | nfs <server:/path>} \
#     at <mountpoint> [<fstab fields 4 through last>]
#
Create or extend a list of fstab(5) entries, <fstabname>.  <fstabname>
will not appear on any filesystem unless it is added to a files
list with a 'copy' statement (below), and the files in the list
are added to a filesystem with a 'filesystem' statement.

#
# copy <new-listname> list <listname> [fstab <fstabname>] [netbsd <kernelname>]
#
Create a copy of a files list, <listname>.  Call it <new-listname>.
Either compile <kernelname> and it add to the list at /netbsd, add
<fstabname> to the list at /etc/fstab, both, or neither.

#
# syspkgs <listname> <syspkg-regex>
#
Add to <listname> all of the files from System Packages matching
the regular expression <syspkg-regex>.

#
# exclude <listname> <syspkg-regex>
#
Remove from <listname> all of the files from System Packages matching
the regular expression <syspkg-regex>.

#
# files <listname> <directory>
#
Add to <listname> all of the files listed in the mtree(5)-format
file, <directory>/METALOG.  Use the file ownership, mode, and type
specified by METALOG.  Take each regular file's content from the
corresponding file under <directory>.

#
# patches <listname> <directory>
#
Treat each file under <directory> as a patch.  Apply the
patch at the root of the list <listname>.

#
# trim <listname> <trimfile>
#
Read from <trimfile> a newline-delimited list of files to remove
from <listname>, and remove them.

#
# build <listname> <srcpath>
#
Cross-build the 3rd-party software at <srcpath> by changing to the
directory <srcpath> and invoking the targets obj, dependall, and
install of the top-level Makefile.  Add the installed files to
<listname>.

#
# user <passwdname> <record>
# group <groupname> <record>
#
Add the passwd(5)/group(5)-format <record> to the list of password/group
records named by <passwdname>/<groupname>.

I have attached a sample configuration file that is adapted from
configuration file written by Lloyd Parkes for a Kerberos Key
Distribution Center (KDC).

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 278-3933
# I'll have a disk image for proper use, and a tgz file for testing via NFS.
# I'll extract the tgz file contents by hand.
# My goal is to fit this onto my old 32MB Kodak CF card

# XXX I want to specifiy how much free space is in /var and root.

#
# filesystem <fsname> [at <path>] list <listname> type ffs|cd9660 \
#     [size <blocks>] <TBD: specification of makefs options>
#
# Create a filesystem named <fsname> with the given type and (optional)
# size.  If 'at <path>' is given, let the filesystem contain the files
# under <path>. <path> must be a pathname starting with '/'. If <fsname>
# is a pathname starting with '/', let the filesystem contain the files
# under <fsname>.  If neither <path> nor <fsname> is a pathname starting
# with '/', the filesystem statement is invalid.
#
filesystem root at /    list kdc type ffs
filesystem /var         list kdc type ffs 

#
# partition <partname> [start <block>] [size <blocks>] \
#   [bsd [part <letter>] fstype <type>] [gpt type <UUID> [name <name>]] \
#   [mbr [part [ext] 0|1|2|3] [sysid <id>] [active]] \
#   { kernel <kernelname> | filesystem <fsname> | file <filename> }
#
# Create a partition named <partname>.  Optionally set its parameters in
# the BSD disklabel, Master Boot Record, and GUID Partition Table.  Fill
# it with the given kernel, filesystem, or ordinary file.
#
partition a     bsd part a filesystem root
partition e     bsd part e filesystem var

#
# disk <diskname> sectors <sectors> \
#    [geometry <cylinders> <heads> <sectors/track>] {partition <partname>}*
#
# Write a disk image to <diskname>.img. <diskname> is not a disktab(5)
# entry name.
#
# Kodak 32MB CompactFlash card
#
disk cf32mb sectors 62592 geometry 489 4 32 partition a partition e

#
# tarroot <tgzname> list <listname>
#
# mdroot <mdname> kernel <kernelname> filesystem <fsname>
#
# .tgz root
#
tarroot kdc list kdc-tar

#
# fstab <fstabname> {filesystem <fsname> | nfs <server:/path>} \
#     at <mountpoint> [<fstab fields 4 through last>]
#
fstab cf-fstab filesystem root  at /
fstab cf-fstab filesystem /var  at /var

fstab tgz-fstab nfs 10.0.1.47:/vol/scratch/export/root/evbarm at /

#
# copy <new-listname> list <listname> [fstab <fstabname>] [netbsd <kernelname>]
#
# Create a copy of <listname>.  Call it <new-listname>.
# Install a kernel at /netbsd or an fstab at /etc/fstab, both, or neither.
#
copy kdc-tar    list kdc fstab tgz-fstab netbsd TS7200
copy kdc-cf     list kdc fstab cf-fstab

#
# syspkgs <listname> <syspkg-regex>
#
# exclude <listname> <syspkg-regex>
#
# For a KDC, we need all the Kerberos utilities and NTP for time
# synchronisation.
#
syspkgs kdc     base-krb5-
syspkgs kdc     base-ntp-bin
syspkgs kdc     base-util-bin
syspkgs kdc     base-sysutil-bin
syspkgs kdc     base-netutil-root
# Needed for testing with an NFS root (well, proper testing anyway)
syspkgs kdc     base-nfsclient-root

# The shared libraries are an unlisted requirement for pretty much everything.
syspkgs kdc     base-sys-shlib
syspkgs kdc     base-net-shlib
syspkgs kdc     base-crypto-shlib
syspkgs kdc     base-sys-shlib

# Let's have the critical configuration files and the startup scripts.
syspkgs kdc     etc-sys-etc
syspkgs kdc     etc-net-etc
syspkgs kdc     etc-sysutil-etc
syspkgs kdc     etc-sys-defaults
syspkgs kdc     etc-sys-log
syspkgs kdc     etc-.*-rc

# /bin/* is generally quite useful, but all we want from /sbin is init (mostly).
syspkgs kdc     base-util-root
syspkgs kdc     base-sysutil-root

exclude kdc     base-krb5-examples

#
# files <listname> <directory>
#
files kdc       ../netbsd.specials
#files          KDC.files

#
# patches <listname> <directory>
#
patches kdc     KDC.patches


Home | Main Index | Thread Index | Old Index