recovery: add initramfs into FIT recovery image

This commit adds the initramfs into the FIT recovery
image. If the RAM disk image is included in the FIT
image we need to create a initramfs file that doesn't
include the u-boot header, because the FIT descriptor
contains all the necessary information to use the
initramfs file.

https://onedigi.atlassian.net/browse/DEL-9168

Signed-off-by: Mike Engel <Mike.Engel@digi.com>
This commit is contained in:
Mike Engel 2024-08-09 14:57:45 +02:00
parent 4c33a85d6b
commit 11426fcb5b
9 changed files with 38 additions and 8 deletions

View File

@ -89,7 +89,7 @@ do_image_boot_ubifs[depends] += " \
IMAGE_CMD:boot.ubifs() { IMAGE_CMD:boot.ubifs() {
BOOTIMG_FILES_SYMLINK="${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin" BOOTIMG_FILES_SYMLINK="${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin"
# Exclude DTB and DTBO from UBIFS image when creating a FIT image # Exclude DTB and DTBO from final image, when creating a FIT file
if [ "${KERNEL_IMAGETYPE}" != "fitImage" ]; then if [ "${KERNEL_IMAGETYPE}" != "fitImage" ]; then
if [ -n "${KERNEL_DEVICETREE}" ]; then if [ -n "${KERNEL_DEVICETREE}" ]; then
for DTB in ${KERNEL_DEVICETREE}; do for DTB in ${KERNEL_DEVICETREE}; do
@ -116,7 +116,7 @@ IMAGE_CMD:boot.ubifs() {
ln ${orig} ${TMP_BOOTDIR}/$(basename ${item}) ln ${orig} ${TMP_BOOTDIR}/$(basename ${item})
done done
# Exclude boot scripts from UBIFS image when creating a FIT image # Exclude boot scripts from final image, when creating a FIT file
if [ "${KERNEL_IMAGETYPE}" != "fitImage" ]; then if [ "${KERNEL_IMAGETYPE}" != "fitImage" ]; then
# Hard-link boot scripts into the temporary folder # Hard-link boot scripts into the temporary folder
for item in ${BOOT_SCRIPTS}; do for item in ${BOOT_SCRIPTS}; do
@ -167,8 +167,12 @@ do_image_recovery_ubifs[depends] += " \
" "
IMAGE_CMD:recovery.ubifs() { IMAGE_CMD:recovery.ubifs() {
if [ "${KERNEL_IMAGETYPE}" = "fitImage" ]; then
RECOVERYIMG_FILES_SYMLINK="${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${RECOVERY_INITRAMFS_IMAGE}-${MACHINE}-${MACHINE}"
else
RECOVERYIMG_FILES_SYMLINK="${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin" RECOVERYIMG_FILES_SYMLINK="${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin"
# Exclude DTB and DTBO from VFAT image when creating a FIT image fi
# Exclude DTB and DTBO from final image, when creating a FIT file
if [ "${KERNEL_IMAGETYPE}" != "fitImage" ]; then if [ "${KERNEL_IMAGETYPE}" != "fitImage" ]; then
if [ -n "${KERNEL_DEVICETREE}" ]; then if [ -n "${KERNEL_DEVICETREE}" ]; then
for DTB in ${KERNEL_DEVICETREE}; do for DTB in ${KERNEL_DEVICETREE}; do
@ -190,15 +194,17 @@ IMAGE_CMD:recovery.ubifs() {
ln ${orig} ${TMP_RECOVERYDIR}/$(basename ${item}) ln ${orig} ${TMP_RECOVERYDIR}/$(basename ${item})
done done
# Exclude bootscript from VFAT image when creating a FIT image # Exclude bootscript from final image when creating a FIT file
if [ "${KERNEL_IMAGETYPE}" != "fitImage" ]; then if [ "${KERNEL_IMAGETYPE}" = "fitImage" ]; then
# rename FITimage to u-boot default kernel load name
mv ${TMP_RECOVERYDIR}/${KERNEL_IMAGETYPE}-${RECOVERY_INITRAMFS_IMAGE}-${MACHINE}-${MACHINE} ${TMP_RECOVERYDIR}/${KERNEL_IMAGETYPE}-${MACHINE}.bin
else
# Hard-link boot scripts into the temporary folder # Hard-link boot scripts into the temporary folder
for item in ${BOOT_SCRIPTS}; do for item in ${BOOT_SCRIPTS}; do
src="$(echo ${item} | awk -F':' '{ print $1 }')" src="$(echo ${item} | awk -F':' '{ print $1 }')"
dst="$(echo ${item} | awk -F':' '{ print $2 }')" dst="$(echo ${item} | awk -F':' '{ print $2 }')"
ln ${DEPLOY_DIR_IMAGE}/${src} ${TMP_RECOVERYDIR}/${dst} ln ${DEPLOY_DIR_IMAGE}/${src} ${TMP_RECOVERYDIR}/${dst}
done done
# Copy the recovery initramfs into the temporary folder # Copy the recovery initramfs into the temporary folder
cp ${DEPLOY_DIR_IMAGE}/${RECOVERY_INITRAMFS_IMAGE}-${MACHINE}.cpio.gz.u-boot.tf ${TMP_RECOVERYDIR}/uramdisk-recovery.img cp ${DEPLOY_DIR_IMAGE}/${RECOVERY_INITRAMFS_IMAGE}-${MACHINE}.cpio.gz.u-boot.tf ${TMP_RECOVERYDIR}/uramdisk-recovery.img
fi fi

View File

@ -16,6 +16,9 @@ UBOOT_SUFFIX = "imx"
BOOTABLE_FILENAME = "${UBOOT_PREFIX}-${MACHINE}.${UBOOT_SUFFIX}" BOOTABLE_FILENAME = "${UBOOT_PREFIX}-${MACHINE}.${UBOOT_SUFFIX}"
SDIMG_BOOTLOADER = "${DEPLOY_DIR_IMAGE}/${BOOTABLE_FILENAME}" SDIMG_BOOTLOADER = "${DEPLOY_DIR_IMAGE}/${BOOTABLE_FILENAME}"
# Set InitRAMDisk load address to U-boot initramfs_addr
UBOOT_RD_LOADADDRESS = "0x19000000"
# Linux kernel configuration # Linux kernel configuration
KERNEL_DEFCONFIG ?= "arch/arm/configs/ccimx6sbc_defconfig" KERNEL_DEFCONFIG ?= "arch/arm/configs/ccimx6sbc_defconfig"

View File

@ -16,6 +16,9 @@ INIT_MANAGER ?= "sysvinit"
UBOOT_PREFIX = "u-boot" UBOOT_PREFIX = "u-boot"
UBOOT_SUFFIX = "imx" UBOOT_SUFFIX = "imx"
# Set InitRAMDisk load address to U-boot initramfs_addr
UBOOT_RD_LOADADDRESS = "0x83800000"
STORAGE_MEDIA = "mtd" STORAGE_MEDIA = "mtd"
# Wireless external module # Wireless external module

View File

@ -17,6 +17,9 @@ BOOTLOADER_IMAGE_RECIPE = "imx-boot"
BOOTABLE_FILENAME = "${UBOOT_PREFIX}-${MACHINE}.bin" BOOTABLE_FILENAME = "${UBOOT_PREFIX}-${MACHINE}.bin"
SDIMG_BOOTLOADER = "${DEPLOY_DIR_IMAGE}/${BOOTABLE_FILENAME}" SDIMG_BOOTLOADER = "${DEPLOY_DIR_IMAGE}/${BOOTABLE_FILENAME}"
# Set InitRAMDisk load address to U-boot initramfs_addr
UBOOT_RD_LOADADDRESS = "0x43800000"
# LPDDR4 firmware # LPDDR4 firmware
DDR_FIRMWARE_NAME = " \ DDR_FIRMWARE_NAME = " \
lpddr4_pmu_train_1d_imem.bin \ lpddr4_pmu_train_1d_imem.bin \

View File

@ -13,6 +13,9 @@ include conf/machine/include/arm/armv8a/tune-cortexa35.inc
UBOOT_PREFIX = "imx-boot" UBOOT_PREFIX = "imx-boot"
UBOOT_SUFFIX = "bin" UBOOT_SUFFIX = "bin"
# Set InitRAMDisk load address to U-boot initrd_addr
UBOOT_RD_LOADADDRESS = "0x8A100000"
# The bootloader image that gets flashed consists of U-Boot and several fw binaries # The bootloader image that gets flashed consists of U-Boot and several fw binaries
EXTRA_IMAGEDEPENDS += "imx-boot" EXTRA_IMAGEDEPENDS += "imx-boot"
BOOTLOADER_IMAGE_RECIPE = "imx-boot" BOOTLOADER_IMAGE_RECIPE = "imx-boot"

View File

@ -15,6 +15,9 @@ UBOOT_ENV = "boot"
UBOOT_PREFIX = "imx-boot" UBOOT_PREFIX = "imx-boot"
UBOOT_SUFFIX = "bin" UBOOT_SUFFIX = "bin"
# Set InitRAMDisk load address to U-boot initrd_addr
UBOOT_RD_LOADADDRESS = "0x83800000"
# Platform kernel settings (keep the override as otherwise KERNEL_IMAGETYPE # Platform kernel settings (keep the override as otherwise KERNEL_IMAGETYPE
# from imx-digi-base.inc takes precedence) # from imx-digi-base.inc takes precedence)
KERNEL_CLASSES = "kernel-fitimage" KERNEL_CLASSES = "kernel-fitimage"

View File

@ -42,6 +42,9 @@ UBOOT_ENV_SIZE ?= "0x20000"
# available space in the environment partition) # available space in the environment partition)
UBOOT_ENV_RANGE ?= "" UBOOT_ENV_RANGE ?= ""
# Set InitRAMDisk load address to U-boot initrd_addr
UBOOT_RD_LOADADDRESS = "0xc4400000"
# OPTEE runtime packages to install # OPTEE runtime packages to install
OPTEE_PKGS ??= "optee-client" OPTEE_PKGS ??= "optee-client"

View File

@ -37,6 +37,8 @@ GRAPHICAL_BACKEND = "${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwa
# Recovery initramfs image name. # Recovery initramfs image name.
RECOVERY_INITRAMFS_IMAGE ?= "dey-image-recovery-initramfs" RECOVERY_INITRAMFS_IMAGE ?= "dey-image-recovery-initramfs"
# Add initramfs into FIT image
INITRAMFS_IMAGE = '${@bb.utils.contains("KERNEL_IMAGETYPE", "fitImage", "${RECOVERY_INITRAMFS_IMAGE}", "", d)}'
# DEY image features (alphabetical order) # DEY image features (alphabetical order)
FEATURE_PACKAGES_dey-audio = "packagegroup-dey-audio" FEATURE_PACKAGES_dey-audio = "packagegroup-dey-audio"

View File

@ -20,6 +20,10 @@ IMAGE_FEATURES = ""
IMAGE_LINGUAS = "" IMAGE_LINGUAS = ""
python() { python() {
# If Kernel image is FIT create different initramfs file without u-boot header
if (d.getVar("KERNEL_IMAGETYPE") == "fitImage"):
d.setVar('IMAGE_FSTYPES', 'cpio.gz')
else:
d.setVar('IMAGE_FSTYPES', 'cpio.gz.u-boot.tf') d.setVar('IMAGE_FSTYPES', 'cpio.gz.u-boot.tf')
} }