qxl: reset update_surface
[qemu/ar7.git] / scripts / refresh-pxe-roms.sh
blob14d586070f552e41c29ad5d8f4d153a180907631
1 #!/bin/bash
3 # PXE ROM build script
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.
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.
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/>.
18 # Copyright (C) 2011 Red Hat, Inc.
19 # Authors: Alex Williamson <alex.williamson@redhat.com>
21 # Usage: Run from root of qemu tree
22 # ./scripts/refresh-pxe-roms.sh
24 QEMU_DIR=$PWD
25 ROM_DIR="pc-bios"
26 BUILD_DIR="roms/ipxe"
27 LOCAL_CONFIG="src/config/local/general.h"
29 function cleanup ()
31 if [ -n "$SAVED_CONFIG" ]; then
32 cp "$SAVED_CONFIG" "$BUILD_DIR"/"$LOCAL_CONFIG"
33 rm "$SAVED_CONFIG"
35 cd "$QEMU_DIR"
38 function make_rom ()
40 cd "$BUILD_DIR"/src
42 BUILD_LOG=$(mktemp)
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
53 rm "$BUILD_LOG"
55 cp bin/"$1".rom "$QEMU_DIR"/"$ROM_DIR"/"$2"
57 cd "$QEMU_DIR"
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
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
73 if [ -e "$BUILD_DIR"/"$LOCAL_CONFIG" ]; then
74 SAVED_CONFIG=$(mktemp)
75 cp "$BUILD_DIR"/"$LOCAL_CONFIG" "$SAVED_CONFIG"
78 echo "#undef BANNER_TIMEOUT" > "$BUILD_DIR"/"$LOCAL_CONFIG"
79 echo "#define BANNER_TIMEOUT 0" >> "$BUILD_DIR"/"$LOCAL_CONFIG"
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
88 echo "#undef PRODUCT_NAME" >> "$BUILD_DIR"/"$LOCAL_CONFIG"
89 echo "#define PRODUCT_NAME \"iPXE $IPXE_VERSION\"" >> "$BUILD_DIR"/"$LOCAL_CONFIG"
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
98 echo done
99 cleanup