* [gentoo-dev] [RFC] Plans for a Gentoo/LoongArch port
@ 2021-08-11 16:39 99% WANG Xuerui
0 siblings, 0 replies; 1+ results
From: WANG Xuerui @ 2021-08-11 16:39 UTC (permalink / raw
To: gentoo-dev
Hi everyone,
I'm your average Gentoo user who obviously thought his sleeping time is more
than enough, and just decided to start porting Gentoo to LoongArch. As this
is such a niche architecture with no upstreamed support so far, I'm posting
this to announce my intent and gather advice on how to best push this.
I'll first give some background material to help people gain context, then
describe my porting plan. This is going to be a bit long; apologizes for
that.
Note: I'm not affiliated with Loongson in any way; I'm just doing this in my
spare time (once meant for some quality sleep).
## A bit of introduction on the LoongArch
LoongArch, as its name implies, is the brand-new ISA developed by the
Loongson Corporation, incompatible with MIPS which was implemented by
all previous Loongson processors. Currently only the base ISA specification
is publicly available; it has fixed-length 32-bit instructions, vastly more
instruction formats (39 distinct formats in the base ISA alone!), and its
instruction semantics mostly resemble RISC-V, with a bit of MIPS R6 here and
there. It is capable of 64-bit operations, obviously.
ISA documentation: https://github.com/loongson/LoongArch-Documentation
ELF psABI draft: https://github.com/loongson/LoongArch-Documentation/pull/3
The draft ABI is undergoing fierce review, and is subject to change,
especially the relocation types. Other parts like the register
convention and
data layout is unlikely to change much, though.
There is little code upstreamed for basic software (GNU toolchain, QEMU,
Linux and the like), but many are open-sourced already. Nevertheless, the
code quality is still very much inferior, and much of it is obviously based
on respective MIPS support. There is continuous debate inside and outside
Loongson on this matter, too.
Kernel ABI and glibc code seems to be inspired by RISC-V, but still some
parts show MIPS heritage. The kernel bits are being reviewed on the
linux-arch
mailing list.
All of the projects above can be accessed at https://github.com/loongson.
Loongson 3A5000 is the first LoongArch CPU; the Lemote A2101 board with this
CPU can be bought in China for ~4000 CNY already.
## Gentoo porting plans
I'm planning to take ARCH=loongarch for the port; and support the LP64 ABI
first. I'd like to support both LP64 and ILP32 ABIs, but that's not a
priority.
The ABI flag might be named "ABI_LOONGARCH" but that's IMO a bit long (pun
semi-intended); ARCH=loong and ABI_LOONG might be better, I'm open to
suggestions.
Because much of the ABI and even some toolchain internals are going through
VERY fierce debate and rework, obviously the port will remain experimental
for a long time. Some minimal support should get in tree though; doing so
would ease a lot of pain for experimentation. I already hacked my way to
generate working crossdev toolchains, and is halfway towards a rootfs with
working Python (and Portage). I've already independently ported strace, and
plan to do the same to libffi in the coming days which would give me Python.
I'll do all work in my own loongson-overlay first, and upstream these when
appropriate. Eventually I hope to have working crossdev, qemu-user emulation
and proper catalyst support.
And that's about all; the message is getting long! Your opinions are
welcome,
and thanks again for following along.
Regards,
WANG "xen0n" Xuerui
^ permalink raw reply [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-08-11 16:39 99% [gentoo-dev] [RFC] Plans for a Gentoo/LoongArch port WANG Xuerui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox