From dc9d354ed22b4c6230c6bfe885e8a3d2519b1285 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Thu, 22 Dec 2022 20:31:06 +0000 Subject: multiboot: Add v1 boot protocol v1 passes the drive and partition number of the boot volume instead of using the volume number. The volume number isn't reliable because the same filesystem might get a different volume number once the firmware is loaded, which will cause the firmware to use the wrong root volume and fail to locate the correct .rockbox directory. Using drive and partition numbers avoids this issue because drive numbering is fixed and determined by the target. Change-Id: I7e68b892d9424a1f686197a6122e139b438e5f7e --- firmware/common/bootdata.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'firmware/common/bootdata.c') diff --git a/firmware/common/bootdata.c b/firmware/common/bootdata.c index fa74c5fe91..224a48d0c1 100644 --- a/firmware/common/bootdata.c +++ b/firmware/common/bootdata.c @@ -42,6 +42,20 @@ static bool verify_boot_data_v0(void) return true; } +static bool verify_boot_data_v1(void) INIT_ATTR; +static bool verify_boot_data_v1(void) +{ + /* validate protocol version */ + if (boot_data.version != 1) + return false; + + /* validate length */ + if (boot_data.length != 4) + return false; + + return true; +} + struct verify_bd_entry { int version; @@ -50,6 +64,7 @@ struct verify_bd_entry static const struct verify_bd_entry verify_bd[] INITDATA_ATTR = { { 0, verify_boot_data_v0 }, + { 1, verify_boot_data_v1 }, }; void verify_boot_data(void) -- cgit v1.2.3