网站点击量软件,亚星网站代理,三个字的公司名称精选,网站制作的书籍使用 x64 的 Ubuntu22.04 电脑编译 Linux SDK#xff0c;即 orangepi-build#xff0c;支持在安装有 Ubuntu 22.04 的电脑上运行#xff0c;所以下载 orangepi-build 前#xff0c;请首先确保自己电脑已安装的 Ubuntu 版本是 Ubuntu22.04。查看电脑已安装的 Ubuntu 版本的命…使用 x64 的 Ubuntu22.04 电脑编译 Linux SDK即 orangepi-build支持在安装有 Ubuntu 22.04 的电脑上运行所以下载 orangepi-build 前请首先确保自己电脑已安装的 Ubuntu 版本是 Ubuntu22.04。查看电脑已安装的 Ubuntu 版本的命令如下所示如果 Release 字段显示的不是 22.04说明当前使用的 Ubuntu 版本不符合要求请更换系统后再进行下面的操作。 lsb_release -a得到如下输出 No LSB modules are available.Distributor ID:UbuntuDescription:Ubuntu 22.04 LTSRelease:Codename:22.04jammy如果电脑安装的是 Windows 系统没有安装有 Ubuntu 22.04 的电脑可以考虑使用 VirtualBox 或者 VMware 来在 Windows 系统中安装一个 Ubuntu 22.04 虚拟机。但是请注意不要在 WSL 虚拟机上编译 orangepi-build因为 orangepi-build 没有在WSL 虚拟机中测试过所以无法确保能正常在 WSL 中使用 orangepi-build。 Ubuntu 22.04 amd64 版本的安装镜像下载地址为 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/22.04/ubuntu-22.04.3-desktop-amd64.iso或者 https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.3-desktop-amd64.iso在电脑中或者虚拟机中安装完 Ubuntu 22.04 后请先设置 Ubuntu 22.04 的软件源为清华源不然后面安装软件的时候很容易由于网络原因而出错 a. 替换清华源的方法参考这个网页的说明即可 https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/b.注意 Ubuntu 版本需要切换到 22.04 c.需要替换的/etc/apt/sources.list 文件的内容为 sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak再执行 sudo vim /etc/apt/sources.list然后按照下面修改 # 默认注释了源码镜像以提高 apt update 速度如有需要可自行取消注释deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse# 预发布软件源不建议启用# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiversed.替换完后需要更新下包信息并确保没有报错 sudo apt updatee.另外由于内核和 U-boot 等源码都是存放在 GitHub 上的所以编译镜像的时候请确保电脑能正常从 GitHub 下载代码这点是非常重要的。
从 github 下载 orangepi-build
linux sdk 其实指的就是 orangepi-build 这套代码orangepi-build 是基于 armbian build 编译系统修改而来的使用 orangepi-build 可以编译出多个版本的 linux 镜像。 首先下载 orangepi-build 的代码命令如下所示
sudo apt-get update
sudo apt-get install -y git
git clone https://github.com/orangepi-xunlong/orangepi-build.git -b next注意Orange Pi 5 开发板是需要下载 orangepi-build 的 next 分支源码的上面的 git clone 命令需要指定 orangepi-build 源码的分支为 next。
编译 运行 build.sh 脚本记得加 sudo 权限 sudo ./build.sh按照提示一步一步把所有的都编译完即可。
定制rootf
rootfs压缩包在
orangepi-build/external/cache/rootfs/jammy-xfce-arm64.f12a43b3e629442a073a7236bf9166ce.tar.lz4解压根文件系统
cd external/cache/rootfs/
mkdir rootfs
sudo tar -I lz4 -pxf jammy-xfce-arm64.f12a43b3e629442a073a7236bf9166ce.tar.lz4 -C rootfs挂载rootfs
sudo chroot rootfs然后在这个虚拟机里面进行一系列操作就可以了 可以参考我这个博客
https://blog.csdn.net/weixin_43269994/article/details/135201633?spm1001.2014.3001.5502操作完后执行
sudo umount rootfs然后执行
cd rootfs然后执行
sudo tar -I lz4 -pcf ../jammy-xfce-arm64.f12a43b3e629442a073a7236bf9166ce.tar.lz4 *至此定制完成 回到主目录执行build.sh即可