Kernel: Zero out .bss contents on aarch64

After building and running

     objcopy -O binary Build/aarch64/Kernel/Prekernel/Prekernel \
                       /media/sdcard/kernel8.img

things start booting on an actual RPi4 :^)

(Assuming the sdcard contains RPi firmware, an empty config.txt,
and no other kernel*.img files).
This commit is contained in:
Nico Weber 2021-09-30 09:36:43 -04:00 committed by Linus Groh
parent 715f9666f2
commit d0c1db5efc
Notes: sideshowbarker 2024-07-18 03:17:25 +09:00
2 changed files with 12 additions and 0 deletions

View File

@ -21,6 +21,14 @@ start:
ldr x14, =start
mov sp, x14
// Clear BSS.
ldr x14, =start_of_bss
ldr x15, =size_of_bss_divided_by_8
Lbss_clear_loop:
str xzr, [x14], #8
subs x15, x15, #1
bne Lbss_clear_loop
b init
.globl wait_cycles

View File

@ -29,6 +29,10 @@ SECTIONS
.bss ALIGN(4K) (NOLOAD) : AT (ADDR(.bss))
{
start_of_bss = .;
*(.bss)
end_of_bss = .;
} :bss
}
size_of_bss_divided_by_8 = (end_of_bss - start_of_bss) / 8;