summaryrefslogtreecommitdiff
path: root/firmware/common/bootdata.c
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-12-22 20:31:06 +0000
committerAidan MacDonald <amachronic@protonmail.com>2024-03-31 16:57:19 +0100
commitdc9d354ed22b4c6230c6bfe885e8a3d2519b1285 (patch)
treeae7e82354a3599bf3bb24cc25b341ba94d235375 /firmware/common/bootdata.c
parent6ffd42548bf10cda13a01555ff4fa56d4213cdf2 (diff)
downloadrockbox-dc9d354ed22b4c6230c6bfe885e8a3d2519b1285.tar.gz
rockbox-dc9d354ed22b4c6230c6bfe885e8a3d2519b1285.zip
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
Diffstat (limited to 'firmware/common/bootdata.c')
-rw-r--r--firmware/common/bootdata.c15
1 files changed, 15 insertions, 0 deletions
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)
42 return true; 42 return true;
43} 43}
44 44
45static bool verify_boot_data_v1(void) INIT_ATTR;
46static bool verify_boot_data_v1(void)
47{
48 /* validate protocol version */
49 if (boot_data.version != 1)
50 return false;
51
52 /* validate length */
53 if (boot_data.length != 4)
54 return false;
55
56 return true;
57}
58
45struct verify_bd_entry 59struct verify_bd_entry
46{ 60{
47 int version; 61 int version;
@@ -50,6 +64,7 @@ struct verify_bd_entry
50 64
51static const struct verify_bd_entry verify_bd[] INITDATA_ATTR = { 65static const struct verify_bd_entry verify_bd[] INITDATA_ATTR = {
52 { 0, verify_boot_data_v0 }, 66 { 0, verify_boot_data_v0 },
67 { 1, verify_boot_data_v1 },
53}; 68};
54 69
55void verify_boot_data(void) 70void verify_boot_data(void)