You could try this:
That boots to the menu, but does not work for me. Tried FAT32 and FAT16. (For FAT32 use "b" instead of "6" and -F32 instead of -F16"). Maybe it would be more easy to use what is copied on HD with the install tool.
Edit: Added -D flag to sfdisk increase boot compatibility with certain boards.
Edit 2: Don't use awk, use syslinux + lilo instead of grub - should be more portable because grub files are not at the same place in most cases. Instead of lilo you can use install-mbr (usually from the mbr package). I basically worte another variant that only uses lilo, but thats maybe not so ideal when the kernel file is moved.
Edit 3: Create 2 partitions, one is 220 mb for the system, the rest is fat32 and can be used to store data which you can access later, everything you store on first partition can not accessed.
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 ,220,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
Edit: Added -D flag to sfdisk increase boot compatibility with certain boards.
Edit 2: Don't use awk, use syslinux + lilo instead of grub - should be more portable because grub files are not at the same place in most cases. Instead of lilo you can use install-mbr (usually from the mbr package). I basically worte another variant that only uses lilo, but thats maybe not so ideal when the kernel file is moved.
Edit 3: Create 2 partitions, one is 220 mb for the system, the rest is fat32 and can be used to store data which you can access later, everything you store on first partition can not accessed.
Comment