Pejman Moghadam / Slackware

Slackware 13.1 - Making Bootable USB using Syslinux


df -hT

Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda2 reiserfs     19G   17G  2.5G  87% /
/dev/sda4 reiserfs     23G  1.4G   22G   6% /storage
/dev/sda3     ext3     14G  509M   13G   4% /mnt/lfs
/dev/sdb1     vfat    3.8G  9.1M  3.8G   1% /mnt/usb

fdisk -l /dev/sdd

Disk /dev/sdd: 16.0 GB, 16039018496 bytes
64 heads, 32 sectors/track, 15296 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x380e2f10

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1   *           1       15296    15663088    b  W95 FAT32

download.sh

#!/bin/bash

URL="http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-4.05.tar.gz"
FILE_NAME=$(basename ${URL})
DIR_NAME=$(echo ${FILE_NAME%.tar.?z*})
OUTPUT_DIR="/mnt/usb/syslinux"

cd /usr/src
wget -c ${URL}
tar xf ${FILE_NAME}
cd ${DIR_NAME}

mkdir -p ${OUTPUT_DIR}
find . -iname ldlinux.sys -exec cp {} ${OUTPUT_DIR} \;
find . -iname mbr.bin -exec cp {} ${OUTPUT_DIR} \;
find . -iname menu.c32 -exec cp {} ${OUTPUT_DIR} \;
find . -iname vesamenu.c32 -exec cp {} ${OUTPUT_DIR} \;
find ./linux/ -iname syslinux -exec cp {} ${OUTPUT_DIR} \;
tree ${OUTPUT_DIR}

tree /mnt/usb/

/mnt/usb/
|-- boot
|   |-- initrd.img-2.6.28.4
|   |-- vmlinuz-2.6.28.4
|   |-- vmlinuz-huge-smp-2.6.21.5-smp
|   `-- vmlinuz-huge-smp-2.6.27.7-smp
|-- install.sh
`-- syslinux
    |-- ldlinux.sys
    |-- menu.c32
    |-- syslinux
    |-- syslinux.cfg
    `-- vesamenu.c32

2 directories, 10 files

/mnt/usb/syslinux/syslinux.cfg

PROMPT 0
TIMEOUT 100
DEFAULT /syslinux/menu.c32
MENU TITLE SysLinux Bootloader

LABEL S120
MENU LABEL Slackware 12.0 
MENU DEFAULT
KERNEL /boot/vmlinuz-huge-smp-2.6.21.5-smp
APPEND ro root=/dev/sda2

LABEL S122
MENU LABEL Slackware 12.2
KERNEL /boot/vmlinuz-huge-smp-2.6.27.7-smp
APPEND ro root=/dev/sda2

LABEL DB50
MENU LABEL Debian 5.0 - kernel 2.6.28.4
KERNEL /boot/vmlinuz-2.6.28.4
APPEND root=/dev/sda2 ro all_generic_ide initrd=/boot/initrd.img-2.6.28.4

install.sh

#!/bin/bash

TARGET=/dev/sdd1
MBR=/dev/sdd
NUM=1

echo; echo
echo "Warning! This installer will setup "syslinux" boot loader on disk $TARGET"
echo "Warning! Master boot record (MBR) of $MBR will be overwritten."
echo
echo "Press Enter to continue, or Ctrl+C to abort..."
read junk
echo

echo "*** Flushing filesystem buffers, this may take a while..."
sync

echo "*** Setting up MBR on $MBR..."
lilo -S /dev/null -M $MBR ext

echo "*** Activating partition $TARGET..."
lilo -S /dev/null -A $MBR $NUM

echo "*** Replacing lilo with syslinux on $MBR..."
cat ./syslinux/mbr.bin > $MBR

echo "*** Setting up boot record for $TARGET..."
./syslinux/syslinux -id syslinux $TARGET

Resources

http://syslinux.zytor.com/
http://www.slax.org/

BY: Pejman Moghadam
TAG: syslinux, boot-loader, usb
DATE: 2012-05-14 09:55:52


Pejman Moghadam / Slackware [ TXT ]