linux-kernel - Yocto 将 initramfs / initrd 映像安装到 Raspberry Pi
问题描述
使用基于 Yocto 的工具,我能够生成多个文件进行部署。这些包括:
sdimg
用于写入 SD 卡的文件cpio.gz
存档(Initramfs )Image-initramfs.bin
(初始化程序)
我想使用基于 Yocto 的 Linux 发行版在我的嵌入式板 (Raspberry Pi) 中激活 plymouth。但是我不确定如何安装cpio.gz
存档或Image-initramfs.bin
. 我在网上读到 vanilla Raspbian 在引导分区 ie 中有一个条目,并且在引导分区/config.txt
ie 中initramfs <file.gz> <start_address>
有一个内核命令行选项。/cmdline.txt
initrd=<file.gz>
到目前为止,我尝试过的都涉及这两种方法。我将cpio.gz
文件复制到/boot
根文件系统分区并配置上述文件,但不起作用。为了分解它,它的外观如下:
+ Boot Partition
+ ---- overlays/
+ ---- config.txt
+ ---- cmdline.txt
+ ---- kernel.img
+ 1.2GB Volume (rootfs)
+ ---- bin/
+ ---- boot/
+--- <file>.cpio.gz
+ ---- var/
+ ---- usr/
....
现在,在 中config.txt
,我有类似的东西(尝试了很多变体):
initramfs <file>.cpio.gz 0x00a00000
ramfsfile="<file>.cpio.gz"
ramfsaddr=0x00a00000
在cmdline.txt
中,我有:
initrd=<file>.cpio.gz dwc_otg.lpm_enable=0 console=serial0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
然而,内核甚至给出一个错误是不够的。这意味着,系统正常启动,并且没有使用 initramfs 的迹象。
我用 yocto 编译的内核如下:
#> uname -a
#> Linux raspberrypi0-wifi 4.9.77-rt61 #11 PREEMPT RT Tue May 22 01:14:26 +03 2018 armv6l armv6l armv6l GNU/Linux
启用以下内核配置参数:
#> modprobe configs
#> cat /proc/config.gz | gunzip > kernelconf.txt
...
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
我不知道我在这里错过了什么。有什么引起你注意的,请告诉我。非常感谢任何指导。
解决方案
通过将生成的 .cpio.gz 存档复制到 sd 卡的引导分区,我能够引导到 initramfs。然后我编辑了 config.txt 选项
#initramfs initramf.gz 0x00800000
至
initramfs <name-of-the-copied-archive>.cpio.gz
启动覆盆子后,它现在启动到我的 initramfs 映像中。
推荐阅读
- android - How to putExtra data from strings.xml
- javascript - 如何使按键在按下时只触发一次?
- c - 返回带有指向内部结构数组的指针成员的结构是否安全?
- abap - 通过自定义报告使用 SUBMIT 时出现运行时错误“SYSTEM_ABAP_ACCESS_DENIED”
- react-native - 如何在 onChangeText 之后将文本输入值更改为零?
- css - 在 create-react-app 中的 App.css 中,背景图像不适合整个页面
- jquery - 等待光标提交 POST 表单
- c# - 为什么使用 Linq Group By Sum 会给我一个转换错误?
- c# - 比较 Form C# Visual Studio 中的两个 Date From Date 和 Database SQL Server 中的 Date
- css - SCSS 可以检测容器的 2 个子元素是放在同一行还是分成 2 行?