首页 > 解决方案 > Yocto 将 initramfs / initrd 映像安装到 Raspberry Pi

问题描述

使用基于 Yocto 的工具,我能够生成多个文件进行部署。这些包括:

我想使用基于 Yocto 的 Linux 发行版在我的嵌入式板 (Raspberry Pi) 中激活 plymouth。但是我不确定如何安装cpio.gz存档或Image-initramfs.bin. 我在网上读到 vanilla Raspbian 在引导分区 ie 中有一个条目,并且在引导分区/config.txtie 中initramfs <file.gz> <start_address>有一个内核命令行选项。/cmdline.txtinitrd=<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

我不知道我在这里错过了什么。有什么引起你注意的,请告诉我。非常感谢任何指导。

标签: linux-kernelraspberry-piinityoctoboot

解决方案


通过将生成的 .cpio.gz 存档复制到 sd 卡的引导分区,我能够引导到 initramfs。然后我编辑了 config.txt 选项

#initramfs initramf.gz 0x00800000

initramfs <name-of-the-copied-archive>.cpio.gz

启动覆盆子后,它现在启动到我的 initramfs 映像中。


推荐阅读