Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

armbian-config on NanoPi Neo: Wrong .dtb selected for editing device tree #214

Open
mdrmdrmdr opened this issue Feb 7, 2024 · 2 comments

Comments

@mdrmdrmdr
Copy link

While testing a device tree overlay to enable the micro-USB port on an NanoPi Neo as USB host,
I found a small issue with armbian-config:

If have 2 .dtb files on my system which contain my board name nanopi-neo in the filename:

Nano$ ls -1 /boot/dtb/*nanopi-neo*
/boot/dtb/sun8i-h3-nanopi-neo-air.dtb
/boot/dtb/sun8i-h3-nanopi-neo.dtb

The code in /usr/lib/armbian-config/jobs.sh, which searches for the proper .dtb file, finds the wrong - first - file.
Which is sun8i-h3-nanopi-neo-air.dtb in my case.

        for dtb in ${dtb_path}/*.dtb
        do
            if [[ $dtb == *"${board_name}"* ]]; then
                used_dtb=$dtb
                break
            fi
        done

I modified the if [[ ]]; then line to find the correct file:

        for dtb in ${dtb_path}/*.dtb
        do
            if [[ $dtb == *"${board_name}.dtb" ]]; then
                used_dtb=$dtb
                break
            fi
        done

I'm not sure if the mask *<board name>.dtb can be applied generally, but it fixes the error and works in my case.

@viraniac
Copy link
Contributor

viraniac commented Feb 7, 2024

Something to try. If you see in the same code block, the board name is beng picked up from the compatible file present in the /proc/device-tree/ directory. There is also the second string there in which the second part is actually the prefix. I think this can be updated so that the function first tries to load <soc_prefix>-<board_name>.dtb and if not present then uses the for loop.

Could you please try the same and see if that solves your issue? If yes, please raise a PR. I can review and merge the same. The file that you might have to modify in this repository is debian-config-jobs.sh which you know as jobs.sh file from your system.

@mdrmdrmdr
Copy link
Author

Unfortunately that does not work as there is no variable available holding the soc prefix.
The only way would be to read and extract overlay_prefix=sun8i-h3 from armbianEnv.txt.
As done in a while loop earlier in the file. Not sure at all if this would be a proper way. Assume not.

I'm wondering why this did not come up earlier. There are 10+ .dtb file combinations which could cause the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants