resources: Add scripts that build disk images
The scripts download packer when necessary and build the
corresponding disk image.
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Change-Id: I3bd044a4f7efffed253fdd249873d5c5f6f803b5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5-resources/+/53904
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: Bobby Bruce <bbruce@ucdavis.edu>
diff --git a/src/boot-exit/README.md b/src/boot-exit/README.md
index a5d2160..118b7ac 100644
--- a/src/boot-exit/README.md
+++ b/src/boot-exit/README.md
@@ -20,6 +20,7 @@
|___ gem5/ # gem5 source code (to be cloned here)
|
|___ disk-image/
+ | |___ build.sh # the script downloading packer binary and building the disk image
| |___ shared/ # Auxiliary files needed for disk creation
| |___ boot-exit/
| |___ boot-exit-image/ # Will be created once the disk is generated
@@ -52,14 +53,7 @@
```sh
cd disk-image
-# if packer (tool to build the disk) is not already installed
-wget https://releases.hashicorp.com/packer/1.6.0/packer_1.6.0_linux_amd64.zip
-unzip packer_1.6.0_linux_amd64.zip
-
-# validate the packer script
-./packer validate boot-exit/boot-exit.json
-# build the disk image
-./packer build boot-exit/boot-exit.json
+./build.sh # the script downloading packer binary and building the disk image
```
If you see errors or warnings from `packer validate` you can modify the file `disk-image/boot-exit/boot-exit.json` to update the file.
diff --git a/src/boot-exit/disk-image/build.sh b/src/boot-exit/disk-image/build.sh
new file mode 100755
index 0000000..e5e4978
--- /dev/null
+++ b/src/boot-exit/disk-image/build.sh
@@ -0,0 +1,10 @@
+PACKER_VERSION="1.7.8"
+
+if [ ! -f ./packer ]; then
+ wget https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip;
+ unzip packer_${PACKER_VERSION}_linux_amd64.zip;
+ rm packer_${PACKER_VERSION}_linux_amd64.zip;
+fi
+
+./packer validate boot-exit/boot-exit.json
+./packer build boot-exit/boot-exit.json
diff --git a/src/gapbs/README.md b/src/gapbs/README.md
index 4a5d2d6..b2336c0 100644
--- a/src/gapbs/README.md
+++ b/src/gapbs/README.md
@@ -28,10 +28,7 @@
```sh
cd disk-image/
-wget https://releases.hashicorp.com/packer/1.6.0/packer_1.6.0_linux_amd64.zip # (if packer is not already installed)
-unzip packer_1.6.0_linux_amd64.zip # (if packer is not already installed)
-./packer validate gapbs/gapbs.json
-./packer build gapbs/gapbs.json
+./build.sh # the script downloading packer binary and building the disk image
```
After this process succeeds, the disk image can be found on the `src/gapbs/disk-image/gapbs-image/gapbs`.
diff --git a/src/gapbs/disk-image/build.sh b/src/gapbs/disk-image/build.sh
new file mode 100755
index 0000000..77cb63e
--- /dev/null
+++ b/src/gapbs/disk-image/build.sh
@@ -0,0 +1,10 @@
+PACKER_VERSION="1.7.8"
+
+if [ ! -f ./packer ]; then
+ wget https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip;
+ unzip packer_${PACKER_VERSION}_linux_amd64.zip;
+ rm packer_${PACKER_VERSION}_linux_amd64.zip;
+fi
+
+./packer validate gapbs/gapbs.json
+./packer build gapbs/gapbs.json
diff --git a/src/hack-back/README.md b/src/hack-back/README.md
index 0e8aaed..65ca7fa 100644
--- a/src/hack-back/README.md
+++ b/src/hack-back/README.md
@@ -24,6 +24,7 @@
|___ gem5/ # gem5 source code
|
|___ disk-image/
+ | |___ build.sh # The script downloading packer binary and building the disk image
| |___ shared/ # Auxiliary files needed for disk creation
| |___ hack-back/
| |___ hack-back-image/ # Will be created once the disk is generated
@@ -50,14 +51,7 @@
```sh
cd disk-image
-# if packer is not already installed
-wget https://releases.hashicorp.com/packer/1.6.0/packer_1.6.0_linux_amd64.zip
-unzip packer_1.6.0_linux_amd64.zip
-
-# validate the packer script
-./packer validate hack-back/hack-back.json
-# build the disk image
-./packer build hack-back/hack-back.json
+./build.sh
```
Once this process succeeds, the created disk image can be found on `hack-back/hack-back-image/hack-back`.
diff --git a/src/hack-back/disk-image/build.sh b/src/hack-back/disk-image/build.sh
new file mode 100755
index 0000000..6e6f011
--- /dev/null
+++ b/src/hack-back/disk-image/build.sh
@@ -0,0 +1,10 @@
+PACKER_VERSION="1.7.8"
+
+if [ ! -f ./packer ]; then
+ wget https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip;
+ unzip packer_${PACKER_VERSION}_linux_amd64.zip;
+ rm packer_${PACKER_VERSION}_linux_amd64.zip;
+fi
+
+./packer validate hack-back/hack-back.json
+./packer build hack-back/hack-back.json
diff --git a/src/npb/README.md b/src/npb/README.md
index a4a71c2..278c4c8 100644
--- a/src/npb/README.md
+++ b/src/npb/README.md
@@ -37,6 +37,7 @@
|___ gem5/ # gem5 source code
|
|___ disk-image/
+ | |___ build.sh # The script downloading packer binary and building the disk image
| |___ shared/ # Auxiliary files needed for disk creation
| |___ npb/
| |___ npb-image/ # Will be created once the disk is generated
@@ -70,14 +71,7 @@
```sh
cd disk-image
-# if packer is not already installed
-wget https://releases.hashicorp.com/packer/1.6.0/packer_1.6.0_linux_amd64.zip
-unzip packer_1.6.0_linux_amd64.zip
-
-# validate the packer script
-./packer validate npb/npb.json
-# build the disk image
-./packer build npb/npb.json
+./build.sh # the script downloading packer binary and building the disk image
```
Once this process succeeds, the created disk image can be found on `npb/npb-image/npb`.
diff --git a/src/npb/disk-image/build.sh b/src/npb/disk-image/build.sh
new file mode 100755
index 0000000..4ba51d4
--- /dev/null
+++ b/src/npb/disk-image/build.sh
@@ -0,0 +1,10 @@
+PACKER_VERSION="1.7.8"
+
+if [ ! -f ./packer ]; then
+ wget https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip;
+ unzip packer_${PACKER_VERSION}_linux_amd64.zip;
+ rm packer_${PACKER_VERSION}_linux_amd64.zip;
+fi
+
+./packer validate npb/npb.json
+./packer build npb/npb.json
diff --git a/src/parsec/README.md b/src/parsec/README.md
index 0665fd2..17801f5 100644
--- a/src/parsec/README.md
+++ b/src/parsec/README.md
@@ -20,6 +20,7 @@
|___ gem5/ # gem5 folder
|
|___ disk-image/
+ | |___ build.sh # the script downloading packer binary and building the disk image
| |___ shared/
| |___ parsec/
| |___ parsec-image/
@@ -57,8 +58,7 @@
```sh
cd disk-image
-wget https://releases.hashicorp.com/packer/1.6.0/packer_1.6.0_linux_amd64.zip
-unzip packer_1.6.0_linux_amd64.zip
+./build.sh # the script downloading packer binary and building the disk image
```
In order to build the disk-image first the script needs to be validated. Run the following command to validate `disk-image/parsec/parsec.json`.
diff --git a/src/parsec/disk-image/build.sh b/src/parsec/disk-image/build.sh
new file mode 100755
index 0000000..df8f6a3
--- /dev/null
+++ b/src/parsec/disk-image/build.sh
@@ -0,0 +1,10 @@
+PACKER_VERSION="1.7.8"
+
+if [ ! -f ./packer ]; then
+ wget https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip;
+ unzip packer_${PACKER_VERSION}_linux_amd64.zip;
+ rm packer_${PACKER_VERSION}_linux_amd64.zip;
+fi
+
+./packer validate parsec/parsec.json
+./packer build parsec/parsec.json
diff --git a/src/spec-2006/README.md b/src/spec-2006/README.md
index 30f3fd5..a6ca257 100644
--- a/src/spec-2006/README.md
+++ b/src/spec-2006/README.md
@@ -31,6 +31,7 @@
|___ gem5/ # gem5 folder
|
|___ disk-image/
+ | |___ build.sh # the script downloading packer binary and building the disk image
| |___ shared/
| |___ spec-2006/
| |___ spec-2006-image/
@@ -62,10 +63,7 @@
```sh
cd disk-image
-wget https://releases.hashicorp.com/packer/1.6.0/packer_1.6.0_linux_amd64.zip #(download the packer binary)
-unzip packer_1.6.0_linux_amd64.zip
-./packer validate spec-2006/spec-2006.json #validate the Packer script
-./packer build spec-2006/spec-2006.json
+./build.sh # the script downloading packer binary and building the disk image
```
## gem5 Configuration Scripts
diff --git a/src/spec-2006/disk-image/build.sh b/src/spec-2006/disk-image/build.sh
new file mode 100755
index 0000000..efdc3f6
--- /dev/null
+++ b/src/spec-2006/disk-image/build.sh
@@ -0,0 +1,10 @@
+PACKER_VERSION="1.7.8"
+
+if [ ! -f ./packer ]; then
+ wget https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip;
+ unzip packer_${PACKER_VERSION}_linux_amd64.zip;
+ rm packer_${PACKER_VERSION}_linux_amd64.zip;
+fi
+
+./packer validate spec-2006/spec-2006.json
+./packer build spec-2006/spec-2006.json
diff --git a/src/spec-2017/README.md b/src/spec-2017/README.md
index 4a355c5..604f5fc 100644
--- a/src/spec-2017/README.md
+++ b/src/spec-2017/README.md
@@ -31,6 +31,7 @@
|___ gem5/ # gem5 folder
|
|___ disk-image/
+ | |___ build.sh # the script downloading packer binary and building the disk image
| |___ shared/
| |___ spec-2017/
| |___ spec-2017-image/
@@ -63,10 +64,7 @@
```sh
cd disk-image
-wget https://releases.hashicorp.com/packer/1.6.0/packer_1.6.0_linux_amd64.zip # download the packer binary
-unzip packer_1.6.0_linux_amd64.zip
-./packer validate spec-2017/spec-2017.json # validate the Packer script
-./packer build spec-2017/spec-2017.json
+./build.sh # the script downloading packer binary and building the disk image
```
## gem5 Configuration Scripts
diff --git a/src/spec-2017/disk-image/build.sh b/src/spec-2017/disk-image/build.sh
new file mode 100755
index 0000000..9d35a90
--- /dev/null
+++ b/src/spec-2017/disk-image/build.sh
@@ -0,0 +1,10 @@
+PACKER_VERSION="1.7.8"
+
+if [ ! -f ./packer ]; then
+ wget https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip;
+ unzip packer_${PACKER_VERSION}_linux_amd64.zip;
+ rm packer_${PACKER_VERSION}_linux_amd64.zip;
+fi
+
+./packer validate spec-2017/spec-2017.json
+./packer build spec-2017/spec-2017.json