From c945bf8dbf013ca947232311e5255b8fc21f2981 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Thu, 29 Sep 2011 16:15:23 -0500 Subject: [PATCH] Build devstack images --- build_pxe_boot.sh | 53 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/build_pxe_boot.sh b/build_pxe_boot.sh index 16fa02c..c5ef276 100755 --- a/build_pxe_boot.sh +++ b/build_pxe_boot.sh @@ -1,9 +1,10 @@ #!/bin/bash # build_pxe_boot.sh - Create a PXE boot environment # -# build_pxe_boot.sh destdir +# build_pxe_boot.sh [-k kernel-version] destdir # # Assumes syslinux is installed +# Assumes devstack files are in `pwd`/pxe # Only needs to run as root if the destdir permissions require it UBUNTU_MIRROR=http://archive.ubuntu.com/ubuntu/dists/natty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64 @@ -12,8 +13,15 @@ MEMTEST_VER=4.10 MEMTEST_BIN=memtest86+-${MEMTEST_VER}.bin MEMTEST_URL=http://www.memtest.org/download/${MEMTEST_VER}/ +KVER=`uname -r` +if [ "$1" = "-k" ]; then + KVER=$2 + shift;shift +fi + DEST_DIR=${1:-/tmp}/tftpboot OPWD=`pwd` +PROGDIR=`dirname $0` mkdir -p $DEST_DIR/pxelinux.cfg cd $DEST_DIR @@ -31,17 +39,42 @@ MENU TITLE PXE Boot Menu EOF -# Get Ubuntu netboot +# Setup devstack boot mkdir -p $DEST_DIR/ubuntu -cd $DEST_DIR/ubuntu -wget -N --quiet $UBUNTU_MIRROR/linux -wget -N --quiet $UBUNTU_MIRROR/initrd.gz +if [ ! -d $OPWD/pxe ]; then + mkdir -p $OPWD/pxe +fi +if [ ! -r $OPWD/pxe/vmlinuz-${KVER}-generic ]; then + if [ ! -r /boot/vmlinuz-${KVER}-generic ]; then + echo "No kernel found" + else + cp -p /boot/vmlinuz-${KVER}-generic $OPWD/pxe + fi +fi +cp -p $OPWD/pxe/vmlinuz-${KVER}-generic $DEST_DIR/ubuntu +if [ ! -r $OPWD/pxe/stack-initrd.gz ]; then + $PROGDIR/build_pxe_ramdisk.sh $OPWD/pxe/stack-initrd.gz +fi +cp -p $OPWD/pxe/stack-initrd.gz $DEST_DIR/ubuntu +cat >>$DEFAULT <>$DEFAULT <>$DEFAULT <>$DEFAULT <