wiki:bootloaders/syslinux

Version 3 (modified by chris@…, 15 years ago) (diff)

--

Extlinux for CLFS Builds

Needed Files

Syslinux http://www.kernel.org/pub/linux/utils/boot/syslinux/Testing/syslinux-3.73-pre7.tar.bz2

Everything below is only needed if you're following the boot method of the build.

NASM http://voxel.dl.sourceforge.net/sourceforge/nasm/nasm-2.05.01.tar.bz2

Changes for Cross-Tools Section

This build is only required if you're using the Boot Method of the build.

Build Nasm

./configure --prefix=/cross-tools &&
make &&
make install

Changes for Boot Section

This build is only required if you're using the Boot Method of the build. You can also skip the building of Grub or Lilo.

Build Syslinux

make CROSS_COMPILE=${CLFS_TARGET}- installer &&
install -d -m 755 /cross-tools/usr/bin &&
install -m 755 mtools/syslinux /cross-tools/usr/bin &&
install -d -m 755 /cross-tools/sbin &&
install -m 755 extlinux/extlinux /cross-tools/sbin &&
install -d -m 755 /cross-tools/usr/share/syslinux &&
install -m 644 mbr/mbr.bin /cross-tools/usr/share/syslinux

Configure Extlinux

First we erase the current MBR on the disk, next we will install the MBR for Extlinux on the Primary Boot Drive. I will assume the Primary Boot Drive is /dev/sda.

dd if=/dev/zero of=/dev/sda bs=446 count=1
dd if=/cross-tools/usr/share/syslinux/mbr.bin of=/dev/sda

Second we will install the Extlinux.sys file for bootup. This is the bootloader.
install -d ${CLFS}/boot
extlinux --install ${CLFS}/boot

Now we will create our extlinux.conf file. Change root_device to your root partition of your Primary Boot Drive.

cat >> ${CLFS}/boot/extlinux.conf << "EOF"
default boot
prompt 0
timeout 10

label boot

kernel clfskernel-boot
append rw root=root_device

EOF

Changes for Final-System Section

Build Nasm

./configure --prefix=/usr &&
make &&
make install

Build Syslinux

Now we will build the final version of the Syslinux, and we will copy the menu.c32 file over so we can have a menu at bootup.

make installer &&
make install &&
cp -ar /usr/share/syslinux/menu.c32 /boot

Configure Extlinux

First we erase the current MBR on the disk, next we will install the MBR for Extlinux on the Primary Boot rive. I will assume the Primary Boot Drive is /dev/sda. We repeat this step from above. Reinstalling this ensures us that we are using the currently built version of the file. When Syslinux is cross-compiled, some files are not made and the premade ones are. This will ensure that we use the ones we just built.

dd if=/dev/zero of=/dev/sda bs=446 count=1
dd if=/usr/share/syslinux/mbr.bin of=/dev/sda

Second we will installed the Extlinux.sys file for bootup. This is the bootloader.
extlinux --install /boot

Now we will create our extlinux.conf file. Change root_device to your root partition of your Primary Boot Drive.

cat >> /boot/extlinux.conf << "EOF"
default menu.c32
prompt 0
menu title CLFS Boot Menu

timeout 60

label linux

menu label CLFS Kernel {kernel_version}
menu default
kernel clfskernel-{kernel_version}
append rw root=root_device


label boot

menu label CLFS Boot Stage Kernel
kernel clfskernel-boot
append rw root=root_device

EOF