Hi everyone,

I'm the guy who previously announced the Gentoo/LoongArch port [1]; since that post, some nice progress has been made, and here's a heads-up and a procedural question regarding how to continue work upstream.


## Progress of the port

After some minimal forking and tweaking, it's already possible to build working stage3 tarballs with catalyst; with quick-and-dirty catalyst[2] and genkernel[3] patches, even working installation CDs can be built (confirmed by LiveUSB-making and booting on real 3A5000 hardware). The built stages and installation CD images are already available in several mirrors like [4] or [5].

The toolchain development of Loongson has gone more-or-less quiet lately, and many projects (eselect, icu, systemd, etc.) have already had releases that contain LoongArch bring-up changes, so it's time to push more things upstream (in this case, the main gentoo.git repo).


## How to test this?

The necessary changes are all brewing in the loongson-overlay[6], which is available via layman (`sudo layman -a loongson`). You'll need this for the loong profile and toolchain patches.

The stages can be tested with QEMU linux-user emulation, if you don't have the LoongArch hardware; but the LoongArch target is not upstream yet, so you'll have to compile Loongson's fork ([7]; qemu-devel threads [8] [9]) yourself. The necessary binfmt-misc declaration is like this (remove all whitespaces and newlines before using):

> :loongarch64:M::
> \x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x01:
> \xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff
> \xff\xff:/usr/local/bin/qemu-loongarch64:

You can use your favorite way to set up this (manually, via rc-scripts, via systemd-binfmt.service, whatever), replacing the interpreter path to suit your setup, then just proceed like every chroot.

Inside the chroot, you need to `git clone` the loongson-overlay, add it to /etc/portage/repos.conf, and fix the profile symlink; after that you should be able to emerge packages as usual. Keywords are mostly missing, so you may use ACCEPT_KEYWORDS=~riscv or something similar to get through, in case everything is masked and not package.accept_keywords-ed.

Note that their system emulation is currently in a worse state than linux-user (horribly slow and dependent on prebuilt firmware blob), according to review comments, so you may as well ignore the installation CDs for now.


## Problem regarding further upstream work

As described above, there is already some nice progress, but a procedural problem still remains: every new architecture needs a backing project and arch team [10], yet I'm not a Gentoo dev and it's unclear if any Gentoo dev would be interested in such a niche architecture with limited hardware availability outside China, so we may get stuck in this state for an extended period.

Any suggestion is welcome; and thank you for your attention.


Regards,
WANG "xen0n" Xuerui


[1]: https://archives.gentoo.org/gentoo-dev/message/ef0b1812e9b66cdf5978ecc2ad4eda4e
[2]: https://github.com/xen0n/catalyst/tree/3.0.20-for-loong
[3]: https://github.com/xen0n/genkernel/tree/loong
[4]: https://mirrors.tuna.tsinghua.edu.cn/loongson/gentoo/experimental/
[5]: https://mirrors.bfsu.edu.cn/loongson/gentoo/experimental/
[6]: https://github.com/xen0n/loongson-overlay
[7]: https://github.com/loongson/qemu/tree/tcg-dev
[8]: https://patchew.org/QEMU/1638610165-15036-1-git-send-email-gaos...@loongson.cn/ [9]: https://patchew.org/QEMU/1638619645-11283-1-git-send-email-yangxiaoj...@loongson.cn/
[10]: https://projects.gentoo.org/council/meeting-logs/20180114-summary.txt


Reply via email to