How can i run bare metal linux on unmatched board?

Hi,
I want to run bare metal linux (without mmu), on the unmatched board. But I can’t managed to do it. The manual of unmatched shows that it needs opensbi in partition2, but opensbi don’t support bare metal linux. So i wonder how can i run it?

1 Like

The board does not require opensbi in partition 2. Rather, the normal linux boot process is to use u-boot SPL as the first stage bootloader, loaded from a partition with a specific type/id which can be any partition number, which then loads opensbi from a partition with a specific type/id which can be any partition number. The linux kernel normally runs in S mode and does not have access to M mode hardware. It uses opensbi for that. So either you need to run the kernel in M mode, or else you use opensbi to handle M accesses from S, or you provide some other equivalent mechanism. Also, you are free to use boot loaders other than u-boot which may work differently.

The only RISC-V nommu linux port I know of is the one for the Kendryte K210 done by Western Digital. I think most of the patches were upstreamed, but it is unlikely that anyone is actively using it, so it may not be in a useful state at this time. You might be able to port that to the Unmatched board, but it is likely a fair amount of work. You can find info for this in various places, e.g.
https://www.cnx-software.com/2020/02/17/how-to-build-run-linux-on-kendryte-k210-risc-v-nommu-processor/
https://github.com/vowstar/k210-linux-nommu

I’ve never tried the K210 nommu linux port, so I don’t know how it works. Maybe it runs in M mode which makes opensbi unnecessary?

1 Like