Creating a SYSLINUX boot disk

Never seen this documented anywhere, but I just found out that you can create a syslinux boot disk from FreeBSD:-
Code:
pkg install -y syslinux
gpart destroy -F da0
gpart create -s mbr da0
gpart add -t fat32 -s 4G da0
gpart set -a active -i 1 da0
newfs_msdos -F32 /dev/da0s1
cp /usr/local/share/syslinux/bios/mbr/mbr.bin /tmp/mbr-syslinux
dd if=/dev/zero of=/tmp/mbr-syslinux seek=440 bs=1 count=72
gpart bootcode -b /tmp/mbr-syslinux da0
syslinux --install -f /dev/da0s1

This doesn't do anything at the moment apart from booting up syslinux. It is left as an exercise for the user to come up with a useful syslinux.cfg :)

Just make sure that da0 is a device is you can afford to mess with.
 
This doesn't do anything at the moment apart from booting up syslinux. It is left as an exercise for the user to come up with a useful syslinux.cfg :)
It might be helpful to create a script or a GUI frontend to make bootable Linux Live USB. I remember Rufus on Windows also relying on SysLinux to make bootable Linux Live ISO from Linux .ISO image ;)
 
I'm working on it, ie a script. A GUI frontend is out of the question, although I may try using dialog().

Here's my latest effort:-

Code:
#pkg install -y syslinux
gpart destroy -F da0
gpart create -s mbr da0
gpart add -t fat32 -s 4G da0
gpart set -a active -i 1 da0
newfs_msdos -F32 /dev/da0s1
cp /usr/local/share/syslinux/bios/mbr/mbr.bin /tmp/mbr-syslinux
dd if=/dev/zero of=/tmp/mbr-syslinux seek=440 bs=1 count=72
gpart bootcode -b /tmp/mbr-syslinux da0
mkdir /mnt/syslinux
mount -t msdosfs /dev/da0s1 /mnt/syslinux
mkdir -p /mnt/syslinux/boot/syslinux

cp /usr/local/share/syslinux/bios/com32/menu/* /mnt/syslinux/boot/syslinux

cp /usr/local/share/syslinux/bios/com32/lib/libcom32.c32  /mnt/syslinux/boot/syslinux
cp /usr/local/share/syslinux/bios/com32/libutil/libutil.c32  /mnt/syslinux/boot/syslinux
cp /usr/local/share/syslinux/bios/com32/menu/* /mnt/syslinux/boot/syslinux
cp /usr/local/share/syslinux/bios/com32/modules/* /mnt/syslinux/boot/syslinux

cat << _SYSLINUX.CFG >> /mnt/syslinux/boot/syslinux/syslinux.cfg
# syslinux.cfg
#TIMEOUT = Time to wait to autoboot in 1/10 secs. zero (0) disables the timeout
#PROMPT = one (1) displays the prompt only, zero (0) will not display the prompt
#ONTIMEOUT = The default menu label to automatically boot at timeout (selected after timeout)
#DISPLAY = Optional menu text if not using LABEL Entries

TIMEOUT 1000
DEFAULT vesamenu.c32
#MENU BACKGROUND /backgroundimages/your_image_here.png
MENU TITLE MULTI-BOOT USB
PROMPT 0
ONTIMEOUT 8
#DISPLAY Menu.txt

#Display help text when F1 pressed on Syslinux Menu
F1 help.txt

LABEL 0
MENU LABEL Local boot
TEXT HELP
Reboot the USB
ENDTEXT
localboot 0x80

LABEL 1
MENU LABEL Reboot
TEXT HELP
Restart the computer
ENDTEXT
COM32 reboot.c32
_SYSLINUX.CFG

umount /mnt/syslinux
rmdir /mnt/syslinux

syslinux --directory /boot/syslinux/ --install -f /dev/da0s1
 
I don't know but I think you shouldn't hardcode the usb as da0. Give a list of possible to use device, or accept it as the script's argument (and check it if it's possible to use or give an error and exit).
 
Back
Top