@@ -159,3 +159,102 @@ 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 :: bazel
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+ :header-rows: 1
206+
207+ * - filename
208+ - index
209+
210+ * - :file: `ti/k3-am62x-sk-hdmi-audio.dtbo `
211+ - 0
212+
213+ * - :file: `ti/k3-am62x-sk-csi2-ov5640.dtbo `
214+ - 1
215+
216+
217+ Adding more :file: `.dtbo ` files to the :file: `dtbo.img `
218+ =======================================================
219+
220+ In this section, we will see how to add more :file: `.dtbo ` files to the :file: `dtbo.img `.
221+ Let's see how to add :file: `ti/k3-am62p5-sk-dsi-rpi-7inch-panel.dtbo ` for example:
222+
223+ #. Edit :file: `${ YOUR_PATH } /ti-kernel-aosp/BUILD.bazel `.
224+ Look for the following section:
225+
226+ .. code-block :: bazel
227+
228+ kernel_build(
229+ name = "ti",
230+ outs = [
231+ "Image",
232+ "System.map",
233+ "k3-am62-lp-sk.dtb",
234+ "k3-am62-lp-sk-microtips-mf101hie-panel.dtbo",
235+
236+ #. In the ``kernel_build() `` section, add ``k3-am62p5-sk-dsi-rpi-7inch-panel.dtbo `` to the ``outs `` array.
237+
238+ #. Still in ``kernel_build() ``, look for the ``make_goals `` array and add ``ti/k3-am62p5-sk-dsi-rpi-7inch-panel.dtbo ``.
239+
240+ #. Now look for the following section:
241+
242+ .. code-block :: bazel
243+
244+ kernel_images(
245+ name = "ti_images",
246+ build_dtbo = True,
247+ build_initramfs = True,
248+ dtbo_srcs = [
249+ ":ti/k3-am62x-sk-hdmi-audio.dtbo",
250+ ":ti/k3-am62x-sk-csi2-ov5640.dtbo",
251+ ":ti/k3-am62x-sk-csi2-tevi-ov5640.dtbo",
252+
253+ #. In the ``kernel_images() ``, add ``:ti/k3-am62p5-sk-dsi-rpi-7inch-panel.dtbo `` at the end of the array.
254+
255+ .. important ::
256+
257+ Make sure to add the it at the **end ** of the array. The order in ``dtbo_srcs `` will determine
258+ the ``adtbo_idx `` to be used.
259+
260+ #. Rebuild the kernel as documented in :ref: `android-build-kernel `.
0 commit comments