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