Page 1 of 1
AArch64 legacy BIOS boot
Posted: Mon Jul 08, 2024 8:09 am
by AverageOSEnjoyer
Hello all,
I have written a small OS in arm64 and have been testing it using QEMU. As part of the next step, I want to try booting on hardware, but the only thing available to me at the moment is a RK3588 which doesn't offer a UEFI boot option. Does anyone know how to get things like the memory map with BIOS + arm64? I saw a few things on doing it with x86 assembly but not much on arm64. Thanks for any help!
Re: AArch64 legacy BIOS boot
Posted: Mon Jul 08, 2024 10:24 am
by Octocontrabass
You haven't found anything because what you're looking for doesn't exist.
Back in the 80s, there were dozens of different x86 computer platforms, each with its own firmware. Nobody liked needing to buy different software for each computer, so "PC-compatible" systems that could run software intended for IBM PCs became really popular, and by the late 90s, if you bought an x86 computer anywhere in the world, it was a PC-compatible. ("BIOS" is actually a generic term, but only the PC-compatible BIOS stuck around long enough to be legacy.)
The same has not happened for ARM. There are dozens of different ARM platforms, each with its own firmware. If you want to write boot code for a particular ARM board, you'll need to find the documentation for that specific ARM board.
You might want to use
U-Boot instead of writing everything from scratch.
Re: AArch64 legacy BIOS boot
Posted: Mon Jul 08, 2024 6:57 pm
by qookie
Octocontrabass wrote: ↑Mon Jul 08, 2024 10:24 am
You might want to use
U-Boot instead of writing everything from scratch.
Worth noting is that in addition to letting you boot Linux boot protocol kernels, U-Boot also has a rudimentary EFI implementation (although it's not particularly good if memory serves).
Also to expand on Octocontrabass' answer, when booted by U-Boot (or anything else supporting the Linux boot proto.) you can get all the information you need from the device tree. It tells you about the available memory, CPU cores, all the system devices that exist, information provided by the bootloader (kernel cmdline, initrd address, etc).
Re: AArch64 legacy BIOS boot
Posted: Mon Jul 08, 2024 8:23 pm
by nexos
U-Boot also has a rudimentary EFI implementation (although it's not particularly good if memory serves).
I've made my bootloader compatible with U-Boot's UEFI. IIRC there are a few oddities with the block I/O protocol I had to work around, and a few glitches here and there with other protocols but for the most part it works fine. The biggest issue tough is that it's very finicky about what hardware it supports. Like some platforms that U-Boot can boot Linux on fine don't have any kind of UEFI support at all.