Commit f83b6297 authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

images: restructure images to simplify and slim down

Remove the ubuntu1804 image. Base only has basic tools, no build tools
or libraries. Install build deps in nopaxos, mtcp, and tas images.
parent 02bc69fb
variable "cpus" {
type = string
default = "4"
}
variable "memory" {
type = string
default = "4096"
}
variable "outname" {
type = string
default = "base"
}
variable "base_img" {
type = string
default = "unused"
}
source "qemu" "autogenerated_1" {
communicator = "ssh"
cpus = "${var.cpus}"
disk_image = true
headless = true
http_directory = "scripts"
iso_checksum = "file:https://cloud-images.ubuntu.com/bionic/current/SHA256SUMS"
iso_url = "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img"
memory = "${var.memory}"
net_device = "virtio-net"
output_directory = "output-${var.outname}"
qemuargs = [["-smbios", "type=1,serial=ds=nocloud-net;instance-id=packer;seedfrom=http://{{ .HTTPIP }}:{{ .HTTPPort }}/"],
["-machine", "pc-q35-4.2,accel=kvm:tcg,usb=off,vmport=off,dump-guest-core=off"]]
shutdown_command = "sudo shutdown --poweroff --no-wall now"
ssh_password = "ubuntu"
ssh_username = "ubuntu"
vm_name = "${var.outname}"
}
build {
sources = ["source.qemu.autogenerated_1"]
provisioner "file" {
direction = "upload"
source = "input-${var.outname}"
destination = "/tmp/input"
}
provisioner "shell" {
execute_command = "{{ .Vars }} sudo -S -E bash '{{ .Path }}'"
scripts = ["scripts/install-${var.outname}.sh", "scripts/cleanup.sh"]
}
}
...@@ -25,17 +25,16 @@ include mk/subdir_pre.mk ...@@ -25,17 +25,16 @@ include mk/subdir_pre.mk
PACKER_VERSION := 1.7.0 PACKER_VERSION := 1.7.0
KERNEL_VERSION := 5.4.46 KERNEL_VERSION := 5.4.46
UBUNTU_IMAGE := $(d)output-ubuntu1804/ubuntu1804
BASE_IMAGE := $(d)output-base/base BASE_IMAGE := $(d)output-base/base
MEMCACHED_IMAGE := $(d)output-memcached/memcached 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
IMAGES := $(UBUNTU_IMAGE) $(BASE_IMAGE) $(NOPAXOS_IMAGE) $(MEMCACHED_IMAGE) IMAGES := $(BASE_IMAGE) $(NOPAXOS_IMAGE) $(MEMCACHED_IMAGE)
RAW_IMAGES := $(addsuffix .raw,$(IMAGES)) RAW_IMAGES := $(addsuffix .raw,$(IMAGES))
IMAGES_MIN := $(UBUNTU_IMAGE) $(BASE_IMAGE) IMAGES_MIN := $(BASE_IMAGE)
RAW_IMAGES_MIN := $(addsuffix .raw,$(IMAGES_MIN)) RAW_IMAGES_MIN := $(addsuffix .raw,$(IMAGES_MIN))
img_dir := $(d) img_dir := $(d)
...@@ -64,21 +63,15 @@ build-images-min: $(IMAGES_MIN) $(RAW_IMAGES_MIN) $(vmlinux) $(bz_image) \ ...@@ -64,21 +63,15 @@ build-images-min: $(IMAGES_MIN) $(RAW_IMAGES_MIN) $(vmlinux) $(bz_image) \
%.raw: % %.raw: %
$(QEMU_IMG) convert -f qcow2 -O raw $< $@ $(QEMU_IMG) convert -f qcow2 -O raw $< $@
$(UBUNTU_IMAGE): $(packer) $(QEMU) $(addprefix $(d),ubuntu1804.json \ $(BASE_IMAGE): $(packer) $(QEMU) $(bz_image) $(m5_bin) $(kheader_tar) \
scripts/user-data scripts/packages.sh scripts/cleanup.sh) $(guest_init) $(kernel_config) \
rm -rf $(dir $@)
cd $(img_dir) && ./packer-wrap.sh none ubuntu1804 ubuntu1804.json
touch $@
$(BASE_IMAGE): $(packer) $(QEMU) $(UBUNTU_IMAGE) $(bz_image) $(m5_bin) \
$(kheader_tar) $(guest_init) $(kernel_config) \
$(addprefix $(d), extended-image.pkr.hcl scripts/install-base.sh \ $(addprefix $(d), extended-image.pkr.hcl scripts/install-base.sh \
scripts/cleanup.sh) scripts/cleanup.sh)
rm -rf $(dir $@) rm -rf $(dir $@)
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 ubuntu1804 base extended-image.pkr.hcl cd $(img_dir) && ./packer-wrap.sh base base base.pkr.hcl
rm -rf $(img_dir)/input-base rm -rf $(img_dir)/input-base
touch $@ touch $@
......
...@@ -11,3 +11,11 @@ update-grub ...@@ -11,3 +11,11 @@ update-grub
tar xf kheaders.tar.bz2 -C / tar xf kheaders.tar.bz2 -C /
popd popd
rm -rf /tmp/input rm -rf /tmp/input
apt-get update
apt-get -y install \
iperf \
netperf \
netcat \
ethtool \
tcpdump
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
set -eux set -eux
apt-get -y install libnuma-dev libgmp-dev bc python libpcre3-dev libpcre++-dev zlib1g-dev apt-get -y install autoconf build-essential file git libnuma-dev libgmp-dev bc \
python libpcre3-dev libpcre++-dev zlib1g-dev
cd /tmp cd /tmp
wget https://ftp.gnu.org/gnu/automake/automake-1.16.2.tar.gz wget https://ftp.gnu.org/gnu/automake/automake-1.16.2.tar.gz
......
#!/bin/bash -eux #!/bin/bash -eux
apt-get update
apt-get -y install \
autoconf \
automake \
build-essential \
g++ \
git \
libevent-dev \
libssl-dev \
libtool \
libunwind-dev \
make \
pkg-config
git clone https://github.com/google/protobuf.git /tmp/protobuf git clone https://github.com/google/protobuf.git /tmp/protobuf
cd /tmp/protobuf cd /tmp/protobuf
./autogen.sh ./autogen.sh
......
#!/bin/bash -eux #!/bin/bash -eux
set -eux set -eux
apt-get -y install libnuma-dev libgmp-dev bc python apt-get -y install build-essential git libnuma-dev libgmp-dev bc python
cd /root/ cd /root/
wget http://fast.dpdk.org/rel/dpdk-18.11.8.tar.gz wget http://fast.dpdk.org/rel/dpdk-18.11.8.tar.gz
......
#!/bin/bash
apt-get update
mount 1>&2
apt-get -y install \
ntp \
nfs-common \
iperf \
netperf \
netcat \
make \
git \
pkg-config \
libevent-dev \
libunwind-dev \
autoconf \
automake \
libtool \
g++ \
libssl-dev \
ethtool \
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