wiki:bootloaders/syslinux

Version 23 (modified by M.N. Akhiezer, 8 years ago) ( diff )

Code-blocks adj to 'preformatted' style; was already present on grub{-legacy,2} btldr pages.

Extlinux for CLFS Builds

Needed Files

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

Gnu-EFI http://sourceforge.net/projects/gnu-efi/files/gnu-efi_3.0u.orig.tar.gz

Everything below is only needed if you're following the Boot Method of the build.

NASM http://www.nasm.us/pub/nasm/releasebuilds/2.07/nasm-2.07.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 GNU-EFI

IA32/64:

EFI_IA_NBITS=64        # 32 or 64 .
make PREFIX=cross-tools efi${EFI_IA_NBITS} &&
make PREFIX=cross-tools efi${EFI_IA_NBITS} install

Build Syslinux

make CROSS_COMPILE=${CLFS_TARGET}- installer &&
install -m 755 extlinux/extlinux /cross-tools/bin &&
install -d -m 755 /cross-tools/syslinux &&
install -m 644 mbr/mbr.bin /cross-tools/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

Bootcode

BOOTCODE_TYP='gpt' ;        # 'gpt' (for GPT) or empty-string (for MBR).
dd bs=440 conv=notrunc count=1 if=/cross-tools/syslinux/${BOOTCODE_TYP}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 GNU-EFI

IA32/64:

EFI_IA_NBITS=64        # 32 or 64 .
make PREFIX=usr efi${EFI_IA_NBITS} &&
make PREFIX=usr efi${EFI_IA_NBITS} install

Build Syslinux

Now we will build the final version of Syslinux, and we will copy the menu.c32 file over so that 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 Drive. I will assume that the Primary Boot Drive is /dev/sda. We repeat this step from above. Reinstalling this ensures that we are using the currently built version of the file. When Syslinux is cross-compiled, some files are not made and the pre-made ones are used instead. This reinstall will ensure that we now use the ones we just built.

dd if=/dev/zero of=/dev/sda bs=446 count=1

Bootcode

BOOTCODE_TYP='gpt' ;        # 'gpt' (for GPT) or empty-string (for MBR).
dd bs=440 conv=notrunc count=1 if=/usr/share/syslinux/${BOOTCODE_TYP}mbr.bin of=/dev/sda

Second we will install 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
Note: See TracWiki for help on using the wiki.