1# Simple initramfs image artifact generation for tiny images.
2SUMMARY = "Tiny image capable of booting a device."
3DESCRIPTION = "Tiny image capable of booting a device. The kernel includes \
4the Minimal RAM-based Initial Root Filesystem (initramfs), which finds the \
5first 'init' program more efficiently. core-image-tiny-initramfs doesn't \
6actually generate an image but rather generates boot and rootfs artifacts \
7that can subsequently be picked up by external image generation tools such as wic."
8
9VIRTUAL-RUNTIME_dev_manager ?= "busybox-mdev"
10
11PACKAGE_INSTALL = "initramfs-live-boot-tiny packagegroup-core-boot dropbear ${VIRTUAL-RUNTIME_base-utils} ${VIRTUAL-RUNTIME_dev_manager} base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}"
12
13# Do not pollute the initrd image with rootfs features
14IMAGE_FEATURES = ""
15
16IMAGE_NAME_SUFFIX ?= ""
17IMAGE_LINGUAS = ""
18
19LICENSE = "MIT"
20
21# don't actually generate an image, just the artifacts needed for one
22IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
23
24inherit core-image
25
26IMAGE_ROOTFS_SIZE = "8192"
27IMAGE_ROOTFS_EXTRA_SPACE = "0"
28
29# Use the same restriction as initramfs-live-install
30COMPATIBLE_HOST = "(i.86|x86_64|aarch64|arm).*-linux"
31
32python tinyinitrd () {
33  # Modify our init file so the user knows we drop to shell prompt on purpose
34  newinit = None
35  with open(d.expand('${IMAGE_ROOTFS}/init'), 'r') as init:
36    newinit = init.read()
37    newinit = newinit.replace('Cannot find $ROOT_IMAGE file in /run/media/* , dropping to a shell ', 'Poky Tiny Reference Distribution:')
38  with open(d.expand('${IMAGE_ROOTFS}/init'), 'w') as init:
39    init.write(newinit)
40}
41
42IMAGE_PREPROCESS_COMMAND += "tinyinitrd"
43
44QB_KERNEL_CMDLINE_APPEND += "debugshell=3 init=/bin/busybox sh init"
45