diff --git a/tools/build_usb_boot.sh b/tools/build_usb_boot.sh new file mode 100755 index 0000000..ac49848 --- /dev/null +++ b/tools/build_usb_boot.sh @@ -0,0 +1,103 @@ +#!/bin/bash -e +# build_usb_boot.sh - Create a syslinux boot environment +# +# build_usb_boot.sh [-k kernel-version] destdev +# +# Assumes syslinux is installed +# Needs to run as root + +KVER=`uname -r` +if [ "$1" = "-k" ]; then + KVER=$2 + shift;shift +fi + +DEST_DIR=${1:-/tmp/syslinux-boot} +PXEDIR=${PXEDIR:-/var/cache/devstack/pxe} +OPWD=`pwd` +PROGDIR=`dirname $0` + +if [ -b $DEST_DIR ]; then + # We have a block device, install syslinux and mount it + DEST_DEV=$DEST_DIR + DEST_DIR=`mktemp -d mntXXXXXX` + + # Install syslinux on the device + syslinux --install --directory syslinux $DEST_DEV + + mount $DEST_DEV $DEST_DIR +else + # We have a directory (for sanity checking output) + DEST_DEV="" + if [ ! -d $DEST_DIR/syslinux ]; then + mkdir -p $DEST_DIR/syslinux + fi +fi + +# Get some more stuff from syslinux +for i in memdisk menu.c32; do + cp -p /usr/lib/syslinux/$i $DEST_DIR/syslinux +done + +CFG=$DEST_DIR/syslinux/syslinux.cfg +cat >$CFG <>$CFG <>$CFG <>$CFG <