[4e71a15b] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | #
|
---|
| 4 | # Copyright (c) 2016 Jakub Jermar
|
---|
| 5 | # All rights reserved.
|
---|
| 6 | #
|
---|
| 7 | # Redistribution and use in source and binary forms, with or without
|
---|
| 8 | # modification, are permitted provided that the following conditions
|
---|
| 9 | # are met:
|
---|
| 10 | #
|
---|
| 11 | # - Redistributions of source code must retain the above copyright
|
---|
| 12 | # notice, this list of conditions and the following disclaimer.
|
---|
| 13 | # - Redistributions in binary form must reproduce the above copyright
|
---|
| 14 | # notice, this list of conditions and the following disclaimer in the
|
---|
| 15 | # documentation and/or other materials provided with the distribution.
|
---|
| 16 | # - The name of the author may not be used to endorse or promote products
|
---|
| 17 | # derived from this software without specific prior written permission.
|
---|
| 18 | #
|
---|
| 19 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 20 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 21 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 22 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 23 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 24 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 25 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 26 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 27 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 28 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 29 | #
|
---|
| 30 |
|
---|
| 31 | REPO="http://repo.gem5.org/gem5"
|
---|
| 32 | OPENSPARC_TARBALL="OpenSPARCT1_Arch.1.5.tar.bz2"
|
---|
| 33 | OPENSPARC_URL="http://download.oracle.com/technetwork/systems/opensparc/${OPENSPARC_TARBALL}"
|
---|
| 34 |
|
---|
| 35 | ARCHIVE_PREFIX="./S10image"
|
---|
| 36 | BINARIES="1up-hv.bin 1up-md.bin nvram1 openboot.bin q.bin reset.bin"
|
---|
| 37 | RENAMES="openboot.bin q.bin reset.bin"
|
---|
| 38 |
|
---|
| 39 | echo "==== Cloning gem5 repository ===="
|
---|
| 40 |
|
---|
| 41 | if [ ! -d gem5 ];
|
---|
| 42 | then
|
---|
| 43 | hg clone ${REPO}
|
---|
| 44 | else
|
---|
| 45 | echo "===== Directory gem5 already exists, skipping. ====="
|
---|
| 46 | fi
|
---|
| 47 |
|
---|
| 48 | echo "==== Building gem5.fast (be patient, this may take a while) ===="
|
---|
| 49 |
|
---|
| 50 | if [ ! -e gem5/build/SPARC/gem5.fast ];
|
---|
| 51 | then
|
---|
| 52 | (cd gem5; scons build/SPARC/gem5.fast --ignore-style -j 4)
|
---|
| 53 | else
|
---|
| 54 | echo "===== SPARC emulator binary already exists, skipping. ====="
|
---|
| 55 | fi
|
---|
| 56 |
|
---|
| 57 | echo "==== Building m5term ===="
|
---|
| 58 |
|
---|
| 59 | if [ ! -e gem5/util/term/m5term ];
|
---|
| 60 | then
|
---|
| 61 | (cd gem5/util/term; make)
|
---|
| 62 | else
|
---|
| 63 | echo "===== m5term binary already exists, skipping. ======"
|
---|
| 64 | fi
|
---|
| 65 |
|
---|
| 66 | echo "==== Downloading OpenSPARC archive ===="
|
---|
| 67 |
|
---|
| 68 | if [ ! -f ${OPENSPARC_TARBALL} ]
|
---|
| 69 | then
|
---|
| 70 | wget ${OPENSPARC_URL}
|
---|
| 71 | else
|
---|
| 72 | echo "===== OpenSPARC archive already exists, skipping. ====="
|
---|
| 73 | fi
|
---|
| 74 |
|
---|
| 75 | echo "==== Extracting OpenSPARC binaries ===="
|
---|
| 76 | (
|
---|
| 77 | mkdir -p binaries;
|
---|
| 78 |
|
---|
| 79 | BINLIST=""
|
---|
| 80 | for b in ${BINARIES};
|
---|
| 81 | do
|
---|
| 82 | if [ ! -f binaries/$b ];
|
---|
| 83 | then
|
---|
| 84 | BINLIST+=${ARCHIVE_PREFIX}/$b" "
|
---|
| 85 | else
|
---|
| 86 | echo "===== $b seems to be already extracted, skipping. ====="
|
---|
| 87 | fi
|
---|
| 88 | done
|
---|
| 89 |
|
---|
| 90 | cd binaries
|
---|
| 91 |
|
---|
| 92 | if [ "${BINLIST}x" != "x" ];
|
---|
| 93 | then
|
---|
| 94 | tar --strip-components=2 -xjf ../OpenSPARCT1_Arch.1.5.tar.bz2 ${BINLIST}
|
---|
| 95 | fi
|
---|
| 96 |
|
---|
| 97 | for r in ${RENAMES};
|
---|
| 98 | do
|
---|
| 99 | NNAME=`basename $r .bin`_new.bin
|
---|
| 100 | if [ ! -f ${NNAME} ];
|
---|
| 101 | then
|
---|
| 102 | ln -s $r ${NNAME};
|
---|
| 103 | else
|
---|
| 104 | echo "===== $r seems to be already linked, skipping. ====="
|
---|
| 105 | fi
|
---|
| 106 | done
|
---|
| 107 | )
|
---|
| 108 |
|
---|
| 109 | echo "==== Copying configs ===="
|
---|
| 110 |
|
---|
| 111 | cp -r gem5/configs .
|
---|
| 112 |
|
---|
| 113 | echo "==== Applying patches to the example configuration ===="
|
---|
| 114 |
|
---|
| 115 | patch -p 1 <disk-image.patch
|
---|