source: mainline/contrib/gem5/build-from-scratch.sh@ d776329b

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since d776329b was 741b2fb1, checked in by Jakub Jermar <jakub@…>, 9 years ago

gem5: A better way to make the —disk-image option take effect

  • Property mode set to 100755
File size: 3.2 KB
Line 
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
31REPO="http://repo.gem5.org/gem5"
32OPENSPARC_TARBALL="OpenSPARCT1_Arch.1.5.tar.bz2"
33OPENSPARC_URL="http://download.oracle.com/technetwork/systems/opensparc/${OPENSPARC_TARBALL}"
34
35ARCHIVE_PREFIX="./S10image"
36BINARIES="1up-hv.bin 1up-md.bin nvram1 openboot.bin q.bin reset.bin"
37RENAMES="openboot.bin q.bin reset.bin"
38
39echo "==== Cloning gem5 repository ===="
40
41if [ ! -d gem5 ];
42then
43 hg clone ${REPO}
44else
45 echo "===== Directory gem5 already exists, skipping. ====="
46fi
47
48echo "==== Building gem5.fast (be patient, this may take a while) ===="
49
50if [ ! -e gem5/build/SPARC/gem5.fast ];
51then
52 (cd gem5; scons build/SPARC/gem5.fast --ignore-style -j 4)
53else
54 echo "===== SPARC emulator binary already exists, skipping. ====="
55fi
56
57echo "==== Building m5term ===="
58
59if [ ! -e gem5/util/term/m5term ];
60then
61 (cd gem5/util/term; make)
62else
63 echo "===== m5term binary already exists, skipping. ======"
64fi
65
66echo "==== Downloading OpenSPARC archive ===="
67
68if [ ! -f ${OPENSPARC_TARBALL} ]
69then
70 wget ${OPENSPARC_URL}
71else
72 echo "===== OpenSPARC archive already exists, skipping. ====="
73fi
74
75echo "==== 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
109echo "==== Copying configs ===="
110
111cp -r gem5/configs .
112
113echo "==== Applying patches to the example configuration ===="
114
115patch -p 1 <disk-image.patch
Note: See TracBrowser for help on using the repository browser.