How to modify the source of Buildroot packages for package development?
Asked Answered
A

2

2

I've been using buildroot in order to build a toolchain using uclibc. Now, buildroot downloads all the packages, extract them and build them all..

I want to change the toolchain's uclibc source and then recompile the toolchain with the new source and i just can't understand how it can be done in the pretty way..

After it finishes building, all of the extracted sources are found in the "<buildroot-src>/output/build". But changing them won't give me a thing because buildroot only uses this directory as an intermediate during build time.

So my thought was, maybe changing the .mk file in the uclibc package and make it use my modified source instead of downloading and extracting it (not yet sure if it can be done there) but that seems a bit ugly solution..

So my question is this: Is there any better way of telling buildroot to build a package using existing source?

Amyl answered 30/10, 2016 at 21:14 Comment(2)
Not sure about that particular build system, but usually there's a way to tell one to apply a patch before building from the original source (and you have to deliver said patch, of course).Perplexity
Generate one or more patch files, and store them in that package directory. Any files with the .patch extension will be applied to the source after it is extracted. Alternatively, once the source is extracted and built, you can modify the source, and then force a recompile by deleting the appropriate .stamp_* files (i.e. keep .stamp_downloaded, .stamp_extracted, .stamp_patched, and .stamp_configured). Beware that you can lose everything when you do a make clean and you don't have patchesHelenahelene
H
5

Please read the Buildroot manual about the <pkg>_OVERRIDE_SRCDIR functionality. It does exactly what you are looking for.

Hoist answered 1/11, 2016 at 13:39 Comment(1)
You buildroot devs are my heroes. Why did you use a separate file instead of using regular options like BR2_PACKAGE_LINUX_OVERRIDE_SRCDIR?Awash
A
0

Minimal git submodule + *_OVERRIDE_SRCDIR example

Docs explain it, but here is a faster to parse version.

Directory structure:

  • buildroot/: git submodule with buildroot 2017.02

  • linux/: git submodule with Linux kernel pointing to your fork at https://github.com/you/linux

  • buildroot_override: contains:

    LINUX_OVERRIDE_SRCDIR = ../linux
    

Build and run:

cd buildroot
make qemu_x86_64_defconfig
echo 'BR2_PACKAGE_OVERRIDE_FILE=../buildroot_override' >> .config
make
qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append root=/dev/vda -net nic,model=virtio -net user

Here is an example project using it.

Awash answered 8/7, 2017 at 9:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.