Setting up SYSLINUX

tested on Devuan/ascii, Ubuntu/artful, Slackware/14.2

Preliminary Note

If using MBR, make sure the needed partition has the bootable flag, for the mbr.bin bootcode to work,

fdisk -l /dev/sda

Also assuming you do NOT have a separate partition for /boot. I have / only as ext4, which EXTLINUX is able to read. Very recent versions of EXTLINUX are also capable to read XFS partitions – see the Building latest EXTLINUX section.

If you have XFS instead of EXT4 on Slackware Linux, see the From Scratch section below, as XFS support is only available since v5.01. Ubuntu has v6.03 but slackware has v4.07.

Install // Packages

Ubuntu artful,

apt install syslinux-utils extlinux

Avoiding Slackware 14.2’s obsolete v4.07,

ls -lhF /var/log/packages/syslinux*
#slackpkg install syslinux

Install // From Scratch

Install latest UCL library

#sbopkg -i ucl
#slackpkg install ucl

wget https://www.oberhumer.com/opensource/ucl/download/ucl-1.03.tar.gz
tar xzf ...
cd ...
./configure
nice make -j$j
nice make install

Install latest UPX

#sbopkg -i upx
#slackpkg install upx

wget https://github.com/upx/upx/releases/download/v3.95/upx-3.95-src.tar.xz
tar xJf upx-3.95-src.tar.xz 
cd upx-3.95-src/src/
nice make -j$j
install -D upx.out /usr/local/bin/upx

Fetch the latest SYSLINUX stable

wget https://cdn.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.gz
tar xzf syslinux-6.03.tar.gz 
cd syslinux-6.03

or testing

#wget https://cdn.kernel.org/pub/linux/utils/boot/syslinux/Testing/6.04/syslinux-6.04-pre1.tar.gz
#tar xzf syslinux-6.04-pre1.tar.gz 
#cd syslinux-6.04-pre1

or current

#git clone --recursive git://repo.or.cz/syslinux.git
#cd syslinux

and proceed

which nasm
ls -lhF /usr/include/uuid/uuid.h
time nice make -j$j > make.log && echo BUILT
removepkg syslinux
nice make install > makeinstall.log && echo INSTALLED

which extlinux
ls -lhF /sbin/extlinux
extlinux -v
ls -lhF /usr/share/syslinux/mbr.bin
ls -lhF /usr/share/syslinux/efi64/syslinux.efi

Secondary Bootcode

extlinux --install /
#--device /dev/sda1
ls -lhF /ldlinux.c32 /ldlinux.sys

From source

#multiboot
cp -f /usr/share/syslinux/libcom32.c32 /
cp -f /usr/share/syslinux/mboot.c32 /
#menu
#cp -f /usr/share/syslinux/libutil.c32 /
#cp -f /usr/share/syslinux/menu.c32 /

Debian/Ubuntu

#multiboot
cp -f /usr/lib/syslinux/modules/bios/libcom32.c32 /
cp -f /usr/lib/syslinux/modules/bios/mboot.c32 /
#menu
#cp -f /usr/lib/syslinux/modules/bios/libutil.c32 /
#cp -f /usr/lib/syslinux/modules/bios/menu.c32 /

Primary Bootcode

fdisk -l /dev/sda | grep ^Disklabel

In case you are using mbr.bin, you will have to MAKE THE PARTITION BOOTABLE,

cfdisk /dev/sda

From source

ls -lF /usr/share/syslinux/*.bin
dd if=/usr/share/syslinux/mbr.bin of=/dev/sda conv=notrunc
#dd if=/usr/share/syslinux/gptmbr.bin of=/dev/sda conv=notrunc

Ubuntu

ls -lF /usr/lib/SYSLINUX/*.bin
dd if=/usr/lib/SYSLINUX/mbr.bin of=/dev/sda
#dd if=/usr/lib/SYSLINUX/gptmbr.bin of=/dev/sda

Debian

ls -lF /usr/lib/EXTLINUX/*.bin
dd if=/usr/lib/EXTLINUX/mbr.bin of=/dev/sda
#dd if=/usr/lib/EXTLINUX/gptmbr.bin of=/dev/sda

Setup

vi /extlinux.conf

default XEN
prompt 1
timeout 50

label Linux
    linux /boot/vmlinuz
    append root=/dev/sda1 ro ipv6.disable=1
    #initrd=initrd.img

label XEN
    kernel mboot.c32
    append /boot/xen.gz loglvl=info pv-linear-pt=true --- vmlinuz root=/dev/sda1 ro ipv6.disable=1
    #console=tty0
    #--- initrd.img
    #noreboot=true
    #loglvl=all
    #dom0_mem=4096M,max:4096M
    #https://xenbits.xen.org/docs/4.11-testing/misc/xen-command-line.html
    #8192M 10240M 12288M
    #netcfg/do_not_use_netplan=true
    #crashkernel=128M
    #crashkernel=128M@16M
    #crashkernel=auto
    #crashkernel=X@Y
    #crashkernel=0M-2G:128M,2G-6G:256M,6G-8G:512M,8G-:768M

ls -lhF /*.{conf,sys,c32}
ls -lhF /xen.gz /vmlinuz

Clean-up

Ubuntu

apt purge lilo
dpkg -l | grep grub
apt purge ...grub...

Slackware – no need to remove lilo, nothing is automated anyways, and there is no grub.

DRAFT ON GPT

bootloader is on gpt3

#sgdisk /dev/sda --attributes=3:set:2
#sgdisk /dev/sda --attributes=3:show

Resources

EXTLINUX https://wiki.syslinux.org/wiki/index.php?title=EXTLINUX

Mboot.c32 http://www.syslinux.org/wiki/index.php?title=Mboot.c32

Installing Slackware Using GPT with a BIOS motherboard https://docs.slackware.com/howtos:slackware_admin:installing_with_gpt_without_uefi

How to install extlinux (syslinux) as a bootloader http://shallowsky.com/linux/extlinux.html

How to boot Linux with extlinux https://superuser.com/questions/743802/how-to-boot-linux-with-extlinux

Syslinux https://wiki.archlinux.org/index.php/syslinux


Nethence | Pub | Lab | Pbraun | SNE Russia | xhtml