From 93a2b3c470cbf1523478e8272816e3a22400775d Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 23 Sep 2013 10:24:10 +0200 Subject: [PATCH] roms: rewrite scripts/refresh-pxe-roms.sh Just use the Makefile in roms/ Signed-off-by: Gerd Hoffmann --- scripts/refresh-pxe-roms.sh | 80 +++---------------------------------- 1 file changed, 6 insertions(+), 74 deletions(-) diff --git a/scripts/refresh-pxe-roms.sh b/scripts/refresh-pxe-roms.sh index 14d586070f..90fc0b374d 100755 --- a/scripts/refresh-pxe-roms.sh +++ b/scripts/refresh-pxe-roms.sh @@ -21,79 +21,11 @@ # Usage: Run from root of qemu tree # ./scripts/refresh-pxe-roms.sh -QEMU_DIR=$PWD -ROM_DIR="pc-bios" -BUILD_DIR="roms/ipxe" -LOCAL_CONFIG="src/config/local/general.h" - -function cleanup () -{ - if [ -n "$SAVED_CONFIG" ]; then - cp "$SAVED_CONFIG" "$BUILD_DIR"/"$LOCAL_CONFIG" - rm "$SAVED_CONFIG" - fi - cd "$QEMU_DIR" -} - -function make_rom () -{ - cd "$BUILD_DIR"/src - - BUILD_LOG=$(mktemp) - - echo Building "$2"... - make bin/"$1".rom > "$BUILD_LOG" 2>&1 - if [ $? -ne 0 ]; then - echo Build failed - tail --lines=100 "$BUILD_LOG" - rm "$BUILD_LOG" - cleanup - exit 1 - fi - rm "$BUILD_LOG" - - cp bin/"$1".rom "$QEMU_DIR"/"$ROM_DIR"/"$2" - - cd "$QEMU_DIR" -} - -if [ ! -d "$QEMU_DIR"/"$ROM_DIR" ]; then - echo "error: can't find $ROM_DIR directory," \ - "run me from the root of the qemu tree" - exit 1 +targets="pxerom" +if test -x "$(which EfiRom 2>/dev/null)"; then + targets="$targets efirom" fi -if [ ! -d "$BUILD_DIR"/src ]; then - echo "error: $BUILD_DIR not populated, try:" - echo " git submodule init $BUILD_DIR" - echo " git submodule update $BUILD_DIR" - exit 1 -fi - -if [ -e "$BUILD_DIR"/"$LOCAL_CONFIG" ]; then - SAVED_CONFIG=$(mktemp) - cp "$BUILD_DIR"/"$LOCAL_CONFIG" "$SAVED_CONFIG" -fi - -echo "#undef BANNER_TIMEOUT" > "$BUILD_DIR"/"$LOCAL_CONFIG" -echo "#define BANNER_TIMEOUT 0" >> "$BUILD_DIR"/"$LOCAL_CONFIG" - -IPXE_VERSION=$(cd "$BUILD_DIR" && git describe --tags) -if [ -z "$IPXE_VERSION" ]; then - echo "error: unable to retrieve git version" - cleanup - exit 1 -fi - -echo "#undef PRODUCT_NAME" >> "$BUILD_DIR"/"$LOCAL_CONFIG" -echo "#define PRODUCT_NAME \"iPXE $IPXE_VERSION\"" >> "$BUILD_DIR"/"$LOCAL_CONFIG" - -make_rom 8086100e pxe-e1000.rom -make_rom 80861209 pxe-eepro100.rom -make_rom 10500940 pxe-ne2k_pci.rom -make_rom 10222000 pxe-pcnet.rom -make_rom 10ec8139 pxe-rtl8139.rom -make_rom 1af41000 pxe-virtio.rom - -echo done -cleanup +cd roms +make -j4 $targets || exit 1 +make clean