0
votes

I'm using buildroot to create a linux system for raspberry pi. I want to use the initramfs to enable to system to self-patch. The procedure roughly runs as follows:

  • Raspi boots, kernel loads initramfs
  • The initramfs-system (which contains busybox, zsync etc.) connects to a central server and checks if there are boot-file updates available (e.g. a new kernel)
  • If not, it checks if there is a system update available and downloads that if needed
  • The downloaded (squashfs) system image is mounted and executed via switch_root

My problem is that I need to compile a secondary busybox (and some more packages) for the initramfs which do not belong in the main system. I currently solved this by manually tinkering with the package files to install into target/initramfs, moving this folder out with pre-build and back in again with post-build, but this seems rather hacky. Additionally, different package types require different types of changes. Is there a better solution to this problem? If one could for example manually overwrite the target directory for each package, this problem would be rather easy to solve.

1
Why not simply use two Buildroot directories, with a shared external toolchain? Then you'll always know what is in each build. There are alternatives, but that requires a lot more work. Assuming that the initramfs is smaller and more stable, then create a new output/target_ramfs that is distinct from the ordinary target directory. Create new package definitions for each program that is needed (with the makefile customized to install to output/target_ramfs).sawdust
I thought about the first one, but one thing I thought which makes this also a bit tricky is the shared kernel (maybe - I'm very new to the whole business of doing this kinda stuff). The latter is what I am doing right now kinda - the problem is that some autoconf packages apparently can't change their destination directories (in my case zsync is causing the trouble, the make install does not take any kind of destination directory, you can only specify it via ./configure --prefix, but that prefix gets "rooted" at the target directory (e.g. "--prefix=/usr/bin" -> "$TARGET_DIR/usr/bin")incaseoftrouble

1 Answers

0
votes

Create two separate buildroot configurations.

One configuration will have the kernel and the initramfs.

The other configuration only has the squashfs rootfs.

Creating a partial rootfs from a configuration is very tricky, because you have to be sure that you don't miss any shared libraries or other auxiliary files needed by some program.

Note that to speed up the build, you can use ccache and/or use an external toolchain. See the manual.