Apalis TK1 - Device Tree Not Found

I’ve asked a similar question a while back now and having just come back to the Apalis TK1 after many months of non-Linux stuff, I’m a little stuck as I can’t recall the fix.

I’m trying to deploy the TK1 Linux kernel to an SD card. When running the update.sh script, I’m presented with the following:

Did not find the devicetrees from KERNEL_DEVICETREE, tegra124-apalis-eval.dtb

I’ve replaced the tegra124-apalis-eval-custom.dtb and uImage-custom binaries from my latest build and I’ve refreshed all symlinks to these files - uImage, uImage-tegra124-apalis-eval.dtb and tegra124-apalis-eval.dtb. However, the error still remains.

To try and help me, I added some echo outputs in the update.sh script, printing out the variables used when searching for the dtb:

kernel_bin = apalis-tk1_bin/uImage

kernel_bin_for_dtb = apalis-tk1-custom.bin

The last variable is throwing me off a little bit, as the link points to tegra124-apalis-eval-custom.dtb so I have no clue as to where the apalis-tk1-custom.bin is coming from.

Apologies for my lack of understand but, I don’t get it.

The best way to debug such shell scripts is using the -x option e.g.:

[user@host Apalis-TK1_LXDE-Image_2.7.2]$ sh -x update.sh -o /var/lib/tftpboot
+ COPIED=false
+ test -n tegra124-apalis-eval.dtb
++ basename tegra124-apalis-eval.dtb
++ awk -F . '{print $1}'
+ DTS_BASE_NAME=tegra124-apalis-eval
+ '[' -e apalis-tk1_bin/uImage-tegra124-apalis-eval.dtb ']'
++ readlink apalis-tk1_bin/uImage
+ kernel_bin=uImage--3.10.40+gitr9ac4a32ea1126f8875dc81d4b3a70b29e624712f-2.7.2-apalis-tk1-20170404175521.bin
++ readlink apalis-tk1_bin/uImage-tegra124-apalis-eval.dtb
++ sed 's,tegra124-apalis-eval,apalis-tk1,g;s,\.dtb$,.bin,g'
+ kernel_bin_for_dtb=uImage--3.10.40+gitr9ac4a32ea1126f8875dc81d4b3a70b29e624712f-2.7.2-apalis-tk1-20170404175521.bin
+ '[' uImage--3.10.40+gitr9ac4a32ea1126f8875dc81d4b3a70b29e624712f-2.7.2-apalis-tk1-20170404175521.bin = uImage--3.10.40+gitr9ac4a32ea1126f8875dc81d4b3a70b29e624712f-2.7.2-apalis-tk1-20170404175521.bin ']'
+ mcopy -i apalis-tk1_bin/boot.vfat -s apalis-tk1_bin//uImage-tegra124-apalis-eval.dtb ::/tegra124-apalis-eval.dtb
+ sudo cp apalis-tk1_bin//uImage-tegra124-apalis-eval.dtb /var/lib/tftpboot/apalis-tk1/tegra124-apalis-eval.dtb
+ COPIED=true

So it basically looks for the links the uImage and its device tree are pointing at, replaces the DTS_BASE_NAME part being tegra124-apalis-eval in this case with apalis-tk1 and the .dtb file ending with .bin and makes sure that does match.

If we now look at how resp. files/links look like:

[user@host Apalis-TK1_LXDE-Image_2.7.2]$ ls -l apalis-tk1_bin/ | grep uImage
lrwxrwxrwx. 1 user  user       96 Apr  4 20:00 uImage -> uImage--3.10.40+gitr9ac4a32ea1126f8875dc81d4b3a70b29e624712f-2.7.2-apalis-tk1-20170404175521.bin
-rw-r--r--. 1 user  user  5462664 Apr  4 20:00 uImage--3.10.40+gitr9ac4a32ea1126f8875dc81d4b3a70b29e624712f-2.7.2-apalis-tk1-20170404175521.bin
-rw-r--r--. 1 user  user    49673 Apr  4 20:00 uImage--3.10.40+gitr9ac4a32ea1126f8875dc81d4b3a70b29e624712f-2.7.2-tegra124-apalis-eval-20170404175521.dtb
lrwxrwxrwx. 1 user  user      106 Apr  4 20:00 uImage-tegra124-apalis-eval.dtb -> uImage--3.10.40+gitr9ac4a32ea1126f8875dc81d4b3a70b29e624712f-2.7.2-tegra124-apalis-eval-20170404175521.dtb

We see that the prefix of the kernel and device tree being uImage--3.10.40+gitr9ac4a32ea1126f8875dc81d4b3a70b29e624712f-2.7.2 in that case need to match. So whatever you do make sure this stays that way.