android_noob_xx
android_noob_xx

Reputation: 83

How to use buildroot with custom changes in packages

I have a buildroot directory with all my configs I am using a package, and for a certain use case, I want to check where the package fails at runtime.

I am trying to modify the package a little bit, but I do not know how to build this package with my debug prints included.

I tried to like this

  1. go to buildroot/dl/package/ folder
  2. extract the package
  3. change in source
  4. gzip the package
  5. delete the intermediate in buildroot/output/build/package
  6. build make

Now build root uses some kind of hash value and rejects the package with my changes. It redownloads the package and replaced my changes.

ERROR: imx-kobs-a0e9adce2fb7fcd57e794d7f9a5deba0f94f521b.tar.gz has wrong sha256 hash:
ERROR: expected: 5855c8964f908ad30e5d4500180ee57c51af68186289ef1bdf8553ee60d3b1f5
ERROR: got     : b5c22a971d9c9130b1b0f5ddd5b60b2eabd60607421c0f746ef0543b42960977
ERROR: Incomplete download, or man-in-the-middle (MITM) attack
dl-wrapper: Re-downloading 'imx-kobs-a0e9adce2fb7fcd57e794d7f9a5deba0f94f521b.tar.gz'...

How to use buildroot with more control?

Upvotes: 1

Views: 3182

Answers (1)

Thomas Petazzoni
Thomas Petazzoni

Reputation: 5956

Two options:

  • For quick tests, modify the source code in output/build/<pkg>-<version>/, and run make <pkg>-rebuild to force the rebuild of that package. Note that output/build/<pkg>-<version>/ folders are lost when doing a make clean in Buildroot, so this is only good for some quick debugging/investigation.

  • For actual development on the source code, I would suggest to use the <pkg>_OVERRIDE_SRCDIR mechanism. Create a local.mk file at the root of the Buildroot tree. In this file, put FOO_OVERRIDE_SRCDIR = $(HOME)/foo. From now on, Buildroot will no longer download/extract/patch the foo package, but instead will instead rsync the source code from $(HOME)/foo into the package build directory. Running make foo-rebuild will re-run rsync and restart the build of this package. This means you can change the source code in $(HOME)/foo and very quickly rebuild the package with those changes. See also slide 269 and following in https://bootlin.com/doc/training/buildroot/buildroot-slides.pdf.

Upvotes: 8

Related Questions