https://wiki.debian.org/ManipulatingISOs#Remaster_an_Installation_Image
Netinst and DVD-1 images are popular choices when it comes to installing Debian. Much of the time it is sufficient simply to boot the image to have everything installed to a user's satisfaction. However, it is also possible to pass boot parameters to the installer to achieve a particular end, either during the installation or on the installed system. Objectives could be to produce a fully automatic installation or to configure part of the system using preseeding.
Appending parameters to the kernel command line to setup, for example, a network connection, can be done relatively easily, but is a repetitive task when installing frequently. On the other hand, the installation image can be altered to contain the needed parameters before burning to CD or DVD or writing to a USB stick.
Manipulating an ISO image in this way is known as remastering. The basic idea will be illustrated using a Debian 9.3.0 i386 netinst image which is planned to be booted from the non-graphical install option with a preseed configuration file, preseed.cfg.
First make a place to put the extracted files:
mktemp -d
The name of the directory is displayed. Something like this should be seen:
/tmp/tmp.8t03ifDFAx
Extract all files from the ISO with (for example)
sudo apt install libarchive-tools cat firmware-9.3.0-i386-netinst.iso | bsdtar -C "/tmp/tmp.8t03ifDFAx" -xf -
and make the files in /tmp/tmp.8t03ifDFAx writable:
chmod -R +w /tmp/tmp.8t03ifDFAx
A preseed configuration file can now be put in /tmp/tmp.8t03ifDFAx:
cp preseed.cfg /tmp/tmp.8t03ifDFAx
vim /tmp/tmp.8t03ifDFAx/isolinux/txt.cfg to add the required parameters to the end of the append line. What follows is a personal choice but
priority=high locale=en_US.UTF-8 keymap=us file=/cdrom/preseed.cfg shows the intent. The language and keymap questions will not be asked and the rest of the installation will proceed under the guidance of preseed.cfg. preseed.cfg is found by the installer because the image is mounted on /cdrom.
For instructions how to re-use the full boot equipment of installation ISOs for “i386”, “amd64”, “arm64”, and other architectures, see RepackBootableISO. The instructions in the following text suffice for “i386” and “amd64” in legacy BIOS mode.
sudo apt install genisoimage cd /tmp/tmp.8t03ifDFAx sudo genisoimage -r -J -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o preseed-firmware-9.3.0-i386-netinst.iso /tmp/tmp.8t03ifDFAx
sudo apt install syslinux-utils isohybrid preseed-firmware-9.3.0-i386-netinst.iso
Finally, remove /tmp/tmp.8t03ifDFAx:
rm -r /tmp/tmp.8t03ifDFAx