Build devstack images

This commit is contained in:
Dean Troyer 2011-09-29 16:15:23 -05:00
parent c966698e0c
commit c945bf8dbf

View file

@ -1,9 +1,10 @@
#!/bin/bash #!/bin/bash
# build_pxe_boot.sh - Create a PXE boot environment # 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 syslinux is installed
# Assumes devstack files are in `pwd`/pxe
# Only needs to run as root if the destdir permissions require it # 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 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_BIN=memtest86+-${MEMTEST_VER}.bin
MEMTEST_URL=http://www.memtest.org/download/${MEMTEST_VER}/ 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 DEST_DIR=${1:-/tmp}/tftpboot
OPWD=`pwd` OPWD=`pwd`
PROGDIR=`dirname $0`
mkdir -p $DEST_DIR/pxelinux.cfg mkdir -p $DEST_DIR/pxelinux.cfg
cd $DEST_DIR cd $DEST_DIR
@ -31,17 +39,42 @@ MENU TITLE PXE Boot Menu
EOF EOF
# Get Ubuntu netboot # Setup devstack boot
mkdir -p $DEST_DIR/ubuntu mkdir -p $DEST_DIR/ubuntu
cd $DEST_DIR/ubuntu if [ ! -d $OPWD/pxe ]; then
wget -N --quiet $UBUNTU_MIRROR/linux mkdir -p $OPWD/pxe
wget -N --quiet $UBUNTU_MIRROR/initrd.gz 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 <<EOF
LABEL devstack
MENU LABEL ^devstack
MENU DEFAULT
KERNEL ubuntu/vmlinuz-$KVER-generic
APPEND initrd=ubuntu/stack-initrd.gz ramdisk_size=2109600 root=/dev/ram0
EOF
# Get Ubuntu
if [ -d $OPWD/pxe ]; then
cp -p $OPWD/pxe/natty-min-initrd.gz $DEST_DIR/ubuntu
fi
cat >>$DEFAULT <<EOF cat >>$DEFAULT <<EOF
LABEL ubuntu LABEL ubuntu
MENU LABEL Ubuntu Natty MENU LABEL ^Ubuntu Natty
KERNEL ubuntu/linux KERNEL ubuntu/vmlinuz-$KVER-generic
APPEND initrd=ubuntu/initrd.gz APPEND initrd=ubuntu/natty-base-initrd.gz ramdisk_size=419600 root=/dev/ram0
EOF EOF
# Get Memtest # Get Memtest
@ -53,7 +86,7 @@ fi
cat >>$DEFAULT <<EOF cat >>$DEFAULT <<EOF
LABEL memtest LABEL memtest
MENU LABEL Memtest86+ MENU LABEL ^Memtest86+
KERNEL $MEMTEST_BIN KERNEL $MEMTEST_BIN
EOF EOF
@ -74,7 +107,7 @@ EOF
cat >>$DEFAULT <<EOF cat >>$DEFAULT <<EOF
LABEL local LABEL local
MENU LABEL Local disk MENU LABEL ^Local disk
MENU DEFAULT MENU DEFAULT
LOCALBOOT 0 LOCALBOOT 0
EOF EOF