Search code examples
buildroot

buildroot package from local source with snapshots


I want to fork buildroot, add a custom package, add the package's source directly in-tree, and have buildroot use the in-tree source to build the custom package. I've done that, following chapter 17 of the buildroot user manual, but buildroot doesn't seem to be picking up local changes that I've made.

For example, I built the entire image, and it also built my custom application. Then I went into the source for my custom application and added an intentional syntax error -- but then I ran make again and it happily generated an image using the old version of my custom app.

How do I tell buildroot to look for local source modifications, even if it already has a cached build of the package with a matching version?

These are the new files which I have added to my buildroot fork:

buildroot/
  package/
    customapp/
      customapp.mk
      Config.in
  customapp/
    configure.ac
    Makefile.am
    README
    src/
      main.c
      Makefile.am

(I also edited buildroot/package/Config.in so that it sources the buildroot/package/customapp/Config.in file. All the Config.in stuff is just a simple boolean to enable customapp, and they work fine, so I'll omit them from this question.)

Here are the contents of the build-related files:

buildroot/package/customapp/customapp.mk

CUSTOMAPP_VERSION = 0.1
CUSTOMAPP_SITE = customapp
CUSTOMAPP_SITE_METHOD = local
CUSTOMAPP_AUTORECONF = YES

$(eval $(autotools-package))

buildroot/customapp/configure.ac

AC_INIT([customapp], [0.1], [name@email.tld])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
 Makefile
 src/Makefile
])
AC_OUTPUT

buildroot/customapp/Makefile.am

SUBDIRS = src
dist_doc_DATA = README

buildroot/customapp/src/Makefile.am

bin_PROGRAMS = customapp
customapp_SOURCES = main.c

Solution

  • Section 8.3 of the buildroot manual explains how to rebuild a single package. The easiest way is with [package name]-rebuild target. In your case it would be:

    make customapp-rebuild
    

    You may want to also trigger the buildroot post build actions to rebuild the target device file system images after your package re-build is complete:

    make target-post-image