Device Tree Build Issue

Viewing 2 reply threads
  • Author
    Posts
    • #8377
      Massimo ManoniMassimo
      Participant

        Hello erverybody,

        I am writing to ask your support about a Device Tree compile issue that I am meeting in these days.

        I am working with a OSD3358-SM-RED board I am new in linux world.

        My intention is to integrate on the board a touch sensor.

        I have already compiled the driver for the sensor (provided by the sensor’s supplier).

        After that I need to customize the device tree.

        My intention is to overlay the reference device tree compiling a customized dts file.

        Prior to go on this way I decided to learn how to do that following Octavo System’s documentation (below):

        OSD335x Lesson 2: Linux Device Tree

        Following the guide I have downloaded the suggested dtb-rebuilder (https://github.com/RobertCNelson/dtb-rebuilder).

        Here I started to have problems.

        Octavo’s guide suggests to copy the dts and dtsi files in <install_path>/dtb_rebuilder/src/arm directory.

        But from the attached link it is not possible to download the .dtsi file (https://octavosystems.com/files/lesson-2-device-tree-files/).

        Reading the following thread I have downloaded the “osd335x-sm.dtsi” file and copied inside “dtb-rebuilder/src/arm” path:

        Compiling osd3358-bsm-refdesign.dts

        Doing that I have modified the dts file replacing the “#include” raw with the new file name:

        #include “osd335x-sm.dtsi”

        After compilation I had a syntax error report.

        For this reason I tried to look for a possible solution and I found the following link:

        http://e2e.ti.com/support/processors/f/791/t/702661?Linux-AM3352-Device-tree-syntax-error

        I have modified the “#include” syntax with “/include/” and tried the instructions reported in the attached image, but always with the same error.

        The dtb-rebuilder version is 4.14 whereas the board kernel version is 4.9. The same results if I try to work with dtb-rebuilder version 4.9-ti.

        I don’t know how to solve this issue.

        Can you please give us support?

        If you need more information don’t hesitate to ask.

        Thank you very much for your collaboration.

        Attachments:
      • #8430
        Neeraj Dantu
        Moderator

          Replied offline. Copying here for reference:

          The include file is available in Octavo’s official device tree git repository: https://github.com/octavosystems/OSD335x-Device-Tree. This should have been pointed out in the tutorial. Thank you for letting us know. We will make a change in the tutorial.

          Please see https://github.com/octavosystems/OSD335x-Device-Tree/blob/master/OSD3358-SM-RED/osd3358-bsm-refdesign.dts for an example of a device tree(.dts) file. As you can see in this file, ‘#include “osd335x-sm.dtsi”‘ works as intended and dtb-rebuilder does not give any errors. Please use the dtb-rebuilder to build your device tree binary as that is a method we have tested and is proven to be working.

          The first thing to verify is whether the setup is correct. You already have the dtb-rebuilder cloned. Here are the steps to build the device tree for OSD3358-SM-RED to verify whether the setup is good(Note that these steps are executed on an OSD3358-SM-RED or an AM335x development/evaluation board):

          1. Copy osd3358-bsm-refdesign.dts(https://github.com/octavosystems/OSD335x-Device-Tree/blob/master/OSD3358-SM-RED/osd3358-bsm-refdesign.dts) and osd335x-sm.dtsi(https://github.com/octavosystems/OSD335x-Device-Tree/blob/master/osd335x-sm.dtsi) to dtb-rebuilder/src/arm directory.

          2. Change directory to dtb-rebuilder from current directory(please edit this command as required): cd dtb-rebuilder/

          3. Clean earlier builds: make clean

          4. Build all device tree blobs: make all

          If this is successful and builds osd3358-bsm-refdesign.dtb, now copy the device tree file that you are intending to compile in dtb-rebuilder/src/arm directory. Then execute steps 2,3 and 4.

          If it gives you a syntax error, please look at the exact line it is giving you an error on. The error must specify an line number at which the error has occurred. “Error: am335x-evm.dts:10.1-9 syntax error” indicates an error in line 10.

          As long as the dtc version is the same, both 4.14 and 4.9(https://github.com/RobertCNelson/dtb-rebuilder/tree/4.9.x) versions of the dtb-rebuilders should work.

          If you are still facing issues, please send us the exact error message and the device tree file you are using in order for us to take a closer look.

          Best,

          Neeraj

           

        • #9061
          Raymond WilliswillisNGC_39
          Participant

            You do not need dtb rebuilder. Create your device tree overlay. FYI if you require Ethernet keep CSPW and MAC info in your device tree. To use the driver for a device that comes with OS, just put the correct information in the com/bus declaration. Also, Lesson 2 is designed for debian 9.5 (Kernel 4.14), not OSD 9.1 (Kernel 4.9) provided by Octavo. You can reverse a dtb of 9.1 to a dts to reverse engineer it by using DTC. The device tree is set using really different hexadecimal values and info, nothing like the device tree in Lesson 2. I also noticed an error with the include in the .dts in Lesson2. The include .dtsi is wrong as it shows as #include “osd335x.dtsi” when it should be “osd335x-sm.dtsi”

            Here’s an example from start to finish. Using 9.5 as reference only. I have Debian 9.5 working on the Octavo RED I have for development.

            As an example, the device tree overlay I want to add ADS7828 A/D converter on my I2C2 bus, because the driver comes with Debian package used.

            &12C2{
            #….”already written info”

            ads7828: ads7828@48 {
            compatible = “ti,ads7828”;
            ti, differential-input;
            reg = <0x4b>;
            };
            };

            On a Linux dev device (Ubuntu or Mint, etc)
            1. Copy the Lesson 2 device tree overlay files to the target device using secure copy from Linux dev device:
            $ scp <myfile>.dts debian@192.168.7.2:
            $ scp osd335x-sm.dtsi debian@192.168.7.2:
            # Or if you set the IP address as something else. You can only secure copy files to debian…not root or any other folder.

            2. SSH into your target device in terminal:
            $ ssh debian@192.168.7.2

            3. Move the device tree overlay where is belongs:
            $ sudo cp <myfile>.dts /opt/source/dtb-4.14-ti/src/arm/
            $ sudo cp osd335x-sm.dtsi /opt/source/dtb-4.14-ti/src/arm/

            4. Change directory to make the dtb of your device tree:
            $ cd /opt/source/dtb-4.14-ti/

            5. Your file will likely have a different date created, let’s fix that:
            $ sudo touch src/arm/*
            # This will set all the timestamp of the files to current time, if not you may get clock skew when the dtb is created.

            6. Let’s clean the dtbs and rebuild:
            $ sudo make clean

            7. Now make the dtbs:
            $ sudo make
            # If you get any errors, look at the line number in the error and use: $ sudo nano src/arm/myfile.dts

            8. Almost there, I swear. Move a copy of the dtb created where it belongs:
            $ sudo cp src/arm/<myfile>.dtb /boot/dtbs/4.14.71-ti-r80

            9. Now edit the uEnv.txt file to include your dtb.
            $ sudo nano /boot/uEnv.txt.

            10. Save and reboot. Your device tree should be in use now. If it looks wrong, use $ dmesg to see the bootup debug messages.
            # You should see something somewhere in there that mentions your sensor or device being added into the kernel or hwmon.

            If something isn’t clear or anyone needs more info, reply. Hope this helps, Enjoy!

            • This reply was modified 5 years, 2 months ago by Raymond WilliswillisNGC_39.
            • This reply was modified 5 years, 2 months ago by Raymond WilliswillisNGC_39.
        Viewing 2 reply threads
        • You must be logged in to reply to this topic.