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/rolo.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'firmware/rolo.c') 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) /* write the bootdata as if rolo were the bootloader * FIXME: this won't work for root redirect... */ if (!strcmp(filename, BOOTDIR "/" BOOTFILE) && boot_data_valid) - write_bootdata(filebuf, filebuf_size, boot_data.boot_volume); /* rb-loader.c */ + { + int volume = 0; + + if (boot_data.version == 0) + volume = boot_data._boot_volume; + else if (boot_data.version == 1) + { + for (int i = 0; i < NUM_VOLUMES; ++i) + { + if (volume_drive(i) == boot_data.boot_drive && + volume_partition(i) == boot_data.boot_partition) + { + volume = i; + break; + } + } + } + + write_bootdata(filebuf, filebuf_size, volume); + } #endif if (err <= 0) -- cgit v1.2.3