diff options
Diffstat (limited to 'recipes-containers/vcontainer/vdkr-rootfs-image.bb')
| -rw-r--r-- | recipes-containers/vcontainer/vdkr-rootfs-image.bb | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/recipes-containers/vcontainer/vdkr-rootfs-image.bb b/recipes-containers/vcontainer/vdkr-rootfs-image.bb new file mode 100644 index 00000000..a9bbb9fa --- /dev/null +++ b/recipes-containers/vcontainer/vdkr-rootfs-image.bb | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | # SPDX-FileCopyrightText: Copyright (C) 2025 Bruce Ashfield | ||
| 2 | # | ||
| 3 | # SPDX-License-Identifier: MIT | ||
| 4 | # | ||
| 5 | # vdkr-rootfs-image.bb | ||
| 6 | # Minimal Docker-capable image for vdkr QEMU environment | ||
| 7 | # | ||
| 8 | # This image is built via multiconfig and used by vdkr-initramfs-create | ||
| 9 | # to provide a proper rootfs for running Docker in QEMU. | ||
| 10 | # | ||
| 11 | # Build with: | ||
| 12 | # bitbake mc:vdkr-aarch64:vdkr-rootfs-image | ||
| 13 | # bitbake mc:vdkr-x86-64:vdkr-rootfs-image | ||
| 14 | |||
| 15 | SUMMARY = "Minimal Docker rootfs for vdkr" | ||
| 16 | DESCRIPTION = "A minimal image containing Docker tools for use with vdkr. \ | ||
| 17 | This image runs inside QEMU to provide Docker command execution." | ||
| 18 | |||
| 19 | LICENSE = "MIT" | ||
| 20 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
| 21 | |||
| 22 | # Track init script changes via file-checksums | ||
| 23 | # This adds the file content hash to the task signature | ||
| 24 | do_rootfs[file-checksums] += "${THISDIR}/files/vdkr-init.sh:True" | ||
| 25 | do_rootfs[file-checksums] += "${THISDIR}/files/vcontainer-init-common.sh:True" | ||
| 26 | |||
| 27 | # Force do_rootfs to always run (no stamp caching) | ||
| 28 | # Combined with file-checksums, this ensures init script changes are picked up | ||
| 29 | do_rootfs[nostamp] = "1" | ||
| 30 | |||
| 31 | # Inherit from core-image-minimal for a minimal base | ||
| 32 | inherit core-image | ||
| 33 | |||
| 34 | # We need Docker and container tools | ||
| 35 | IMAGE_INSTALL = " \ | ||
| 36 | packagegroup-core-boot \ | ||
| 37 | docker-moby \ | ||
| 38 | containerd \ | ||
| 39 | runc \ | ||
| 40 | skopeo \ | ||
| 41 | busybox \ | ||
| 42 | iproute2 \ | ||
| 43 | util-linux \ | ||
| 44 | " | ||
| 45 | |||
| 46 | # No extra features needed | ||
| 47 | IMAGE_FEATURES = "" | ||
| 48 | |||
| 49 | # Keep the image small | ||
| 50 | IMAGE_ROOTFS_SIZE = "524288" | ||
| 51 | IMAGE_ROOTFS_EXTRA_SPACE = "0" | ||
| 52 | |||
| 53 | # Use squashfs for smaller size (~3x compression) | ||
| 54 | # The preinit mounts squashfs read-only with tmpfs overlay for writes | ||
| 55 | IMAGE_FSTYPES = "squashfs" | ||
| 56 | |||
| 57 | # Install our init script | ||
| 58 | ROOTFS_POSTPROCESS_COMMAND += "install_vdkr_init;" | ||
| 59 | |||
| 60 | install_vdkr_init() { | ||
| 61 | # Install vdkr-init.sh as /init and vcontainer-init-common.sh alongside it | ||
| 62 | install -m 0755 ${THISDIR}/files/vdkr-init.sh ${IMAGE_ROOTFS}/init | ||
| 63 | install -m 0755 ${THISDIR}/files/vcontainer-init-common.sh ${IMAGE_ROOTFS}/vcontainer-init-common.sh | ||
| 64 | |||
| 65 | # Create required directories | ||
| 66 | install -d ${IMAGE_ROOTFS}/mnt/input | ||
| 67 | install -d ${IMAGE_ROOTFS}/mnt/state | ||
| 68 | install -d ${IMAGE_ROOTFS}/var/lib/docker | ||
| 69 | install -d ${IMAGE_ROOTFS}/run/containerd | ||
| 70 | |||
| 71 | # Create skopeo policy | ||
| 72 | install -d ${IMAGE_ROOTFS}/etc/containers | ||
| 73 | echo '{"default":[{"type":"insecureAcceptAnything"}]}' > ${IMAGE_ROOTFS}/etc/containers/policy.json | ||
| 74 | } | ||
