OpenWRT build system
How feeds work
The OpenWRT build system contains several core packages but can be extended and modified by using feeds. Feeds are repositories that contain package Makefiles, i.e. descriptions on where to find the source code for a package and how to build an OpenWRT package from it. Feeds are defined in feeds.conf file in TOPDIR. The layout for the dectmngr package is shown below. That is the feeds.conf contains a reference to a feeds git repo and a commit, then in that feed the dectmngr git repo and commit ID is specified.
feeds.conf #commit -> feeds/intenopackages/dectmngr/Makefile #commit -> dectmngr.git
feeds.conf: src-git-full intenopackages git@iopsys.inteno.se:inteno-packages.git^e0bb62451d8b2030d84191732b42a0d3064b1c5f
feeds/intenopackages/dectmngr/Makefile: PKG_SOURCE_URL:=http://ihgsp.inteno.se/git/dectmngr.git PKG_SOURCE_VERSION:=6ba403663bc9cfdb8f89fb34de367f0796d68552
While the OpenWRT build system supports branch names in feeds.conf, in IOWRT we only use commit IDs. This ensures that we can always recreate a build at a later date by checking out a specific commit in the top level repository.
IOWRT initialization
After cloning the repository, the iop command needs to be initialized to install the commands for this version of IOWRT.
Running iop without arguments gives the following output:
./iop
Usage: iop <command> [<args>]
Available commands:
bootstrap Initial command to run to install other commands
setup_host Install needed packets to host machine
As can be seen, there is only two command available. First you need to install everything needed to your host with.
./iop setup_host
This will only work on debian based distros. ex ubuntu. not on fedora.
After the host is set up OpenWRT build needs to be populated with packages to build. Run this to install more commands from feeds:
./iop bootstrap
When bootstrap completes, you should have more commands available (some commands can differ for your version):
./iop
Usage: iop <command> [<args>]
Available commands:
bootstrap Initial command to run to install other commands
genconfig Generate configuration for board and customer
setup_host Install needed packages to host machine
status Display the state of your working tree
NOTE. iop bootstrap only needs to be run once to install the commands above.
Now, generate a .config file for the board and customer you're building for with
iop genconfig <profiles>
NOTE. To get the list of available devices profiles, run:
iop genconfig -b
First iop genconfig will clone all required repositories into /feeds and install required packages from those repositories into the build system by creating symlinks in packages/feeds/.
To summarize, to initialize the repository, run:
- git clone <IOWRT>
- iop bootstrap
- iop genconfig <profiles>
If it's the first time you're building an image on your host, you should run:
iop setup_host
to install the required packages on your host machine. After that run:
make
alt: for parallel build.
make download
make -j8
Updating the repository
If you run git pull in the toplevel repository, you will most probably get changes that modify feeds.conf.io and/or yml profile files. Now references in those files point to the newer commits then what is checked out in the feed repositories, and you need to update your feeds. This can be done by calling genconfig again:\
iop genconfig <profiles>
NOTE. If you'd like to prevent your local feed changes from being overwritten
by genconfig use --keep
option:
iop genconfig --keep <profiles>
Working with feeds
The build system will clone and checkout the packages in build_dir in detached head state so before you can commit you need to checkout a branch to work on.
If you want to update feed references, you need to modify feeds.conf.io and/or yml profile files manually in profiles/include directory. Before updating references in feeds.conf.io or yml profile files make sure you've pushed relevant changes to the remote repository.
When you have created a new commit in the package repo in the build directory this commit needs to be pushed to two places. First the package makefile in the feed needs to be repointed to the new commit. This in turn creates a new commit in the feed and feeds.conf.io or yml needs to be repointed to that commit.