0

I am using initramfs-tools hooks to run custom commands during pre-boot or post-boot on Ubuntu. (https://manpages.ubuntu.com/manpages/xenial/man8/initramfs-tools.8.html)

Now I want to try same thing for my embedded device running Linux in buildroot environment. I dont find any initramfs-tools for buildroot configuration.

Question:

  1. How can be include initramfs-tools in buildroot environment
  2. Is there any existing way to invoke are scripts from initramfs in buildroot?

Thanks

1 Answers1

0

When building a system with Buildroot, it's not usual to first boot into an initramfs and later pivot into the full rootfs. Indeed, there is usually no need for that since on the systems targeted with Buildroot you usually know perfectly well which modules are needed at boot, and you build those into the kernel instead of building them as modules.

In the rare cases that an initramfs is needed, the usual approach is to make two separate Buildroot configurations: one for the initramfs (and usually including the kernel as well), and one for the rootfs.

That said, an approach using initramfs-tools sounds like a useful approach as well.

To make this work, first of all you need to create the initramfs-tools package. It would be a host-only package. It's quite likely, however, that initramfs-tools is not cross-build friendly, so it may need to be patched to be able to use in a context where the build environment is not the same as the target environment.

Next, you need a step in the process where initramfs-tools is run. You can do this as a post-build script. Alternatively, you could create a new "filesystem" for it, i.e. a new directory under fs/ with a menu entry and a makefile.

Arnout
  • 2,927
  • 16
  • 24