= Extlinux for CLFS Builds = == Needed Files == Syslinux [[http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.02.tar.bz2]][[BR]] Gnu-EFI [[http://sourceforge.net/projects/gnu-efi/files/gnu-efi_3.0u.orig.tar.gz]][[BR]] 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]][[BR]] == 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 &&[[BR]] make &&[[BR]] make install[[BR]] == 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} &&[[BR]] make PREFIX=cross-tools efi${EFI_IA_NBITS} install[[BR]] === Build Syslinux === make CROSS_COMPILE=${CLFS_TARGET}- installer &&[[BR]] install -m 755 extlinux/extlinux /cross-tools/bin &&[[BR]] install -d -m 755 /cross-tools/syslinux &&[[BR]] install -m 644 mbr/mbr.bin /cross-tools/syslinux[[BR]] === 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.[[BR]] dd if=/dev/zero of=/dev/sda bs=446 count=1[[BR]] ==== Bootcode ==== BOOTCODE_TYP='gpt' ; # 'gpt' (for GPT) or empty-string (for MBR).[[BR]] dd bs=440 conv=notrunc count=1 if=/cross-tools/syslinux/${BOOTCODE_TYP}mbr.bin of=/dev/sda[[BR]] Second we will install the Extlinux.sys file for bootup. This is the bootloader.[[BR]] install -d ${CLFS}/boot[[BR]] extlinux --install ${CLFS}/boot[[BR]] Now we will create our extlinux.conf file. Change root_device to your root partition of your Primary Boot Drive.[[BR]] cat >> ${CLFS}/boot/extlinux.conf << "EOF"[[BR]] default boot[[BR]] prompt 0[[BR]] timeout 10[[BR]] [[BR]] label boot[[BR]] kernel clfskernel-boot[[BR]] append rw root=root_device[[BR]] EOF[[BR]] == Changes for Final-System Section == === Build Nasm === ./configure --prefix=/usr &&[[BR]] make &&[[BR]] make install[[BR]] === Build GNU-EFI === ==== IA32/64: ==== EFI_IA_NBITS=64 # 32 or 64 . make PREFIX=usr efi${EFI_IA_NBITS} &&[[BR]] make PREFIX=usr efi${EFI_IA_NBITS} install[[BR]] === 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 &&[[BR]] make install &&[[BR]] cp -ar /usr/share/syslinux/menu.c32 /boot[[BR]] === 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.[[BR]] dd if=/dev/zero of=/dev/sda bs=446 count=1[[BR]] ==== Bootcode ==== BOOTCODE_TYP='gpt' ; # 'gpt' (for GPT) or empty-string (for MBR).[[BR]] dd bs=440 conv=notrunc count=1 if=/usr/share/syslinux/${BOOTCODE_TYP}mbr.bin of=/dev/sda[[BR]] Second we will install the extlinux.sys file for bootup. This is the bootloader.[[BR]] extlinux --install /boot[[BR]] Now we will create our extlinux.conf file. Change root_device to your root partition of your Primary Boot Drive.[[BR]] cat >> /boot/extlinux.conf << "EOF"[[BR]] default menu.c32[[BR]] prompt 0[[BR]] menu title CLFS Boot Menu[[BR]] [[BR]] timeout 60[[BR]] [[BR]] label linux[[BR]] menu label CLFS Kernel {kernel_version}[[BR]] menu default[[BR]] kernel clfskernel-{kernel_version}[[BR]] append rw root=root_device[[BR]] [[BR]] label boot[[BR]] menu label CLFS Boot Stage Kernel[[BR]] kernel clfskernel-boot[[BR]] append rw root=root_device[[BR]] EOF[[BR]]