mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-04 02:56:18 +00:00
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 <julio.montes@intel.com>
This commit is contained in:
parent
8065bb615a
commit
71ccc0a6ea
5
Makefile
5
Makefile
@ -9,7 +9,6 @@ ROOTFS_BUILDER := $(MK_DIR)/rootfs-builder/rootfs.sh
|
|||||||
INITRD_BUILDER := $(MK_DIR)/initrd-builder/initrd_builder.sh
|
INITRD_BUILDER := $(MK_DIR)/initrd-builder/initrd_builder.sh
|
||||||
IMAGE_BUILDER := $(MK_DIR)/image-builder/image_builder.sh
|
IMAGE_BUILDER := $(MK_DIR)/image-builder/image_builder.sh
|
||||||
|
|
||||||
IMG_SIZE = 500
|
|
||||||
AGENT_INIT ?= no
|
AGENT_INIT ?= no
|
||||||
DISTRO ?= centos
|
DISTRO ?= centos
|
||||||
ROOTFS_BUILD_DEST := $(PWD)
|
ROOTFS_BUILD_DEST := $(PWD)
|
||||||
@ -42,7 +41,7 @@ image-%: $(IMAGES_BUILD_DEST)/kata-containers-image-%.img
|
|||||||
.PRECIOUS: $(IMAGES_BUILD_DEST)/kata-containers-image-%.img
|
.PRECIOUS: $(IMAGES_BUILD_DEST)/kata-containers-image-%.img
|
||||||
$(IMAGES_BUILD_DEST)/kata-containers-image-%.img: rootfs-%
|
$(IMAGES_BUILD_DEST)/kata-containers-image-%.img: rootfs-%
|
||||||
@echo Creating image based on $^
|
@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
|
initrd-%: $(IMAGES_BUILD_DEST)/kata-containers-initrd-%.img
|
||||||
@ # DONT remove. This is not cancellation rule.
|
@ # DONT remove. This is not cancellation rule.
|
||||||
@ -63,7 +62,7 @@ image: $(DISTRO_IMAGE)
|
|||||||
|
|
||||||
$(DISTRO_IMAGE): $(DISTRO_ROOTFS_MARKER)
|
$(DISTRO_IMAGE): $(DISTRO_ROOTFS_MARKER)
|
||||||
@echo Creating image based on "$(DISTRO_ROOTFS)"
|
@echo Creating image based on "$(DISTRO_ROOTFS)"
|
||||||
$(IMAGE_BUILDER) -s "$(IMG_SIZE)" "$(DISTRO_ROOTFS)"
|
$(IMAGE_BUILDER) "$(DISTRO_ROOTFS)"
|
||||||
|
|
||||||
.PHONY: initrd
|
.PHONY: initrd
|
||||||
initrd: $(DISTRO_INITRD)
|
initrd: $(DISTRO_INITRD)
|
||||||
|
@ -17,6 +17,7 @@ source "$lib_file"
|
|||||||
[ "$(id -u)" -eq 0 ] || die "$0: must be run as root"
|
[ "$(id -u)" -eq 0 ] || die "$0: must be run as root"
|
||||||
|
|
||||||
IMAGE="${IMAGE:-kata-containers.img}"
|
IMAGE="${IMAGE:-kata-containers.img}"
|
||||||
|
IMG_SIZE=128
|
||||||
AGENT_BIN=${AGENT_BIN:-kata-agent}
|
AGENT_BIN=${AGENT_BIN:-kata-agent}
|
||||||
AGENT_INIT=${AGENT_INIT:-no}
|
AGENT_INIT=${AGENT_INIT:-no}
|
||||||
|
|
||||||
@ -27,13 +28,10 @@ usage()
|
|||||||
Usage: ${script_name} [options] <rootfs-dir>
|
Usage: ${script_name} [options] <rootfs-dir>
|
||||||
This script will create a Kata Containers image file of
|
This script will create a Kata Containers image file of
|
||||||
an adequate size based on the <rootfs-dir> directory.
|
an adequate size based on the <rootfs-dir> directory.
|
||||||
The size of the image can be also be specified manually
|
|
||||||
by '-s' flag.
|
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-h Show this help
|
-h Show this help
|
||||||
-o path to generate image file ENV: IMAGE
|
-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
|
-r Free space of the root partition in MB ENV: ROOT_FREE_SPACE
|
||||||
|
|
||||||
Extra environment variables:
|
Extra environment variables:
|
||||||
@ -67,16 +65,6 @@ do
|
|||||||
h) usage ;;
|
h) usage ;;
|
||||||
o) IMAGE="${OPTARG}" ;;
|
o) IMAGE="${OPTARG}" ;;
|
||||||
r) ROOT_FREE_SPACE="${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}" ;;
|
f) FS_TYPE="${OPTARG}" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user