rebuilding-packages.txt 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. Understanding how to rebuild packages
  2. =====================================
  3. One of the most common questions asked by Buildroot users is how to
  4. rebuild a given package or how to remove a package without rebuilding
  5. everything from scratch.
  6. Removing a package is currently unsupported by Buildroot without
  7. rebuilding from scratch. This is because Buildroot doesn't keep track
  8. of which package installs what files in the +output/staging+ and
  9. +output/target+ directories. However, implementing clean package
  10. removal is on the TODO-list of Buildroot developers.
  11. The easiest way to rebuild a single package from scratch is to remove
  12. its build directory in +output/build+. Buildroot will then re-extract,
  13. re-configure, re-compile and re-install this package from scratch.
  14. However, if you don't want to rebuild the package completely from
  15. scratch, a better understanding of the Buildroot internals is
  16. needed. Internally, to keep track of which steps have been done and
  17. which steps remain to be done, Buildroot maintains stamp files (empty
  18. files that just tell whether this or that action has been done). The
  19. problem is that these stamp files are not uniformly named and handled
  20. by the different packages, so some understanding of the particular
  21. package is needed.
  22. For packages relying on Buildroot packages infrastructures (see
  23. xref:add-packages[this section] for details), the following stamp
  24. files are relevant:
  25. * +output/build/packagename-version/.stamp_configured+. If removed,
  26. Buildroot will trigger the recompilation of the package from the
  27. configuration step (execution of +./configure+).
  28. * +output/build/packagename-version/.stamp_built+. If removed,
  29. Buildroot will trigger the recompilation of the package from the
  30. compilation step (execution of +make+).
  31. For other packages, an analysis of the specific 'package.mk' file is
  32. needed. For example, the zlib Makefile used to look like this (before
  33. it was converted to the generic package infrastructure):
  34. -----------------
  35. $(ZLIB_DIR)/.configured: $(ZLIB_DIR)/.patched
  36. (cd $(ZLIB_DIR); rm -rf config.cache; \
  37. [...]
  38. )
  39. touch $@
  40. $(ZLIB_DIR)/libz.a: $(ZLIB_DIR)/.configured
  41. $(MAKE) -C $(ZLIB_DIR) all libz.a
  42. touch -c $@
  43. -----------------
  44. If you want to trigger the reconfiguration, you need to remove
  45. +output/build/zlib-version/.configured+. If you want to trigger only
  46. the recompilation, you need to remove
  47. +output/build/zlib-version/libz.a+.
  48. Note that most packages, if not all, will progressively be ported over
  49. to the generic or autotools infrastructure, making it much easier to
  50. rebuild individual packages.