diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-12-22 20:31:06 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2024-03-31 16:57:19 +0100 |
commit | dc9d354ed22b4c6230c6bfe885e8a3d2519b1285 (patch) | |
tree | ae7e82354a3599bf3bb24cc25b341ba94d235375 /firmware/rolo.c | |
parent | 6ffd42548bf10cda13a01555ff4fa56d4213cdf2 (diff) | |
download | rockbox-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/rolo.c')
-rw-r--r-- | firmware/rolo.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/firmware/rolo.c b/firmware/rolo.c index 1b37b6f771..f9b0cc9e61 100644 --- a/firmware/rolo.c +++ b/firmware/rolo.c | |||
@@ -253,7 +253,26 @@ int rolo_load(const char* filename) | |||
253 | /* write the bootdata as if rolo were the bootloader | 253 | /* write the bootdata as if rolo were the bootloader |
254 | * FIXME: this won't work for root redirect... */ | 254 | * FIXME: this won't work for root redirect... */ |
255 | if (!strcmp(filename, BOOTDIR "/" BOOTFILE) && boot_data_valid) | 255 | if (!strcmp(filename, BOOTDIR "/" BOOTFILE) && boot_data_valid) |
256 | write_bootdata(filebuf, filebuf_size, boot_data.boot_volume); /* rb-loader.c */ | 256 | { |
257 | int volume = 0; | ||
258 | |||
259 | if (boot_data.version == 0) | ||
260 | volume = boot_data._boot_volume; | ||
261 | else if (boot_data.version == 1) | ||
262 | { | ||
263 | for (int i = 0; i < NUM_VOLUMES; ++i) | ||
264 | { | ||
265 | if (volume_drive(i) == boot_data.boot_drive && | ||
266 | volume_partition(i) == boot_data.boot_partition) | ||
267 | { | ||
268 | volume = i; | ||
269 | break; | ||
270 | } | ||
271 | } | ||
272 | } | ||
273 | |||
274 | write_bootdata(filebuf, filebuf_size, volume); | ||
275 | } | ||
257 | #endif | 276 | #endif |
258 | 277 | ||
259 | if (err <= 0) | 278 | if (err <= 0) |