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
PACKER_VERSION := 1.7.0
KERNEL_VERSION := 5.4.46
UBUNTU_IMAGE := $(d)output-ubuntu1804/ubuntu1804
BASE_IMAGE := $(d)output-base/base
MEMCACHED_IMAGE := $(d)output-memcached/memcached
NOPAXOS_IMAGE := $(d)output-nopaxos/nopaxos
MTCP_IMAGE := $(d)output-mtcp/mtcp
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))
IMAGES_MIN := $(UBUNTU_IMAGE) $(BASE_IMAGE)
IMAGES_MIN := $(BASE_IMAGE)
RAW_IMAGES_MIN := $(addsuffix .raw,$(IMAGES_MIN))
img_dir := $(d)
......@@ -64,21 +63,15 @@ build-images-min: $(IMAGES_MIN) $(RAW_IMAGES_MIN) $(vmlinux) $(bz_image) \
%.raw: %
$(QEMU_IMG) convert -f qcow2 -O raw $< $@
$(UBUNTU_IMAGE): $(packer) $(QEMU) $(addprefix $(d),ubuntu1804.json \
scripts/user-data scripts/packages.sh scripts/cleanup.sh)
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) \
$(BASE_IMAGE): $(packer) $(QEMU) $(bz_image) $(m5_bin) $(kheader_tar) \
$(guest_init) $(kernel_config) \
$(addprefix $(d), extended-image.pkr.hcl scripts/install-base.sh \
scripts/cleanup.sh)
rm -rf $(dir $@)
mkdir -p $(img_dir)/input-base
cp $(m5_bin) $(kheader_tar) $(guest_init) $(bz_image) $(kernel_config) \
$(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
touch $@
......
......@@ -11,3 +11,11 @@ update-grub
tar xf kheaders.tar.bz2 -C /
popd
rm -rf /tmp/input
apt-get update
apt-get -y install \
iperf \
netperf \
netcat \
ethtool \
tcpdump
......@@ -2,7 +2,8 @@
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
wget https://ftp.gnu.org/gnu/automake/automake-1.16.2.tar.gz
......
#!/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
cd /tmp/protobuf
./autogen.sh
......
#!/bin/bash -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/
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