Creating a custom iso installer.

This is to create a custom ISO for installing on a system with limited memory. I'm doing this in a jail to avoid contaminating my desktop. You need ezjail (or just a jail) with sources installed.

Use: sudo ezjail-admin install -S if your ezjail does not have sources.

Start by creating a jail:

sudo ezjail-admin create isobuild 're0|'

Get into the jail: sudo ezjail-admin console -f isobuild

First, we need to create a writable copy of /usr/src: cp /usr/src /usr/src2

I'm going to modify the generic kernel since this is a custom image anyways, you can follow the recomended advice and make it with a different name if you want. That will require you to select the correct kernel during boot of the installer. Edit /usr/src2/sys/i386/conf/GENERIC with your favourite editor, and start commenting things out.

Things I removed: optins: DTRACE, debug anything, AUDIT, SMP, apic devices: most scsi controllers, anything with RAID, SATA, SAS, NVMe in the name, agp I removed most PCI nics and all wireless nics. Depending on what you're building for, this may not be desired md (memory disks) was an obvious removal USB 2 and 3 All virtualization support

Now build the world: cd /usr/src2 make buildworld The volume ID/ISO label is unique and must be set to the correct release information.

You can probably prune the contents of /usr/src/{doc|ports|src} to thin out the iso, I didn't bother since I'm just worried about memory.

Some other blogposts I used to arive at this method: