Commit 3f623d89 authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

images: add makefile option for image compression

This increases build time, and might hurt disk performance for kvm/qemu
a bit. So we disable it by default. But will be useful for docker images
etc.
parent f0568a80
...@@ -19,10 +19,16 @@ variable "base_img" { ...@@ -19,10 +19,16 @@ variable "base_img" {
default = "unused" default = "unused"
} }
variable "compressed" {
type = bool
default = false
}
source "qemu" "autogenerated_1" { source "qemu" "autogenerated_1" {
communicator = "ssh" communicator = "ssh"
cpus = "${var.cpus}" cpus = "${var.cpus}"
disk_image = true disk_image = true
disk_compression = "${var.compressed}"
headless = true headless = true
http_directory = "scripts" http_directory = "scripts"
iso_checksum = "file:https://cloud-images.ubuntu.com/minimal/releases/bionic/release/SHA256SUMS" iso_checksum = "file:https://cloud-images.ubuntu.com/minimal/releases/bionic/release/SHA256SUMS"
......
...@@ -19,10 +19,16 @@ variable "base_img" { ...@@ -19,10 +19,16 @@ variable "base_img" {
default = "base" default = "base"
} }
variable "compressed" {
type = bool
default = false
}
source "qemu" "autogenerated_1" { source "qemu" "autogenerated_1" {
communicator = "ssh" communicator = "ssh"
cpus = "${var.cpus}" cpus = "${var.cpus}"
disk_image = true disk_image = true
disk_compression = "${var.compressed}"
headless = true headless = true
iso_checksum = "none" iso_checksum = "none"
iso_url = "output-${var.base_img}/${var.base_img}" iso_url = "output-${var.base_img}/${var.base_img}"
......
...@@ -30,6 +30,7 @@ MEMCACHED_IMAGE := $(d)output-memcached/memcached ...@@ -30,6 +30,7 @@ MEMCACHED_IMAGE := $(d)output-memcached/memcached
NOPAXOS_IMAGE := $(d)output-nopaxos/nopaxos NOPAXOS_IMAGE := $(d)output-nopaxos/nopaxos
MTCP_IMAGE := $(d)output-mtcp/mtcp MTCP_IMAGE := $(d)output-mtcp/mtcp
TAS_IMAGE := $(d)output-tas/tas TAS_IMAGE := $(d)output-tas/tas
COMRESSED_IMAGES ?= false
IMAGES := $(BASE_IMAGE) $(NOPAXOS_IMAGE) $(MEMCACHED_IMAGE) IMAGES := $(BASE_IMAGE) $(NOPAXOS_IMAGE) $(MEMCACHED_IMAGE)
RAW_IMAGES := $(addsuffix .raw,$(IMAGES)) RAW_IMAGES := $(addsuffix .raw,$(IMAGES))
...@@ -71,7 +72,8 @@ $(BASE_IMAGE): $(packer) $(QEMU) $(bz_image) $(m5_bin) $(kheader_tar) \ ...@@ -71,7 +72,8 @@ $(BASE_IMAGE): $(packer) $(QEMU) $(bz_image) $(m5_bin) $(kheader_tar) \
mkdir -p $(img_dir)/input-base mkdir -p $(img_dir)/input-base
cp $(m5_bin) $(kheader_tar) $(guest_init) $(bz_image) $(kernel_config) \ cp $(m5_bin) $(kheader_tar) $(guest_init) $(bz_image) $(kernel_config) \
$(img_dir)/input-base/ $(img_dir)/input-base/
cd $(img_dir) && ./packer-wrap.sh base base base.pkr.hcl cd $(img_dir) && ./packer-wrap.sh base base base.pkr.hcl \
$(COMRESSED_IMAGES)
rm -rf $(img_dir)/input-base rm -rf $(img_dir)/input-base
touch $@ touch $@
...@@ -79,7 +81,9 @@ $(MEMCACHED_IMAGE): $(packer) $(QEMU) $(BASE_IMAGE) \ ...@@ -79,7 +81,9 @@ $(MEMCACHED_IMAGE): $(packer) $(QEMU) $(BASE_IMAGE) \
$(addprefix $(d), extended-image.pkr.hcl scripts/install-memcached.sh \ $(addprefix $(d), extended-image.pkr.hcl scripts/install-memcached.sh \
scripts/cleanup.sh) scripts/cleanup.sh)
rm -rf $(dir $@) rm -rf $(dir $@)
cd $(img_dir) && ./packer-wrap.sh base memcached extended-image.pkr.hcl cd $(img_dir) && ./packer-wrap.sh base memcached \
extended-image.pkr.hcl $(COMRESSED_IMAGES)
rm -rf $(img_dir)/input-base
touch $@ touch $@
$(NOPAXOS_IMAGE): $(packer) $(QEMU) $(BASE_IMAGE) \ $(NOPAXOS_IMAGE): $(packer) $(QEMU) $(BASE_IMAGE) \
...@@ -88,21 +92,24 @@ $(NOPAXOS_IMAGE): $(packer) $(QEMU) $(BASE_IMAGE) \ ...@@ -88,21 +92,24 @@ $(NOPAXOS_IMAGE): $(packer) $(QEMU) $(BASE_IMAGE) \
rm -rf $(dir $@) rm -rf $(dir $@)
mkdir -p $(img_dir)/input-nopaxos mkdir -p $(img_dir)/input-nopaxos
cp $(img_dir)/nopaxos.config $(img_dir)/input-nopaxos/ cp $(img_dir)/nopaxos.config $(img_dir)/input-nopaxos/
cd $(img_dir) && ./packer-wrap.sh base nopaxos extended-image.pkr.hcl cd $(img_dir) && ./packer-wrap.sh base nopaxos extended-image.pkr.hcl \
$(COMRESSED_IMAGES)
touch $@ touch $@
$(MTCP_IMAGE): $(packer) $(QEMU) $(BASE_IMAGE) \ $(MTCP_IMAGE): $(packer) $(QEMU) $(BASE_IMAGE) \
$(addprefix $(d), extended-image.pkr.hcl scripts/install-mtcp.sh \ $(addprefix $(d), extended-image.pkr.hcl scripts/install-mtcp.sh \
scripts/cleanup.sh) scripts/cleanup.sh)
rm -rf $(dir $@) rm -rf $(dir $@)
cd $(img_dir) && ./packer-wrap.sh base mtcp extended-image.pkr.hcl cd $(img_dir) && ./packer-wrap.sh base mtcp extended-image.pkr.hcl \
$(COMRESSED_IMAGES)
touch $@ touch $@
$(TAS_IMAGE): $(packer) $(QEMU) $(BASE_IMAGE) \ $(TAS_IMAGE): $(packer) $(QEMU) $(BASE_IMAGE) \
$(addprefix $(d), extended-image.pkr.hcl scripts/install-tas.sh \ $(addprefix $(d), extended-image.pkr.hcl scripts/install-tas.sh \
scripts/cleanup.sh) scripts/cleanup.sh)
rm -rf $(dir $@) rm -rf $(dir $@)
cd $(img_dir) && ./packer-wrap.sh base tas extended-image.pkr.hcl cd $(img_dir) && ./packer-wrap.sh base tas extended-image.pkr.hcl \
$(COMRESSED_IMAGES)
touch $@ touch $@
$(packer): $(packer):
......
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