Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anti-rollback protection support #1072

Merged
merged 10 commits into from
Apr 10, 2023
Prev Previous commit
Next Next commit
base: uboot-fitimage.bbclass: add bootfirmware version to U-Boot DTB
Add LMP_BOOT_FIRMWARE_VERSION value to U-Boot device tree blob before
final FIT creation.

Example of a node (added to /firmware):

bootloader {
    bootfirmware-version = "147";
    compatible = "lmp,bootloader";
};

Signed-off-by: Igor Opaniuk <[email protected]>
igoropaniuk committed Mar 30, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 24c426daebfe3ce0e75dc5b0d931562bc5cb8ae5
10 changes: 10 additions & 0 deletions meta-lmp-base/classes/uboot-fitimage.bbclass
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@

inherit kernel-arch

DEPENDS += "dtc-native"

# Share same key as used by U-Boot by default
UBOOT_SPL_SIGN_ENABLE ??= "${UBOOT_SIGN_ENABLE}"
UBOOT_SPL_SIGN_KEYNAME ??= "${UBOOT_SIGN_KEYNAME}"
@@ -247,6 +249,14 @@ EOF
};
EOF

# Add boot firmware version to U-Boot DTB (if it's defined and is not zero)
if [ -n "${LMP_BOOT_FIRMWARE_VERSION}" -a "${LMP_BOOT_FIRMWARE_VERSION}" != "0" ]; then
# Might return "FDT_ERR_EXISTS" error, if "lmp" node already exists
fdtput -c -t s ${uboot_dtb} /firmware/bootloader || true
fdtput -t s ${uboot_dtb} /firmware/bootloader compatible "lmp,bootloader"
fdtput -t s ${uboot_dtb} /firmware/bootloader bootfirmware-version "${LMP_BOOT_FIRMWARE_VERSION}"
fi

# Assemble the ITB image
tools/mkimage -f u-boot.its ${1}
}