Commit 4998b831 authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

images: further split images into just ubuntu & base image

parent 22effe94
......@@ -15,9 +15,7 @@ images/mqnic/modules.order
images/mqnic/mqnic.mod*
images/vmlinux
images/bzImage
images/output-ubuntu1804-base
images/output-nopaxos
images/output-mtcp
images/output-*
images/packer
images/packer_cache
images/kheaders.tar.bz2
......
PACKER_VERSION := 1.6.0
KERNEL_VERSION := 5.4.46
BASE_IMAGE := output-ubuntu1804-base/ubuntu1804-base
UBUNTU_IMAGE := output-ubuntu1804/ubuntu1804
BASE_IMAGE := output-base/base
NOPAXOS_IMAGE := output-nopaxos/nopaxos
MTCP_IMAGE := output-mtcp/mtcp
IMAGES := $(BASE_IMAGE) $(NOPAXOS_IMAGE) $(MTCP_IMAGE)
......@@ -10,9 +11,10 @@ RAW_IMAGES := $(addsuffix .raw,$(IMAGES))
all: $(IMAGES) $(RAW_IMAGES) vmlinux bzImage mqnic/mqnic.ko
clean:
rm -rf packer packer_cache output-ubuntu1804 vmlinux bzImage \
rm -rf packer packer_cache vmlinux bzImage \
mqnic/mqnic.ko mqnic/*.o mqnic/.*.cmd mqnic/mqnic.mod.c \
mqnic/Module.symvers mqnic/modules.order \
output-ubuntu1804 output-base output-mtcp output-nopaxos \
kernel/linux-$(KERNEL_VERSION)/ kheaders.tar.bz2
################################################
......@@ -21,9 +23,14 @@ clean:
%.raw: %
qemu-img convert -f qcow2 -O raw $< $@
$(BASE_IMAGE): $(wildcard scripts/*) packer ubuntu1804-base.json bzImage kheaders.tar.bz2
rm -rf output-ubuntu1804-base
./packer build ubuntu1804-base.json
$(UBUNTU_IMAGE): $(wildcard scripts/*) packer ubuntu1804.json
rm -rf output-ubuntu1804
./packer build ubuntu1804.json
touch $@
$(BASE_IMAGE): $(wildcard scripts/*) packer base.json $(UBUNTU_IMAGE) bzImage kheaders.tar.bz2
rm -rf output-base
./packer build base.json
touch $@
$(NOPAXOS_IMAGE): $(wildcard scripts/*) packer nopaxos.json $(BASE_IMAGE) scripts/install-nopaxos.sh
......@@ -89,6 +96,7 @@ kernel/linux-$(KERNEL_VERSION)/.config: kernel/config-$(KERNEL_VERSION)
wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-$(KERNEL_VERSION).tar.xz
tar xf linux-$(KERNEL_VERSION).tar.xz
rm -f linux-$(KERNEL_VERSION).tar.xz
rm -rf kernel/linux-$(KERNEL_VERSION)
mv linux-$(KERNEL_VERSION) kernel/
cd kernel/linux-$(KERNEL_VERSION) && patch -p1 < ../linux-$(KERNEL_VERSION)-timers-gem5.patch
cp kernel/config-$(KERNEL_VERSION) kernel/linux-$(KERNEL_VERSION)/.config
......
{
"_comment": "Build with `packer build ubuntu.json`",
"builders": [
{
"iso_urls": [ "output-ubuntu1804/ubuntu1804" ],
"iso_checksum": "none",
"disk_image": "true",
"use_backing_file": "true",
"headless": "{{ user `headless` }}",
"disable_vnc": "false",
"output_directory": "output-{{ user `vm_name` }}",
"qemuargs": [
[
"-m",
"{{ user `memory` }}"
],
[
"-display",
"none"
],
[
"-machine",
"accel=kvm"
],
[
"-cpu",
"host"
],
[
"-smp",
"cpus={{ user `cpus`}}"
],
[
"-serial",
"mon:stdio"
]
],
"shutdown_command": "echo '{{ user `ssh_password` }}'|sudo -S shutdown -P now",
"ssh_password": "{{ user `ssh_password` }}",
"ssh_timeout": "10000s",
"ssh_username": "{{ user `ssh_username` }}",
"type": "qemu",
"vm_name": "{{ user `vm_name` }}"
}
],
"provisioners": [
{
"type": "file",
"source": "scripts/guestinit.sh",
"destination": "/home/ubuntu/guestinit.sh",
"direction": "upload"
},
{
"type": "file",
"source": "bzImage",
"destination": "/tmp/bzImage",
"direction": "upload"
},
{
"type": "file",
"source": "kernel/config-5.4.46",
"destination": "/tmp/config-5.4.46",
"direction": "upload"
},
{
"type": "file",
"source": "kheaders.tar.bz2",
"destination": "/tmp/kheaders.tar.bz2",
"direction": "upload"
},
{
"type": "shell",
"inline": [
"sudo mv /tmp/bzImage /boot/vmlinuz-5.4.46",
"sudo mv /tmp/config-5.4.46 /boot/config-5.4.46",
"sudo update-grub",
"cd / && sudo tar xf /tmp/kheaders.tar.bz2"
]
},
{
"type": "file",
"source": "m5",
"destination": "/tmp/m5",
"direction": "upload"
},
{
"type": "shell",
"inline": ["sudo mv /tmp/m5 /sbin/m5"]
}
],
"variables": {
"cleanup_pause": "",
"cpus": "4",
"custom_script": ".",
"desktop": "false",
"disk_size": "10000",
"headless": "", "hostname": "vagrant",
"memory": "4096",
"preseed": "preseed.cfg",
"ssh_fullname": "vagrant",
"ssh_password": "ubuntu",
"ssh_username": "ubuntu",
"vagrantfile_template": "",
"version": "0.1.0",
"vm_name": "base"
}
}
......@@ -2,7 +2,7 @@
"_comment": "Build with `packer build ubuntu.json`",
"builders": [
{
"iso_urls": [ "output-ubuntu1804-base/ubuntu1804-base" ],
"iso_urls": [ "output-base/base" ],
"iso_checksum": "none",
"disk_image": "true",
"use_backing_file": "true",
......
......@@ -2,7 +2,7 @@
"_comment": "Build with `packer build ubuntu.json`",
"builders": [
{
"iso_urls": [ "output-ubuntu1804-base/ubuntu1804-base" ],
"iso_urls": [ "output-base/base" ],
"iso_checksum": "none",
"disk_image": "true",
"use_backing_file": "true",
......
......@@ -82,49 +82,6 @@
"scripts/cleanup.sh"
],
"type": "shell"
},
{
"type": "file",
"source": "scripts/guestinit.sh",
"destination": "/home/ubuntu/guestinit.sh",
"direction": "upload"
},
{
"type": "file",
"source": "bzImage",
"destination": "/tmp/bzImage",
"direction": "upload"
},
{
"type": "file",
"source": "kernel/config-5.4.46",
"destination": "/tmp/config-5.4.46",
"direction": "upload"
},
{
"type": "file",
"source": "kheaders.tar.bz2",
"destination": "/tmp/kheaders.tar.bz2",
"direction": "upload"
},
{
"type": "shell",
"inline": [
"sudo mv /tmp/bzImage /boot/vmlinuz-5.4.46",
"sudo mv /tmp/config-5.4.46 /boot/config-5.4.46",
"sudo update-grub",
"cd / && sudo tar xf /tmp/kheaders.tar.bz2"
]
},
{
"type": "file",
"source": "m5",
"destination": "/tmp/m5",
"direction": "upload"
},
{
"type": "shell",
"inline": ["sudo mv /tmp/m5 /sbin/m5"]
}
],
"variables": {
......@@ -156,7 +113,7 @@
"update": "false",
"vagrantfile_template": "",
"version": "0.1.0",
"vm_name": "ubuntu1804-base"
"vm_name": "ubuntu1804"
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment