From e840cf2ce6c5bea7e068580b1e9e0c4ce48164d6 Mon Sep 17 00:00:00 2001 From: Tony Fang Date: Thu, 16 Mar 2023 18:17:32 +0000 Subject: [PATCH] Upgrade firecracker to 1.3.1 Fix a build issue by specifying release branch for tools from firecracker repo Signed-off-by: Tony Fang --- Makefile | 10 +++++++--- examples/cmd/snapshotting/Makefile | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9e2a98e3..802173bc 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,8 @@ JAILER_BIN=$(FC_TEST_DATA_PATH)/jailer-main UID = $(shell id -u) GID = $(shell id -g) -firecracker_version=v1.0.0 +# Version has to be in format of vx.x.x +firecracker_version=v1.3.1 # The below files are needed and can be downloaded from the internet release_url=https://github.com/firecracker-microvm/firecracker/releases/download/$(firecracker_version)/firecracker-$(firecracker_version)-$(arch).tgz @@ -107,10 +108,11 @@ $(FC_TEST_DATA_PATH)/root-drive.img: $(FC_TEST_DATA_PATH)/root-drive-ssh-key $(FC_TEST_DATA_PATH)/root-drive-with-ssh.img: # Need root to move ssh key to testdata location +# Need to change the jammy.rootfs.ext4 if firecracker uses another Debian distro ifeq ($(GID), 0) $(MAKE) $(FIRECRACKER_DIR) $(FIRECRACKER_DIR)/tools/devtool build_rootfs -m $(FC_TEST_DATA_PATH)/mnt - cp $(FIRECRACKER_DIR)/build/rootfs/bionic.rootfs.ext4 $(FC_TEST_DATA_PATH)/root-drive-with-ssh.img + cp $(FIRECRACKER_DIR)/build/rootfs/jammy.rootfs.ext4 $(FC_TEST_DATA_PATH)/root-drive-with-ssh.img cp $(FIRECRACKER_DIR)/build/rootfs/ssh/id_rsa $(FC_TEST_DATA_PATH)/root-drive-ssh-key rm -rf $(FIRECRACKER_DIR) else @@ -132,8 +134,10 @@ $(FC_TEST_BIN_PATH)/tc-redirect-tap: $(FC_TEST_DATA_PATH)/ltag: $(call install_go,github.com/kunalkushwaha/ltag,v0.2.3) +# Clone firecracker repo +# Checkout the matching release branch to make sure tools used match the firecracker version $(FIRECRACKER_DIR): - - git clone https://github.com/firecracker-microvm/firecracker.git $(FIRECRACKER_DIR) + - git clone --branch firecracker-${firecracker_version%.*} https://github.com/firecracker-microvm/firecracker.git $(FIRECRACKER_DIR) .PHONY: test-images test-images: $(FIRECRACKER_BIN) $(JAILER_BIN) diff --git a/examples/cmd/snapshotting/Makefile b/examples/cmd/snapshotting/Makefile index 598c9471..7e088789 100644 --- a/examples/cmd/snapshotting/Makefile +++ b/examples/cmd/snapshotting/Makefile @@ -61,7 +61,7 @@ root-drive-with-ssh.img root-drive-ssh-key: - mkdir temp - git clone https://github.com/firecracker-microvm/firecracker temp temp/tools/devtool build_rootfs - cp temp/build/rootfs/bionic.rootfs.ext4 root-drive-with-ssh.img + cp temp/build/rootfs/jammy.rootfs.ext4 root-drive-with-ssh.img cp temp/build/rootfs/ssh/id_rsa root-drive-ssh-key rm -rf temp