Debian's live-build is a powerful tool to build customized OS images that can be used to install pre-configured Debian from a USB/CD drive. This post is kind of old and I'd started writing it back in January. Keep in mind this is not a complete "guide", but rather collection of good resources + some things I couldn't find anywhere that I discovered myself.
First of all, make sure to read the official Debian Live Manual — it has almost everything to get started, as well as covering more advanced features. Don't be afraid of big texts: read and study a lot to accomplish what you want. Also it's worth checking out the manpages.
Ian LeCorbeau has got some useful tips on config options and hooks, especially boot time hooks that allow you to perform some customization concerning the live user. Also check the note regarding backing up your config.
auto/config:
If you want more software, you should add contrib and non-free archive areas — --archive-areas "main contrib non-free non-free-firmware"; for minimalism you may add --debootstrap-options "--variant=minbase".
config/archives (my example):
Put your APT repository lines into .list. files and .asc keys into .key. files. Those files that end in .chroot will be available at build time, but won't be present on the installed system. For repositories to be present in the target installation use .binary instead.
config/bootloaders (my example):
Bootloader customization seems to be poorly documented and usually not covered in tutorials, so I'll try to describe some of my findings in details here. On (legacy) BIOS systems you need isolinux; on UEFI you need grub-pc.
Take a look at the example I provided. IsoLinux is configured in .cfg files with isolinux.cfg being the primary one. Instead of using hardcoded paths to kernels and other things, you should use substitutions like @LINUX@, @INITRD@, @APPEND_LIVE@, @APPEND_LIVE_FAILSAFE@, @FLAVOUR@.
You may include splash.png, of course, but it's usually better to provide splash.svg that will be automatically preprocessed and converted. This allows you to use nice substitutions, such as @DISTRIBUTION@ or @MONTH@.
In order to use characters other than default English ASCII in IsoLinux you need to include your own .psf font file. In my example I used koi8u_8x16.psf that contains KOI-8 Ukrainian codepage. Make sure all other config files are encoded in the appropriate encoding (I don't remember exactly, perhaps CP1258)!
GRUB is much easier to customize and doesn't require such quirks, so I'm not going to explain it here.
config/hooks:
"Normal" hooks are executed only on the installed system (not on the live system). Hooks ending in .chroot are executed as chroot, duh. The only thing to mind here is you WON'T be able to install Flatpaks in them! For that, apparently, you need to use .container hooks that are run under a systemd-nspawn container.
config/includes.*:
Files in .binary are copied onto the ISO image directly and can be used, for example, to provide documentation. There are many other types of includes, but you may mostly need .chroot_after_packages — these are files (and folders) copied to the system after all packages are installed. It is typically used to provide /etc/skel — base configuration for users. In my example these config files change default KDE themes and settings.
.chroot_after_packages/etc/live/config.conf may contain some variables to change hostname, live user name, locales, etc. It's documented in manpages for live-boot.
Boot time hooks can be provided under .chroot_after_packages/lib/live/config-hooks/.
The rest of config/ should be pretty straightforward. Remember to use a virtual machine to test your images before proceeding to install them onto a real machine. I hope you found at least some use in this "guide"; thank your for reading, good luck! :)
No comments:
Post a Comment