It is a yocto bsp layer for loongson machines. We make minimal changes to add support to upstream poky repository to support loongarch(mainly the qemuloongarch64 machine for now), combine with this layers, we can build a working os for loongarch64.
- clone the modified poky code.
git clone -b loongarch https://github.com/foxsen/poky
- clone this repository in the poky top level directory
cd poky
git clone https://github.com/foxsen/meta-loongson
git checkout loongarch
- setup the environment
export MACHINE=loongarch64
source oe-init-build-env
<make necessary changes, see the following notes>
bitbake core-image-minimal
For changes to configuration, you can refer to meta-loongson/conf/{bblayers.conf.sample,local.conf.sample}
- run and test
If everything goes smooth, you can get a working image for loongarch. Test it with qemu:
runqemu
or
runqemu nographic serialstdio
- generate sdk
bitbake -c populate_sdk core-image-minimal
Again, I am trying hard to keep the modification minimal.
-
Some upstream packages need some patches to support loongarch. They are:
- libffi
- diffutils
- openssl
-
We are using a custom linux kernel, because the latest yocto kernel is 5.19 which does not have full support for loongarch. This is not a perfect solution. We can try to add patches to the yocto 5.19 kernel, or waiting for newer kernel(upstream v6.1 should fully support loongarch64).
-
qemu-system-loongarch64 need a bios. For now the edk2-loongarch recipe provide its binary. Should be changed to build from source. Poky has ovmf recipe but it does not support loongarch yet.
-
conf and sample configurations