From 6ffd42548bf10cda13a01555ff4fa56d4213cdf2 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Thu, 22 Dec 2022 19:23:29 +0000 Subject: multiboot: Refactor boot data validation, add version numbers Instead of verifying the CRC before every access of the boot data, verify the CRC once at startup and set a flag to indicate the boot data is valid. Also add a framework to support multiple boot protocol versions. Firmware declares the maximum supported protocol version using a version byte in the boot data header. The bootloader chooses the highest version supported by it and the firmware when deciding what boot protocol to use. Change-Id: I810194625dc0833f026d2a23b8d64ed467fa6aca --- firmware/target/arm/pp/mi4-loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'firmware/target') diff --git a/firmware/target/arm/pp/mi4-loader.c b/firmware/target/arm/pp/mi4-loader.c index f609e3ff7a..14bb5e6f47 100644 --- a/firmware/target/arm/pp/mi4-loader.c +++ b/firmware/target/arm/pp/mi4-loader.c @@ -256,7 +256,7 @@ int load_mi4(unsigned char* buf, const char* firmware, unsigned int buffer_size) { ret = load_mi4_filename(buf, filename, buffer_size); /* if firmware has no boot_data don't load from external drive */ - if (write_bootdata(buf, ret, i) <= 0) + if (!write_bootdata(buf, ret, i)) ret = EKEY_NOT_FOUND; } /* if ret is valid breaks from loop to continue loading */ -- cgit v1.2.3