How to Install the SYSLINUX Bootloader
Table of Contents
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.
- 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.
- NOTE: If you see the following message, you will need to following the instructions for Removing a GUID Table below.
- In fdisk, delete any existing partition table and create a new one using the o command:
Command (m for help): o
- 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
- Create a new primary partition using the n command:
- (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:
- Create a new primary partition using the n command:
- Write the partition table to the card using the w command.
Command (m for help): w
- Create a VFAT filesystem on the first partition:
$ mkfs.vfat /dev/sdX1
- Create an ext4 filesystem on the second partition:
$ mkfs.ext4 /dev/sdX2
Install SYSLINUX
- Unmount the VFAT partition, if it was automounted.
- The following command installs SYSLINUX to the partition:
$ /PATH/TO/TIMESYS/INSTALLATION/toolchain/bin/syslinux /dev/sdX1
- Mount the filesystem. For the purposes of this document, we assume it's mounted at /mnt/boot:
$ mount /dev/sdX1 /mnt/boot
- 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
- Mount the volume:
$ sudo mount -t ext4 /dev/sdX2 /mnt/rfs
- Change to the mounted directory:
$ cd /mnt/rfs
- As root, extract the RFS output tarball into the mount point:
$ sudo tar -xf /PATH/TO/TIMESYS/INSTALLATION/rfs/rootfs.tar.gz
Clean up
- Leave the RFS partition:
$ cd /
- Unmount the RFS partition:
$ sudo umount /mnt/rfs
- Unmount the boot partition:
$ sudo umount /mnt/boot
- 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.
- Start up parted:
parted /dev/sdX
- Change the disk label with the mklabel command:
mklabel msdos
- Answer y to any questions. This will destroy all information on the disk.