From b4179d57a393a2508322f300f5f60a5f72bf4dc3 Mon Sep 17 00:00:00 2001 From: Mattijs Korpershoek Date: Tue, 7 Jan 2025 14:52:01 +0100 Subject: [PATCH 1/4] fix(android): Remove OTA from application notes TOC commit f8c988a83c2f ("feat(android): Move ota guide to Foundational_Components") moved the ota guides to the generic Android documentation (Foundational Components). However, the removed file is still listed in the device-specific TOCs. This generates a build warning: WARNING: toctree contains reference to nonexisting document 'devices/AM62X/android/ Fix the warning by removing the nonexisting OTA document. Fixes: f8c988a83c2f ("feat(android): Move ota guide to Foundational_Components") Signed-off-by: Mattijs Korpershoek --- source/devices/AM62PX/android/Application_Notes.rst | 1 - source/devices/AM62X/android/Application_Notes.rst | 1 - 2 files changed, 2 deletions(-) diff --git a/source/devices/AM62PX/android/Application_Notes.rst b/source/devices/AM62PX/android/Application_Notes.rst index d5fa4135d..040d5f099 100644 --- a/source/devices/AM62PX/android/Application_Notes.rst +++ b/source/devices/AM62PX/android/Application_Notes.rst @@ -13,7 +13,6 @@ Application Notes Application_Notes_Android_SD_CARD Application_Notes_Android_Dual_Screen Application_Notes_Android_Low_Power - Application_Notes_OTA Application_Notes_Camera Application_Notes_Android_Multimedia_Video Application_Notes_Sample_Maps_App diff --git a/source/devices/AM62X/android/Application_Notes.rst b/source/devices/AM62X/android/Application_Notes.rst index 724da7cbf..07e90a5b5 100644 --- a/source/devices/AM62X/android/Application_Notes.rst +++ b/source/devices/AM62X/android/Application_Notes.rst @@ -13,7 +13,6 @@ Application Notes Application_Notes_Android_SD_CARD Application_Notes_Android_Dual_Screen Application_Notes_Android_Low_Power - Application_Notes_OTA Application_Notes_Camera Application_Notes_Simple_UI_App Application_Notes_BeaglePlay From cbcb7b6819ad37bf16abbdfee709c94074d7911b Mon Sep 17 00:00:00 2001 From: Mattijs Korpershoek Date: Tue, 7 Jan 2025 13:51:15 +0100 Subject: [PATCH 2/4] feat(android): kernel: Reindent implicit numbered list For numbering to behave properly when a new paragraph is inserted, implicit lists should be indented. Reindent the list that describes how to add a new kernel module. Signed-off-by: Mattijs Korpershoek --- .../Foundational_Components_Kernel.rst | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/source/android/Foundational_Components_Kernel.rst b/source/android/Foundational_Components_Kernel.rst index 162c2206e..afc741908 100644 --- a/source/android/Foundational_Components_Kernel.rst +++ b/source/android/Foundational_Components_Kernel.rst @@ -132,30 +132,30 @@ new drivers should always be added as **modules**. To enable new modules: -#. Run ``menuconfig`` as documented previously, Select ``=m`` for the driver. + #. Run ``menuconfig`` as documented previously, Select ``=m`` for the driver. -#. Edit :file:`${YOUR_PATH}/ti-kernel-aosp/BUILD.bazel` to add your new module. - Look for the following section: + #. Edit :file:`${YOUR_PATH}/ti-kernel-aosp/BUILD.bazel` to add your new module. + Look for the following section: - .. code-block:: bash + .. code-block:: bash - _TI_MODULE_OUTS = [ - # keep sorted - "crypto/af_alg.ko", - "crypto/algif_hash.ko", + _TI_MODULE_OUTS = [ + # keep sorted + "crypto/af_alg.ko", + "crypto/algif_hash.ko", -#. In the ``_TI_MODULE_OUTS`` array, add the path to your new kernel module. + #. In the ``_TI_MODULE_OUTS`` array, add the path to your new kernel module. -#. Rebuild the kernel as documented in :ref:`android-build-kernel`. + #. Rebuild the kernel as documented in :ref:`android-build-kernel`. -#. If the driver module needs to be loaded early (in the ramdisk), edit - :file:`${YOUR_PATH}/ti-aosp-15/device/ti/am62x/BoardConfig-common.mk` - and add the path to your module: + #. If the driver module needs to be loaded early (in the ramdisk), edit + :file:`${YOUR_PATH}/ti-aosp-15/device/ti/am62x/BoardConfig-common.mk` + and add the path to your module: - .. code-block:: make + .. code-block:: make - BOARD_VENDOR_RAMDISK_KERNEL_MODULES += \ - device/ti/am62x-kernel/kernel/$(TARGET_KERNEL_USE)/your_module.ko + BOARD_VENDOR_RAMDISK_KERNEL_MODULES += \ + device/ti/am62x-kernel/kernel/$(TARGET_KERNEL_USE)/your_module.ko -#. Finally, rebuild the Android images. + #. Finally, rebuild the Android images. From bb6013ab6e3797adeaeef7b19b8ca499d2464163 Mon Sep 17 00:00:00 2001 From: Mattijs Korpershoek Date: Wed, 8 Jan 2025 09:23:28 +0100 Subject: [PATCH 3/4] fix(android): kernel: Use bazel language for code block The snippet comes from BUILD.bazel which is in bazel language. According to [1], bazel is supported by pygments. Use it instead of using bash. [1] https://pygments.org/docs/lexers/#pygments.lexers.python.PythonLexer Suggested-by: Randolph Sapp Signed-off-by: Mattijs Korpershoek --- source/android/Foundational_Components_Kernel.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/android/Foundational_Components_Kernel.rst b/source/android/Foundational_Components_Kernel.rst index afc741908..95fb905fd 100644 --- a/source/android/Foundational_Components_Kernel.rst +++ b/source/android/Foundational_Components_Kernel.rst @@ -137,7 +137,7 @@ To enable new modules: #. Edit :file:`${YOUR_PATH}/ti-kernel-aosp/BUILD.bazel` to add your new module. Look for the following section: - .. code-block:: bash + .. code-block:: bazel _TI_MODULE_OUTS = [ # keep sorted From d0e2651f05b6378f9848179fc790c7640bf379de Mon Sep 17 00:00:00 2001 From: Mattijs Korpershoek Date: Tue, 7 Jan 2025 14:41:10 +0100 Subject: [PATCH 4/4] 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 --- .../Foundational_Components_Kernel.rst | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/source/android/Foundational_Components_Kernel.rst b/source/android/Foundational_Components_Kernel.rst index 95fb905fd..b90e8c06b 100644 --- a/source/android/Foundational_Components_Kernel.rst +++ b/source/android/Foundational_Components_Kernel.rst @@ -159,3 +159,102 @@ To enable new modules: #. Finally, rebuild the Android images. +******************** +Device tree overlays +******************** + +Mapping ``adtbo_idx`` with filenames +==================================== + +Device tree overlays can be used to configure additional hardware peripherals. +These overlays are stored in the :file:`dtbo.img`. This image is generated when +building the Android kernel as documented in :ref:`android-build-kernel`. + +As listed in :ref:`android-dtbo`, we can configure an overlay to be applied +from U-Boot by setting the ``adtbo_idx`` variable. + +To view how the ``adtbo_idx`` maps with the dtbo file, we can inspect the :file:`BUILD.bazel` +from the `kernel source code `__. +Looking at the ``kernel_images()`` macro, we can see: + +.. code-block:: bazel + + kernel_images( + name = "ti_images", + build_dtbo = True, + build_initramfs = True, + dtbo_srcs = [ + ":ti/k3-am62x-sk-hdmi-audio.dtbo", + ":ti/k3-am62x-sk-csi2-ov5640.dtbo", + ":ti/k3-am62x-sk-csi2-tevi-ov5640.dtbo", + ":ti/k3-am625-sk-microtips-mf101hie-panel.dtbo", + ":ti/k3-am62x-sk-lpm-wkup-sources.dtbo", + ":ti/k3-am62-lp-sk-microtips-mf101hie-panel.dtbo", + ":ti/k3-am625-beagleplay-csi2-ov5640.dtbo", + ":ti/k3-am625-beagleplay-csi2-tevi-ov5640.dtbo", + ":ti/k3-am625-beagleplay-lincolntech-lcd185-panel.dtbo", + ":ti/k3-am62p5-sk-mcan.dtbo", + ":ti/k3-am62p5-sk-microtips-mf101hie-panel.dtbo", + ":ti/k3-am625-sk-m2-cc3301.dtbo", + ":ti/k3-am62p5-sk-m2-cc3301.dtbo", + ":ti/k3-am625-sk-wl1837.dtbo", + +The ``dtbo_srcs`` array order dicates the index. For example: + +.. list-table:: + :header-rows: 1 + + * - filename + - index + + * - :file:`ti/k3-am62x-sk-hdmi-audio.dtbo` + - 0 + + * - :file:`ti/k3-am62x-sk-csi2-ov5640.dtbo` + - 1 + + +Adding more :file:`.dtbo` files to the :file:`dtbo.img` +======================================================= + +In this section, we will see how to add more :file:`.dtbo` files to the :file:`dtbo.img`. +Let's see how to add :file:`ti/k3-am62p5-sk-dsi-rpi-7inch-panel.dtbo` for example: + + #. Edit :file:`${YOUR_PATH}/ti-kernel-aosp/BUILD.bazel`. + Look for the following section: + + .. code-block:: bazel + + kernel_build( + name = "ti", + outs = [ + "Image", + "System.map", + "k3-am62-lp-sk.dtb", + "k3-am62-lp-sk-microtips-mf101hie-panel.dtbo", + + #. In the ``kernel_build()`` section, add ``k3-am62p5-sk-dsi-rpi-7inch-panel.dtbo`` to the ``outs`` array. + + #. Still in ``kernel_build()``, look for the ``make_goals`` array and add ``ti/k3-am62p5-sk-dsi-rpi-7inch-panel.dtbo``. + + #. Now look for the following section: + + .. code-block:: bazel + + kernel_images( + name = "ti_images", + build_dtbo = True, + build_initramfs = True, + dtbo_srcs = [ + ":ti/k3-am62x-sk-hdmi-audio.dtbo", + ":ti/k3-am62x-sk-csi2-ov5640.dtbo", + ":ti/k3-am62x-sk-csi2-tevi-ov5640.dtbo", + + #. In the ``kernel_images()``, add ``:ti/k3-am62p5-sk-dsi-rpi-7inch-panel.dtbo`` at the end of the array. + + .. important:: + + Make sure to add the it at the **end** of the array. The order in ``dtbo_srcs`` will determine + the ``adtbo_idx`` to be used. + + #. Rebuild the kernel as documented in :ref:`android-build-kernel`.