1 | | I added some trace statements... and they solved this crash :'-( |
2 | | |
3 | | {{{ |
4 | | diff --git a/src/system/boot/loader/loader.cpp b/src/system/boot/loader/loader.cpp |
5 | | index 32e1a064df..fd8a476044 100644 |
6 | | --- a/src/system/boot/loader/loader.cpp |
7 | | +++ b/src/system/boot/loader/loader.cpp |
8 | | @@ -116,10 +116,13 @@ load_kernel(stage2_args* args, BootVolume& volume) |
9 | | |
10 | | dprintf("load kernel %s...\n", name); |
11 | | |
12 | | + dprintf("FLOW: elf_init()\n"); |
13 | | elf_init(); |
14 | | preloaded_image *image; |
15 | | + dprintf("FLOW: elf_load_image()\n"); |
16 | | status_t status = elf_load_image(fd, &image); |
17 | | |
18 | | + dprintf("FLOW: close()\n"); |
19 | | close(fd); |
20 | | |
21 | | if (status < B_OK) { |
22 | | @@ -127,14 +130,17 @@ load_kernel(stage2_args* args, BootVolume& volume) |
23 | | return status; |
24 | | } |
25 | | |
26 | | + dprintf("FLOW: kernel_image == image\n"); |
27 | | gKernelArgs.kernel_image = image; |
28 | | |
29 | | + dprintf("FLOW: elf_relocate_image\n"); |
30 | | status = elf_relocate_image(gKernelArgs.kernel_image); |
31 | | if (status < B_OK) { |
32 | | dprintf("relocating kernel failed: %" B_PRIx32 "!\n", status); |
33 | | return status; |
34 | | } |
35 | | |
36 | | + dprintf("FLOW: name = kernel_args_strdup\n"); |
37 | | gKernelArgs.kernel_image->name = kernel_args_strdup(name); |
38 | | |
39 | | return B_OK; |
40 | | diff --git a/src/system/boot/loader/main.cpp b/src/system/boot/loader/main.cpp |
41 | | index d6b81182f9..d02abb38c4 100644 |
42 | | --- a/src/system/boot/loader/main.cpp |
43 | | +++ b/src/system/boot/loader/main.cpp |
44 | | @@ -19,7 +19,7 @@ |
45 | | #include "file_systems/packagefs/packagefs.h" |
46 | | |
47 | | |
48 | | -//#define TRACE_MAIN |
49 | | +#define TRACE_MAIN |
50 | | #ifdef TRACE_MAIN |
51 | | # define TRACE(x) dprintf x |
52 | | #else |
53 | | @@ -113,20 +113,25 @@ main(stage2_args *args) |
54 | | } |
55 | | } |
56 | | |
57 | | + TRACE(("load_kernel B_OK!\n")); |
58 | | + |
59 | | // if everything is okay, continue booting; the kernel |
60 | | // is already loaded at this point and we definitely |
61 | | // know our boot volume, too |
62 | | if (status == B_OK) { |
63 | | + TRACE(("FLOW: bootVolume IsPackaged\n")); |
64 | | if (bootVolume.IsPackaged()) { |
65 | | packagefs_apply_path_blocklist(bootVolume.SystemDirectory(), |
66 | | pathBlocklist); |
67 | | } |
68 | | |
69 | | + TRACE(("FLOW: register_boot_file_system\n")); |
70 | | register_boot_file_system(bootVolume); |
71 | | |
72 | | if ((platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) == 0) |
73 | | platform_switch_to_logo(); |
74 | | |
75 | | + TRACE(("FLOW: load_modules\n")); |
76 | | load_modules(args, bootVolume); |
77 | | |
78 | | gKernelArgs.ucode_data = NULL; |
79 | | @@ -139,12 +144,15 @@ main(stage2_args *args) |
80 | | apply_boot_settings(); |
81 | | #endif |
82 | | |
83 | | + TRACE(("FLOW: kernel_args setup\n")); |
84 | | + |
85 | | // set up kernel args version info |
86 | | gKernelArgs.kernel_args_size = sizeof(kernel_args); |
87 | | gKernelArgs.version = CURRENT_KERNEL_ARGS_VERSION; |
88 | | if (gKernelArgs.ucode_data == NULL) |
89 | | gKernelArgs.kernel_args_size = kernel_args_size_v1; |
90 | | |
91 | | + TRACE(("FLOW: clone boot_volume\n")); |
92 | | // clone the boot_volume KMessage into kernel accessible memory |
93 | | // note, that we need to 8-byte align the buffer and thus allocate |
94 | | // 7 more bytes |
95 | | @@ -154,6 +162,7 @@ main(stage2_args *args) |
96 | | "arguments"); |
97 | | } |
98 | | |
99 | | + TRACE(("FLOW: buffer stuff\n")); |
100 | | buffer = (void*)(((addr_t)buffer + 7) & ~(addr_t)0x7); |
101 | | memcpy(buffer, gBootVolume.Buffer(), gBootVolume.ContentSize()); |
102 | | gKernelArgs.boot_volume = buffer; |
103 | | @@ -162,6 +171,7 @@ main(stage2_args *args) |
104 | | platform_cleanup_devices(); |
105 | | // TODO: cleanup, heap_release() etc. |
106 | | heap_print_statistics(); |
107 | | + TRACE(("FLOW: platform start kernel\n")); |
108 | | platform_start_kernel(); |
109 | | } |
110 | | } |
111 | | }}} |
| 1 | I started doing a debug build of our kernel, and the -O0 it sets seems to solve the early boot issue we see on qemu after the gcc 11 upgrade. |