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

这篇具有很好参考价值的文章主要介绍了RISC-V云测平台:Compiling The Fedora Linux Kernel Natively on RISC-V。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

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

RISC-V云测平台:Compiling The Fedora Linux Kernel Natively on RISC-V,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云测平台:Compiling The Fedora Linux Kernel Natively on RISC-V,risc-v

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(本篇)

 文章来源地址https://www.toymoban.com/news/detail-647596.html

到了这里,关于RISC-V云测平台:Compiling The Fedora Linux Kernel Natively on RISC-V的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • RISC-V公测平台发布 · 7-zip 测试

    7-Zip 是一个开源的压缩和解压缩工具,具有高压缩比和快速解压缩的特点。除了普通的文件压缩和解压缩功能之外,7-Zip 还提供了基准测试功能,通过压缩和解压缩大型文件来评估系统的处理能力和性能。 7-Zip 提供了一种在不同压缩级别和多线程设置下进行基准测试的方式,

    2024年02月12日
    浏览(23)
  • RISC-V公测平台发布· CoreMark测试报告

    一. CoreMark简介 CoreMark是一款用于评估CPU性能的基准测试程序,它包含了多种不同的计算任务,包括浮点数、整数、缓存、内存等方面的测试。CoreMark的测试结果通常被用来作为CPU性能的参考,它可以帮助开发人员和系统管理员评估不同处理器和系统的性能,比较不同处理器之

    2024年02月12日
    浏览(24)
  • RISC-V公测平台发布 · UnixBench完整测试

    UnixBench是一个开源的GPLv2许可的工具,它提供了对类Unix系统性能的基本指标。 通过运行UnixBench,可以获得有关系统性能的基本指标,用于与其他系统进行比较,也可以作为改进系统性能的参考。但UnixBench并不是一个综合性能评估工具,它只提供了一些基本的性能指标。要全面

    2024年02月13日
    浏览(21)
  • RISC-V公测平台发布:如何在SG2042上玩转OpenMPI

    HS-2 RISC-V通用主板是澎峰科技与合作伙伴共同研发的一款专为开发者设计的标准mATX主板,它预装了澎峰科技为RISC-V高性能服务器定制开发的软件包,包括各种标准bencmark、支持V扩展的GCC编译器、计算库、中间件以及多种典型服务器应用程序。 HS-2 RISC-V通用主板搭载了一颗国产

    2024年02月14日
    浏览(27)
  • RISC-V Linux系统rootfs制作

    buildroot 是一个构建嵌入式Linux系统的框架。整个 buildroot 是由Makefile(*.mk) 脚本和 Kconfig(Config.in) 配置文件构成的,因此可以像配置 Linux 内核一样执行 make menuconfig 进行配置,编译出一个完整的、可以直接烧写到机器上运行的 Linux 系统文件(包含 bootloader、kernel、rootfs 以及 rootf

    2024年02月11日
    浏览(29)
  • RISC-V公测平台发布 · 在SG2042上配置Jupiter+Octave科学计算环境

    简介 JupyterHub是一个开源的共享计算平台,它为每个用户管理一个单独的 Jupyter 环境, 可以用于学生班级、企业数据科学小组或科学研究小组。它是一个多用户中心,可以生成、管理和代理多个单用户Jupyter笔记本服务器的实例。 GNU Octave是一种采用高级编程语言的主要用于数

    2024年02月10日
    浏览(22)
  • 加速开发RISC-V开源软件,Linux基金会启动RISE项目

    使用RISC-V架构为移动、消费电子、数据中心和汽车等领域提供商用软件。 Linux软件基金会在官博宣布了RISC-V软件生态系统 RISE,该项目由Linux Foundation Europe托管,并支持RISC-V International的全球开放标准活动和成就。 官网:https://riseproject.dev/ RISE项目专注于商业软件的准备工作,

    2024年02月08日
    浏览(52)
  • 在FPGA上运行轻量级Linux系统的RISC-V内核 FPGA开发

    随着嵌入式系统的发展,FPGA(现场可编程门阵列)在实现高性能和灵活性方面发挥着重要作用。RISC-V是一种基于开放指令集架构(ISA)的处理器架构,它在嵌入式系统中越来越受欢迎。本文将介绍如何在FPGA上实现一个轻量级Linux系统,其中包括RISC-V内核的开发。 为了在FPGA上

    2024年02月04日
    浏览(31)
  • 【RISC-V】RISC-V寄存器

    寄存器 别名 全称 说明 X0 zero 零寄存器 可做源寄存器(rs)或目标寄存器(rd) X1 ra 链接寄存器 保存函数返回地址 X2 sp 栈指针寄存器 指向栈的地址 X3 gp 全局寄存器 用于链接器松弛优化 X4 tp 线程寄存器 常用于在OS中保存指向进程控制块(task_struct)数据结构的指针 X5 ~ X7 X28 ~ X31 t0

    2024年02月10日
    浏览(25)
  • RISC-V(1)——RISC-V是什么,有什么用

    目录 1. RISC-V是什么 2. RISC-V指令集 3. RISC-V特权架构 4. RiscV的寄存器描述 5. 指令  5.1 算数运算—add/sub/addi/mul/div/rem  5.2 逻辑运算—and/andi/or/ori/xor/xori 5.3 位移运算—sll/slli/srl/srli/sra/srai 5.4 数据传输—lb/lh/lw/lbu/lhu/lwu/sb/sh/sw 5.5 比较指令—slt/slti/sltu/sltiu 5.6 条件分支指令—

    2024年02月11日
    浏览(31)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包