image: integrate the secure initramfs generator

This change wires the secure initramfs generator into the image
pipeline. It also introduces a load address for the initrd in FITs and
aligns kernel config handling for initramfs compression.

- include/image.mk:
  * Rewrite Image/SecureInitramfs as a traced shell block with clearer
    variables and debug output.
  * Add explicit `secure-initramfs` phony target and run it before
    `kernel_prepare`.
  * Keep existing initramfs kernel/ramdisk artifacts flow intact.

Closes: PCF-1893
Tracked-by: FEAT-29
Signed-off-by: Mohamed-nour Toumi <mohamed.toumi_ext@softathome.com>
This commit is contained in:
Mohamed-nour Toumi 2025-10-31 12:22:15 +01:00 committed by Petr Štetiar
parent b8ba3aecc3
commit 0832a9abc7
No known key found for this signature in database
GPG Key ID: 58EE120F30CC02D3

View File

@ -158,12 +158,26 @@ define prepare_generic_squashfs
endef
define Image/SecureInitramfs
UNSTRIPPED_FOLDER=$(STAGING_DIR_ROOT) \
BINARIES_PATH=$(CONFIG_TARGET_INIT_PATH) \
$(TOPDIR)/scripts/gen-secure-initramfs.sh build \
$(call get_initramfs_compression,CONFIG_TARGET_SECURE_INITRAMFS_COMPRESSION_) \
$(BIN_DIR)/$(IMG_SECURE_INITRAMFS) \
$(STAGING_DIR_IMAGE)/initramfs $(TARGET_DIR)
@{ \
set -eu; \
comp="$(call get_initramfs_compression,CONFIG_TARGET_SECURE_INITRAMFS_COMPRESSION_)"; \
out="$(BIN_DIR)/$(IMG_SECURE_INITRAMFS)"; \
initramfs_dir="$(STAGING_DIR_IMAGE)/initramfs"; \
rootfs_dir="$(TARGET_DIR)"; \
echo "[SecureInitramfs] UNSTRIPPED_FOLDER=$(STAGING_DIR_ROOT)"; \
echo "[SecureInitramfs] BINARIES_PATH=$(CONFIG_TARGET_INIT_PATH)"; \
printf '[SecureInitramfs] COMPRESSION => %q\n' "$$$$comp"; \
printf '[SecureInitramfs] OUTPUT => %q\n' "$$$$out"; \
printf '[SecureInitramfs] INITRAMFS => %q\n' "$$$$initramfs_dir"; \
printf '[SecureInitramfs] ROOTFS => %q\n' "$$$$rootfs_dir"; \
PS4='+ [SecureInitramfs] $${0##*/}:$${LINENO}: '; set -x; \
UNSTRIPPED_FOLDER="$(STAGING_DIR_ROOT)" \
BINARIES_PATH="$(CONFIG_TARGET_INIT_PATH)" \
"$(TOPDIR)/scripts/gen-secure-initramfs.sh" build \
"$$$$comp" \
"$$$$out" \
"$$$$initramfs_dir" "$$$$rootfs_dir"; \
}
endef
define Image/BuildKernel/Initramfs
@ -956,7 +970,7 @@ define BuildImage
image_prepare:
ifeq ($(IB),)
.PHONY: download prepare compile compile-dtb clean image_prepare kernel_prepare install install-images
.PHONY: download prepare compile compile-dtb clean image_prepare kernel_prepare install install-images secure-initramfs
compile:
$(call Build/Compile)
@ -975,13 +989,16 @@ define BuildImage
mkdir -p $(BIN_DIR) $(KDIR)/tmp
endif
kernel_prepare: image_prepare
secure-initramfs:
ifeq ($(CONFIG_TARGET_SECURE_INITRAMFS),y)
$(call Image/SecureInitramfs)
endif
kernel_prepare: secure-initramfs image_prepare
$(call Image/Build/targz)
$(call Image/Build/cpiogz)
$(call Image/BuildKernel)
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$(if $(IB),,$(call Image/BuildKernel/Initramfs)))
$(call Image/InstallKernel)
$(if $(CONFIG_TARGET_SECURE_INITRAMFS),$(call Image/SecureInitramfs))
$(foreach device,$(TARGET_DEVICES),$(call Device,$(device)))