website: Add a template packer script
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Change-Id: Ia1bc51bdb6bd5ef5ee651571046b82b6638ea87d
diff --git a/_pages/documentation/general_docs/fullsystem/disks.md b/_pages/documentation/general_docs/fullsystem/disks.md
index 1d1db0c..253ad0f 100644
--- a/_pages/documentation/general_docs/fullsystem/disks.md
+++ b/_pages/documentation/general_docs/fullsystem/disks.md
@@ -525,7 +525,7 @@
## 4) Using Packer to create a disk image
-This section discusses an automated way of creating gem5-compatible disk images with Ubuntu server installed. We make use of packer to do this which makes use of .json template files to build and configure a disk image. These template files can be configured to build a disk image with specific benchmarks installed.
+This section discusses an automated way of creating gem5-compatible disk images with Ubuntu server installed. We make use of packer to do this which makes use of a .json template file to build and configure a disk image. The template file could be configured to build a disk image with specific benchmarks installed. The mentioned template file can be found [here](/assets/files/packer_template.json).
### Building a Simple Disk Image with Packer
diff --git a/assets/files/packer_template.json b/assets/files/packer_template.json
new file mode 100644
index 0000000..68f89eb
--- /dev/null
+++ b/assets/files/packer_template.json
@@ -0,0 +1,98 @@
+{
+ "builders":
+ [
+ {
+ "type": "qemu",
+ "format": "raw",
+ "accelerator": "kvm",
+ "boot_command":
+ [
+ "{{ user `boot_command_prefix` }}",
+ "debian-installer={{ user `locale` }} auto locale={{ user `locale` }} kbd-chooser/method=us ",
+ "file=/floppy/{{ user `preseed` }} ",
+ "fb=false debconf/frontend=noninteractive ",
+ "hostname={{ user `hostname` }} ",
+ "/install/vmlinuz noapic ",
+ "initrd=/install/initrd.gz ",
+ "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
+ "keyboard-configuration/variant=USA console-setup/ask_detect=false ",
+ "passwd/user-fullname={{ user `ssh_fullname` }} ",
+ "passwd/user-password={{ user `ssh_password` }} ",
+ "passwd/user-password-again={{ user `ssh_password` }} ",
+ "passwd/username={{ user `ssh_username` }} ",
+ "-- <enter>"
+ ],
+ "cpus": "{{ user `vm_cpus`}}",
+ "disk_size": "{{ user `image_size` }}",
+ "floppy_files":
+ [
+ "http/{{ user `preseed` }}"
+ ],
+ "headless": "{{ user `headless` }}",
+ "http_directory": "http",
+ "iso_checksum": "{{ user `iso_checksum` }}",
+ "iso_checksum_type": "{{ user `iso_checksum_type` }}",
+ "iso_urls": [ "{{ user `iso_url` }}" ],
+ "memory": "{{ user `vm_memory`}}",
+ "output_directory": "{{ user `image_name` }}-image",
+ "qemuargs":
+ [
+ [ "-cpu", "host" ],
+ [ "-display", "none" ]
+ ],
+ "qemu_binary":"/usr/bin/qemu-system-x86_64",
+ "shutdown_command": "echo '{{ user `ssh_password` }}'|sudo -S shutdown -P now",
+ "ssh_password": "{{ user `ssh_password` }}",
+ "ssh_username": "{{ user `ssh_username` }}",
+ "ssh_wait_timeout": "60m",
+ "vm_name": "{{ user `image_name` }}"
+ }
+ ],
+ "provisioners":
+ [
+ {
+ "type": "file",
+ "source": "../gem5/util/m5/m5",
+ "destination": "/home/gem5/"
+ },
+ {
+ "type": "file",
+ "source": "scripts/serial-getty@.service",
+ "destination": "/home/gem5/"
+ },
+ {
+ "type": "file",
+ "source": "scripts/runscript.sh",
+ "destination": "/home/gem5/"
+ },
+ {
+ "type": "shell",
+ "execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
+ "scripts":
+ [
+ "scripts/post-installation.sh"
+ ]
+ }
+ ],
+ "variables":
+ {
+ "boot_command_prefix": "<enter><wait><f6><esc><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
+ "desktop": "false",
+ "image_size": "8192",
+ "headless": "true",
+ "iso_checksum": "34416ff83179728d54583bf3f18d42d2",
+ "iso_checksum_type": "md5",
+ "iso_name": "ubuntu-18.04.2-server-amd64.iso",
+ "iso_url": "http://old-releases.ubuntu.com/releases/18.04.2/ubuntu-18.04.2-server-amd64.iso",
+ "locale": "en_US",
+ "preseed" : "preseed.cfg",
+ "hostname": "gem5",
+ "ssh_fullname": "gem5",
+ "ssh_password": "12345",
+ "ssh_username": "gem5",
+ "vm_cpus": "16",
+ "vm_memory": "8192",
+ "image_name": "ubuntu"
+ }
+
+}