Results 1 to 10 of 122

Thread: Splashtop on USB stick

Threaded View

  1. #1
    Join Date
    Aug 2007
    Posts
    6,607

    Default Splashtop on USB stick

    Here you find some scripts, the first is to create an USB stick which can be booted on several motherboards - vendor independ to check out the system. The second script can be seen as an optional way to create a hd image which can be used together with VirtualBox to start the system. VirtualBox has to be configured to automatically enable the USB stick - best using the USB filter setting as the apps are loaded via USB. I use the kernel which is stored on the interal SSD therefore you need to emulate it. In order to store additional data on the stick, two partitions are made. If you try it on real hardware and you can not boot from USB, just put the ce_bz kernel from the stick onto your hd and boot it with your standard bootloader. When you are able to start it but you don't have got LAN working, the cheapest solution is to add a Realtek 1 GBit ethernet adapter - this is supported. You might experince problems with front usb connectors - in that case try the ones directly onboard - even there try all ports if needed.

    a) Create USB stick

    Change DEVICE to match your stick. Also set IMAGE to the image you want to use.

    Required tools which are not always preinstalled are: lilo (or mbr with a simple change), syslinux

    Code:
    #!/bin/sh
    DEVICE="/dev/USBSTICK"
    IMAGE="FILE.IMG"
    offset=$(($(sfdisk -d $IMAGE|grep start=|head -n1|sed 's/.*start=\s*//;s/,.*//')*512))
    OPTIONS="umask=000,shortname=mixed,quiet,utf8"
    DIR=/tmp/target
    INPUT=/tmp/input
    umount ${DEVICE}1 $INPUT
    mkdir -p $DIR $INPUT
    mount -o loop,offset=$offset,$OPIONS $IMAGE $INPUT
    dd if=/dev/zero of=$DEVICE count=1
    sfdisk -D -uM $DEVICE <<EOT
    ,240,6,*
    ,,b
    EOT
    #install-mbr -p D ${DEVICE}
    lilo -s /dev/null -M ${DEVICE}
    mkdosfs -F16 -nDVMUSB ${DEVICE}1
    mkdosfs -F32 -nDATA ${DEVICE}2
    syslinux -s ${DEVICE}1
    mount -o $OPTIONS ${DEVICE}1 $DIR
    cat > $DIR/syslinux.cfg <<EOT
    default /ce_bz
    EOT
    cp -av $INPUT/* $DIR/
    umount ${DEVICE}1 $INPUT
    sync
    b) Inject GRUB into image - bootable!

    Set IMAGE to the image you want to use. Also check the postition of the grub stage1/2 files. Example for 32 bit Debian/Ubuntu.

    Code:
    #!/bin/sh
    IMAGE="FILE.IMG"
    offset=$(($(sfdisk -d $IMAGE|awk '/start=/{print $4}'|head -n1|sed 's/,//')*512))
    uuid=$(dd if=$IMAGE skip=$((0x27+$offset)) bs=1 count=4 2>/dev/null|hexdump -e '"%X"'|sed 's/\(....\)/\1-/')
    LOOP="/dev/loop0"
    OPTIONS="umask=000,shortname=mixed,quiet,utf8"
    DIR=/tmp/target
    mkdir -p $DIR
    losetup -d $LOOP
    losetup $LOOP $IMAGE
    umount $DIR
    mount -o loop,offset=$offset,$OPIONS $IMAGE $DIR
    mkdir -p $DIR/boot/grub
    cat > $DIR/boot/grub/menu.lst <<EOT
    timeout 0
    title Test
    kernel /ce_bz
    EOT
    cp -v /usr/lib/grub/i386-pc/stage1 $DIR/boot/grub
    cp -v /usr/lib/grub/i386-pc/stage2 $DIR/boot/grub
    grub --device-map=/dev/null --batch <<EOT
    device (hd0) $LOOP
    root (hd0,0)
    setup --stage2=$DIR/boot/grub/stage2 (hd0)
    EOT
    cat > $DIR/splash.idx <<EOT
    root=UUID=$uuid
    EOT
    umount $DIR
    losetup -d $LOOP
    c) Try image with qemu

    Code:
    qemu -m 256 -hda FILE.IMG
    d) Convert image to VMware harddisk image

    Requires qemu.

    Code:
    qemu-img convert FILE.IMG -O vmdk test.vmdk
    e) Install onto FAT32 partition (without grub-install ntfs would work too).

    Requires grub.

    Code:
    #!/bin/sh
    PARTITION="/dev/partition"
    IMAGE="FILE.IMG"
    offset=$(($(sfdisk -d $IMAGE|grep start=|head -n1|sed 's/.*start=\s*//;s/,.*//')*512))
    OPTIONS="umask=000,shortname=mixed,quiet,utf8"
    DIR=/tmp/target
    INPUT=/tmp/input
    umount $PARTITION $INPUT
    mkdir -p $DIR $INPUT
    mount -o loop,offset=$offset,$OPIONS $IMAGE $INPUT
    mount $PARTITION $DIR
    mkdir -p $DIR/boot/grub
    cat > $DIR/boot/grub/menu.lst <<EOT
    timeout 0
    title Test
    kernel /TEST.IT/ce_bz
    EOT
    grub-install --recheck --no-floppy --root-directory=$DIR $PARTITION
    grub-install --recheck --no-floppy --root-directory=$DIR $PARTITION
    mkdir -p $DIR/TEST.IT
    cp -av $INPUT/* $DIR/TEST.IT/
    cat > $DIR/splash.idx <<EOT
    root=UUID=$(/lib/udev/vol_id -u $PARTITION)
    /TEST.IT
    /TEST.IT
    EOT
    umount $PARTITION $INPUT
    sync
    PS: The used IMAGE is really easy to find when you look for updates of boards with Splashtop support like P5Q.

    Edit: I looked a bit at the Win installer (which you can use of course too, just boot ce_bz with any bootloader you want to use, like grub4dos) and found that there was a file called splash.idx in the root of the partition. Then it was fully clear to me what to do - the file needs to be there when you don't want to start it via USB (emulates the SSD). The structure is easy:

    Code:
    root=UUID=$uuid
    /DIR.SYSTEM
    /DIR.USERDATA
    where $uuid is similar to /dev/disk/by-uuid/$uuid. the lines 2 and 3 are optional and point to the files where it is installed, the userdata dir has to contain the files matching user*. With that info you could have multiply installs on one partition - just set the dir names to the ones you want to use and even share the userdata between em. So - I think thats all. If needed I could add some hints for Grub4Dos.

    Edit 2: Use 240 mb instead of 220 mb in order to add more custom addons. You can use even more if want to add extra apps.

    Extra hint: If you want to modify existing packages you can get rid of the error message that the install was corrupted using:

    Code:
    dd of=version bs=1 seek=32 count=0
    in the same dir with the sqx packages. You do not need that if you only add more packages.
    Last edited by Kano; 08-19-2008 at 07:45 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •