Making your own Flash Key

Before you do anything else, you need to prepare the key. It is critical to the remainder of the installation process that you get this bit right and we’ve deliberately not automated this part of the installation for the moment, partly for this reason.

Getting set up

Identifying the key

find /proc/scsi/usb-storage -type f -exec cat {} \;

# Example output;

   Host scsi2: usb-storage
       Vendor: M-Systems
      Product: DiskOnKey
Serial Number: 0317A10D2A001B86
     Protocol: Transparent SCSI
    Transport: Bulk
       Quirks:
#
# you could also do;
# find /proc/scsi/usb-storage -ls
# then;
# cat /proc/scsi/usb-storage/<file>
#
cd `find /sys/bus/usb/drivers/usb-storage/*/host?/*:* -maxdepth 0`
ls

# Example output;
... block -> ../../../../../../../../block/sdb
... delete
... detach_state
... device_blocked
... generic -> ../../../../../../../../class/scsi_generic/sg1
... max_sectors
... model
... power
... queue_depth
... rescan
... rev
... scsi_level
... state
... timeout
... type
... vendor

# Now try;

cat model type vendor

# Example output;

DiskOnKey
0
M-Sys

# Alternatively, unplug and plug the key and type;
dmesg

Erasing the key

# BE WARNED: THIS WILL ERASE THE CONTENTS OF YOUR KEY
dd if=/dev/zero of=/dev/device name bs=1k count=100

# using the above example, this would be;
dd if=/dev/zero of=/dev/sdb bs=1k count=100

# now you need to rewrite a "sane" partition table
sfdisk -H9 -S56 /dev/device name
<press return until it asks if you want to save, then press 'y'>

# don't forget to use the right device name!
#
# Please note the choices of "fdisk" and "sfdisk", they are important
#
# now you need to create some approptiate partitions
# Flash Linux needs a boot partition of ~ 4M
# and a root partition of at least 150M
# So; (for example)
fdisk /dev/device name
d (delete partition created by sfdisk)
n (new partition)
p (primary)
1 (use partition #1)
<return> (start at first block)
+4M (make it 4Mb in size)
n (new partition)
p (primary)
2 (use second partition)
<return> (start on next free block)
<return> (use rest of key)
a (mark a partition as active)
1 (choose the boot partition)
w (write changes)
q (quit)
#
# Note: they key will not boot if you for get to do the 'a' operation.
#

 Installing FlashLinux

chmod 755 /root/flash_key.sh
/root/flash_key.sh

Gareth's Blog