<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX ProcessorsのトピックRe: Android: Problem loading kernel modules from vendor partition (init.rc)</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Android-Problem-loading-kernel-modules-from-vendor-partition/m-p/1864554#M223644</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;This may be helpful:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://source.android.com/docs/core/architecture/kernel/kernel-module-support" target="_blank"&gt;https://source.android.com/docs/core/architecture/kernel/kernel-module-support&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
    <pubDate>Mon, 13 May 2024 14:54:40 GMT</pubDate>
    <dc:creator>Bio_TICFSL</dc:creator>
    <dc:date>2024-05-13T14:54:40Z</dc:date>
    <item>
      <title>Android: Problem loading kernel modules from vendor partition (init.rc)</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Android-Problem-loading-kernel-modules-from-vendor-partition/m-p/1863460#M223559</link>
      <description>&lt;P&gt;I am using Anmdroid 14.0.0_1.2.0 on an i.MX 8MM custom hardware.&lt;/P&gt;&lt;P&gt;On the hardware there are some peripheral chips where the kernel driver needs to load a firmware from eMMC when the driver module gets loaded.&lt;/P&gt;&lt;P&gt;The related kernel modules are all placed in vendor_dklm partition (passed to the BOARD_VENDOR_KERNEL_MODULES makefile variable) so that they get loaded by the init.rc script when vendor partition is already mounted.&lt;/P&gt;&lt;P&gt;Because of programming firmwares some of these driver take a long to time to load. But system already start while the modules are still in loading process. This might lead to conditions where HAL services get loaded but the related hardware is not ready on driver level yet.&lt;/P&gt;&lt;P&gt;The problem is how the modules get loaded from init.rc script. The loading process is declared as a service. The init.rc file is located in device directory (e.g. device/nxp/imx8m/evk_8mm\init.rc)&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;service early_init_sh /vendor/bin/init.insmod.sh /vendor/etc/early.init.cfg vendor.all.early_init.ready&lt;BR /&gt;class main&lt;BR /&gt;user root&lt;BR /&gt;group root system&lt;BR /&gt;disabled&lt;BR /&gt;oneshot&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This service is started in early_init phase (see same init.rc file):&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;on early-init&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; start early_init_sh&lt;BR /&gt;&amp;nbsp;&amp;nbsp; # Set the host name which used in console&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; export HOSTNAME evk_8mm&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;When the service as started via the "start" command it is started in the background and init goes on without waiting. So the HAL services are already loaded while the load kernel modules script is still busy in loading the modules.&lt;/P&gt;&lt;P&gt;I would like to propose to start the kernel module loading script with the "exec_start" command. This will make init process wait until the module load service (or the script) terminates and all modules are loaded before going on loading HAL services.&lt;/P&gt;&lt;P&gt;So this is the patch to apply to all related init.rc files which use the same scheme for laoding the kernel modules:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;diff --git a/imx8m/evk_8mm/init.rc b/imx8m/evk_8mm/init.rc&lt;BR /&gt;index d1d2c1a5..06edc59d 100644&lt;BR /&gt;--- a/imx8m/evk_8mm/init.rc&lt;BR /&gt;+++ b/imx8m/evk_8mm/init.rc&lt;BR /&gt;@@ -7,7 +7,7 @@ on early-init&lt;BR /&gt;mount debugfs none /sys/kernel/debug/ mode=0755&lt;/P&gt;&lt;P&gt;on early-init&lt;BR /&gt;- start early_init_sh&lt;BR /&gt;+ exec_start early_init_sh&lt;BR /&gt;# Set the host name which used in console&lt;BR /&gt;export HOSTNAME evk_8mm&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 12:16:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Android-Problem-loading-kernel-modules-from-vendor-partition/m-p/1863460#M223559</guid>
      <dc:creator>OliW</dc:creator>
      <dc:date>2024-05-10T12:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Android: Problem loading kernel modules from vendor partition (init.rc)</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Android-Problem-loading-kernel-modules-from-vendor-partition/m-p/1864554#M223644</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;This may be helpful:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://source.android.com/docs/core/architecture/kernel/kernel-module-support" target="_blank"&gt;https://source.android.com/docs/core/architecture/kernel/kernel-module-support&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2024 14:54:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Android-Problem-loading-kernel-modules-from-vendor-partition/m-p/1864554#M223644</guid>
      <dc:creator>Bio_TICFSL</dc:creator>
      <dc:date>2024-05-13T14:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: Android: Problem loading kernel modules from vendor partition (init.rc)</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Android-Problem-loading-kernel-modules-from-vendor-partition/m-p/1864982#M223682</link>
      <description>&lt;P&gt;In this documentation&lt;/P&gt;&lt;DIV&gt;&lt;A href="https://source.android.com/docs/core/architecture/kernel/loadable-kernel-modules#module-loading-&amp;amp;-versioning" target="_blank" rel="noopener"&gt;https://source.android.com/docs/core/architecture/kernel/loadable-kernel-modules#module-loading-&amp;amp;-versioning&lt;/A&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it is proposed to load the modules using the exec command of Android's init process:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;on early&lt;/SPAN&gt;&lt;SPAN class=""&gt;-&lt;/SPAN&gt;&lt;SPAN class=""&gt;init&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;exec&lt;/SPAN&gt;&lt;SPAN class=""&gt; u&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN class=""&gt;r&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN class=""&gt;vendor_modprobe&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&lt;SPAN class=""&gt;s0 &lt;/SPAN&gt;&lt;SPAN class=""&gt;--&lt;/SPAN&gt; &lt;SPAN class=""&gt;/&lt;/SPAN&gt;&lt;SPAN class=""&gt;vendor&lt;/SPAN&gt;&lt;SPAN class=""&gt;/&lt;/SPAN&gt;&lt;SPAN class=""&gt;bin&lt;/SPAN&gt;&lt;SPAN class=""&gt;/&lt;/SPAN&gt;&lt;SPAN class=""&gt;modprobe &lt;/SPAN&gt;&lt;SPAN class=""&gt;-&lt;/SPAN&gt;&lt;SPAN class=""&gt;a &lt;/SPAN&gt;&lt;SPAN class=""&gt;-&lt;/SPAN&gt;&lt;SPAN class=""&gt;d &lt;/SPAN&gt;&lt;SPAN class=""&gt;\&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;/&lt;/SPAN&gt;&lt;SPAN class=""&gt;vendor&lt;/SPAN&gt;&lt;SPAN class=""&gt;/&lt;/SPAN&gt;&lt;SPAN class=""&gt;lib&lt;/SPAN&gt;&lt;SPAN class=""&gt;/&lt;/SPAN&gt;&lt;SPAN class=""&gt;modules module_a module_b module_c &lt;/SPAN&gt;&lt;SPAN class=""&gt;...&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The exec commands load the modules blocking (wait until all modules are loading). The approach in the NXP i.MX Android distribution uses service start command which starts the module loading script as a service in the background not waiting for it to terminate. This leads to the situation that modules and HAL services are loaded at the same time which may cause race conditions.&lt;/P&gt;&lt;P&gt;So I want to propse that you change this in future Android distributions to use "exec_start" command which waits for the service to terminate.&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 06:10:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Android-Problem-loading-kernel-modules-from-vendor-partition/m-p/1864982#M223682</guid>
      <dc:creator>OliW</dc:creator>
      <dc:date>2024-05-14T06:10:05Z</dc:date>
    </item>
  </channel>
</rss>

