4

I am using buildroot to create an OS for the Raspberry PI. How do I apply a patch to a file in the resulting rootfs?

For example adding the lines

auto eth0

iface eth0 inet dhcp

to /etc/network/interfaces on the resulting rootfs.

I realize that this can be done with a script after unpacking the rootfs on my target, but I am wondering if it can be automated using buildroot.

Community
  • 1
  • 1
John
  • 530
  • 5
  • 19

1 Answers1

5

First of all take a look at BR2_EXTERNAL mechanism. This way you can manage your project/configurations/package independent from Buildroot tree.

Then look at "Root filesystem overlays (BR2_ROOTFS_OVERLAY)" and "Post-build scripts (BR2_ROOTFS_POST_BUILD_SCRIPT)" in Customizing the generated target filesystem section. They describe both ways, i.e supply your custom file via fs-overlay or run a post-build script and alter the file within this script.

yegorich
  • 4,653
  • 3
  • 31
  • 37
  • but BR2_ROOTFS_POST_BUILD_SCRIPT always run when I run make -j. causing duplicate line write to the file – nuclear Jul 25 '23 at 02:29
  • @nuclear then your script will have to check if the change is already there or you just use the rootfs overlay. – yegorich Jul 25 '23 at 08:38