nerves-project / nerves_system_bbb

Base Nerves system configuration for the BeagleBone-based boards
Apache License 2.0
36 stars 39 forks source link

Extra device tree overlays `*.dts` cannot reference kernel includes #271

Closed insasec closed 2 years ago

insasec commented 2 years ago

Environment

Elixir 1.13.4 (compiled with Erlang/OTP 25)

* Nerves environment: (`mix nerves.env --info`)

==> nerves /usr/bin/make -C src all make[1]: Entering directory '/home/udos/Documents/Development/nerves_playground/deps/nerves/src' cc /home/udos/Documents/Development/nerves_playground/_build/bbb_dev/lib/nerves/obj/port.o -o /home/udos/Documents/Development/nerves_playground/_build/bbb_dev/lib/nerves/priv/port make[1]: Leaving directory '/home/udos/Documents/Development/nerves_playground/deps/nerves/src' if [ -f test/fixtures/port/Makefile ]; then /usr/bin/make -C test/fixtures/port; fi ==> nerves_playground |nerves_bootstrap| Environment Package List

Pkg: nerves_system_bbb Vsn: 2.15.2 Type: system BuildRunner: {Nerves.Artifact.BuildRunners.Local, [make_args: ["source", "all", "legal-info"]]}

Pkg: nerves_system_br Vsn: 1.20.4 Type: system_platform BuildRunner: {nil, []}

Pkg: nerves_toolchain_armv7_nerves_linux_gnueabihf Vsn: 1.6.0 Type: toolchain BuildRunner: {Nerves.Artifact.BuildRunners.Local, []}

Pkg: nerves_toolchain_ctng Vsn: 1.9.0 Type: toolchain_platform BuildRunner: {nil, []}

|nerves_bootstrap| Loadpaths Start

|nerves_bootstrap| Precompile Start

|nerves_bootstrap| Env Start

|nerves_bootstrap| Env End

==> nerves_system_br Generated nerves_system_br app ==> nerves_toolchain_ctng Compiling 1 file (.ex) Generated nerves_toolchain_ctng app ==> nerves_toolchain_armv7_nerves_linux_gnueabihf |nerves_bootstrap| Compile.NervesPackage start

|nerves_bootstrap| Compile.NervesPackage end

Generated nerves_toolchain_armv7_nerves_linux_gnueabihf app ==> nerves_system_bbb Generated nerves_system_bbb app |nerves_bootstrap| Compile.NervesPackage start

|nerves_bootstrap| Compile.NervesPackage end

==> nerves_playground |nerves_bootstrap| Precompile End

Nerves environment MIX_TARGET: bbb MIX_ENV: dev

|nerves_bootstrap| Environment Variable List target: bbb toolchain: /home/udos/.nerves/artifacts/nerves_toolchain_armv7_nerves_linux_gnueabihf-linux_x86_64-1.6.0 system: /home/udos/.nerves/artifacts/nerves_system_bbb-portable-2.15.2 app: .

|nerves_bootstrap| Loadpaths End


* Additional information about your host, target hardware or environment that
  may help

### Current behavior

The current implementation of `package/extra-dts/extra-dts.mk` allows for simple dropping of additional `*.dts` files into `package/extra-dts`. Those will automatically be compiled by `dtc` and copied to `/lib/firmware/` in the target FS.

However the preprocessor run to feed into `dtc` does not include the Linux kernel sources. Thus `#includes` of Linux `*.dts` files and or macros are not supported. So adding  device tree overlays which reference Linux includes require the developer to compile them manually and to place the `*.dtbo` files via `rootfs_overlay`.

### Expected behavior

Run the preprocessor with additional includes referencing Linux kernel sources to include the `include` and `arch` directory.

This will allow (most) additional `*.dts` to be simply dropped into  `package/extra-dts` while nerves takes care of compiling them and placing them under `/lib/firmware` in the target FS.