Gentoo Archives: gentoo-dev

From: WANG Xuerui <i.gentoo@×××××.name>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Progress of the Gentoo/LoongArch port, and question on upstreaming procedure
Date: Sat, 01 Jan 2022 17:28:31
1 Hi everyone,
3 I'm the guy who previously announced the Gentoo/LoongArch port [1];
4 since that post, some nice progress has been made, and here's a heads-up
5 and a procedural question regarding how to continue work upstream.
8 ## Progress of the port
10 After some minimal forking and tweaking, it's already possible to build
11 working stage3 tarballs with catalyst;
12 with quick-and-dirty catalyst[2] and genkernel[3] patches, even working
13 installation CDs can be built (confirmed by LiveUSB-making and booting
14 on real 3A5000 hardware).
15 The built stages and installation CD images are already available in
16 several mirrors like [4] or [5].
18 The toolchain development of Loongson has gone more-or-less quiet
19 lately, and many projects (eselect, icu, systemd, etc.) have already had
20 releases that contain LoongArch bring-up changes, so it's time to push
21 more things upstream (in this case, the main gentoo.git repo).
24 ## How to test this?
26 The necessary changes are all brewing in the loongson-overlay[6], which
27 is available via layman (`sudo layman -a loongson`). You'll need this
28 for the loong profile and toolchain patches.
30 The stages can be tested with QEMU linux-user emulation, if you don't
31 have the LoongArch hardware;
32 but the LoongArch target is not upstream yet, so you'll have to compile
33 Loongson's fork ([7]; qemu-devel threads [8] [9]) yourself. The
34 necessary binfmt-misc declaration is like this (remove all whitespaces
35 and newlines before using):
37 > :loongarch64:M::
38 > \x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x01:
39 > \xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff
40 > \xff\xff:/usr/local/bin/qemu-loongarch64:
42 You can use your favorite way to set up this (manually, via rc-scripts,
43 via systemd-binfmt.service, whatever), replacing the interpreter path to
44 suit your setup, then just proceed like every chroot.
46 Inside the chroot, you need to `git clone` the loongson-overlay, add it
47 to /etc/portage/repos.conf, and fix the profile symlink; after that you
48 should be able to emerge packages as usual. Keywords are mostly missing,
49 so you may use ACCEPT_KEYWORDS=~riscv or something similar to get
50 through, in case everything is masked and not package.accept_keywords-ed.
52 Note that their system emulation is currently in a worse state than
53 linux-user (horribly slow and dependent on prebuilt firmware blob),
54 according to review comments, so you may as well ignore the installation
55 CDs for now.
58 ## Problem regarding further upstream work
60 As described above, there is already some nice progress, but a
61 procedural problem still remains: every new architecture needs a backing
62 project and arch team [10], yet I'm not a Gentoo dev and it's unclear if
63 any Gentoo dev would be interested in such a niche architecture with
64 limited hardware availability outside China, so we may get stuck in this
65 state for an extended period.
67 Any suggestion is welcome; and thank you for your attention.
70 Regards,
71 WANG "xen0n" Xuerui
74 [1]:
76 [2]:
77 [3]:
78 [4]:
79 [5]:
80 [6]:
81 [7]:
82 [8]:
84 [9]:
86 [10]: