Skip to content

Commit 9a8aa57

Browse files
author
Mattijs Korpershoek
committed
feat(android): kernel: Document how to add new overlays
For Android newcomers, it's not trivial to know how to add new device tree overlays. See [1] Since it's different than the linux SDK, we should document it. Add a section in the kernel guide for this. [1] https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1454200/sk-am62p-lp-sk-am62p-lp-androidautomotive-unable-to-get-the-dsi-port-up-and-running Signed-off-by: Mattijs Korpershoek <[email protected]>
1 parent cbcb7b6 commit 9a8aa57

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

source/android/Foundational_Components_Kernel.rst

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,103 @@ To enable new modules:
159159
160160
#. Finally, rebuild the Android images.
161161
162+
********************
163+
Device tree overlays
164+
********************
165+
166+
Mapping ``adtbo_idx`` with filenames
167+
====================================
168+
169+
Device tree overlays can be used to configure additional hardware peripherals.
170+
These overlays are stored in the :file:`dtbo.img`. This image is generated when
171+
building the Android kernel as documented in :ref:`android-build-kernel`.
172+
173+
As listed in :ref:`android-dtbo`, we can configure an overlay to be applied
174+
from U-Boot by setting the ``adtbo_idx`` variable.
175+
176+
To view how the ``adtbo_idx`` maps with the dtbo file, we can inspect the :file:`BUILD.bazel`
177+
from the `kernel source code <https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/BUILD.bazel?h=ti-android-linux-6.6.y#n953>`__.
178+
Looking at the ``kernel_images()`` macro, we can see:
179+
180+
.. code-block::
181+
182+
kernel_images(
183+
name = "ti_images",
184+
build_dtbo = True,
185+
build_initramfs = True,
186+
dtbo_srcs = [
187+
":ti/k3-am62x-sk-hdmi-audio.dtbo",
188+
":ti/k3-am62x-sk-csi2-ov5640.dtbo",
189+
":ti/k3-am62x-sk-csi2-tevi-ov5640.dtbo",
190+
":ti/k3-am625-sk-microtips-mf101hie-panel.dtbo",
191+
":ti/k3-am62x-sk-lpm-wkup-sources.dtbo",
192+
":ti/k3-am62-lp-sk-microtips-mf101hie-panel.dtbo",
193+
":ti/k3-am625-beagleplay-csi2-ov5640.dtbo",
194+
":ti/k3-am625-beagleplay-csi2-tevi-ov5640.dtbo",
195+
":ti/k3-am625-beagleplay-lincolntech-lcd185-panel.dtbo",
196+
":ti/k3-am62p5-sk-mcan.dtbo",
197+
":ti/k3-am62p5-sk-microtips-mf101hie-panel.dtbo",
198+
":ti/k3-am625-sk-m2-cc3301.dtbo",
199+
":ti/k3-am62p5-sk-m2-cc3301.dtbo",
200+
":ti/k3-am625-sk-wl1837.dtbo",
201+
202+
The ``dtbo_srcs`` array order dicates the index. For example:
203+
204+
.. list-table::
205+
:widths: 16 16
206+
:header-rows: 1
207+
208+
* - filename
209+
- index
210+
211+
* - :file:`ti/k3-am62x-sk-hdmi-audio.dtbo`
212+
- 0
213+
214+
* - :file:`ti/k3-am62x-sk-csi2-ov5640.dtbo`
215+
- 1
216+
217+
218+
Adding more :file:`.dtbo` files to the :file:`dtbo.img`
219+
=======================================================
220+
221+
In this section, we will see how to add more :file:`.dtbo` files to the :file:`dtbo.img`.
222+
Let's see how to add :file:`ti/k3-am62p5-sk-dsi-rpi-7inch-panel.dtbo` for example:
223+
224+
#. Edit :file:`${YOUR_PATH}/ti-kernel-aosp/BUILD.bazel`.
225+
Look for the following section:
226+
227+
.. code-block::
228+
229+
kernel_build(
230+
name = "ti",
231+
outs = [
232+
"Image",
233+
"System.map",
234+
"k3-am62-lp-sk.dtb",
235+
"k3-am62-lp-sk-microtips-mf101hie-panel.dtbo",
236+
237+
#. In the ``kernel_build()`` section, add ``k3-am62p5-sk-dsi-rpi-7inch-panel.dtbo`` to the ``outs`` array.
238+
239+
#. Still in ``kernel_build()``, look for the ``make_goals`` array and add ``ti/k3-am62p5-sk-dsi-rpi-7inch-panel.dtbo``.
240+
241+
#. Now look for the following section:
242+
243+
.. code-block::
244+
245+
kernel_images(
246+
name = "ti_images",
247+
build_dtbo = True,
248+
build_initramfs = True,
249+
dtbo_srcs = [
250+
":ti/k3-am62x-sk-hdmi-audio.dtbo",
251+
":ti/k3-am62x-sk-csi2-ov5640.dtbo",
252+
":ti/k3-am62x-sk-csi2-tevi-ov5640.dtbo",
253+
254+
#. In the ``kernel_images()``, add ``:ti/k3-am62p5-sk-dsi-rpi-7inch-panel.dtbo`` at the end of the array.
255+
256+
.. important::
257+
258+
Make sure to add the it at the **end** of the array. The order in ``dtbo_srcs`` will determine
259+
the ``adtbo_idx`` to be used.
260+
261+
#. Rebuild the kernel as documented in :ref:`android-build-kernel`.

0 commit comments

Comments
 (0)