This is a simple method to customize a Debian Installer image, for example in order to preseed the installation. The method is viable if you want to install Debian on a EFI system booting from a USB stick, which should be a common enough use case.
First create a FAT32 filesystem on the removable device and mount it. The device is sdX in the example.
parted --script /dev/sdX mklabel msdos parted --script /dev/sdX mkpart primary fat32 0% 100% mkfs.vfat /dev/sdX1 mount /dev/sdX1 /mnt/data/
Then copy to the USB stick the installer ISO you would like to modify, debian-12.2.0-amd64-netinst.iso here.
kpartx -v -a debian-12.2.0-amd64-netinst.iso # Mount the first partition on the ISO and copy its contents to the stick mount /dev/mapper/loop0p1 /mnt/cdrom/ rsync -av /mnt/cdrom/ /mnt/data/ umount /mnt/cdrom # Same story with the second partition on the ISO mount /dev/mapper/loop0p2 /mnt/cdrom/ rsync -av /mnt/cdrom/ /mnt/data/ umount /mnt/cdrom
You can now edit the files on the USB stick at will. For example, you can add a preseed file called /mnt/data/preseed.cfg and add preseed/file=/cdrom/preseed.cfg to the kernel command line in /mnt/data/boot/grub/grub.cfg as follows:
linux /install.amd/vmlinuz vga=788 --- quiet preseed/file=/cdrom/preseed.cfg
When you're done, run umount /mnt/data and remove the USB stick. You should be able to boot from it to install Debian normally.