AArch64 legacy BIOS boot

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
AverageOSEnjoyer
Posts: 1
Joined: Wed Jul 03, 2024 1:35 pm
Libera.chat IRC: Dinkleberg

AArch64 legacy BIOS boot

Post 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!
Octocontrabass
Member
Member
Posts: 5560
Joined: Mon Mar 25, 2013 7:01 pm

Re: AArch64 legacy BIOS boot

Post 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.
User avatar
qookie
Member
Member
Posts: 72
Joined: Sun Apr 30, 2017 12:16 pm
Libera.chat IRC: qookie
Location: Poland

Re: AArch64 legacy BIOS boot

Post 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).
Working on managarm.
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: AArch64 legacy BIOS boot

Post 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.
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
Post Reply