mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-15 04:14:24 +01:00
Re-implement image builder script to generate an image with a double MBR + a DAX metadata. The DAX metadata is read by the NVDIMM driver to know the beginning of the data in the pmem device. This new image format is required to enable DAX in the kernels and hypervisors that support NVDIMM, without breaking the compatibility with the kernels and hypervisors that don't support it. Following diagram shows how the resulting image will look like ``` .-----------.----------.---------------.-----------. | 0 - 512 B | 4 - 8 Kb | 2M - 2M+512B | 3M | |-----------+----------+---------------+-----------+ | MBR #1 | DAX | MBR #2 | Rootfs | '-----------'----------'---------------'-----------+ | | ^ | ^ | '-data-' '--------' | | '--------rootfs-partition---------' ``` MBR: Master boot record. DAX: Metadata required by the NVDIMM driver to enable DAX in the guest [1][2] (struct nd_pfn_sb). Rootfs: partition that contains the root filesystem (/usr, /bin, etc). Kernels and hypervisors that support DAX/NVDIMM read the MBR #2, otherwise MBR #1 is read. [1] - https://github.com/kata-containers/osbuilder/blob/master/image-builder/\ nsdax.gpl.c [2] - https://github.com/torvalds/linux/blob/master/drivers/nvdimm/pfn.h fixes #263 Signed-off-by: Julio Montes <julio.montes@intel.com>
Kata Containers image generation
A Kata Containers disk image is generated using the image_builder.sh script.
This uses a rootfs directory created by the rootfs-builder/rootfs.sh script.
Creating a guest OS image
To create a guest OS image run:
$ sudo ./image_builder.sh path/to/rootfs
Where path/to/rootfs is the directory populated by rootfs.sh.
Note
: If you are building an image from an Alpine rootfs, see the important note here.
Further information
For more information about usage (including how to adjust the size of the image), run:
$ ./image_builder.sh -h