Thursday, September 15, 2016

How to rebuild package in Buildrot

Hi Folks! Welcome to my Blog. 

Most of the developers have this question, "How to rebuild a given package without rebuilding everything from scratch" as it is time consuming.
 
Buildroot doesn’t keep track of which package installs what files in the output/staging and output/target directories. However, implementing clean package removal is on the TODO-list of Buildroot developers.

Here are the steps do the rebuild of a package.

let us change directory to buildroot source root directory

$cd buildroot

Here we take an example of modifying raw.c file available in the util-linux package, and compile the package alone to get our new changes into the binary raw.
 
Step1: Modify the Source

In the buildroot/output/build directory you find the source of the package util-linux-<version no> lets say util-linux-2.26.2 is the package we are interested to re-compile

$gedit ./output/build/util-linux-2.26.2/disk-utils/raw.c

Save and exit after the modifications
 
Step2: Build the package
 
make <package>-rebuild, followed by make or make <package>

$ make util-linux-rebuild
$ make

This completes the build if no compilation errors. The freshly built executable is 
 
Step3: Use the new binary
 
Binary compiled with the new changes is available at path buildroot/output/build/util-linux-2.26.2/raw which you can copy to sbin folder of your root file-system. 
 
For more details refer to Buildroot Documentation

please leave your comments, it will be encouraging :)