Annotation of qemu/scripts/refresh-pxe-roms.sh, revision 1.1.1.1

1.1       root        1: #!/bin/bash
                      2: 
                      3: # PXE ROM build script
                      4: #
                      5: # This program is free software; you can redistribute it and/or modify
                      6: # it under the terms of the GNU General Public License as published by
                      7: # the Free Software Foundation; either version 2 of the License, or
                      8: # (at your option) any later version.
                      9: #
                     10: # This program is distributed in the hope that it will be useful,
                     11: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     12: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
                     13: # GNU General Public License for more details.
                     14: #
                     15: # You should have received a copy of the GNU General Public License
                     16: # along with this program; if not, see <http://www.gnu.org/licenses/>.
                     17: #
                     18: # Copyright (C) 2011 Red Hat, Inc.
                     19: #   Authors: Alex Williamson <[email protected]>
                     20: #
                     21: # Usage: Run from root of qemu tree
                     22: # ./scripts/refresh-pxe-roms.sh
                     23: 
                     24: QEMU_DIR=$PWD
                     25: ROM_DIR="pc-bios"
                     26: BUILD_DIR="roms/ipxe"
                     27: LOCAL_CONFIG="src/config/local/general.h"
                     28: 
                     29: function cleanup ()
                     30: {
                     31:     if [ -n "$SAVED_CONFIG" ]; then
                     32:         cp "$SAVED_CONFIG" "$BUILD_DIR"/"$LOCAL_CONFIG"
                     33:         rm "$SAVED_CONFIG"
                     34:     fi
                     35:     cd "$QEMU_DIR"
                     36: }
                     37: 
                     38: function make_rom ()
                     39: {
                     40:     cd "$BUILD_DIR"/src
                     41: 
                     42:     BUILD_LOG=$(mktemp)
                     43: 
                     44:     echo Building "$2"...
                     45:     make bin/"$1".rom > "$BUILD_LOG" 2>&1
                     46:     if [ $? -ne 0 ]; then
                     47:         echo Build failed
                     48:         tail --lines=100 "$BUILD_LOG"
                     49:         rm "$BUILD_LOG"
                     50:         cleanup
                     51:         exit 1
                     52:     fi
                     53:     rm "$BUILD_LOG"
                     54: 
                     55:     cp bin/"$1".rom "$QEMU_DIR"/"$ROM_DIR"/"$2"
                     56: 
                     57:     cd "$QEMU_DIR"
                     58: }
                     59: 
                     60: if [ ! -d "$QEMU_DIR"/"$ROM_DIR" ]; then
                     61:     echo "error: can't find $ROM_DIR directory," \
                     62:          "run me from the root of the qemu tree"
                     63:     exit 1
                     64: fi
                     65: 
                     66: if [ ! -d "$BUILD_DIR"/src ]; then
                     67:     echo "error: $BUILD_DIR not populated, try:"
                     68:     echo "  git submodule init $BUILD_DIR"
                     69:     echo "  git submodule update $BUILD_DIR"
                     70:     exit 1
                     71: fi
                     72: 
                     73: if [ -e "$BUILD_DIR"/"$LOCAL_CONFIG" ]; then
                     74:     SAVED_CONFIG=$(mktemp)
                     75:     cp "$BUILD_DIR"/"$LOCAL_CONFIG" "$SAVED_CONFIG"
                     76: fi
                     77: 
                     78: echo "#undef BANNER_TIMEOUT" > "$BUILD_DIR"/"$LOCAL_CONFIG"
                     79: echo "#define BANNER_TIMEOUT 0" >> "$BUILD_DIR"/"$LOCAL_CONFIG"
                     80: 
                     81: IPXE_VERSION=$(cd "$BUILD_DIR" && git describe --tags)
                     82: if [ -z "$IPXE_VERSION" ]; then
                     83:     echo "error: unable to retrieve git version"
                     84:     cleanup
                     85:     exit 1
                     86: fi
                     87: 
                     88: echo "#undef PRODUCT_NAME" >> "$BUILD_DIR"/"$LOCAL_CONFIG"
                     89: echo "#define PRODUCT_NAME \"iPXE $IPXE_VERSION\"" >> "$BUILD_DIR"/"$LOCAL_CONFIG"
                     90: 
                     91: make_rom 8086100e pxe-e1000.rom
                     92: make_rom 80861209 pxe-eepro100.rom
                     93: make_rom 10500940 pxe-ne2k_pci.rom
                     94: make_rom 10222000 pxe-pcnet.rom
                     95: make_rom 10ec8139 pxe-rtl8139.rom
                     96: make_rom 1af41000 pxe-virtio.rom
                     97: 
                     98: echo done
                     99: cleanup

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.