<?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>topic Compile kernel module for specific Linux version on i.MX in Wireless MCU</title>
    <link>https://community.nxp.com/t5/Wireless-MCU/Compile-kernel-module-for-specific-Linux-version-on-i-MX/m-p/379077#M272</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Assuming a Linux kernel running on a i.MX powered machine, adding kernel modules to it needs the specific kernel sources and a toolchain for ARM. First, identify the kernel version running:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: verdana, geneva;"&gt;$ uname -r&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Next, download the kernel sources from the Freescale i.MX Linux Tree [1]. Change branch from &lt;EM&gt;master&lt;/EM&gt; to the one seen above, the download links shall be seen under the &lt;EM&gt;commit&lt;/EM&gt; tab.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;The toolchain to be used is Linaro. It can be downloaded from [2]. Now that both the kernel sources and the toolchain are available, the steps to follow for compiling an additional kernel module are (assuming the working directory the kernel source tree):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1. &lt;SPAN style="font-family: verdana, geneva;"&gt;$ &lt;SPAN style="font-family: verdana, geneva;"&gt;export PATH=/.../fsl-linaro-toolchain/bin/:$PATH&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2. &lt;SPAN style="font-family: verdana, geneva;"&gt;$ export ARCH=arm&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3. &lt;SPAN style="font-family: verdana, geneva;"&gt;$ export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Now, inserting a kernel module on top of a running kernel needs that the module to be compiled in the same manner the kernel was, in terms of configuration. The configuration file which tells how the running kernel was compiled can be found under:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: verdana, geneva;"&gt;$ /proc/config.gz &lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;(or under /boot sometimes)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Copy this file under the kernel source tree and issue:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4. &lt;SPAN style="font-family: verdana, geneva;"&gt;$ zcat config.gz &amp;gt; .config&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Now modify aspects of .config to enable compilation of your desired module. E.g. to enable compilation of the CDC_ACM module, one should change the following line in .config:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: verdana, geneva;"&gt;# CONFIG_USB_ACM is not set&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;to&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: verdana, geneva;"&gt;CONFIG_USB_ACM=m&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;. &lt;SPAN style="font-family: verdana, geneva;"&gt;$ make&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Trying to compile just the specific module may not work since not all dependencies may be present, so making the whole kernel is needed. If available, compile using multiple cores by using -j:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: verdana, geneva;"&gt;$ make -j 4&lt;/SPAN&gt; (if 4 cores available)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;[1] &lt;A href="http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/" title="http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/"&gt;linux-2.6-imx.git - Freescale i.MX Linux Tree&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;[2] &lt;/SPAN&gt;&lt;A href="https://github.com/embest-tech/fsl-linaro-toolchain" title="https://github.com/embest-tech/fsl-linaro-toolchain"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;embest-tech/fsl-linaro-toolchain · GitHub&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Oct 2014 07:55:31 GMT</pubDate>
    <dc:creator>adrian_nicolau</dc:creator>
    <dc:date>2014-10-09T07:55:31Z</dc:date>
    <item>
      <title>Compile kernel module for specific Linux version on i.MX</title>
      <link>https://community.nxp.com/t5/Wireless-MCU/Compile-kernel-module-for-specific-Linux-version-on-i-MX/m-p/379077#M272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Assuming a Linux kernel running on a i.MX powered machine, adding kernel modules to it needs the specific kernel sources and a toolchain for ARM. First, identify the kernel version running:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: verdana, geneva;"&gt;$ uname -r&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Next, download the kernel sources from the Freescale i.MX Linux Tree [1]. Change branch from &lt;EM&gt;master&lt;/EM&gt; to the one seen above, the download links shall be seen under the &lt;EM&gt;commit&lt;/EM&gt; tab.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;The toolchain to be used is Linaro. It can be downloaded from [2]. Now that both the kernel sources and the toolchain are available, the steps to follow for compiling an additional kernel module are (assuming the working directory the kernel source tree):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1. &lt;SPAN style="font-family: verdana, geneva;"&gt;$ &lt;SPAN style="font-family: verdana, geneva;"&gt;export PATH=/.../fsl-linaro-toolchain/bin/:$PATH&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2. &lt;SPAN style="font-family: verdana, geneva;"&gt;$ export ARCH=arm&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3. &lt;SPAN style="font-family: verdana, geneva;"&gt;$ export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Now, inserting a kernel module on top of a running kernel needs that the module to be compiled in the same manner the kernel was, in terms of configuration. The configuration file which tells how the running kernel was compiled can be found under:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: verdana, geneva;"&gt;$ /proc/config.gz &lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;(or under /boot sometimes)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Copy this file under the kernel source tree and issue:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4. &lt;SPAN style="font-family: verdana, geneva;"&gt;$ zcat config.gz &amp;gt; .config&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Now modify aspects of .config to enable compilation of your desired module. E.g. to enable compilation of the CDC_ACM module, one should change the following line in .config:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: verdana, geneva;"&gt;# CONFIG_USB_ACM is not set&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;to&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: verdana, geneva;"&gt;CONFIG_USB_ACM=m&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;. &lt;SPAN style="font-family: verdana, geneva;"&gt;$ make&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Trying to compile just the specific module may not work since not all dependencies may be present, so making the whole kernel is needed. If available, compile using multiple cores by using -j:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: verdana, geneva;"&gt;$ make -j 4&lt;/SPAN&gt; (if 4 cores available)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;[1] &lt;A href="http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/" title="http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/"&gt;linux-2.6-imx.git - Freescale i.MX Linux Tree&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;[2] &lt;/SPAN&gt;&lt;A href="https://github.com/embest-tech/fsl-linaro-toolchain" title="https://github.com/embest-tech/fsl-linaro-toolchain"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;embest-tech/fsl-linaro-toolchain · GitHub&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Oct 2014 07:55:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Wireless-MCU/Compile-kernel-module-for-specific-Linux-version-on-i-MX/m-p/379077#M272</guid>
      <dc:creator>adrian_nicolau</dc:creator>
      <dc:date>2014-10-09T07:55:31Z</dc:date>
    </item>
  </channel>
</rss>

