buildroot编译一个基于riscv架构的linux系统
创始人
2025-05-31 17:29:55
0

1、https://toolchains.bootlin.com. 下載工具鏈,並配置PATH,注意此処使用root權限配置
2、内核編譯:
make ARCH=riscv CROSS_COMPILE=riscv64-linux- defconfig
make ARCH=riscv CROSS_COMPILE=riscv64-linux- -j $(nproc)

3、opensbi編譯
git clone https://github.com/riscv-software-src/opensbi.git
export CROSS_COMPILE=riscv64-linux-
make PLATFORM=generic

4、rootfs(也可以在buildroot中选择内核编译)
https://buildroot.org/download.html

make defconfig
make menuconfig
配置目標架構為riscv
配置image文件格式為ext2/3/4

//編譯會聯網
make -j$(nproc)

生成文件在output/images下,rootfs.ext2

這裏也可以下載busybox:
git clone https://git.busybox.net/busybox
cd busybox
CROSS_COMPILE=riscv{{bits}}-unknown-linux-gnu- make defconfig
CROSS_COMPILE=riscv{{bits}}-unknown-linux-gnu- make -j $(nproc)

5、運行
sudo qemu-system-riscv64 -nographic -machine virt
-kernel linux/arch/riscv/boot/Image -append “root=/dev/vda ro console=ttyS0”
-drive file=busybox,format=raw,id=hd0
-device virtio-blk-device,drive=hd0

相關鏈接:
https://risc-v-getting-started-guide.readthedocs.io/en/latest/linux-qemu.html#:~:text=Build%20Linux%20for%20the%20RISC-V%20target.%20First%2C%20checkout,riscv%20CROSS_COMPILE%3D%20riscv64-unknown-linux-gnu-%20defconfig%20Then%20compile%20the%20kernel%3A

相关内容

热门资讯

监控摄像头接入GB28181平... 流程简介将监控摄像头的视频在网站和APP中直播,要解决的几个问题是:1&...
Windows10添加群晖磁盘... 在使用群晖NAS时,我们需要通过本地映射的方式把NAS映射成本地的一块磁盘使用。 通过...
protocol buffer... 目录 目录 什么是protocol buffer 1.protobuf 1.1安装  1.2使用...
educoder数据结构与算法...                                                   ...
MySQL下载和安装(Wind... 前言:刚换了一台电脑,里面所有东西都需要重新配置,习惯了所...
MFC文件操作  MFC提供了一个文件操作的基类CFile,这个类提供了一个没有缓存的二进制格式的磁盘...
在Word、WPS中插入AxM... 引言 我最近需要写一些文章,在排版时发现AxMath插入的公式竟然会导致行间距异常&#...
有效的括号 一、题目 给定一个只包括 '(',')','{','}'...
Fluent中创建监测点 1 概述某些仿真问题,需要创建监测点,用于获取空间定点的数据࿰...
【Ctfer训练计划】——(三... 作者名:Demo不是emo  主页面链接:主页传送门 创作初心ÿ...