diff options
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r-- | apps/debug_menu.c | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 5b73f8badd..5e2451e41b 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -2530,38 +2530,31 @@ static bool dbg_pic(void) | |||
2530 | #if defined(HAVE_BOOTDATA) && !defined(SIMULATOR) | 2530 | #if defined(HAVE_BOOTDATA) && !defined(SIMULATOR) |
2531 | static bool dbg_boot_data(void) | 2531 | static bool dbg_boot_data(void) |
2532 | { | 2532 | { |
2533 | unsigned int crc = crc_32(boot_data.payload, boot_data.length, 0xffffffff); | ||
2534 | struct simplelist_info info; | 2533 | struct simplelist_info info; |
2535 | info.scroll_all = true; | 2534 | info.scroll_all = true; |
2536 | simplelist_info_init(&info, "Boot data", 1, NULL); | 2535 | simplelist_info_init(&info, "Boot data", 1, NULL); |
2537 | simplelist_set_line_count(0); | 2536 | simplelist_set_line_count(0); |
2538 | 2537 | ||
2539 | #if defined(HAVE_MULTIBOOT) | 2538 | if (!boot_data_valid) |
2540 | char rootpath[MAX_PATH / 2] = RB_ROOT_CONTENTS_DIR; | ||
2541 | int boot_volume = 0; | ||
2542 | if(crc == boot_data.crc) | ||
2543 | { | 2539 | { |
2544 | boot_volume = boot_data.boot_volume; /* boot volume contained in uint8_t payload */ | 2540 | simplelist_addline("Boot data invalid"); |
2545 | int rtlen = get_redirect_dir(rootpath, sizeof(rootpath), boot_volume, "", ""); | 2541 | simplelist_addline("Magic[0]: %08lx", boot_data.magic[0]); |
2546 | while (rtlen > 0 && rootpath[--rtlen] == PATH_SEPCH) /* remove extra separators */ | 2542 | simplelist_addline("Magic[1]: %08lx", boot_data.magic[1]); |
2547 | rootpath[rtlen] = '\0'; | 2543 | simplelist_addline("Length: %lu", boot_data.length); |
2548 | } | 2544 | } |
2549 | simplelist_addline("Boot Volume: <%lu>", boot_volume); | 2545 | else |
2550 | simplelist_addline("Root:"); | 2546 | { |
2551 | simplelist_addline("%s", rootpath); | 2547 | simplelist_addline("Boot data valid"); |
2552 | simplelist_addline(""); | 2548 | simplelist_addline("Version: %d", (int)boot_data.version); |
2553 | #endif | 2549 | simplelist_addline("Boot volume: %d", (int)boot_data.boot_volume); |
2550 | } | ||
2551 | |||
2554 | simplelist_addline("Bootdata RAW:"); | 2552 | simplelist_addline("Bootdata RAW:"); |
2555 | if (crc != boot_data.crc) | 2553 | for (size_t i = 0; i < boot_data.length; i += 4) |
2556 | simplelist_addline("Magic: %.8s", boot_data.magic); | ||
2557 | simplelist_addline("Length: %lu", boot_data.length); | ||
2558 | simplelist_addline("CRC: %lx", boot_data.crc); | ||
2559 | (crc == boot_data.crc) ? simplelist_addline("CRC: OK!") : | ||
2560 | simplelist_addline("CRC: BAD"); | ||
2561 | for (unsigned i = 0; i < boot_data.length; i += 4) | ||
2562 | { | 2554 | { |
2563 | simplelist_addline("%02x: %02x %02x %02x %02x", i, boot_data.payload[i], | 2555 | simplelist_addline("%02x: %02x %02x %02x %02x", i, |
2564 | boot_data.payload[i+1], boot_data.payload[i+2], boot_data.payload[i+3]); | 2556 | boot_data.payload[i + 0], boot_data.payload[i + 1], |
2557 | boot_data.payload[i + 2], boot_data.payload[i + 3]); | ||
2565 | } | 2558 | } |
2566 | 2559 | ||
2567 | return simplelist_show_list(&info); | 2560 | return simplelist_show_list(&info); |