# # SAMPLE CONFIGURATION # # Copy this to another file and use that when running Crochet, e.g. # $ sudo /bin/sh Crochet.sh -c # # Note: Only board_setup is actually required, assuming /usr/src has # suitable FreeBSD sources. Everything else below is optional. # REQUIRED: # Uncomment one to choose the default configuration for your board # # board_setup BeagleBone # board_setup GenericI386 # board_setup PandaBoard board_setup RaspberryPi # board_setup VersatilePB # board_setup ZedBoard # Don't see your board here? board/NewBoardExample has details for # how to add a new board definition. If you need help, ask. If you # get it working, please consider contributing it. # # Read board//README for more details # about configuring for your particular board. # # Suggested: option ImageSize # # Size of the disk image that will be built. This is usually the same # size as your memory card or disk drive, but it can be smaller. # Each board setup above defines a default value, but it's deliberately # chosen to be very small. # # 'mb' = 10 ^ 6, 'gb' = 10 ^ 9, 'mib' = 2 ^ 20 and 'gib' = 2 ^ 30 # #option ImageSize 256mb # for kernel-only images option ImageSize 1950mb # for 2 Gigabyte card #option ImageSize 3900mb # for 4 Gigabyte card option VideoCore # # How to Customize Your Build # # Crochet supports a variety of customization approaches: # # 1) "options" provide canned functionality. If there is not # an option that provides what you want, consider contributing # a new one. There's a template in option/Sample that explains # how to write a new one. # 2) There are a large number of shell variables that control # how various internal features work. A very few are described # below; you can find many more by skimming the source code. # (Variables beginning with '_' should not be touched.) # 3) "overlay" files are simply copied to the image as-is. Crochet # looks in a couple of standard places; you can just add the file # you want and it will get copied for you. # 4) Functions beginning with "customize_" are provide for user # customization. The default definitions are empty; feel free to # override them. There are examples at the end of this file. # 5) Crochet internally uses a "strategy list" of shell functions that # will be run. The board definitions and options all add items to # the strategy list; you can also define your own functions and # add them directly to the strategy list using strategy_add. # Read the comments in lib/base.sh for details of how this works. # # If none of the above mechanisms support your requirements, ask # and we'll see if we can add something else. # # option AutoSize # # "AutoSize" adds a startup item that will use "growfs" to # grow the UFS partition as large as it can. This can be used # to construct small (e.g., 1GB) images that can be copied onto larger # (e.g., 32GB) media. At boot, such images will automatically resize # to fully utilize the larger media. # option SwapFile # # Takes a size argument (e.g., "768mb") and adds a swap file # to the UFS partition of the indicated size. This also adds # the appropriate rc.conf entries to use the swap file. # option UsrPorts # # Uses "portsnap" to download an up-to-date ports tree and # install it on the image. # option UsrSrc # # Copies the src tree that was used to build this image to /usr/src # on the image. # KERNCONF=MYCONF # # Each board picks a default KERNCONF but you can override it. FREEBSD_SRC=/src/FreeBSD/head # # FreeBSD source that will be used for kernel, world, and ubldr. # This directory doesn't need to exist yet. When you run the script, # it will tell you how to get appropriate sources into this directory. # (I find FREEBSD_SRC=${TOPDIR}/src to be useful.) # WORKDIR=${TOPDIR}/work # # You will probably never override this, but you may need to # understand it: WORKDIR holds all of the created files (in # particular, the FreeBSD "obj" is redirected here). It also holds a # lot of log files: If something goes wrong, there's probably a record # here. # # After successful world or kernel builds, a marker is put in this # directory; subsequent runs of this script check for the marker and # avoid rebuilding. This makes it easy to tinker with the image # layout and build without having to wait on all of FreeBSD to build # every single time. # # In particular: If you need to do a clean build of everything from # scratch, remove the contents of $WORKDIR first. # IMG=${WORKDIR}/FreeBSD-${KERNCONF}.img # # The name of the final disk image. # This file will be as large as IMAGE_SIZE above, so make # sure it's located somewhere with enough space. FREEBSD_INSTALL_WORLD=y # # Unset this to suppress installworld. This is # useful when experimenting with boot and kernel # startup, since it greatly speeds up the image # generation. Set IMAGE_SIZE to 50 * MB or even smaller # to really shorten your build/test cycles: # # Extra arguments for FreeBSD build stages. # # Each board definition specifies certain options for the world and # kernel builds. Note that these are recorded in ${WORKDIR} when # Crochet runs a build; subsequent Crochet runs will skip the # corresponding build if the options are unchanged. # # You can add your own options to any single build phase: # # FREEBSD_BUILDWORLD_EXTRA_ARGS="" # FREEBSD_INSTALLWORLD_EXTRA_ARGS="" # FREEBSD_BUILDKERNEL_EXTRA_ARGS="" # FREEBSD_INSTALLKERNEL_EXTRA_ARGS="" # You can specify options for both buildworld and installworld: # FREEBSD_WORLD_EXTRA_ARGS="" # You can specify options for both buildkernel and installkernel. # FREEBSD_KERNEL_EXTRA_ARGS="" # You can specify options used for all four of the above: # FREEBSD_EXTRA_ARGS="" # You can specify a custom src.conf or make.conf; the defaults are: # SRCCONF="/dev/null" # __MAKE_CONF="/dev/null" # For example, I find each of the following quite useful at times: FREEBSD_EXTRA_ARGS="-DNO_CLEAN" FREEBSD_KERNEL_EXTRA_ARGS="-DKERNFAST" WORLDJOBS=-j4 # OVERLAY FILES # # Most customization simply consists of putting extra # files onto the image. # # The contents of ${BOARDDIR}/overlay, ${TOPDIR}/overlay, and # ${WORKDIR}/overlay are copied over the image in that order. For # example, you can put a custom passwd or fstab file into # ${TOPDIR}/overlay/etc and it will be picked up automatically. # Adding Strategy Items # # XXX explain how to use strategy_add directly and why you might want to XXX # # STANDARD customize_ FUNCTIONS # # There are a few standard functions beginning with customize_ # that are specifically provided for you to override. These # are never defined by Crochet. # # Most board definitions work with two partitions (for some boards, # these are in different image files): # * A boot partition holds the various boot loaders. This varies # significantly by board. # * A FreeBSD partition holds the FreeBSD world (and usually kernel). # Board definitions should keep this as standard as possible. # # The following functions are run after the default board setup has # run, so you can feel free to delete or rearrange files on the image # as you see fit. # # WARNING: Unlike some other system-building scripts, these do *not* # run in a chroot or jail. (It can't because we're cross-building.) # For example, if you want to add an account, be sure to modify # etc/passwd and not /etc/passwd! # # Some useful shell variables: # ${WORKDIR} is the full path to the 'work' directory # which you can use for intermediate files # ${TOPDIR} is the current directory where crochet is located # # The lib/*.sh files also define a number of functions # that you may find useful here. # # # Runs after boot partition is built. # # The current working directory is at the root of the mounted # # boot partition. # customize_boot_partition ( ) { # } # # Note that the following runs even if FREEBSD_INSTALL_KERNEL # and FREEBSD_INSTALL_WORLD are not enabled. # # # Runs after FreeBSD partition is built and populated. # # The current working directory is at the root of the mounted # # freebsd partition. # customize_freebsd_partition ( ) { # } # For example, here's one way to add an entry to the default fstab: # # customize_freebsd_partition ( ) { # echo "md /tmp mfs rw,noatime,-s30m 0 0" >> etc/fstab # } # If you can't do what you want with the above, try this: # customize_post_unmount is called after the image is fully created # and unmounted. $1 is the filename of the constructed image file. # You can remount, resize partitions, change partition options, etc. # If you do anything interesting with this, please let me know. (I've # never actually needed it and am dreadfully curious what someone # might use it for.)