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
Message-Id: d77e6018-548a-63b8-7630-65e75ff24ab7@xen0n.name
1 Hi everyone,
2
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.
6
7
8 ## Progress of the port
9
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].
17
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).
22
23
24 ## How to test this?
25
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.
29
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):
36
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:
41
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.
45
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.
51
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.
56
57
58 ## Problem regarding further upstream work
59
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.
66
67 Any suggestion is welcome; and thank you for your attention.
68
69
70 Regards,
71 WANG "xen0n" Xuerui
72
73
74 [1]:
75 https://archives.gentoo.org/gentoo-dev/message/ef0b1812e9b66cdf5978ecc2ad4eda4e
76 [2]: https://github.com/xen0n/catalyst/tree/3.0.20-for-loong
77 [3]: https://github.com/xen0n/genkernel/tree/loong
78 [4]: https://mirrors.tuna.tsinghua.edu.cn/loongson/gentoo/experimental/
79 [5]: https://mirrors.bfsu.edu.cn/loongson/gentoo/experimental/
80 [6]: https://github.com/xen0n/loongson-overlay
81 [7]: https://github.com/loongson/qemu/tree/tcg-dev
82 [8]:
83 https://patchew.org/QEMU/1638610165-15036-1-git-send-email-gaosong@××××××××.cn/
84 [9]:
85 https://patchew.org/QEMU/1638619645-11283-1-git-send-email-yangxiaojuan@××××××××.cn/
86 [10]: https://projects.gentoo.org/council/meeting-logs/20180114-summary.txt