DTS support in imagebuilder

I really like YOLO solutions. As the most of the image builder process is doing everything I want the only thing I needed was to update the DTB.

make image PROFILE=rt5350f-olinuxino FILES=files/ PACKAGES="kmod-usb-storage block-mount kmod-fs-ext4"

ORIGVMLINUX=build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_rt305x/vmlinux
DTBFILE=build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_rt305x/OLINUXINO-RT5350F.dtb
TMPFWFILE=build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_rt305x/tmp/lede-17.01.4-ramips-rt305x-rt5350f-olinuxino-squashfs-sysupgrade.bin
UIMAGE=build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_rt305x/uImage.lzma

cp ${ORIGVMLINUX} ${ORIGVMLINUX}-olinuxino-rt5350f
/root/dtc -O dtb -o  ./${DTBFILE} ./target/linux/ramips/dts/RT5350F-OLINUXINO.hack
./staging_dir/host/bin/patch-dtb ${ORIGVMLINUX}-olinuxino-rt5350f ${DTBFILE}
./staging_dir/host/bin/lzma e ${ORIGVMLINUX}-olinuxino-rt5350f -lc1 -lp2 -pb2 ${ORIGVMLINUX}-olinuxino-rt5350f.lzma


./staging_dir/host/bin/mkimage -A mips -O linux -T kernel -C lzma -a 0x80000000 -e 0x80000000 -n "MIPS OpenWrt Linux-4.4.92" -d ${ORIGVMLINUX}-olinuxino-rt5350f.lzma ${UIMAGE}

dd if=${UIMAGE} > ${TMPFWFILE}

dd if=build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_rt305x/root.squashfs >> ${TMPFWFILE}
./staging_dir/host/bin/padjffs2 ${TMPFWFILE}  4 8 16 64 128 256
echo '{  "supported_devices":["rt5350f-olinuxino"], "version": { "dist": "LEDE", "version": "17.01.4", "revision": "r3560-79f57e422d", "board": "ramips" } }' | ./staging_dir/host/bin/fwtool  -I - ${TMPFWFILE}
cp ${TMPFWFILE} bin/targets/ramips/rt305x/lede-17.01.4-ramips-rt305x-rt5350f-olinuxino-squashfs-sysupgrade.bin

When you need a DTB files, just use fdtdump and edit as you like.
The advantage is that I don't have to modify my kernel and I do not have to recompile everything for every time. Exactly as DTB files are intended.

2 Likes