RISC-V云测平台:Compiling The Fedora Linux Kernel Natively on RISC-V


注释:编译Fedora,HS-2 64核RISC-V服务器比Ryzen5700x快两倍!
--- 以下是blog 正文 ---
# Compiling The Fedora Linux Kernel Natively on RISC-V
## Fedora RISC-V Support
There is ongoing work to Fedora to support RISC-V hardware. As of right now the Fedora documentation officially only shows how to install the distribution on the SiFive HiFive Unleashed
board. Although there is another board which is unofficially supported by Fedora. This board is the Sispeed LicheePi 4A which I have been planning on getting for Project Andre and Fedora development.
## Setting Up A Fedora Chroot Environment On The PerfXLab System
The PerfXLab RISC-V server is running Ubuntu 22.10, so getting a Fedora environment to compile the kernel in took a bit of tinkering. I knew I needed a container or a chroot environment to
be able to get into the appropriate build environment as not to run into any issues with the build or contaminate the host system.
I started out by looking for a pre-compiled RISC-V Fedora rootfs to use as my chroot environment. During my search I found a pre-built RISC-V raw image. This raw image was perfect! It was
essentially a premade rootfs originally designed for coincidentally the Licheepi 4A and T-Head variants!
Once I downloaded the image to the PerXLab system I started mounting the raw image as a loopback device. One of the easiest ways to dissect a raw image is by doing this quick hack! I then
found the root partition (usually the largest partition) then mounted it, so I can work on chrooting into it.
Once I got the partition mounted I started setting up the pre-requisites for a fully functioning chroot environment. I reffered to the trust Linux From Scratch book like I often do with
this type of work and started mounting the virtual kernel filesystems.
```
# Just for ease of running the commands :)
LFS="/home/maxinehayes90/fedora_rv_mnt"
# Populate /dev
sudo mount -v --bind /dev $LFS/dev
# Mount virtual kernel filesystems
mount -v --bind /dev/pts $LFS/dev/pts
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run
```
Now that /dev and the VKFS are mounted I could chroot into the Fedora rootfs by simply just running ```sudo chroot $LFS /bin/bash```. In the chroot I made sure to test if I had a network
connection by running a dnf search for a package. I got an error where dnf couldn't download the metadata, so I made sure to copy /etc/resolv.conf on the host to the chroot environment. I
then ran into the issue of not being able to copy it due to it being a symlink. Once I tracked down the symlink I saw that it was pointed to /run/systemd/resolve/stub-resolv.conf. I copied
this file into the chroot as /etc/resolv.conf. Success! Dnf was able to download the metadata!
## Building The Fedora Kernel In The Chroot Environment
For Fedora there is a Koji that supplies RISC-V package builds. I went to the Koji hosted at http://fedora.riscv.rocks/koji/ and downloaded the kernel source RPM into the chroot using wget.
To build the kernel source I initially installed mock and looked for a RISC-V config. I unfortunately didn't find one it in /etc/mock. After finding that out I went with plan b by using rpmbuild.
To build the source code with rpmbuild I first had to install the dependencies that the specfile requires using ```dnf builddep SPECS/kernel.spec```. Once I did that I was set to build the kernel! I started the build using ```time rpmbuild -bb SPECS/kernel.spec``` then waited a few minutes to see if it would error which it did after about 7 minutes. So I tried a different
version of the kernel which had the same issue. After walking away for a while I relized what the error was. I ran out of disk space in the chroot!
The root partition I mounted and chrooted into was only a few gigabytes in size and when building the kernel I had forgotten this detail. What I did to resolve the issue was to unmount all
of the virtual kernel filesystems and /dev. I then copied the mounted rootfs to a directory on the host. After that I remounted the VKFS then chrooted back in where I restarted the build.
Once I restarted the build I sat and waited again for about 20 minutes to see if I would run into another error. When I was sure there wouldn't be the possibility of an error I walked away
and came back the next day to find it build without any issues! To my surprise the build took 1 hour and 37 minutes to complete!
## Resources
Image used: https://openkoji.iscas.ac.cn/pub/dl/riscv/T-Head/th1520_light/images/fedora-disk-minimal_thead_th1520-f38-20230511-210358.n.0-sda.raw.xz
Fedora T-Head Documentation: https://fedoraproject.org/wiki/Architectures/RISC-V/T-Head
Linux From Scratch VKFS Page: https://www.linuxfromscratch.org/lfs/view/stable/chapter07/kernfs.html
PerfXLab (Thank you Paul Wang for giving me access to the RISC-V Server!): http://www.perfxlab.com/
-
About HS-2
HS-2 RISC-V通用主板是澎峰科技与合作伙伴共同研发的一款专为开发者设计的标准mATX主板,它预装了澎峰科技为RISC-V高性能服务器定制开发的软件包,包括各种标准bencmark、支持V扩展
的GCC编译器、计算库、中间件以及多种典型服务器应用程序。
HS-2 RISC-V通用主板搭载了一颗国产RISC-V 64核处理器(SG2042)。SG2042是目前已量产的性能最高的RISC-V处理器,主要针对高性能计算领域需求设计,适用于科学计算、工程计算、AI计算、融合计算等大算力应用场景。

RISC-V公共测试云平台系列文章
1. RISC-V公测平台发布 ·Stream带宽完整测试
2. RISC-V公测平台发布 · 我的世界MohistMC
3. RISC-V公测平台发布 · 第一个WEB Server“Hello RISC-V world!”
4. RISC-V公测平台发布 ·如何在SG2042上玩转k3s
5.“RISC-V成长日记” blog发布,第一个运行在RISC-V服务器上的blog?
6. RISC-V公测平台发布:如何在SG2042上玩转OpenMPI
7. RISC-V公测平台发布:Compiling The Fedora Linux Kernel Natively on RISC-V(本篇)
相关文章:
RISC-V云测平台:Compiling The Fedora Linux Kernel Natively on RISC-V
注释:编译Fedora,HS-2 64核RISC-V服务器比Ryzen5700x快两倍! --- 以下是blog 正文 --- # Compiling The Fedora Linux Kernel Natively on RISC-V ## Fedora RISC-V Support There is ongoing work to Fedora to support RISC-V hardwar…...
Vim学习(三)—— Git Repo Gerrit
Git、Gerrit、Repo三者的概念及使用 三者各自作用: git:版本管理库,在git库中没有中心服务器的概念,真正的分布式。 repo:repo就是多个git库的管理工具。如果是多个git库同时管理,可以使用repo。当然使用…...
论坛项目之用户部分
注册接口 实现思路 1.特殊字段检查(比如性别没有给出需要给出默认值) 2.对比检查两次输入的密码是否一致,不一致报错 3.利用UUID生成随机‘盐’值,并使用密码进行MD5加密后与‘盐’进行拼接,生成加密后的密码 4.创建U…...
golang内存对齐
为什么要内存对齐? CPU访问内存时,以CPU的位数为单位进行访问。 如果访问未对齐的内存,处理器需要做两次内存访问,对齐的内存的访问可能仅需要一次,利用内存对齐后提升读取速度。 golang结构体内存对齐规则 在代码编译…...
【CheatSheet】Python、R、Julia数据科学编程极简入门
《Python、R、Julia数据科学编程极简入门》PDF版,是我和小伙伴一起整理的备忘清单,帮助大家10分钟快速入门数据科学编程。 另外,最近 TIOBE 公布了 2023 年 8 月的编程语言排行榜。 Julia 在本月榜单中实现历史性突破,成功跻身 …...
【golang】怎样判断一个变量的类型?
怎样判断一个变量的类型? package mainimport "fmt"var container []string{"zero", "one", "two"} func main() {container : map[int]string{0: "zero", 1: "one", 2: "two"}fmt.Printf…...
怎么学习AJAX相关技术? - 易智编译EaseEditing
学习AJAX(Asynchronous JavaScript and XML)相关技术可以让你实现网页的异步数据交互,提升用户体验。以下是一些学习AJAX技术的步骤和资源: HTML、CSS和JavaScript基础: 首先,确保你已经掌握了基本的HTML…...
JDK、JRE、JVM:揭秘Java的关键三者关系
文章目录 JDK:Java开发工具包JRE:Java运行环境JVM:Java虚拟机关系概述 案例示例:Hello World结语 在Java世界中,你可能经常听到JDK、JRE和JVM这几个概念,它们分别代表了Java开发工具包、Java运行环境和Java…...
【reactNative混合安卓开发~使用问题持续更】
reactNative混合安卓开发 reactNative开发移动端reactNative界面开发前端init.bat文件部分组件第三方组件解析1、定义theme主题shopify/restyle;菜单导航react-navigation/drawer、react-navigation/native; RN问题记录1、使用theme.js写的公共组件报错&…...
OCR的发明人是谁?
OCR的发明背景可以追溯到早期计算机科学和图像处理的研究。随着计算机技术的不断发展,人们开始探索如何将印刷体文字转换为机器可读的文本。 OCR(Optical Character Recognition,光学字符识别)的发明涉及多个人的贡献,…...
笔记本电脑连上WiFi之后的IP为什么会变?如何让它不变固定住?
笔记本连上WiFi后获取IP地址的过程,通常是通过DHCP (动态主机配置协议) 来完成的。默认情况下,DHCP会根据连接设备和网络状态动态地分配IP地址,因此你会看到IP地址可能经常改变。 如果你希望电脑的IP地址固定,可以尝试设置静态IP…...
【数学建模】--因子分析模型
因子分析有斯皮尔曼在1904年首次提出,其在某种程度上可以被看成时主成分分析的推广和扩展。 因子分析法通过研究变量间的相关稀疏矩阵,把这些变量间错综复杂的关系归结成少数几个综合因子,由于归结出的因子个数少于原始变量的个数,…...
RAM不够?CUBEIDE使用CCMRAM
RAM不够?使用CCMRAM 文章目录 RAM不够?使用CCMRAM打开连接LD文件:添加代码添加标识宏使用 打开连接LD文件: 添加代码 在SECTIONS段最后加上下面代码: _siccmram LOADADDR(.ccmram); /* CCM-RAM section * * IMPORTAN…...
npm ERR! code ERESOLVEnpm ERR! ERESOLVE unable to resolve dependency tree
拉取项目到本地 执行 npm install 报错 遇到这个问题首先确认的就是版本是不是太高了,降一下版本。或者通过yarn命令替代npm install命令安装,同理,启动也可以采用yarn dev 启动代替npm run dev 下面教大家用一个NVM工具,这个工…...
使用 prometheus client SDK 暴露指标
目录 1. 使用 prometheus client SDK 暴露指标1.1. How Go exposition works1.2. Adding your own metrics1.3. Other Go client features 2. Golang Application monitoring using Prometheus2.1. Metrics and Labels2.2. Metrics Types2.2.1. Counters:2.2.2. Gauges:2.2.3. …...
Jmeter之BeanShell取出参数进行四则运算,并判断是否正确
首先调用余额接口,使用正则提取响应中的余额字段,记作变量acctBal1做支付交易再次调用余额接口,使用正则提取响应中的余额字段,记作变量acctBal2最后在结果树中可以看到断言错误的信息,断言正确时没有提示以下是beansh…...
PYTHON 斗地主发牌 (简易版)
利用方法: 1. random.randint( ) 随机抽取数字 方法 2.random.sample((抽取范围的参数),(抽取的个数)) 返回的是列表 所以用[0]可以输出里面的元素 import random# 1. 创建牌 # 花色 color ["\u2660", "\u2663", "\u2665", "\…...
CSS文本裁剪
对于单行文本裁剪: span {text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block; } 对于多行文本裁剪: 在文本容器上定义 CSS Flexbox 属性 display: -webkit-box; 定义要显示的文本行数 -webkit-line-clamp: 4; 添加 -webkit-…...
ClickHouse常见的引擎和使用
1.日志引擎 日志引擎特点 1.数据存储在磁盘上 2.写入时将数据追加在文件末尾 3.不支持突变操作 4.不支持索引 5.非原子地写入数据 6.引擎不支持 ALTER UPDATE 和 ALTER DELETE 操作 建表语法示例 CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] ( …...
构建之法 - 软件工程实践教学:一线教师的13问
福州大学单红老师的软工课程总结 2020春,不一样的学期不一样的软工实践 单红⽼师在总结中,提出了13条疑惑,《构建之法》的作者邹欣⽼师就单红⽼师提出的每⼀条疑惑,给出了⾃⼰的思考,与他进⾏探讨交流。欢迎你也来参与…...
Appium+python自动化(十六)- ADB命令
简介 Android 调试桥(adb)是多种用途的工具,该工具可以帮助你你管理设备或模拟器 的状态。 adb ( Android Debug Bridge)是一个通用命令行工具,其允许您与模拟器实例或连接的 Android 设备进行通信。它可为各种设备操作提供便利,如安装和调试…...
Mac软件卸载指南,简单易懂!
刚和Adobe分手,它却总在Library里给你写"回忆录"?卸载的Final Cut Pro像电子幽灵般阴魂不散?总是会有残留文件,别慌!这份Mac软件卸载指南,将用最硬核的方式教你"数字分手术"࿰…...
HBuilderX安装(uni-app和小程序开发)
下载HBuilderX 访问官方网站:https://www.dcloud.io/hbuilderx.html 根据您的操作系统选择合适版本: Windows版(推荐下载标准版) Windows系统安装步骤 运行安装程序: 双击下载的.exe安装文件 如果出现安全提示&…...
vue3 定时器-定义全局方法 vue+ts
1.创建ts文件 路径:src/utils/timer.ts 完整代码: import { onUnmounted } from vuetype TimerCallback (...args: any[]) > voidexport function useGlobalTimer() {const timers: Map<number, NodeJS.Timeout> new Map()// 创建定时器con…...
浅谈不同二分算法的查找情况
二分算法原理比较简单,但是实际的算法模板却有很多,这一切都源于二分查找问题中的复杂情况和二分算法的边界处理,以下是博主对一些二分算法查找的情况分析。 需要说明的是,以下二分算法都是基于有序序列为升序有序的情况…...
C/C++ 中附加包含目录、附加库目录与附加依赖项详解
在 C/C 编程的编译和链接过程中,附加包含目录、附加库目录和附加依赖项是三个至关重要的设置,它们相互配合,确保程序能够正确引用外部资源并顺利构建。虽然在学习过程中,这些概念容易让人混淆,但深入理解它们的作用和联…...
(一)单例模式
一、前言 单例模式属于六大创建型模式,即在软件设计过程中,主要关注创建对象的结果,并不关心创建对象的过程及细节。创建型设计模式将类对象的实例化过程进行抽象化接口设计,从而隐藏了类对象的实例是如何被创建的,封装了软件系统使用的具体对象类型。 六大创建型模式包括…...
基于PHP的连锁酒店管理系统
有需要请加文章底部Q哦 可远程调试 基于PHP的连锁酒店管理系统 一 介绍 连锁酒店管理系统基于原生PHP开发,数据库mysql,前端bootstrap。系统角色分为用户和管理员。 技术栈 phpmysqlbootstrapphpstudyvscode 二 功能 用户 1 注册/登录/注销 2 个人中…...
【Elasticsearch】Elasticsearch 在大数据生态圈的地位 实践经验
Elasticsearch 在大数据生态圈的地位 & 实践经验 1.Elasticsearch 的优势1.1 Elasticsearch 解决的核心问题1.1.1 传统方案的短板1.1.2 Elasticsearch 的解决方案 1.2 与大数据组件的对比优势1.3 关键优势技术支撑1.4 Elasticsearch 的竞品1.4.1 全文搜索领域1.4.2 日志分析…...
论文阅读:LLM4Drive: A Survey of Large Language Models for Autonomous Driving
地址:LLM4Drive: A Survey of Large Language Models for Autonomous Driving 摘要翻译 自动驾驶技术作为推动交通和城市出行变革的催化剂,正从基于规则的系统向数据驱动策略转变。传统的模块化系统受限于级联模块间的累积误差和缺乏灵活性的预设规则。…...
