How to Install the SYSLINUX Bootloader

SYSLINUX is a lightweight bootloader for MS-DOS FAT filesystems. For more information on SYSLINUX, see http://syslinux.zytor.com/wiki/index.php/SYSLINUX.

SYSLINUX requires a block device supported by the Linux kernel. For example, SYSLINUX can be used on a hard disk or a USB mass storage device.

Prerequisites

  • x86 Target
  • x86 Host
  • Timesys Factory build with syslinux enabled
  • Bootable media supported by your target system, such as a hard disk, USB stick, or SD Card

Procedure

Formatting the disk

We must create a bootable partition on the disk. The following example assumes that the block device is /dev/sdX.

NOTE: These steps will destroy all data on your disk.

  1. As root, run the fdisk utility on the drive.
    $ sudo fdisk /dev/sdX
    • NOTE: If you see the following message, you will need to following the instructions for Removing a GUID Table below.
      WARNING: GPT (GUID Partition Table) detected on '/dev/sdX'! The util fdisk doesn't support GPT. Use GNU Parted.
  2. In fdisk, delete any existing partition table and create a new one using the o command:
    Command (m for help): o
  3. Create the boot partition.
    • Create a new primary partition using the n command:
      Command (m for help): n
    • Set it as partition 1 and accept the defaults for first sector.
    • For the Last Sector, set it to a reasonably large value, such as +50M
    • Set partition 1 as bootable using the a command:
      Command (m for help): a
      Partition number (1-4): 1
      
  4. (Optional) Create a second partition for your RFS.
    • Create a new primary partition using the n command:
      Command (m for help): n
    • Set it as partition 2 and accept the defaults for first sector and last sector:
  5. Write the partition table to the card using the w command.
    Command (m for help): w
  6. Create a VFAT filesystem on the first partition:
    $ mkfs.vfat /dev/sdX1
  7. Create an ext4 filesystem on the second partition:
    $ mkfs.ext4 /dev/sdX2

Install SYSLINUX

  1. Unmount the VFAT partition, if it was automounted.
  2. The following command installs SYSLINUX to the partition:
    $ /PATH/TO/TIMESYS/INSTALLATION/toolchain/bin/syslinux /dev/sdX1
  3. Mount the filesystem. For the purposes of this document, we assume it's mounted at /mnt/boot:
    $ mount /dev/sdX1 /mnt/boot
  4. Copy the kernel to the mounted filesystem:
    $ cp /PATH/TO/TIMESYS/INSTALLATION/bzImage* /mnt/boot/

Configure SYSLINUX

SYSLINUX uses a very simple plain-text file to determine how to boot the system. The syslinux.cfg file must be present in the root directory of the filesystem that SYSLINUX was installed on. The following is an example default syslinux.cfg configuration that can be created in /mnt/boot:

prompt 1
default timesys
timeout 100
# optional
# serial 0 9600

label timesys
kernel bzImage
append ip=dhcp root=/dev/nfs rw noinitrd console=ttyS0,9600 

You should substitute your own command line options for the append line.

(OPTIONAL) Write RFS to Second Partition

  1. Mount the volume:
    $ sudo mount -t ext4 /dev/sdX2 /mnt/rfs
  2. Change to the mounted directory:
    $ cd /mnt/rfs
  3. As root, extract the RFS output tarball into the mount point:
    $ sudo tar -xf /PATH/TO/TIMESYS/INSTALLATION/rfs/rootfs.tar.gz

Clean up

  1. Leave the RFS partition:
    $ cd /
  2. Unmount the RFS partition:
    $ sudo umount /mnt/rfs
  3. Unmount the boot partition:
    $ sudo umount /mnt/boot
  4. Remove the hard drive from your system, and attach it to the target system.

Additional Information

Removing a GUID Table

NOTE Only follow these steps if you need to.

If your disk contains a GUID table rather than an MSDOS MBR, then you will need to use the parted tool to change the disk type.

  1. Start up parted:
    parted /dev/sdX
  2. Change the disk label with the mklabel command:
    mklabel msdos
  3. Answer y to any questions. This will destroy all information on the disk.