View Single Post

   
  #9 (permalink)  
Old 02-20-2008, 09:34 AM
TTK Ciar
 
Posts: n/a
Default Re: usb memory stick boot sector problem

Sorry for coming into this so late .. here's a formula I used
for making a custom knoppix distrib bootable from a usb-dongle for
The Archive's petabox project, and a similar process should also
work for slackware. The use of syslinux and the "special" SPB
custom boot block from 8ung.at were the key I needed. I never
did get lilo to work for it.

Ignore the cautionary note at the end, it's particular to the
hardware we were using for that project.

-- TTK

#!/bin/true
#
# First check out the petabox installation files:
cd /
cvs -d ws20:/var/cvs /petabox/install

# Load the usb mass storage module to map the usb device to /dev/sda:
modprobe usb-storage

# Create a mountpoint for the usb device's filesystem:
mkdir /au

# Wipe any existing partition and bootblock:
dd if=/dev/zero of=/dev/sda bs=1024k count=1

# Now we need to label the partition table as DOS-style formatted.
# For some reason "apt-get install mtools" didn't install "mlabel",
# which is the normal tool of choice for this sort of thing. So we
# will use parted.
parted -s -- /dev/sda mklabel msdos

# Next, partition the device with a single partition of type "b" (Win95 Fat32)
echo '/dev/sda1 : start= 1, size= 1014, Id= b' | sfdisk -uC /dev/sda

# and mark the partition as "bootable"
echo ',,,*' | sfdisk -N1 /dev/sda

# Then create a dos filesystem on the newly created partiton:
mkdosfs /dev/sda1

# Mount the partition:
mount -t vfat /dev/sda1 /au

# Put the Feather Linux files onto the filesystem:
cd /au
unzip /petabox/install/usb-100.zip

# Now unmount the filesystem:
# This might take a *very* long time to complete. Be patient.
# What's happening is that most of the data you just wrote to this filesystem
# is "really" just in linux's filesystem cache. It needs to flush the cache
# to the USB device before it can unmount it.
cd ..
umount /au

# Make the partition bootable with syslinux:
syslinux /dev/sda1

# Install the SPB custom boot block on the USB device to make it bootable:
# You can't use the standard linux bootblock, must use the SPB-linux file.
dd if=/petabox/install/spb2_mbr.sec of=/dev/sda

# (further discussion of this can be found at
# http://rz-obrian.rz.uni-karlsruhe.de/knoppix-usb/ and
# http://www.8ung.at/spblinux/)
#
# At this point the USB device should be bootable on any PC that's capable of
# booting off USB. You will likely need to set the BIOS to prefer booting off
# a device of type "USB HDD" though some bioses may allow or even require
# "USB Zip Drive."
#
# NOTE: AFTER BOOTING FROM USB DEVICE, MACHINE MUST BE "HARD" POWER-CYCLED.
# The plug must be removed from the power supply, and re-entered after a slow
# count of four. Otherwise the USB device is left in a disabled state.
# (This behavior might change if we switch to a different motherboard.)

echo 'done.'

Reply With Quote