Hello, this patchset introduces support for attaching a bootconfig block both to plain initramfs images and inside FIT images. The bootconfig is built from one or more source files, that can be configured globally or per-image.
If multiple bootconfig source files are specified, they are combined before attaching the bootconfig block to the image (or FIT). Combination is done through a simple "cat" operation (and the bootconfig tool will then do the magic). == Introduction to bootconfig == A bootconfig is a small footer that can be added to an initramfs image and is read by the kernel at startup if the CONFIG_BOOT_CONFIG option is set. Its content can be used to expand the kernel command line even beyond its canonical size limit. An interesting point about the bootconfig mechanism is that the initramfs image does *not* need to be there for the bootconfig to be read, as its presence is always checked starting from the bottom of the declared initramfs area. More details on the bootconfig concept can be found at [0]. == Patchset walkthrough == Patch 1 adds a new recipe to compile the tool used for bootconfig management; being this part of the Linux kernel source code, it is compiled from the kernel shared workdir. Patch 2 adds a new image conversion type to add the bootconfig to an image. While today only a cpio (plain or compressed) or an ext2 image would make sense here as a base for such operation, this is not strictly enforced as new usecases may arise in the future. A new bbclass containing the relevant configuration variables for this operation is also introduced in this patch. Patche 3 adds a test recipe containing a bootconfig that can be used for tests; this recipe will then be used by patch 4. Patch 4 adds support for adding a bootconfig inside a FIT image. Since the bootconfig is always read from the end of an initramfs memory area (even if the initramfs isn“t really there!), two forms of support are added here, both enabled by the FIT_INCLUDE_BOOTCONFIG variable: - if INITRAMFS_IMAGE is set, the .bootconfig image is searched to be included as ramdisk section; - if INITRAMFS_IMAGE is not set, a dummy/empty initramfs artifact is created and the bootconfig block is added there; the resulting binary is then added as ramdisk section. It should be noted that if INITRAMFS_IMAGE_BUNDLE is set the bootconfig will NOT be included inside the FIT image and a warning will be displayed. == Usecases == The main usecases I can think of are: - (the one driving the work) initramfs-less dm-verity setup starting from a bootconfig included inside the FIT image and verified as part of the FIT verification; - complex tracing setups where the classic kernel command line is not sufficient (bootconfig is e.g. indicated as boot-time tracing mechanism [1]); - debug flexibility: no need to modify the kernel nor the bootloader setup to pass debug arguments to the kernel. == New dependencies == New dependencies are introduced only explicitly through the BOOTCONFIG_TASKS variable; tasks specified there become dependencies either for the initramfs image (if INITRAMFS_IMAGE is set) or the FIT image (if INITRAMFS_IMAGE is not set but FIT_INCLUDE_BOOTCONFIG is). Thank you in advance for any feedback on this! Best regards, Francesco [0] https://docs.kernel.org/admin-guide/bootconfig.html [1] https://docs.kernel.org/trace/boottime-trace.html Signed-off-by: Francesco Valla <[email protected]> --- Changes in v2: - Support for multiple bootconfigs - The bootconfig recipe has been renamed to linux-bootconfig-native; this tool is no more buildable for the target. - Link to v1: https://lore.kernel.org/r/[email protected] --- Francesco Valla (4): linux-bootconfig-native: add recipe image_types: add bootconfig conversion type recipes-test: add bootconfig-test recipe kernel-fit-image: add bootconfig support .../recipes-test/bootconfig/bootconfig-test.bb | 20 +++++++ .../bootconfig/bootconfig-test/bootconfig-test.txt | 6 +++ meta/classes-recipe/bootconfig-config.bbclass | 12 +++++ meta/classes-recipe/image_types.bbclass | 28 +++++++++- meta/classes-recipe/kernel-fit-image.bbclass | 48 +++++++++++++++-- meta/conf/image-fitimage.conf | 3 ++ meta/lib/oeqa/selftest/cases/fitimage.py | 63 +++++++++++++++++++--- .../linux-bootconfig/linux-bootconfig-native.bb | 31 +++++++++++ 8 files changed, 197 insertions(+), 14 deletions(-) --- base-commit: acf86cc2af1d08fdf191209f1462b2eafb53d3bb change-id: 20260318-bootconfig-47ebc0231153 Best regards, -- Francesco Valla <[email protected]>
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#234096): https://lists.openembedded.org/g/openembedded-core/message/234096 Mute This Topic: https://lists.openembedded.org/mt/118538130/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
