1
votes

I am attempting to get initramfs working on an embedded linux device using buildroot and uboot. I have been following the guides have have initramfs set up in the buildroot and kernel config. 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.

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
  2. Stage 2 bootloader (uboot) initializes a few things, loads the kernel into memory and runs it
  3. The kernel places the CPIO archive into memory, makes that root and runs init in that enviornment

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. I am not sure how to make item 3 actually happen from here.

Second, in terms of actual configurations, the Buildroot menuconfig has a number of options for filesystems

  • ext2/3/4 root filesystem (on by default)
  • cpio the root filesystem (for use as an initial RAM filesystem)
  • initial RAM filesystem linked into linux kernel

Then in the kernel config

  • General -> Initial RAM filesystem and RAM disk (initramfs/initrd) support
  • General -> Initramfs source files (set to the generated cpio file)

What is buildroot generating here? From my end it looks like I am getting duplicate images (CPIO and ext4) and the CPIO is being ignored.

1

1 Answers

0
votes

For people who may have the same question, the best way forward is to become more familiar with uboot and it's options. In particular the role uboot-env.txt plays in the process.

My understanding of buildroot was wrong. The process is

  1. Building kernel
  2. Creating all root filesystems (ext and CPIO)
  3. Rebuilding the kernel with the CPIO inside
  4. Packaging the ext file as dictated by my genimage.cfg file

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
  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
  3. This kernel did not have the cpio so it did not run.

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.