This script has been updated 25 September 2007 - if you have a problem with this version, you can try the old page & old script.


Setup

Copy your standard firmware image (for me it is U96CPQ163.bin) into the t20 directory you made when you were patching/building grub - it's 94Meg for the one I use, so it might take a moment to copy! You must use the correct firmware image for your model of T20.

Copy the kernel and initrd from your DSL flash drive into the t20 directory. I did it like this (starting in the t20 directory):

$ mkdir mnt
$ sudo mount /dev/sda1 mnt
Password: *******
$ cp mnt/linux24 mnt/minirt24.gz .
`mnt/linux24' -> `./linux24'
`mnt/minirt24.gz' -> `./minirt24.gz'
$ sudo umount mnt
$ rmdir mnt

Note that your flash drive might not be /dev/sda1 - you'll have to figure this one out yourself.

Get the script

Create a file called build-devosl.sh in the t20 directory containing this:

build-devosl.sh

Loop devices

NOTE: You need to be root for this section.

Check for the loop module

# lsmod | grep '^loop'
loop                   59596  0
  • note that you'll probably have different numbers displayed, and it might say something about not used, all we really care is that it says loop at the beginning of the line.

If nothing is displayed, try this:

# modprobe loop

and then try the above lsmod/grep command again.

Check for some loop devices

# ls /dev/loop*
/dev/loop0  /dev/loop1  /dev/loop2  /dev/loop3  /dev/loop4  /dev/loop5  /dev/loop6  /dev/loop7

You want some loop devices listed here. You may have something slightly different, including possibly a /dev/loop/ directory - I think that if you have /dev/loop/ listed then it's probably OK. If you managed to load the loop module, but still have no loop devices, you may need to use MAKEDEV or mknod - look it up on the web.

Run the script

At this point, you should have these files/directories in the t20 directory:

$ ls
build-devosl.sh  devosl-grub.patch  grub-0.97/  grub-0.97.tar.gz  linux24  minirt24.gz  U96CPQ163.bin
  • Note that your shell may or may not display the / at the end of directory names when you do ls
  • You may or may not have a mnt-DEvoSL directory in there. If you don't already, the script will create it when it needs to.
  • Extra files in the directory shouldn't hurt, but might get overwritten.
  • You need the correct firmware image for your machine, so may have a different file from U96CPQ163.bin

You have to be root to do this; in the t20 directory, do:

# chmod +x build-devosl.sh
# ./build-devosl.sh 
(lots of stuff displayed, hopefully no errors)

You now have a bootable image (bootp.bin) to install in your T20!

Flash the T20 with this, then plug in your DSL USB-flashdrive, reboot the T20, and rejoice!

Notes and possible problems

  • The first part of the script has a bunch of lines defining default locations and names of things - you probably don't need to fiddle with them. Most of these things can be adjusted with command-line arguments - do "./build-devosl.sh -h" to get a usage display.

  • This script has only been tested with the U96CPQ163.BIN firmware which comes in the package called SP22462. I've tried to make the script general-purpose, but it is untested. If you need to use a different standard firmware file from what I used (which you must do if you have a different model from me), you can just specify the name on the commandline when you run the script - it's not necessary to edit the script just for that change. eg.: ./build-devosl.sh -f SomeOtherFirmware

  • Wine works for extracting the firmware bin file from the windows executable it comes in (or you can just use a windows computer).

  • This script has been tested with DSL v3.3 Embedded version, but should work equally well with files from the CD (ISO) version.

  • If you are running Debian and the script complains about not being able to find mkfs.vfat, then you may need to install the dosfstools package.

  • If /dev/loop1 is already being used by something else then you need to modify the script to use another loop device, or use the "-l loopdevice" command-line option.

  • The script doesn't always clean up after itself if it fails, so you might need to use umount and losetup.

  • umount mnt would unmount whatever is mounted on mnt (note the lack of an n in the umount command - it's not unmount)
  • losetup -a tells you what loops are setup. This script uses /dev/loop1 by default.
  • losetup -d /dev/loop1 would detach loop1

  • To become root on Ubuntu, you could do sudo su and it would probably be fine. A more "thorough" way to become root is sudo su -, but that will change directory to root's home, and then you need to find your way back to your t20 directory.

  • Zeroing out the partition is not necessary, but it does make the image file much more compressible - useful if you want to bzip it for email. The standard 94M image bzips to 72M, whilst the DEvoSL image bzips to 2M. The script will need modifying if you want to do zeroing.

  • Normal display from build-devosl.sh is something like this:


    # ./build-devosl.sh
    === Checking tools ==================================================
    Checking 'mount'                                          
    Checking 'umount'                                         
    Checking 'losetup'                                        
    Checking 'dd'
    Checking 'mkfs.vfat'
    Checking 'strings'
    Check that we can use real echo (/bin/echo).
    Check that echo handles octal escapes.
    Check that the chosen loop device exists.
    Check/setup mount directory.
    Check source image exists and is readable.
    Check grub stage1 and stage2 exist and are readable.
    Check kernel and initrd exist and are readable.
    === Start working ===================================================
    Copying standard firmware ' ./U96CPQ163.bin ' to working file './bootp.bin'
    Making image './bootp.bin' accessible by anyone.
    Searching for WinNT Master Boot Record.
    Disk start set to 834236
    Partition start set to 834748
    Checking MBR has expected ID of 0x55 0xAA at end.
    2+0 records in
    2+0 records out
    2 bytes (2 B) copied, 3.8995e-05 seconds, 51.3 kB/s
    MBR 'confirmed' at 834236
    === Tweak partitioning ==============================================
    Setting the partition type as FAT (standard was NTFS).
    1+0 records in
    1+0 records out
    1 byte (1 B) copied, 5.498e-05 seconds, 18.2 kB/s
    === Setup bootloader ================================================
    Setting up loop for partition (start at 834748, length unconstrained).
    Creating FAT filesystem, with large reserved space for grub.
    mkfs.vfat 2.11 (12 Mar 2005)
    Loop device does not match a floppy size, using default hd params
    Installing grub stage1 (part1).
    3+0 records in
    3+0 records out
    3 bytes (3 B) copied, 0.00016075 seconds, 18.7 kB/s
    Installing grub stage1 (part2).
    450+0 records in
    450+0 records out
    450 bytes (450 B) copied, 0.0010693 seconds, 421 kB/s
    Installing grub stage2.
    148+1 records in
    148+1 records out
    76106 bytes (76 kB) copied, 0.00321247 seconds, 23.7 MB/s
    === Copy files ======================================================
    Mounting image.
    Copying kernel.
    Copying initrd.
    === Close up ========================================================
    Unmounting image
    Detaching loop.
    === Tidying =========================================================
    === Finished! =======================================================
    
    Done!  You should now flash the T20 with './bootp.bin'
  • Thanks to Craig (Gizmomelb) for initial testing.

  • If you find any errors, try contacting me - Karl Mowatt-Wilson