Custom DTS / DTB building with ImageBuilder

Joseph Mullally jwmullally at gmail.com
Tue Mar 9 21:44:19 GMT 2021


Great, it turns out to be very straightforward.

To build a DTS into DTB and assemble the firmware kernel image using
the Image Builder Makefile recipes, you just need to manually invoke
the built target for it. You'll also need to fetch any missing DTS
header dependencies it complains about. Then you can build the image
as normal.

    ln -sf /usr/bin/cpp staging_dir/host/bin/mips-openwrt-linux-musl-cpp
    PATH=$(pwd)/staging_dir/host/bin:$PATH make --trace -C
target/linux/ath79/image
"$(pwd)/build_dir/target-mips_24kc_musl/linux-ath79_generic/tplink_archer-c7-v5-kernel.bin"
TOPDIR="$(pwd)" INCLUDE_DIR="$(pwd)/include" TARGET_BUILD=1
BOARD="ath79" SUBTARGET="generic" PROFILE="tplink_archer-c7-v5"
DEVICE_DTS="qca9563_tplink_archer-c7-v5"
    make image PROFILE="tplink_archer-c7-v5"

Full example which patches in a new custom device profile and builds it:
[1] https://github.com/jwmullally/openwrt_wpa8630p_v2_fullmem/blob/master/Makefile

On Sat, Feb 27, 2021 at 12:21 AM Joseph Mullally <jwmullally at gmail.com> wrote:
>
> Hi,
>
> Device Tree is great as it decouples the hardware layout from the
> kernel build. What are peoples thoughts on supporting custom DTS
> building in ImageBuilder? There are a few advantages: Uses the
> official kernel, makes it easier to support out-of-tree unofficial
> firmwares etc. [1] says DTS files were rebuilt in Chaos Calmer Image
> Builder?
>
> As an example: https://github.com/jwmullally/openwrt_wpa8630p_v2_fullmem
>
> As you can see from the Makefile, most of the tools are already
> included in ImageBuilder except for cpp and some DTS headers from the
> kernel (ignore the tplink-firmware.c patching as its unavoidable).
> There are some clunky parts there, like needing to manually assemble
> the "-kernel.bin" instead of using the OpenWRT Makefile definitions.
> Does anyone know how to do that? I got close using "make -C
> target/linux/ath79/image install" with "IB" undefined, but I wasn't
> able to narrow it down enough to build just one DTB + image for a
> single profile. That would probably solve most of the issue and make
> these out-of-tree builds much simpler.
>
> Other examples from the forums:
> [1] https://forum.openwrt.org/t/dts-support-in-imagebuilder/12320
> [2] https://forum.openwrt.org/t/ath79-dtb-update-mechanism/52630
> [3] https://forum.openwrt.org/t/using-release-ath79-19-07-0-kernel-and-packages-on-hardware-modded-tp-link-wr703n-16mb-64mb-without-snapshot-compilation/54310
>
> Thanks
> - Joe



More information about the openwrt-devel mailing list