FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
343 views 2 comments
by anonymous

Hello,

I am trying to build the images for the TRB140:

make menuconfig
Select Target System (Qualcomm MDM9x07)
Select Target Profile (Teltonika TRB140 EC25-EU (Region 0))
make V=s

The build fails at the end with:

DTB combiner:
  Input directory: '~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mdm9x07/linux-3.18/arch/arm/boot/dts/qcom/'
  Output file: '~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mdm9x07/masterDTB'
=> Found 0 unique DTB(s)
Pseudo file "/dev" exists in source filesystem "~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/root-mdm9x07/dev".
Ignoring, exclude it (-e/-ef) to override.
DTB combiner:
  Input directory: '~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mdm9x07/linux-3.18/arch/arm/boot/dts/qcom/'
  Output file: '~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mdm9x07/masterDTB'
=> Found 0 unique DTB(s)
DTB combiner:
  Input directory: '~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mdm9x07/linux-3.18/arch/arm/boot/dts/qcom/'
  Output file: '~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mdm9x07/masterDTB'
=> Found 0 unique DTB(s)
DTB combiner:
  Input directory: '~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mdm9x07/linux-3.18/arch/arm/boot/dts/qcom/'
  Output file: '~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mdm9x07/masterDTB'
=> Found 0 unique DTB(s)
[===================/                                                                                                             ]  527/3541  14%DTB combiner:
  Input directory: '~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mdm9x07/linux-3.18/arch/arm/boot/dts/qcom/'
  Output file: '~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mdm9x07/masterDTB'
=> Found 0 unique DTB(s)
~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/staging_dir/host/bin/mkbootimg --kernel ~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mdm9x07/zImage --dt ~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mdm9x07/masterDTB --ramdisk /dev/null --cmdline "noinitrd console=ttyHSL0,115200,n8 earlycon=msm_hsl_uart,0x78b3000 ehci-hcd.park=3 msm_rtb.filter=0x37 lpm_levels.sleep_disabled=1 loglevel=10 ubi.fm_autoconvert=1 ubi.mtd=%ROOTFS_MTD_NAME% ubi.block=0,0 root=/dev/ubiblock0_0 rootfstype=squashfs init=/etc/preinit ubi.mtd=modem ubi.block=1,0 ubi.mtd=storage" --pagesize "2048" --base 0x80000000 --tags-addr 0x81E00000 --ramdisk_offset 0x0 --output ~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mdm9x07/trb1400-kernel.bin
error: could not load device tree image '~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mdm9x07/masterDTB'
make[6]: *** [Makefile:182: ~/trb140/openwrt-gpl-mdm9x07.Linux-x86_64/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mdm9x07/trb1400-kernel.bin] Error 1

May I have missed something in make menuconfig ?

Regards,

1 Answer

0 votes
by anonymous

Hello,

I have just done some tests myself and I was able to compile firmware images successfully. I would like to ask which Ubuntu version did you use? Also, I would recommend to double check if all required packages are installed from the instructions: https://wiki.teltonika-networks.com/view/RUTX_Software_Development_Kit_instructions 

Could you try to compile the image without creating a menu config (simply run command make)

Regards.

by anonymous

Hello,

I don't use Ubuntu I use Centos7 and devtoolset-9 but that's no the point. I have found the cause it is a shortcoming in dtbtool, the test:

while ((dp = readdir(dir)) != NULL) {
        if ((dp->d_type == DT_REG)) {

is wrong if the subjacent filesystem doesn't set d_type, which is the case with xfs. According to man 3 readdir:

Only the fields d_name and d_ino are specified in POSIX.1-2001

So dtbtool didn't find any .dtb file and the masterDTB was not built.

Here is a patch to fix the issue, tested it works as expected I have now a firmware image:

--- tools/dtbtool/dtbtool.c-org	2020-05-04 07:06:14.000000000 +0200
+++ tools/dtbtool/dtbtool.c	2021-03-22 20:28:30.207909020 +0100
@@ -758,22 +758,21 @@
        extract "qcom,msm-id" parameter
      */
     while ((dp = readdir(dir)) != NULL) {
-        if ((dp->d_type == DT_REG)) {
+	flen = strlen(input_dir) + strlen(dp->d_name) + 1;
+	filename = (char *)malloc(flen);
+	if (!filename) {
+	    log_err("Out of memory\n");
+	    rc = RC_ERROR;
+	    break;
+	}
+	strncpy(filename, input_dir, flen);
+	strncat(filename, dp->d_name, flen);
+        if (stat(filename, &st) != -1 && (st.st_mode & S_IFMT) == S_IFREG) {
             flen = strlen(dp->d_name);
             if ((flen > 4) &&
                 (strncmp(&dp->d_name[flen-4], ".dtb", 4) == 0)) {
                 log_info("Found file: %s ... \n", dp->d_name);
 
-                flen = strlen(input_dir) + strlen(dp->d_name) + 1;
-                filename = (char *)malloc(flen);
-                if (!filename) {
-                    log_err("Out of memory\n");
-                    rc = RC_ERROR;
-                    break;
-                }
-                strncpy(filename, input_dir, flen);
-                strncat(filename, dp->d_name, flen);
-
                 /* To identify the version number */
                 msmversion = GetVersionInfo(filename);
@@ -805,8 +804,7 @@
                     }
                 }
 
-                if ((stat(filename, &st) != 0) ||
-                    (st.st_size == 0)) {
+                if (st.st_size == 0) {
                     log_err("skip, failed to get DTB size\n");
                     free(filename);
                     continue;

Regards,

by anonymous
Hello,

Thank you for the additional information. I will test more regarding this issue and forward information to our RnD department.

Regards.