Dealing with SYSLINUX


Syslinux is simple and works great, but I wasted a lot of time today with a setup that refused to boot. Apparently if you install syslinux on a bootable partition, that just isn’t enough for the PC to boot.

By any means necessary find the mbr.bin file that came with your version of syslinux and cat it to the disk device (not the partition of course). For me “any means” meant a simple apt-get source syslinux. install-mbr simply did not work despite what debian’s guide said.

Most of what I know was given to me by rolling a custom debian installer. Of course I read all the way through their guide except the very bottom where there was a user contributed note expressing what I just explained. But I wanted to drop that note here just for the sake of polluting the Internet.

Here’s an example of what I’m working with for this project.

Files:

development:~/usb-disk# find .
.
./mbr.bin
./mkinstalldisk.sh
./boot-contents
./boot-contents/boot.txt
./boot-contents/initrd.gz
./boot-contents/vmlinuz
./boot-contents/initrd-autodisk.gz
./boot-contents/syslinux.cfg

And the script “mkinstalldisk.sh” … note that this is very crude…

#!/bin/bash
if whiptail --yesno "This is a dangerous tool... do you want to quit?" 8 40
then
    exit 1
fi

if whiptail --yesno "Are you SURE you want to wipe all data on disk $1 ???" 8 40
then

    # Destroy whatever's going on with this disk
    dd if=/dev/zero of=$1 bs=512 count=1

    # Add a FAT32 partition for the size of the disk
    echo -e "n\np\n1\n\n\nt\nc\na\n1\nw" | fdisk $1

    # Format....
    mkdosfs $11

    # Install SYSLINUX on this bootable partition
    syslinux $11

    # Install a valid MBR on the disk itself
    cat mbr.bin  > /dev/sdb


    # Add the boot environment

    mntdir=/mnt/target-`date +%s`/
    mkdir $mntdir
    mount $11 $mntdir
    cp `dirname $0`/boot-contents/* $mntdir
    umount $mntdir
    rmdir $mntdir

fi

Advertisements

About andyortlieb

I've been a tinkerer and a lazy ideologist since I gained my first personal computer in 1989. I have an aversion to formal education and I prefer to learn things by experimentation. That is not a brag, it has not been a particularly helpful set of traits. My primary goals are to increase my safety, pleasure and usefulness as I work to build and modify technologies that will bring those same attributes to the masses irrespective of government. This is the documentation of my attempt at that journey.
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Dealing with SYSLINUX

  1. andyortlieb says:

    Correction, mbr.bin is in debian

    root@mke-vz:~# dpkg -L syslinux-common | grep mbr
    /usr/lib/syslinux/gptmbr.bin
    /usr/lib/syslinux/gptmbr_c.bin
    /usr/lib/syslinux/gptmbr_f.bin
    /usr/lib/syslinux/altmbr_f.bin
    /usr/lib/syslinux/mbr_c.bin
    /usr/lib/syslinux/mbr_f.bin
    /usr/lib/syslinux/com32/include/gplinclude/disk/mbrs.h
    /usr/lib/syslinux/altmbr_c.bin
    /usr/lib/syslinux/altmbr.bin
    /usr/lib/syslinux/mbr.bin

    However, since it’s not the exact same file, and the one from the original source works well, I’m not going to change my processes.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s