There aren't too many simple guides that show you how to use commands to setup your USB or other drive as a normal bootable drive where you can easily boot custom kernels or whatever OS you would like.
We install "syslinux" for MBR and "syslinux-efi" for EFI and "MBR" as we need a tool that embeds the actual MBR into our USB:
sudo apt install syslinux syslinux-efi mbr
This assumes your USB is partitioned and is partition 1 on drive sdj /dev/sdj1
#you may need to mark the partition as bootable in fdisk by hitting the "b" flag
Install the MBR on /dev/sdj
sudo install-mbr /dev/sdj
Now install syslinux to the partition
sudo syslinux -i /dev/sdj1
Download syslinux 6.04
Install the EFI syslinux:
Mount it first:
mount /dev/sdj1 /mnt/sdj1
mkdir -p EFI/BOOT
#copy the EFI32 and EFI64 binaries to EFI/BOOT directory on your USB
BOOTIA32.efi BOOTX64.efi ldlinux.e32 ldlinux.e64
#file locations from .zip file linked above
./efi64/efi/syslinux.efi #rename this to BOOTX64.efi
add this to syslinux.cfg in the root:
SAY Now booting the kernel from realtechtalk.com SYSLINUX...
#you can add extra kernel flags after initrd=initrd.img by adding a specify a flag. eg initrd=initrd.img ro quiet nosplash
Congrats you should now have an MBR and EFI compatible Bootable USB!
ubuntu, debian, linux, unix, howto, install, syslinux, bootable, usb, efi, mbr, cli, terminalthere, aren, guides, commands, custom, kernels, os, quot, embeds, sudo, apt, format, vfat, assumes, partitioned, partition, sdj, dev, mkfs, vat, cfg, default, booting, kernel, realtechtalk, label, kernelfs, append, targetdev, nvme, initrd, initramfs, tar, gz,