mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
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
This commit is contained in:
parent
af644e02a1
commit
6ffd42548b
11 changed files with 150 additions and 59 deletions
|
|
@ -29,7 +29,6 @@
|
|||
#include "rb-loader.h"
|
||||
#include "multiboot.h"
|
||||
#include "bootdata.h"
|
||||
#include "crc32.h"
|
||||
#endif
|
||||
|
||||
#ifndef RB_ROOT_VOL_HIDDEN
|
||||
|
|
@ -144,8 +143,7 @@ static inline void volume_onmount_internal(IF_MV_NONVOID(int volume))
|
|||
char rtpath[MAX_PATH / 2];
|
||||
make_volume_root(volume, path);
|
||||
|
||||
unsigned int crc = crc_32(boot_data.payload, boot_data.length, 0xffffffff);
|
||||
if (crc > 0 && crc == boot_data.crc)
|
||||
if (boot_data_valid)
|
||||
{
|
||||
/* we need to mount the drive before we can access it */
|
||||
root_mount_path(path, 0); /* root could be different folder don't hide */
|
||||
|
|
@ -174,7 +172,7 @@ static inline void volume_onmount_internal(IF_MV_NONVOID(int volume))
|
|||
root_mount_path(rtpath, NSITEM_CONTENTS);
|
||||
}
|
||||
|
||||
} /*CRC OK*/
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_redirect:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue