SourceForge.net Logo

3.3. Prepare the CF card

The router will boot from a compact flash card. That implies that the boot loader, linux kernel and root file system need to be present on that card. This section describes how to prepare the CF card.

3.3.1. Partition table

The command listed below will make a new partition table on your compact flash card.

[Warning]Warning

Ensure that FLASH_DEV and FLASH_PART are assigned correct values as described in Section 2.1, “Environment Variables”.

sudo chmod o+rw $FLASH_DEV $FLASH_PART
fdisk $FLASH_DEV <<EOF
o
n
 p
 1


t
 6
a
 1
w
EOF
fdisk -l $FLASH_DEV

3.3.2. Boot Loader

The CF will use syslinux in the Master Boot Record (MBR). Syslinux is a lightweight boot loader to start the Linux operating system from FAT12 or FAT16 filesystems .

Download, compile and install syslinux using the following commands: [15]

wget -P $DL_DIR http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-2.11.tar.bz2
mkdir -p $PRJ_DIR/bootldr
tar -C $PRJ_DIR/bootldr -xvjf $DL_DIR/syslinux-2.11.tar.bz2
cd $PRJ_DIR/bootldr/syslinux-2.11
make syslinux

Download, compile and install ms-sys using the following commands: [16]

wget -P $DL_DIR http://cogent.dl.sourceforge.net/sourceforge/ms-sys/ms-sys-2.0.0.tgz
tar -C $PRJ_DIR/bootldr -xvzf $DL_DIR/ms-sys-2.0.0.tgz
cd $PRJ_DIR/bootldr/ms-sys-2.0.0
make

Write the MBR, format the file system and install the syslinux boot loader using the commands below.

pushd $PRJ_DIR/bootldr
  ms-sys-2.0.0/bin/ms-sys -s $FLASH_DEV
  sudo mkdosfs $FLASH_PART
  sudo syslinux-2.11/syslinux $FLASH_PART
popd



[15] Ensure that nasm is installed (rpm -q nasm).