Mainline Linux 和 U-Boot编译
By Toradex胡珊逢
Toradex 自从 Linux BSP v6 开始在使用 32位处理器的 Arm 模块如 iMX6、iMX6ULL、iMX7 上提供 mainline/upstream kernel ,部分 64位处理器模块如 Verdin iMX8M Mini/Plus 也提供实验性支持。文章将以季度发布版本 Linux BSP V6.3.0 为例介绍如何下载和编译 mainline/upstream Linux kernel 和 U-Boot。
Linux
下载 kernel 源码
内核源码可以从官网 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git 下载。但考虑到国内网络情况,推荐从国内的镜像站点下载,如 https://mirrors.tuna.tsinghua.edu.cn/git/linux-stable.git。默认下载时会获取最新的 upstream 内核版本。可根据模块上运行 Linux 的版本 checkout 到对应版本源码。在模块上的 Linux 中运行 uname 命令,可以看到当前版本是 6.1.37。后面的 6.3.0 是 Toradex Linux BSP 季度发布版本。季度发布版本是经过充分的自动化和人工测试后发布的,可用于对应模块的生产环境。
----------------------------------
root@apalis-imx6:~# uname -a
Linux apalis-imx6 6.1.37-6.3.0+git.0f4ac6b4c5f0 #1 SMP Sat Jul 1 11:16:27 UTC 2023 armv7l armv7l armv7l GNU/Linux
----------------------------------
在电脑上使用下面命令并 checkout 到 v6.1.37。
----------------------------------
$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/linux-stable.git
$ git checkout v6.1.37
----------------------------------
下载和应用补丁
mainline/upstream kernel 通常还需要一些补丁。它们可以从 meta-toradex-bsp-common 中下载,后续其版本也需要对应到一样的季度版本。首先打开网址 https://git.toradex.com/cgit/toradex-manifest.git/tree/bsp/pinned-tdx.xml?h=6.3.0。结尾的 6.3.0 为对应的季度发布版本号。在页面中可以看到如下内容:
----------------------------------
<project name="meta-toradex-bsp-common.git" path="layers/meta-toradex-bsp-common" remote="tdx" revision="f7ff10a3b560dcf4e258115da679d1f864e09837" upstream="kirkstone-6.x.y"/>
----------------------------------
可以看到 meta-toradex-bsp-common.git 在季度发布版本 6.3.0 对应的 hash 是 f7ff10a3b560dcf4e258115da679d1f864e09837。通常建议使用最新发布的季度版本,获得问题修复和功能完善。因此,下载时请修改季度发布版本号和 hash 值。
进入上面下载的 Linux 源码目录后创建 patch 文件夹,并在其中下载 meta-toradex-bsp-common,checkout 对应用版本。
----------------------------------
$ cd linux-stable/
$ mkdir patch
$ cd patch
$ git clone https://git.toradex.com/cgit/meta-toradex-bsp-common.git
$ cd meta-toradex-bsp-common
$ git checkout f7ff10a3b560dcf4e258115da679d1f864e09837
----------------------------------
将 meta-toradex-bsp-common/recipes-kernel/linux/linux-toradex-mainline-git 的所有 patch 文件复制到 patch 目录下。
----------------------------------
$ cp meta-toradex-bsp-common/recipes-kernel/linux/linux-toradex-mainline-git/*.patch ./
----------------------------------
在 patch 目录下使用 git am 命令给 kernel 打补丁。注意必须要以固定的顺序打补丁。补丁顺序可以参看 meta-toradex-bsp-common/recipes-kernel/linux/linux-toradex-mainline_git.bb 文件。
----------------------------------
SRC_URI:append = " \
file://0001-thermal-imx-Update-critical-temp-threshold.patch \
file://0001-Revert-drm-panel-simple-drop-use-of-data-mapping-pro.patch \
file://0001-arm-dts-colibri-imx6-usb-dual-role-switching.patch \
file://0002-arm-dts-colibri-imx6-move-vbus-supply-to-module-leve.patch \
file://0003-arm-dts-colibri-imx6-specify-usbh_pen-gpio-being-act.patch \
file://0001-arm-dts-colibri-imx6ull-keep-peripherals-disabled.patch \
file://0002-arm-dts-colibri-imx6ull-enable-default-peripherals.patch \
file://0001-ARM-dts-colibri-imx6ull-Enable-dual-role-switching.patch \
file://0002-drivers-chipidea-disable-runtime-pm-for-imx6ul.patch \
file://0001-ARM-dts-apalis-imx6-Disable-usb-over-current.patch \
file://0002-ARM-dts-colibri-imx6-Disable-usb-over-current.patch \
file://0003-ARM-dts-colibri-imx6ull-Disable-usb-over-current.patch \
file://0004-ARM-dts-colibri-imx7-Disable-usb-over-current.patch \
file://0001-arm64-dts-imx8mm-verdin-Add-yavia-carrier-board.patch \
file://0002-arm64-dts-imx8mp-verdin-Add-yavia-carrier-board.patch \
file://0001-media-v4l2-async-fix-binding-async-subdevs-with-mult.patch \
file://0002-media-i2c-ov5640-Implement-get_mbus_config.patch \
file://0001-Revert-media-v4l2-async-Use-endpoints-in-__v4l2_asyn.patch \
"
----------------------------------
在 patch 文件夹里执行面命令,期间不应该出现任何错误和冲突。
----------------------------------
$ cd patch
$ git am 0001-thermal-imx-Update-critical-temp-threshold.patch \
0001-Revert-drm-panel-simple-drop-use-of-data-mapping-pro.patch \
0001-arm-dts-colibri-imx6-usb-dual-role-switching.patch \
0002-arm-dts-colibri-imx6-move-vbus-supply-to-module-leve.patch \
0003-arm-dts-colibri-imx6-specify-usbh_pen-gpio-being-act.patch \
0001-arm-dts-colibri-imx6ull-keep-peripherals-disabled.patch \
0002-arm-dts-colibri-imx6ull-enable-default-peripherals.patch \
0001-ARM-dts-colibri-imx6ull-Enable-dual-role-switching.patch \
0002-drivers-chipidea-disable-runtime-pm-for-imx6ul.patch \
0001-ARM-dts-apalis-imx6-Disable-usb-over-current.patch \
0002-ARM-dts-colibri-imx6-Disable-usb-over-current.patch \
0003-ARM-dts-colibri-imx6ull-Disable-usb-over-current.patch \
0004-ARM-dts-colibri-imx7-Disable-usb-over-current.patch \
0001-arm64-dts-imx8mm-verdin-Add-yavia-carrier-board.patch \
0002-arm64-dts-imx8mp-verdin-Add-yavia-carrier-board.patch \
0001-media-v4l2-async-fix-binding-async-subdevs-with-mult.patch \
0002-media-i2c-ov5640-Implement-get_mbus_config.patch \
0001-Revert-media-v4l2-async-Use-endpoints-in-__v4l2_asyn.patch
----------------------------------
kernel 配置
内核配置文件 .config 也可以从 Toradex Artifactory 下载,并使用对应的季度发布版本的编译文件。打开 Toradex Artifactory 网页,在左边的 Artifact Repository Browser 中点开 oe-release,选择 Linux BSP v6 对应的 kirkstone-6.x.y。依次打开 kirkstone-6.x.y/release/7/apalis-imx6/tdx-xwayland-upstream/tdx-reference-multimedia-image/oedeploy/。release 下面一般可以选择最大序列的,这对应最新的发布版本。右击 kernel-config 下载即可。
将 kernel-config 复制到刚才下载的内核源码目录,命名为 .config ,用其作为 Linux 的默认配置。如果需要修改,后面还可以使用 make menuconfig 命令。
----------------------------------
$ cd linux-stable/
$ mv kernel-config .config
$ make olddefconfig
----------------------------------
准备好源码、补丁和内核配置文件,接下来就可以编译了,具体方法参考这里。
U-Boot
下载 U-Boot 源码
首先从 https://source.denx.de/u-boot/u-boot.git 下载源码,并 checkout 到 v2022.07 版本,也是 Linux BSP v6 所使用的 U-Boot 版本。
----------------------------------
$ git clone https://source.denx.de/u-boot/u-boot.git
$ cd u-boot
$ git checkout v2022.07
----------------------------------
下载和应用补丁
Upstream/mainline U-Boot 同样也需要相关补丁,和上面一样由 meta-toradex-bsp-common 提供。按照前面的方法在 u-boot 目录中建立 patch 文件夹后,在其中下载和 checkout。U-Boot 补丁位于 meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex 目录下。将里面的 patch 文件复制到 u-boot/patch 目录下。
----------------------------------
$ cd u-boot
$ mkdir patch
$ cd patch
$ git clone https://git.toradex.com/cgit/meta-toradex-bsp-common.git
$ cd meta-toradex-bsp-common
$ git checkout f7ff10a3b560dcf4e258115da679d1f864e09837
$ cp meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex/*.patch ./
----------------------------------
注意必须要以固定的顺序打补丁。补丁顺序可以参看 U-Boot meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex_2022.07.bb 文件。
----------------------------------
TDX_PATCHES = " \
file://0001-toradex-tdx-cfg-block-use-only-snprintf.patch \
file://0002-toradex-tdx-cfg-block-use-defines-for-string-length.patch \
file://0003-toradex-tdx-cfg-block-extend-assembly-version.patch \
file://0004-toradex-tdx-cfg-block-add-new-toradex-oui-range.patch \
file://0005-toradex-tdx-cfg-block-add-0068-i.mx-8m-mini-sku.patch \
file://0006-toradex-common-Remove-stale-comments-about-modules-a.patch \
file://0007-toradex-common-Use-ARRAY_SIZE-macro.patch \
file://0008-toradex-tdx-cfg-block-Cleanup-interactive-cfg-block-.patch \
file://0009-toradex-common-Remove-stale-function-declaration.patch \
file://0010-toradex-common-Remove-ifdef-usage-for-2nd-ethaddr.patch \
file://0011-toradex-tdx-cfg-block-Use-official-SKU-names.patch \
file://0012-toradex-common-Improve-product-serial-print-during-b.patch \
file://0013-configs-colibri-imx7-Enable-bootd-command.patch \
file://0001-ARM-imx8mp-verdin-imx8mp-Add-memory-size-detection.patch \
file://0001-apalis-colibri_imx6-imx6ull-_imx7-update-env-memory-.patch \
file://0001-configs-colibri-imx7-Fix-bad-block-table-in-flash-co.patch \
file://0001-colibri_imx6-fix-RALAT-and-WALAT-values.patch \
"
----------------------------------
在 patch 文件夹里执行面 git am 命令,期间不应该出现任何错误和冲突。
----------------------------------
$ git am 0001-toradex-tdx-cfg-block-use-only-snprintf.patch \
0002-toradex-tdx-cfg-block-use-defines-for-string-length.patch \
0003-toradex-tdx-cfg-block-extend-assembly-version.patch \
0004-toradex-tdx-cfg-block-add-new-toradex-oui-range.patch \
0005-toradex-tdx-cfg-block-add-0068-i.mx-8m-mini-sku.patch \
0006-toradex-common-Remove-stale-comments-about-modules-a.patch \
0007-toradex-common-Use-ARRAY_SIZE-macro.patch \
0008-toradex-tdx-cfg-block-Cleanup-interactive-cfg-block-.patch \
0009-toradex-common-Remove-stale-function-declaration.patch \
0010-toradex-common-Remove-ifdef-usage-for-2nd-ethaddr.patch \
0011-toradex-tdx-cfg-block-Use-official-SKU-names.patch \
0012-toradex-common-Improve-product-serial-print-during-b.patch \
0013-configs-colibri-imx7-Enable-bootd-command.patch \
0001-ARM-imx8mp-verdin-imx8mp-Add-memory-size-detection.patch \
0001-apalis-colibri_imx6-imx6ull-_imx7-update-env-memory-.patch \
0001-configs-colibri-imx7-Fix-bad-block-table-in-flash-co.patch \
0001-colibri_imx6-fix-RALAT-and-WALAT-values.patch
----------------------------------
U-Boot 配置
对于 32位处理器的模块,默认配置如下:
l colibri_imx6_defconfig
l colibri-imx6ull_defconfig
l colibri-imx6ull-emmc_defconfig
l colibri_imx7_defconfig
l colibri_imx7_emmc_defconfig
l apalis_imx6_defconfig
以 Apalis iMX6 为例。
----------------------------------
$ make mrproper
$ make apalis_imx6_defconfig
----------------------------------
最后编译 U-Boot。
----------------------------------
$ make -j$(nproc)
----------------------------------
相关文章:

Mainline Linux 和 U-Boot编译
By Toradex胡珊逢 Toradex 自从 Linux BSP v6 开始在使用 32位处理器的 Arm 模块如 iMX6、iMX6ULL、iMX7 上提供 mainline/upstream kernel ,部分 64位处理器模块如 Verdin iMX8M Mini/Plus 也提供实验性支持。文章将以季度发布版本 Linux BSP V6.3.0 为例介绍如何下…...

Mycat教程+面试+linux搭建
目录 一 MyCAT介绍 二 常见的面试题总结 三 linux下搭建Mycat 一 MyCAT介绍 1.1. 什么是MyCAT? 简单的说,MyCAT就是: 一个彻底开源的,面向企业应用开发的“大数据库集群” 支持事务、ACID、可以替代Mysql的加强版数据库 一个可…...

基于工作过程的高职计算机网络技术专业课程体系构建策略
行业人才需求分析高职教育是面向地方行业培养技能型、应用型人才,因此, 在课程体系的构建上要走社会调研、构建岗位群、构建专业模块及课程设置“四步 曲”。即通过社会行业需求调查研究,构建岗位群,设置相应的专业模块…...

(笔记四)利用opencv识别标记视频中的目标
预操作: 通过cv2将视频的某一帧图片转为HSV模式,并通过鼠标获取对应区域目标的HSV值,用于后续的目标识别阈值区间的选取 img cv.imread(r"D:\data\123.png") img cv.cvtColor(img, cv.COLOR_BGR2HSV) plt.figure(1), plt.imshow…...

一、计算机硬件选购
计算机硬件选购 一、设备选购1.1 I/O设备1.2 机箱1.3 主板1.3.1 主板芯片组的命名方式1.3.2 主板版型1.3.3 Z790-a(DDR5)主板参数 1.4 CPU1.5 硬盘1.6 显卡1.7 内存条1.8 散热器(水冷)1.9 电源、风扇、网线、插线板1.9.1 电源1.9.2 风扇1.9.3 网线1.9.4 …...

Dockerfile制作LAMP环境镜像
文章目录 使用Dockerfile制作LAMP环境镜像编写Dockerfile不修改默认页面修改默认页面 Start Script目录结构及文件登录私有仓库给镜像打标签上传镜像页面检查检测镜像可用性 使用Dockerfile制作LAMP环境镜像 编写Dockerfile 不修改默认页面 FROM centos:7 MAINTAINER "…...

暴力递归转动态规划(二)
上一篇已经简单的介绍了暴力递归如何转动态规划,如果在暴力递归的过程中发现子过程中有重复解的情况,则证明这个暴力递归可以转化成动态规划。 这篇帖子会继续暴力递归转化动态规划的练习,这道题有点难度。 题目 给定一个整型数组arr[]&…...

debian apt error: Package ‘xxx‘ has no installation candidate
新的debian虚拟机可能会出现这个问题。 修改apt的source.list,位于/etc/apt/source.list,添加两行: deb http://deb.debian.org/debian bullseye main deb-src http://deb.debian.org/debian bullseye main执行: sudo apt-get u…...

c#设计模式-结构型模式 之 外观模式
概述 外观模式(Facade Pattern)又名门面模式,隐藏系统的复杂性,并向客户端提供了一个客户端可以访问系统的接口。这种类型的设计模式属于结构型模式,它向现有的系统添加一个接口,来隐藏系统的复杂性。该模式…...

Focal Loss-解决样本标签分布不平衡问题
文章目录 背景交叉熵损失函数平衡交叉熵函数 Focal Loss损失函数Focal Loss vs Balanced Cross EntropyWhy does Focal Loss work? 针对VidHOI数据集Reference 背景 Focal Loss由何凯明提出,最初用于图像领域解决数据不平衡造成的模型性能问题。 交叉熵损失函数 …...

运算符(个人学习笔记黑马学习)
算数运算符 加减乘除 #include <iostream> using namespace std;int main() {int a1 10;int a2 20;cout << a1 a2 << endl;cout << a1 - a2 << endl;cout << a1 * a2 << endl;cout << a1 / a2 << endl;/*double a3 …...

开源与专有软件:比较与对比
🌷🍁 博主猫头虎 带您 Go to New World.✨🍁 🦄 博客首页——猫头虎的博客🎐 🐳《面试题大全专栏》 文章图文并茂🦕生动形象🦖简单易学!欢迎大家来踩踩~🌺 &a…...

openResty+lua+redis实现接口访问频率限制
openResty简介: OpenResty 是一个基于 Nginx 与 Lua 的高性能 Web 平台,其内部集成了大量精良的 Lua 库、第三方模块以及大多数的依赖项。用于方便地搭建能够处理超高并发、扩展性极高的动态 Web 应用、Web 服务和动态网关。 OpenResty 通过汇聚各种设…...

自动化测试(三):接口自动化pytest测试框架
文章目录 1. 接口自动化的实现2. 知识要点及实践2.1 requests.post传递的参数本质2.2 pytest单元测试框架2.2.1 pytest框架简介2.2.2 pytest装饰器2.2.3 断言、allure测试报告2.2.4 接口关联、封装改进YAML动态传参(热加载) 2.3 pytest接口封装ÿ…...

Python --datetime模块
目录 1, 获取datetime时间 2, datetime与timestamp转换 2-1, datetime转timestamp 2-2, timestamp转datetime 3, str格式与datetime转换 3-1, datetime转str格式 3-2, str格式转datetime…...

顺序表链表OJ题(3)——【数据结构】
W...Y的主页 😊 代码仓库分享 💕 前言: 今天是链表顺序表OJ练习题最后一次分享,每一次的分享题目的难度也再有所提高,但是我相信大家都是非常机智的,希望看到博主文章能学到东西的可以一键三连关注一下博主…...

【Azure】Virtual Hub vWAN
虚拟 WAN 文档 Azure 虚拟 WAN 是一个网络服务,其中整合了多种网络、安全和路由功能,提供单一操作界面。 我们主要讨论两种连接情况: 通过一个 vWAN 来连接不通的 vNET 和本地网络。以下是一个扩展的拓扑 结合 vhub,可以把两个中…...

React Navigation 使用导航
在 Web 浏览器中,您可以使用锚标记链接到不同的页面。当用户单击链接时,URL 会被推送到浏览器历史记录堆栈中。当用户按下后退按钮时,浏览器会从历史堆栈顶部弹出该项目,因此活动页面现在是以前访问过的页面。React Native 不像 W…...

双指针算法,基础算法实践,基本的算法的思想,双指针算法的实现
一,定义 双指针算法是一种常用于解决数组和链表问题的算法技巧。它的核心思想是使用两个指针在数据结构中按照一定的规则移动,从而达到快速搜索或处理数据的目的。这个技巧通常用于优化算法,降低时间复杂度,提高程序的执行效率。…...

idea http request无法识别环境变量
问题描述 创建了环境变量文件 http-client.env.json,然后在*.http 文件中引用环境变量,运行 HTTP 请求无法读取环境变量文件中定义的变量。 事故现场 IDEA 版本:2020.2 2021.2 解决步骤 2020.2 版本环境变量无法读取 2021.2 版本从 2020.…...

性能测试常见的测试指标
一、什么是性能测试 先看下百度百科对它的定义 性能测试是通过自动化的测试工具模拟多种正常、峰值以及异常负载条件来对系统的各项性能指标进行测试。我们可以认为性能测试是:通过在测试环境下对系统或构件的性能进行探测,用以验证在生产环境下系统性能…...

并发 04(Callable,CountDownLatch)详细讲解
并发 Callable 1 可以返回值 2可以抛出异常 泛型指的是返回值的类型 public class Send {public static void main(String[] args) {//怎么启动Callable//new Thread().start();Aaa threadnew Aaa();FutureTask futureTasknew FutureTask(thread);new Thread(futureTask,&qu…...

Json路径表达式
原json路径 {"timeStamp": "20220801110008","transIDO": "6ba9088c981b407fb38feasdf09","version": "1.0.0","signMethod": "md5","content": "{\"companyName\&quo…...

【uniapp 上传图片示例】
以下是 uniapp 上传图片的详细步骤示例: 定义一个方法,用于选择图片并上传: methods: {chooseImage() {uni.chooseImage({count: 1, // 最多选择的图片数量sizeType: [original, compressed], // 可以指定原图或压缩图sourceType: [album, …...

apache2配置文件 Require all granted是什么意思
修改apache2的配置文件 /etc/apache2/apache2.conf,需要增加网站代码的路径,下列配置是什么意思呢 <Directory "/var/www/html">Options FollowSymLinksAllowOverride AllRequire all granted </Directory> 1. Options Options …...

c/c++ 的一些知识
c 面向对象是一种思想,通常情况下都是以组合为主,也就是在子类里定义一个基类struct base_t {void (*method)(base_t *base_p); };struct children_t {int a;int b;base_t base;void (*method)(children_t *children_p); };children_t children_creat(i…...

Rancher上的应用服务报错:413 Request Entity Too Large
UI->rancher的ingress->UI前端(在nginx里面)->zuul->server 也就是说没经过一次http servlet 都要设置一下大小 1.rancher的ingress 当出现Request Entity Too Large时,是由于传输流超过1M。 1、需要在rancher的ingress中设置参数解决。 配置注释&a…...

【LeetCode题目详解】第八章 贪心算法 part01 理论基础 455.分发饼干 376. 摆动序列 53. 最大子序和 day31补
贪心算法理论基础 关于贪心算法,你该了解这些! 题目分类大纲如下: # 什么是贪心 贪心的本质是选择每一阶段的局部最优,从而达到全局最优。 这么说有点抽象,来举一个例子: 例如,有一堆钞票&…...

ssm+vue中国咖啡文化宣传网站源码和论文
ssmvue中国咖啡文化宣传网站源码和论文078 开发工具:idea 数据库mysql5.7 数据库链接工具:navcat,小海豚等 技术:ssm 课题背景 随着时代的发展和人们生活理念的进一步改变,咖啡业已经成为了全球经济中发展最迅猛的产业之一。…...

基于MATLAB开发AUTOSAR软件应用层Code mapping专题-part 4 Data store标签页介绍
这篇文章我们继续讲解code-mapping的Data stores页,这个页的内容对应的SIMULINK中的模块是Data store memory。 我们首先在模型中创建一个Data store memory模块,如图: Data store memory模块的作用相当于一个全局变量,我们可以在模型的功能逻辑里将一个信号存进去,在另…...