From 71ccc0a6eab62b0f9df52913adfe17b17e2ae76b Mon Sep 17 00:00:00 2001 From: Julio Montes Date: Fri, 8 Mar 2019 10:08:14 -0600 Subject: [PATCH] mage-builder: remove -s option and IMG_SIZE envar guest kernel needs 64 bytes of DRAM per 4K page of emulated PMEM, hence the image size should be as small as possible to reduce the container's memory footprint. The image size is recalculated automatically if it's too small to contain the rootfs. Signed-off-by: Julio Montes --- Makefile | 5 ++--- image-builder/image_builder.sh | 14 +------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 93a57d13ae..52c451cb9a 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,6 @@ ROOTFS_BUILDER := $(MK_DIR)/rootfs-builder/rootfs.sh INITRD_BUILDER := $(MK_DIR)/initrd-builder/initrd_builder.sh IMAGE_BUILDER := $(MK_DIR)/image-builder/image_builder.sh -IMG_SIZE = 500 AGENT_INIT ?= no DISTRO ?= centos ROOTFS_BUILD_DEST := $(PWD) @@ -42,7 +41,7 @@ image-%: $(IMAGES_BUILD_DEST)/kata-containers-image-%.img .PRECIOUS: $(IMAGES_BUILD_DEST)/kata-containers-image-%.img $(IMAGES_BUILD_DEST)/kata-containers-image-%.img: rootfs-% @echo Creating image based on $^ - $(IMAGE_BUILDER) -s $(IMG_SIZE) -o $@ $(ROOTFS_BUILD_DEST)/$*_rootfs + $(IMAGE_BUILDER) -o $@ $(ROOTFS_BUILD_DEST)/$*_rootfs initrd-%: $(IMAGES_BUILD_DEST)/kata-containers-initrd-%.img @ # DONT remove. This is not cancellation rule. @@ -63,7 +62,7 @@ image: $(DISTRO_IMAGE) $(DISTRO_IMAGE): $(DISTRO_ROOTFS_MARKER) @echo Creating image based on "$(DISTRO_ROOTFS)" - $(IMAGE_BUILDER) -s "$(IMG_SIZE)" "$(DISTRO_ROOTFS)" + $(IMAGE_BUILDER) "$(DISTRO_ROOTFS)" .PHONY: initrd initrd: $(DISTRO_INITRD) diff --git a/image-builder/image_builder.sh b/image-builder/image_builder.sh index 21791e366b..017b91d613 100755 --- a/image-builder/image_builder.sh +++ b/image-builder/image_builder.sh @@ -17,6 +17,7 @@ source "$lib_file" [ "$(id -u)" -eq 0 ] || die "$0: must be run as root" IMAGE="${IMAGE:-kata-containers.img}" +IMG_SIZE=128 AGENT_BIN=${AGENT_BIN:-kata-agent} AGENT_INIT=${AGENT_INIT:-no} @@ -27,13 +28,10 @@ usage() Usage: ${script_name} [options] This script will create a Kata Containers image file of an adequate size based on the directory. - The size of the image can be also be specified manually - by '-s' flag. Options: -h Show this help -o path to generate image file ENV: IMAGE - -s Image size in MB ENV: IMG_SIZE -r Free space of the root partition in MB ENV: ROOT_FREE_SPACE Extra environment variables: @@ -67,16 +65,6 @@ do h) usage ;; o) IMAGE="${OPTARG}" ;; r) ROOT_FREE_SPACE="${OPTARG}" ;; - s) { - IMG_SIZE=${OPTARG} - if [ ${IMG_SIZE} -le 0 ]; then - die "Image size has to be greater than 0 MB." - fi - if [ ${IMG_SIZE} -gt ${MAX_IMG_SIZE_MB} ]; then - die "Image size should not be greater than ${MAX_IMG_SIZE_MB} MB." - fi - } - ;; f) FS_TYPE="${OPTARG}" ;; esac done