How to build custom mfsbsd images.

Generation of mfsbsd image
You can generate your own mfsbsd image (see below) or just get one of the Testing/Beta ones from MFSBSD8. In the latter case, you will need to also download the original kernel.txz from a FreeBSD mirror site because by default mfsbsd does not include the geom_eli module and its dependencies (zlib, crypto). The generic image will just use DHCP to get all its network related data and start sshd. Just connect with the mfsroot password by root.
The kernel.tgz can be taken from ftp://ftp.fr.freebsd.org/pub/FreeBSD/releases/amd64/amd64/9.2-RELEASE. Note that the kernel.tgz version needs to be the same one as the one inside mfsbsd, else you will not be able to load the modules.

NOTE: I have submitted patches to add the missing modules, for now, the method above with kernel.txz works fine.

buildworld & buildkernel

make buildworld
make buildkernel KERNCONF=GENERIC

Please add any option you want like -j8 and define options as you see fit like NO_CLEAN=yes

NOTE: The mfsbsd Makefile can do that for you if you specify CUSTOM=1 BUILDWORLD=1 BUILDKERNEL=1.

Configuration
You need to modify and customize the various configuration files located in conf/:

authorized_keys
interfaces.conf
loader.conf
rc.conf
resolv.conf

The main things to change are IP addresses of the server, DNS servers, defaultroute and all that. Most of these informations are on the page describing your server in the console. Recent versions of mfsbsd (around 2.0) allow to specify DHCP making thinsg much easier (and the images more generic).
loader.conf is important because that where you specify the tunables for the kernel. As we are installing a ZFS system, you will need at least to specify vm.kmem_size. I’d advise you to use 2xRAM here.
There also on file we need to modify: Makefile. By default, only some kernel modules are loaded in, a few more are put as loadable modules and there are some missing (in the context of the current article): geom_eli, aesni and its dependencies (crypto, zlib). ZFS and opensolaris are included though.

mfsbsd creation
If you use the source to generate a release/snapshot, use the following to create the mfsbsd image:

make BASE=/data/work/freebsd/9 SRC_DIR=/data/work/freebsd/9  CUSTOM=1

If you use the files from a given distribution, SRC_DIR is not needed and BASE should point to the directory with base.txz and kernel.txz.
Copy the newly created mfsboot.img somewhere you can reach over the Internet. Any FTP or HTTP server will do.

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: