Syslinux from Linux



Recently I was locked out of a customer-provided laptop with their development environment, and access to their source code repository via vpn. I suspect their domain controller propagated an update last time I was on the vpn which has locked me out.

They're overseas and about 12 hours flight time away, so with their permission I used ntpasswd to reset the Administrator password. The boot CD (downloadable as an iso) uses syslinux, which is fine, except that instead of wasting CD-Rs I like to use USB keys.

I copied the contents to a blank FAT32-formatted usb key, but it has no boot sector yet. I installed grub and tried to make a grub menu file from the syslinux.cfg with these tips for converting a syslinux .cfg file to a grub .conf file. I failed because the syslinux.cfg has the line:
append rw vga=1 initrd=initrd.cgz,scsi.cgz

And I don't know how to append the two cgz's into one grub initrd line. Normally grub uses an initrd like this:
initrd /initrd.cgz

So I decided to install syslinux from linux. The man page makes it look easy:
syslinux [-sfr] [-d directory] [-o offset] device
When I ran "syslinux /dev/sdd1" and booted the laptop with this usb key, it just gave me a blank cursor blink. This is because the laptop is looking in the MBR of the usb key and finding nothing. The syslinux man page shows some hints:
Booting from a FAT partition on a hard disk
SYSLINUX can boot from a FAT filesystem partition on a hard disk
(including FAT32). The installation procedure is identical to the pro-
cedure for installing it on a floppy, and should work under either DOS
or Linux. To boot from a partition, SYSLINUX needs to be launched from
a Master Boot Record or another boot loader, just like DOS itself
would. A sample master boot sector (mbr.bin) is included with SYSLINUX.
Well, that's nice to know, but how do I put that on my usb key? Follow these steps:

1. Start with a FAT32 formatted usb key (it can have other data on it) and some syslinux-based boot image. I'm using the latest ntpasswd iso cd080802. Unpack the contents to the root of the usb key.

2. Copy a boot sector to the code image of the MBR of your to-be-booted usb key:
dd if=/usr/share/syslinux/mbr.bin of=/dev/sdd bs=440 count=1
/dev/sdd is my usb key
 Look at Wikipedia for an explanation of the MBR layout
your mbr.bin might be in a different location. It should come installed with syslinux 

3. Run syslinux to make the partition bootable:
sudo syslinux /dev/sdd1

4. Mark the partition as bootable (may not be necessary)
fdisk /dev/sdd
Select a, 1, w to make the first partition bootable. CHECK THESE OPTIONS FIRST!

5. Insert USB key to your PC / laptop and boot (so long as your BIOS is setup and capable!)


source: http://nthrbldyblg.blogspot.com/2010/02/syslinux-from-linux.html

Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

0 comments:

Post a Comment

Popular Posts