{"id":34788,"date":"2024-09-06T10:15:38","date_gmt":"2024-09-06T02:15:38","guid":{"rendered":"https:\/\/www.deepin.org\/?p=34788"},"modified":"2024-11-07T13:12:43","modified_gmt":"2024-11-07T05:12:43","slug":"deepin-multi-architecture-compatibility","status":"publish","type":"post","link":"https:\/\/www.deepin.org.cn\/en\/deepin-multi-architecture-compatibility\/","title":{"rendered":"From AMD64 to RISC-V, LoongArch, and ARM64: The Multi-Architecture Adaptation Journey of deepin"},"content":{"rendered":"<img loading=\"lazy\" class=\"alignnone size-full wp-image-34452\" src=\"https:\/\/www.deepin.org\/wp-content\/uploads\/2024\/08\/641.jpeg\" alt=\"\" width=\"900\" height=\"383\" srcset=\"https:\/\/www.deepin.org.cn\/wp-content\/uploads\/2024\/08\/641.jpeg 900w, https:\/\/www.deepin.org.cn\/wp-content\/uploads\/2024\/08\/641-300x128.jpeg 300w, https:\/\/www.deepin.org.cn\/wp-content\/uploads\/2024\/08\/641-150x64.jpeg 150w, https:\/\/www.deepin.org.cn\/wp-content\/uploads\/2024\/08\/641-768x327.jpeg 768w, https:\/\/www.deepin.org.cn\/wp-content\/uploads\/2024\/08\/641-24x10.jpeg 24w, https:\/\/www.deepin.org.cn\/wp-content\/uploads\/2024\/08\/641-36x15.jpeg 36w, https:\/\/www.deepin.org.cn\/wp-content\/uploads\/2024\/08\/641-48x20.jpeg 48w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/p>\n<blockquote><p><span data-font-family=\"default\">Author: longlong<\/span><\/p>\n<p><span data-font-family=\"default\">This article is a full transcription of longlong\u2019s speech at WHLUG, so there are some informal expressions. The content only represents personal views and positions.<\/span><\/p><\/blockquote>\n<p><span data-font-family=\"default\">As the successor to deepin 20, one of the biggest changes in deepin 23 is the addition of multi-architecture support: from originally only supporting the AMD64 architecture to now supporting multiple CPU architecture platforms including AMD64, RISC-V, LoongArch (New World), and ARM64.<\/span><\/p>\n<p><span data-font-family=\"default\">Currently, the stable image for AMD64 architecture of deepin 23 has been released, while the images for other CPU architectures are still in the preview version stage as the ecosystem is being built. We will release the stable version for other architectures when we believe the quality meets the standard for a stable release.<\/span><\/p>\n<p>&nbsp;<\/p>\n<section>\n<h1 style=\"text-align: center;\"><strong data-brushtype=\"text\">ARM64<\/strong><\/h1>\n<section><\/section>\n<\/section>\n<p><span data-font-family=\"default\">ARM64 was the first architecture introduced in deepin 23. When we started officially building the repository for version 23, ARM64 was already a primary target for support, and it is now one of the best-developed architectures apart from x86. Our support for the ARM64 architecture has also received backing from partners like Phytium and Zhaoxin Technology.<\/span><\/p>\n<h2><b><span data-font-family=\"default\">Main Build Cluster<\/span><\/b><\/h2>\n<p><span data-font-family=\"default\">When we were adapting deepin 23, we initially only had one FT2000\/64 server. As the number of system packages grew to over 3,000, this build scale became far from sufficient. Moreover, ARM64 servers were not readily available on the market. Therefore, we took the initiative, searched through the company\u2019s warehouse, and found a Kunpeng 920 server and five Pangu W510 desktops to form a build cluster.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><b><span data-font-family=\"default\">Virtually No Ecosystem Barriers<\/span><\/b><\/h2>\n<p><span data-font-family=\"default\">The Linux ecosystem for ARM64 is almost on par with x86, and there is no need to worry about software compatibility. Almost all software packages that can be built on x86 can be compiled normally on ARM64.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><b><span data-font-family=\"default\">UEFI Challenges<\/span><\/b><\/h2>\n<p><span data-font-family=\"default\">ARM64 was initially used mainly in embedded devices, so U-Boot was more common. However, U-Boot presented several issues when booting deepin 23, such as requiring different device tree binary files (DTBs) for different devices. This posed challenges for mainstreaming deepin 23. As a result, we currently only support UEFI-enabled devices like Phytium D2000\/D3000, Kunpeng 920, and new products from Zhaoxin Technology. For other ARM64 devices, we can only offer limited support, as adapting different development boards requires significant manpower and resources. However, we welcome more ARM64 development boards and device manufacturers to collaborate with us, and we will do our best to adapt to them.<\/span><\/p>\n<p>&nbsp;<\/p>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section data-role=\"outer\">\n<section>\n<section>\n<section>\n<section>\n<h1 style=\"text-align: center;\"><strong data-brushtype=\"text\">LoongArch<\/strong><\/h1>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<p><span data-font-family=\"default\">LoongArch (New World) was not initially within the scope of target architectures for deepin 23, but around 2022, as Loongson began actively promoting the New World distribution ecosystem, we decided to attempt adaptation for LoongArch systems. This decision was triggered by Revy, who sent us two LA50007A2000 machines.<\/span><\/p>\n<h2><b><span data-font-family=\"default\">From Loong Arch Linux to deepin Linux<\/span><\/b><\/h2>\n<p><span data-font-family=\"default\">We decided to build on the shoulders of giants, choosing the more mature LoongArch Linux as the foundation, rather than manually creating a root filesystem (rootfs) using the still-imperfect QEMU. Based on this, we built the rootfs and launched OBS workers, giving us the capability to build for LoongArch (New World). Meanwhile, Loongson firmware continued to improve, and the freezing issues were reduced.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><b><span data-font-family=\"default\">Loongson 3C5000 Power!<\/span><\/b><\/h2>\n<p><span data-font-family=\"default\">Following the principle of \u201cbenefiting from a large tree\u2019s shade,\u201d we borrowed two four-way Loongson 3C5000L servers from a friendly department. These became our most powerful build servers. However, initially, they lacked support for New World firmware. After obtaining firmware from Loongson, we were able to use them (though the RAID card still couldn\u2019t function properly under New World).<\/span><\/p>\n<p><span data-font-family=\"default\">Our community also purchased a dual-way 3C5000LL server, which presented an unexpected issue: it came with New World firmware and BMC out of the factory, but when powered on, it emitted a loud \u201cdragon roar\u201d at maximum fan speed, loud enough to drown out all other servers in our machine room. Additionally, it was unstable, crashing almost daily. Eventually, we sought help from engineers at Wuhan Loongson. With their assistance, we discovered the cause: the motherboard has 8 four-pin fan sockets, and the new BMC checks whether the 1st, 2nd, 3rd, and 4th sockets are connected properly. If not, the BMC runs the fans at maximum power, causing overheating. However, the manufacturer of our server did not follow this order when connecting the fans, leading to the issue.<\/span><\/p>\n<p><span data-font-family=\"default\">Later, we obtained more Loongson 3C5000 servers through UOS, greatly enhancing our build resources.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><b><span data-font-family=\"default\">deepin Loong64 Booted!<\/span><\/b><\/h2>\n<p><span data-font-family=\"default\">Once everything was in place, we manually crafted the rootfs, packaged DDE, and created the first image. It successfully ran on the Loongson 3A5000. However, since we were unfamiliar with the special tuning of the Loongson kernel at the time, we borrowed the kernel from the neighboring Loong Arch Linux. As for the system software packages, most were sourced from our own system repository, with some borrowed from Revy.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><b><span data-font-family=\"default\">3A6000 Performance Surge<\/span><\/b><\/h2>\n<p><span data-font-family=\"default\">In early 2024, Loongson released the 3A6000. Once again, Revy was the first to sponsor us with a 3A6000 motherboard. As with the earlier samples, this motherboard encountered various problems: crashes at startup, system freezes, PCIe instability, and so on. However, as the 3A6000 boards we purchased later, along with Asus 3A6000 motherboards, gradually resolved these issues, system stability greatly improved. Of course, we still had to complain about the GPU on the Loongson 7A2000 bridge chip. Due to the lack of stable and fully functional drivers, early performance was very unstable, especially when connecting to 4K monitors. We will work with Loongson to address this issue using official drivers\u2014stay tuned!<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><b><span data-font-family=\"default\">Ecosystem Building<\/span><\/b><\/h2>\n<p><span data-font-family=\"default\">In terms of ecosystem building, the New World ecosystem of Loongson essentially started from scratch. Achievements from the Old World, such as UOS, could not be directly migrated to New World, though AOSC's libLoL helped alleviate some of the problems. To promote Loongson's ecosystem, we mandated that first-party applications must compile successfully on Loong64. As a result, you can now see that deepin's UnionCode (IDE) is running smoothly on Loong64, which is a great benefit to Loongson's developer ecosystem.<\/span><\/p>\n<p><span data-font-family=\"default\">However, we still face issues, such as upstream\u2019s arrogant attitude towards Loong patches, which has caused software like Neovim to be incompatible with Loong64. To solve this, deepin maintained the necessary patches to ensure Luajit runs smoothly on Loong64.<\/span><\/p>\n<p><span data-font-family=\"default\">We currently maintain good relationships with various New World distribution communities, allowing us to access the latest technological developments and solve issues. For example, deepin 23 comes pre-installed with libLoL and supports booting New World systems on Old World machines.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><b><span data-font-family=\"default\">When Will It Be Stable?<\/span><\/b><\/h2>\n<p><span data-font-family=\"default\">The issues preventing us from releasing a stable version of the Loong64 image are:<\/span><\/p>\n<ol>\n<li><span data-font-family=\"default\">The current app store is just an empty shell. For a distribution aiming for an out-of-the-box experience, this clearly does not meet the release standard.<\/span><\/li>\n<li><span data-font-family=\"default\">Our build resources are still insufficient. We cannot yet provide the same level of support as we do for ARM64. We are still heavily reliant on Loongson desktops as part of our infrastructure.<\/span><\/li>\n<li><span data-font-family=\"default\">The stability does not meet the release requirements. Loongson\u2019s hardware, software, and firmware are evolving at a relatively fast pace, making it difficult to stabilize a version and guarantee reliable service for users. So, we are opting for rolling updates\u2014let\u2019s roll!<\/span><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<section data-mpa-template=\"t\">\n<section data-role=\"outer\">\n<section>\n<section>\n<section>\n<section>\n<h1 style=\"text-align: center;\"><strong data-brushtype=\"text\">RISC-V<\/strong><\/h1>\n<p><span data-font-family=\"default\">As for the RISC-V architecture, I have not personally been deeply involved. The support for RISC-V in deepin was mainly completed by our colleague Yang, who is currently at the RISC-V summit in Hangzhou, exchanging ideas with various experts. So, I will introduce the RISC-V adaptation situation on her behalf.<\/span><\/p>\n<h2><b><span data-font-family=\"default\">Boards: Tasteless but Hard to Discard<\/span><\/b><\/h2>\n<p><span data-font-family=\"default\">Our support for the RISC-V architecture actually began before Loong64. The PLCT team at the Chinese Academy of Sciences had already prepared a very early version that could boot to the desktop. However, the hardware we received was the Allwinner D1 board. After running Linux on it, I lost interest because its performance was far too weak. Compared to the similarly priced RK3566, it was vastly inferior in both performance and ecosystem. Why did we do RISC-V? Maybe for the innovation.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><b><span data-font-family=\"default\">Sg2042: Chinese Violent Aesthetics in a RISC-V Processor<\/span><\/b><\/h2>\n<p><span data-font-family=\"default\">Later, Revy sent us two Sg2042 machines, each with 64 C910 cores from Pingtouge. These cores are also used in the TH1520 board. While the single-core performance was weak, the large number of cores compensated. We were even able to insert an AMD graphics card into the Sg2042: DDE booted!<\/span><\/p>\n<p><span data-font-family=\"default\">Thanks to the Sg2042, we reached the threshold for batch building. With the two 2042 machines running in the server room day and night, our RISC-V ecosystem almost caught up to ARM64. Because RISC-V is generally more accepted upstream, even without stronger hardware, RISC-V continues to be supported by Debian\u2019s main branch, which has greatly facilitated our adaptation efforts.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><b><span data-font-family=\"default\">Embedded Limitations<\/span><\/b><\/h2>\n<p><span data-font-family=\"default\">Most of the RISC-V devices we encounter are still in the form of development boards, likely due to the early stage of RISC-V technology for desktop applications. This embedded-focused design philosophy has made the adaptation process challenging. This experience has made us realize that, to promote the use of RISC-V in desktop environments, closer collaboration with manufacturers is needed to explore and resolve the issues encountered during the adaptation process. Furthermore, it will take joint efforts within the industry to mature RISC-V technology and broaden its application.<\/span><\/p>\n<p><span data-font-family=\"default\">That concludes this article. A huge thank you to all the teachers and partners who supported and helped us on deepin\u2019s adaptation journey.<\/span><\/p>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h1><strong>Releated Reading\uff1a<\/strong><\/h1>\n<p>\uff081\uff09<a href=\"https:\/\/distrowatch.com\/index.php?distribution=deepin\">deepin Full Version Image Downloads (including deepin V15)<\/a><\/p>\n<p>\uff082\uff09<a href=\"https:\/\/www.deepin.org\/en\/download\/\">deepin RISC-V\u00a0 Architecture Image (LicheePi 44A, VisionFive2, etc.)<\/a><\/p>\n<p>\uff083\uff09<a href=\"https:\/\/wiki.deepin.org\/zh\/02_%E7%A1%AC%E4%BB%B6wiki\/01_%E8%AE%BE%E5%A4%87%E9%80%82%E9%85%8D%E5%88%97%E8%A1%A8\/deepin%E5%A4%9A%E6%9E%B6%E6%9E%84%E9%80%82%E9%85%8D%E6%9C%BA%E5%9E%8B%E6%B8%85%E5%8D%95\">deepin Multi-Architecture Compatible Model List<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<article id=\"post-34740\" class=\"post-34740 post type-post status-publish format-standard hentry category-technology-sharing category-community-news\">\n<div class=\"entry-content\">\n<article id=\"post-34702\" class=\"post-34702 post type-post status-publish format-standard hentry category-community-news category-community-activities\">\n<div class=\"entry-content\">\n<p style=\"text-align: right;\">Content source: deepin community<\/p>\n<p style=\"text-align: right;\">Reprinted with attribution<\/p>\n<\/div>\n<\/article>\n<\/div>\n<\/article>\n<div id=\"comments\" class=\"comments-area\">\n<div id=\"respond\" class=\"comment-respond\"><\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Author: longlong This article is a full transcription of longlong\u2019s speech at WHLUG, so there are some informal expressions. The content only represents personal views and positions. As the successor to deepin 20, one of the biggest changes in deepin 23 is the addition of multi-architecture support: from originally only supporting the AMD64 architecture to now supporting multiple CPU architecture platforms including AMD64, RISC-V, LoongArch (New World), and ARM64. Currently, the stable image for AMD64 architecture of deepin 23 has been released, while the images for other CPU architectures are still in the preview version stage as the ecosystem is ...<a href=https:\/\/www.deepin.org.cn\/en\/deepin-multi-architecture-compatibility\/>Read more<\/a><\/p>\n","protected":false},"author":11164,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[155,93],"tags":[194,144,148,141,147,193,143,192,142,162],"_links":{"self":[{"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/posts\/34788"}],"collection":[{"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/users\/11164"}],"replies":[{"embeddable":true,"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/comments?post=34788"}],"version-history":[{"count":9,"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/posts\/34788\/revisions"}],"predecessor-version":[{"id":35299,"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/posts\/34788\/revisions\/35299"}],"wp:attachment":[{"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/media?parent=34788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/categories?post=34788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/tags?post=34788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}