简体   繁体   English

使用buildroot和uboot配置initramfs

[英]Configuring initramfs with buildroot and uboot

I am attempting to get initramfs working on an embedded linux device using buildroot and uboot. 我试图让initramfs使用buildroot和uboot在嵌入式Linux设备上工作。 I have been following the guides have have initramfs set up in the buildroot and kernel config. 我一直在遵循指南,在buildroot和内核配置中设置了initramfs。 However as far as I can tell it is not being built into the kernel, although a CPIO or the root FS is being included in the output. 但是据我所知,尽管输出中包含了CPIO或根FS,但它并未内置在内核中。

My questions is twofold. 我的问题是双重的。 First, from a high level standpoint, is my understanding of the boot process correct? 首先,从较高的角度来看,我对引导过程的理解正确吗?

  1. Stage 1 bootloader (Atmel/ARM specific) starts and hands off 第1阶段引导程序(特定于Atmel / ARM)启动并移交
  2. Stage 2 bootloader (uboot) initializes a few things, loads the kernel into memory and runs it 第2阶段自举程序(uboot)初始化一些东西,将内核加载到内存中并运行它
  3. The kernel places the CPIO archive into memory, makes that root and runs init in that enviornment 内核将CPIO归档文件放入内存,创建该根目录并在该环境中运行init

This means the image I flash onto the chip is an IMG with a boot and system partition, the system partition is ext4 and contains the CPIO archive within. 这意味着我刷新到芯片上的映像是具有引导和系统分区的IMG,系统分区是ext4,并且其中包含CPIO存档。 I am not sure how to make item 3 actually happen from here. 我不确定如何使第3项实际上从这里发生。

Second, in terms of actual configurations, the Buildroot menuconfig has a number of options for filesystems 其次,在实际配置方面,Buildroot菜单配置具有许多文件系统选项

  • ext2/3/4 root filesystem (on by default) ext2 / 3/4根文件系统(默认情况下处于启用状态)
  • cpio the root filesystem (for use as an initial RAM filesystem) cpio根文件系统(用作初始RAM文件系统)
  • initial RAM filesystem linked into linux kernel 链接到linux内核的初始RAM文件系统

Then in the kernel config 然后在内核配置中

  • General -> Initial RAM filesystem and RAM disk (initramfs/initrd) support 常规->初始RAM文件系统和RAM磁盘(initramfs / initrd)支持
  • General -> Initramfs source files (set to the generated cpio file) 常规-> Initramfs源文件(设置为生成的cpio文件)

What is buildroot generating here? 这里的buildroot是什么? From my end it looks like I am getting duplicate images (CPIO and ext4) and the CPIO is being ignored. 从我的角度来看,好像我正在获得重复的图像(CPIO和ext4),并且CPIO被忽略了。

For people who may have the same question, the best way forward is to become more familiar with uboot and it's options. 对于可能有相同问题的人,最好的解决方法是更加熟悉uboot及其选项。 In particular the role uboot-env.txt plays in the process. 特别是uboot-env.txt在此过程中扮演的角色。

My understanding of buildroot was wrong. 我对buildroot的理解是错误的。 The process is 这个过程是

  1. Building kernel 构建内核
  2. Creating all root filesystems (ext and CPIO) 创建所有根文件系统(ext和CPIO)
  3. Rebuilding the kernel with the CPIO inside 使用内部的CPIO重建内核
  4. Packaging the ext file as dictated by my genimage.cfg file 按照我的genimage.cfg文件的指示打包ext文件

This may be of interest if the process is confusing to you. 可能会感兴趣如果这个过程是混乱给你。

Here is what the system was doing 这是系统正在做的

  1. Stage 1 bootloader (Atmel/ARM specific) starts and hands off 第1阶段引导程序(特定于Atmel / ARM)启动并移交
  2. Stage 2 bootloader (uboot) initializes a few things, then behaves as dictated by as config, by writing the kernel to memory from the ext4 partition and running it 第2阶段引导程序(uboot)初始化一些事情,然后按照config的指示运行,方法是将内核从ext4分区写入内存并运行它
  3. This kernel did not have the cpio so it did not run. 该内核没有cpio,因此它没有运行。

Better understanding the process and components I was able to restructure my img file and use the bootloader to load the kernel that was built with the cpio. 更好地了解过程和组件之后,我能够重组img文件并使用引导加载程序来加载使用cpio构建的内核。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM