Hi all, based on this openwrt-devel mail thread I started a little script scraping some device specific information. This should eventually help creating and maintaining a device wiki with hardware information.
The output should be some YAML file which is then rendered into a fancy website.
I just figured out a few properties, I'd appreciate if somebody else could join in!
Tracked this on the mailing list.
I like that idea.
However, I would suggest that we pick it up during the build.
This has the advantage that for every build the information is up to date.
Everything else will stop simming after a while!
I found a project in python that parses a dtb file
The needed value can then be written into a YAML file and after that could be pushed to the web.
A played a little bit and it is working as expected.
Hi, thanks for the quick response. Could you please add an example output?
I don't see it as a big problem that the information is not continuously updated, as a device hardware unlikely change over time. A TP-Link 4300 will always keep the same SoC and amount of memory.
Sorry for the delay I am just somewhere else at the moment. My boss is breathing down my neck
If I still have time today, I will put together a small script.
First of all, a question:
Since I am based on the python libaries fdt and yaml, is that a problem? I am thinking about the dependencies.
For testing python I always use pipenv. Is this an option in openwrt if we want to build this information during build? This is my pipfile
This script converts the device tree files (dtb) coming from the openwrt build into yml files.
So far only the model and the soc is written. I have tested only with the lantiq target.
The generated dtb files for this target are located in the directory <openwrt>/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200
So i called my script from my pipenv directory with the following command line. ./device-info.py -i <openwrt>/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200 -o ./info
And I got in the output directory the yml files for all dtb files in the input directory.
Not to take anything away from the OP or fellow contribs, but I use and recommend
which is an ansible-driven configuration collector ("gather facts") and can output to csv json markdown sql html or plain txt. The results are printed in a nice html clickable page for all hosts in your inventory file. Seems to work with openwrt, but not perfectly. ( I dont have pip3/python3 running yet).
Maybe this can give you ideas or combine bits of code to give you something even more Deluxe. Good luck yaml'ing and such.
Thank you the tool looks good. However Python is a bit of a big package so I'd rather not have it as a dependency for the initial device info. Can you evaluate how well it works without Python on OpenWrt devices?
Where do we go from here?
If we want to automate the whole thing, then I think it's best to get the data from the devicetree binary blob with this script, since this is automatable during the build or doring a postprocess step.
Which information do we need from a running system?
@feckert Is your plan to use the script on dtb files? If so we have to compile as those files before parsing - just a comment.
Looking at the dts (using the to_dts() function) there is quite some content in the file, however I don't really see number of CPU cores or storage size. Do you have an idea for that?
@feckert Is your plan to use the script on dtb files? If so we have to compile as those files before parsing - just a comment.
I would say that we use the dtb files as a basis for parsing the information's.
There is everything inside including the includes like the dts files.
So we have one file per device with all information's in binary from (dtb).
With every openWrt build run these dtb files are generated when the images are built.
Looking at the dts (using the to_dts() function) there is quite some content in the file, however I don't really see number of CPU cores or storage size. Do you have an idea for that?
I am not quite sure whether this has to be defined in the dtb or whether it will be probed! I think we should start small and then expand. If the information is not defined, it can be added later by hand or added when building the YAML file. So that we have a semi-automatic process
Sorry for the delay, because of the corona everything is a bit confused in the normal workflow!
Sure. That would be a good starting point
How are we supposed to proceed?
I have a few more comments.
Do we want to integrate this into the openwrt buildsystem?
Is it alright that we run the conversion tool to be written in a pipenv? (Because we want to use the dtb python lib. If not then it would be difficult because of the python package dependency)
Should I set up a repository in my github account where I implement the source?
I Could only do test with the lantiq dtb. (Thats my device. I also have x86 but they does not have a dtb)
No problem at all! Please don't be stressed by this issue it has no priority!
We could add a make target that prints/stores the information
Yes let's use a Python venv
Yes please
I have a random selection of other devices here and we can compile for whatever else anyway. Your approach is based on DTB files and not on running devices, isn't it?