Monday, June 5, 2017

Building bootable FreeBSD Images: Crochet-FreeBSD

10:52 AM Leave a Reply
Building bootable FreeBSD Images: Crochet-FreeBSD
Building bootable FreeBSD Images

     Crochet is a tool for building bootable FreeBSD images. This tool was formerly known as “freebsd-beaglebone” or “beaglebsd” as the original work was done for BeagleBone. But it now supports more boards and should easily extend to support many more.





Supported Platforms

Alix
BananaPi
BananaPi BPI-M3
BeagleBone
Chromebook Snow
Cubieboard
OrangePi
PandaBoard
Pine64
RaspberryPi and RaspberryPi 2
Soekris
generic x86 systems.
Wandboard
Versatile PB
VMWare
ZedBoard


How to Build a Disk Image

     The crochet.sh script can build a complete bootable FreeBSD image ready to be copied to a suitable device (e.g., SDHC card, Compact Flash card, disk drive, etc.). The script runs on FreeBSD-CURRENT, though some people have reported success running it on FreeBSD 9-STABLE.

Using the script to build an image consists of a few steps:

READ board/board-name/READMEThe board-specific directories each have a README with various details about running FreeBSD on a particular system. (Some boards have several README files in subdirectories with additional technical information.)
CREATE a config fileStart by copying config.sh.sample.The first line specifies the board configuration you want to use. The name here should exactly match a directory under “board/”.
The configuration file can specify a wide variety of customizations for the generated image. The config.sh.sample file includes extensive documentation in the form of comments.

RUN crochet.sh as root$ sudo /bin/sh crochet.sh -c <config file>The script will first check that you have any needed sources. If you don’t, the script will tell you exactly how to obtain the missing pieces. Follow the instructions and re-run the script until you have everything.
As soon as it finds all the required pieces, the script will then compile everything and build the disk image. This part of the process can take many hours.

Crochet keeps the built system, kernel, and other files between runs. In many cases, you can adjust the configuration and re-run crochet to build a new image in just a few minutes. However, if you update the FreeBSD sources or make a significant configuration change, you should probably delete the contents of the work directory to force everything to be rebuilt from scratch.

Shortcut: If you only want the most basic build for a board, you can use this command without creating a config file:

$ sudo /bin/sh crochet.sh -b <boardname>

However, if you want to tweak the build in any way, you will need to create a config file.

COPY the image to a suitable device (SD card, disk drive, etc)The script will suggest a ‘dd’ command to do this.
BOOT the image on your board.Again, read board/board-name/README for details.


Using pkg

You can use pkg to install packages on your final crochet image if you have your own package repository. Add the following to your config:

# Package Installation Information

option PackageInit $pkg-repo
option Package security/sudo

# If you don't put a custom resolv.conf in your overlay use this
# Otherwise pkg will not be able to resolv hostnames

option Resolv
      In the example above, change $pkg-repo to the full URL of your package repository. Be sure to include the category for the package. Ex: security/sudo vs. sudo. You can also specify more than one package at a time. Ex: option Package security/sudo sysutils/tmux. In order for pkg to communicate with a remote package repo, you either need a custom resolv.conf in your board overlay, or use option Resolv in your config.

Docs
Download