Difference between revisions of "IoTGateway/BSP/Linux/iMX6/Yocto LBV6 User Guide"
Alex.cheng (talk | contribs) (update information) |
|||
Line 1: | Line 1: | ||
− | {{DISPLAYTITLE:Yocto Linux BSP Ver.6 User Guide for iMX6 series}} <!-- | + | <p><span class="fck_mw_template">{{DISPLAYTITLE:Yocto Linux BSP Ver.6 User Guide for iMX6 series}}</span> <!-- |
{| align="right" | {| align="right" | ||
| <span class="fck_mw_magic" _fck_mw_customtag="true" _fck_mw_tagname="TOC" _fck_mw_tagtype="c">_</span> | | <span class="fck_mw_magic" _fck_mw_customtag="true" _fck_mw_tagname="TOC" _fck_mw_tagtype="c">_</span> | ||
|} | |} | ||
--> | --> | ||
− | + | </p> | |
− | + | <h1> Getting Started </h1> | |
− | + | <h2> <span style="color:#0070c0;">Prerequisites</span> </h2> | |
− | + | <p>All operations in this guide are based on Ubuntu 12.04 LTS 64bit only.<br />First please install Ubuntu 12.04 LTS 64bit<sup><span style="color:red">*</span></sup> with minimum 2GB memory. | |
− | + | <br /><pre class="fck_mw_nowiki"><nowiki>* ubuntu-12.04.1-desktop-amd64.iso</nowiki></pre> | |
− | All operations in this guide are based on Ubuntu 12.04 LTS 64bit only.<br/>First please install Ubuntu 12.04 LTS 64bit<sup><span style="color:red">*</span></sup> with minimum 2GB memory. | + | </p> |
− | <br/><nowiki>* ubuntu-12.04.1-desktop-amd64.iso</nowiki> | + | <h3> <span style="color:#0070c0;">To install required packages</span> </h3> |
− | + | <p>Please login and perform the following commands: | |
− | + | </p> | |
− | + | <pre class="_fck_mw_lspace">$ sudo apt-get install ssh | |
− | Please login and perform the following commands: | + | $ sudo apt-get install ia32-libs libx11-dev:i386 libreadline6-dev:i386 \ |
− | + | libgl1-mesa-glx:i386 zlib1g-dev:i386 uuid-dev:i386 liblzo2-dev:i386 \ | |
− | + | libncurses5-dev:i386 | |
− | + | $ sudo apt-get install \ | |
− | + | bison build-essential ccache dpkg flex gcc g++ gettext intltool \ | |
− | + | libarchive-zip-perl libfreetype6-dev libdbus-glib-1-dev liborbit2-dev \ | |
− | + | libxml2-dev libx11-dev libgtk2.0-dev liblzo2-2 libtool m4 \ | |
− | + | patch rpm tcl uboot-mkimage uuid zlib1g zlib1g-dev \ | |
− | + | git gnupg flex bison gperf build-essential zip \ | |
− | + | curl libc6-dev libncurses5-dev x11proto-core-dev libx11-dev:i386 \ | |
− | + | libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib \ | |
− | + | mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 \ | |
− | + | gcc-4.6 g++-4.6 cpp-4.6 gcc-4.6-multilib uuid-dev liblzo2-dev \ | |
− | + | uboot-mkimage libarchive-zip-perl \ | |
− | + | wget git-core unzip texinfo gawk diffstat build-essential chrpath \ | |
− | + | sed cvs subversion coreutils texi2html \ | |
− | + | docbook-utils python-pysqlite2 help2man make gcc g++ \ | |
− | + | desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev mercurial \ | |
− | + | autoconf automake groff curl lzop asciidoc xterm | |
− | + | $ sudo apt-get install libncurses5-dev:i386 liblzo2-dev:i386 uuid-dev:i386 | |
− | + | $ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so | |
− | + | $ tar zcvf ~/usr_lib_i386-linux-gnu_for_Building_Android_KK.tar.gz \ | |
− | + | /usr/lib/i386-linux-gnu/{libuuid.a,libuuid.so,liblzo2.so,liblzo2.a} | |
− | + | $ sudo apt-get install uuid-dev liblzo2-dev | |
− | + | $ sudo tar zxvf ~/usr_lib_i386-linux-gnu_for_Building_Android_KK.tar.gz -C / | |
− | + | </pre> | |
− | + | <h3> <span style="color:#0070c0;">To install JDK</span> </h3> | |
− | + | <p>Please download "jdk-6u45-linux-x64.bin" manually from <a href="http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR" alt="http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR" title="http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR">Oracle Official Website</a> | |
− | + | </p><p>And put it to directory ~/FILES/ and perform the following commands: | |
− | + | </p> | |
− | + | <pre class="_fck_mw_lspace">$ cd /usr/lib | |
− | Please download "jdk-6u45-linux-x64.bin" manually from | + | $ sudo ~/FILES/jdk-6u45-linux-x64.bin |
− | + | $ sudo mkdir jvm | |
− | + | $ cd jvm | |
− | + | $ sudo mv ../jdk1.6.0_45 . | |
− | + | $ cd jdk1.6.0_45/ | |
− | + | $ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/jre/bin/java 2 | |
− | + | $ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 2 | |
− | + | $ sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_45/bin/jar 2 | |
− | + | $ sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk1.6.0_45/bin/javap 2 | |
− | + | $ sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_45/bin/javadoc 2 | |
− | + | $ sudo update-alternatives --config javap | |
− | + | $ sudo update-alternatives --config javadoc | |
− | + | $ sudo update-alternatives --config java | |
− | + | $ sudo update-alternatives --config javac | |
− | + | $ sudo update-alternatives --config jar | |
− | + | $ cd ~/ | |
− | + | $ sudo sh -c "echo "JAVA_HOME=/usr/lib/jvm/jdk1.6.0_45" >> /etc/environment" | |
− | + | </pre> | |
− | + | <p>If you have some troubles on setting up build environment, we recommend that you use Docker, and it is more safely & quickly. Please refer to <a href="IoTGateway%2FDocker">Docker</a> | |
− | + | </p> | |
− | + | <h2> <span style="color:#0070c0;">Conventions</span> </h2> | |
− | + | <p><span style="color:purple"><b>${PREBUILT_IMAGE}</b></span> : compressed prebuilt image (*.img.gz) | |
− | + | </p><p><span style="color:purple"><b>${BSP_TARBALL}</b></span> : BSP tarball (*.tgz) | |
− | If you have some troubles on setting up build environment, we recommend that you use Docker, and it is more safely & quickly. Please refer to | + | </p><p><span style="color:purple"><b>${BSP_HOME}</b></span> : home directory of the BSP |
− | + | </p><p><span style="color:purple"><b>${BDIR}</b></span> : build directory (e.g. build_x11) | |
− | + | </p><p><span style="color:purple"><b>${MX6PROC}</b></span> : i.MX6 Processor | |
− | + | </p> | |
− | <span style="color:purple"> | + | <dl><dd>mx6q for iMX6 Quad Core / Dual Core |
− | + | </dd> | |
− | <span style="color:purple"> | + | <dd>mx6dl for iMX6 Dual Lite / Solo |
− | + | </dd></dl><p><span style="color:purple"><b>${IMX6PROC}</b></span> : i.MX6 Processor | |
− | <span style="color:purple"> | + | </p> |
− | + | <dl><dd>imx6q / imx6dl | |
− | <span style="color:purple"> | + | </dd></dl><p><span style="color:purple"><b>${BOARD}</b></span> : available target boards list below |
− | + | </p> | |
− | <span style="color:purple"> | + | <dl><dd>rom5420 / ubc220 / rom7421/ rom3420 / rom7420 / rsb4410 / rsb4411 / rsb6410 / ubcds31 / wise3310 |
− | + | </dd></dl><p><span style="color:purple"><b>${BOARD_REV}</b></span> : board revision | |
− | + | </p> | |
− | + | <dl><dd>a1 / a2 / b1 | |
− | + | </dd></dl><p><span style="color:purple"><b>${MC}</b></span> : machine code combined with <span style="color:purple"><b>${IMX6PROC}${BOARD}${BOARD_REV}</b></span> | |
− | <span style="color:purple"> | + | </p> |
− | + | <dl><dd>for example, | |
− | + | </dd></dl><dl><dd><dl><dd><tt>imx6dlrom5420b1 for ROM-5420-Solo B1</tt> | |
− | + | </dd> | |
− | <span style="color:purple"> | + | <dd><tt>imx6dlubc220a1 for UBC-220-Dual-Light A1</tt> |
− | + | </dd> | |
− | + | <dd><tt>imx6qprom7421a1 for ROM-7421-Dual/Quad-Plus A1</tt> | |
− | + | </dd> | |
− | <span style="color:purple"> | + | <dd><tt>imx6qrom3420a1 for ROM-3420-Dual/Quad A1</tt> |
− | + | </dd> | |
− | + | <dd><tt>imx6qrom5420a1 for ROM-5420-Dual/Quad A1</tt> | |
− | + | </dd> | |
− | < | + | <dd><tt>imx6qrom5420b1 for ROM-5420-Dual/Quad B1</tt> |
− | + | </dd> | |
− | + | <dd><tt>imx6qrom7420a1 for ROM-7420-Dual/Quad A1</tt> | |
− | + | </dd> | |
− | + | <dd><tt>imx6qrsb4410a2 for RSB-4410-Dual A2</tt> | |
− | + | </dd> | |
− | + | <dd><tt>imx6qrsb4410a1 for RSB-4410-Dual A1</tt> | |
− | + | </dd> | |
− | + | <dd><tt>imx6qrsb4411a1 for RSB-4411-Dual/Quad A1</tt> | |
− | + | </dd> | |
− | + | <dd><tt>imx6qrsb6410a1 for RSB-6410-Dual A1</tt> | |
− | + | </dd> | |
− | + | <dd><tt>imx6qubcds31a1 for UBC-DS31-Dual A1</tt> | |
− | + | </dd> | |
− | + | <dd><tt>imx6qwise3310a1 for WISE-3310-Dual A1</tt> | |
− | + | </dd></dl></dd></dl><p><span style="color:purple"><b>${MEM_SIZE}</b></span> : memory size | |
− | + | </p> | |
− | + | <dl><dd>1G / 2G / 512M | |
− | < | + | </dd></dl><p><span style="color:purple"><b>${SD_DEVICE}</b></span> : device name of SD card in Ubuntu (e.g. /dev/sdf) |
− | + | </p><p><span style="color:purple"><b>${SDCARD_IMAGE}</b></span> : sdcard image built by bitbake (*.sdcard) | |
− | + | </p><p><span style="color:purple"><b>${UBOOT}</b></span> :u-boot version(e.g. 2015.04) | |
− | + | </p><p><span style="color:purple"><b>${KERNEL}</b></span> : linux kernel version(e.g. 3.14.52) | |
− | < | + | </p><p><span style="color:purple"><b>${TOOLCHAIN}</b></span> : toolchain installed directory(e.g. /opt/fsl-imx-x11/3.14.52-1.1.0) |
− | + | </p><p>debug console / serial console | |
− | <span style="color:purple"> | + | </p> |
− | + | <dl><dd>serial terminal program (e.g. minicom, putty, teraterm ...) that serial port is configured to 115200 8N1 | |
− | <span style="color:purple"> | + | </dd></dl><p>terminal console |
− | + | </p> | |
− | <span style="color:purple"> | + | <dl><dd>terminal program (e.g. gnome-terminal, xfce4-terminal ...) |
− | + | </dd></dl><h2> <span style="color:#0070c0;">Introducing BSP</span> </h2> | |
− | < | + | <dl><dd>The BSP is based on Yocto Project with Freescale enhanced features for i.MX6, plus specific target board features from Advantech Inc.. |
− | + | </dd></dl><h3> <span style="color:#0070c0;">Naming Rule</span> </h3> | |
− | debug console / serial console | + | <dl><dd>The tarball/prebuilt image name is consist of the model name followed by "LB" or "LI" plus version number and released date. |
− | + | </dd></dl><dl><dd>For example, 4410A1LBV6000_2016-03-07.tgz which "4410A1" stands for RSB-<span style="color:#ff0000;"><b>4410 A1</b></span>, "LB" is acronym of <span style="color:#ff0000;"><b>L</b></span>inux <span style="color:#ff0000;"><b>B</b></span>SP, "V6000" stands for <span style="color:#ff0000;"><b>V</b></span>ersion <span style="color:#ff0000;"><b>6</b></span>.<span style="color:#ff0000;"><b>000</b></span><pre class="fck_mw_nowiki"><nowiki>.</nowiki></pre> | |
− | + | </dd></dl><p> | |
− | + | </p> | |
− | + | <dl><dd>For example, 4410A1LIV6000_DualQuad_2016-03-07.img.gz which "LI" is acronym for prebuilt <span style="color:#ff0000;"><b>L</b></span>inux <span style="color:#ff0000;"><b>I</b></span>mage, DualQuad means this image is fit for Dual Core/Quad Core. | |
− | + | </dd></dl><h3> <span style="color:#0070c0;">BSP tarball</span> </h3> | |
− | + | <dl><dd>Unpack BSP tarball to home directory by performing the following command: | |
− | + | <dl><dd><code>$ tar xvf <span style="color:#7030a0;"><b>${BSP</b></span><b><span style="color:#7030a0;">_TARBALL</span><span style="color:#7030a0;">}</span></b> -C ~/</code> | |
− | + | </dd></dl></dd></dl><div style="margin-left:1.498cm;margin-right:0cm;">(Every BSP with different version contains an unique folder, e.g. after unpacking 4410A1LBV6000_2016-03-07.tgz to home directory, the directory , ~/imx6LBV6000_2016-03-07 is the BSP's home folder.)</div><div style="margin-left:0.499cm;margin-right:0cm;">The description of some important folders list below:</div><div style="margin-left:1.499cm;margin-right:0cm;"><b>sources/</b></div><div style="margin-left:1.998cm;margin-right:0cm;"><b>meta-advantech/</b> : meta layer by Advantech</div><div style="margin-left:1.998cm;margin-right:0cm;"><b>meta-fsl-*/</b> : meta layer by Freescale</div><div style="margin-left:1.499cm;margin-right:0cm;"><b>fsl-setup-release.sh</b> : to create one new build environment</div><div style="margin-left:1.499cm;margin-right:0cm;"><b>setup-environment</b> : to continue an exist build environment</div> | |
− | + | <h3> <span style="color:#0070c0;">Prebuilt image</span> </h3> | |
− | + | <dl><dd>Perform the following command to build one boot-up SD card | |
− | + | <dl><dd><code>$ gunzip -c <span style="color:#7030a0;"><b>${</b></span><b><span style="color:#7030a0;">PREBUILT_IMAGE</span><span style="color:#7030a0;">}</span></b> | dd of=<span style="color:#7030a0;"><b>${SD_DEVICE}</b></span> bs=1M</code> | |
− | + | </dd></dl></dd></dl><h2> <span style="color:#0070c0;">Build Instructions</span> </h2> | |
− | + | <h3> <span style="color:#0070c0;">To create one new build environment</span> </h3> | |
− | + | <dl><dd>Perform the following commands in terminal console | |
− | + | <dl><dd><code>$ cd <span style="color:#7030a0;"><b>${BSP_HOME}</b></span></code> | |
− | + | </dd> | |
− | + | <dd><code>$ MACHINE=<span style="color:#7030a0;"><b>${MC}</b></span> source fsl-setup-release.sh -b <span style="color:#7030a0;"><b>${BDIR}</b></span> -e x11</code> | |
− | + | </dd></dl></dd> | |
− | + | <dd>You need to read and accept the EULA. | |
− | + | </dd> | |
− | + | <dd><img src="/wiki/images/1/1d/Accept_EULA.png" _fck_mw_filename="Accept EULA.png" _fck_mw_origimgwidth="444" _fck_mw_origimgheight="29" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /> | |
− | + | </dd></dl><h3> <span style="color:#0070c0;">To continue an exist build environment</span> </h3> | |
− | + | <dl><dd>Perform the following commands in terminal console | |
− | + | <dl><dd><code>$ cd <span style="color:#7030a0;"><b>${BSP_HOME}</b></span></code> | |
− | <div style="margin-left:1.498cm;margin-right:0cm;">(Every BSP with different version contains an unique folder, e.g. after unpacking 4410A1LBV6000_2016-03-07.tgz to home directory, the directory , ~/imx6LBV6000_2016-03-07 is the BSP's home folder.)</div><div style="margin-left:0.499cm;margin-right:0cm;">The description of some important folders list below:</div><div style="margin-left:1.499cm;margin-right:0cm;"> | + | </dd> |
− | + | <dd><code>$ source setup-environment <span style="color:#7030a0;"><b>${BDIR}</b></span></code> | |
− | + | </dd></dl></dd></dl><h3> <span style="color:#0070c0;">To build sdcard image</span> </h3> | |
− | + | <dl><dd>To create/continue a build environment | |
− | + | </dd> | |
− | + | <dd>Perform the following command in terminal console | |
− | + | <dl><dd><code>$ bitbake fsl-image-qt5</code> | |
− | + | </dd></dl></dd> | |
− | + | <dd>The file, fsl-image-qt5-<span style="color:#7030a0;"><b>${MC}</b></span>.sdcard, will be located in directory, ./tmp/deploy/images/<span style="color:#7030a0;"><b>${MC}</b></span>, while building process finished successfully. | |
− | + | </dd></dl><h3> <span style="color:#0070c0">To build toolchain installer</span> </h3> | |
− | + | <dl><dd>To create/continue a build environment | |
− | + | </dd> | |
− | + | <dd>Perform the following command in terminal console | |
− | + | <dl><dd><code>$ bitbake meta-toolchain-qt5</code><br /> | |
− | + | </dd></dl></dd> | |
− | + | <dd>The below installer will be located in the directory "./tmp/deploy/sdk". | |
− | + | <dl><dd><tt>fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-<span style="color:#7030a0"><b>${KERNEL}</b></span>-1.1.0.sh</tt><br /> | |
− | + | </dd></dl></dd></dl><h3> <span style="color:#0070c0;">To build u-boot</span> </h3> | |
− | + | <dl><dd>To create/continue a build environment | |
− | + | </dd> | |
− | + | <dd>Perform the following command in terminal console | |
− | + | <dl><dd><code>$ bitbake u-boot-imx</code> | |
− | + | </dd></dl></dd> | |
− | + | <dd>The two files, u-boot_crc.bin & u-boot_crc.bin.crc, will be located in directory, ./tmp/deploy/images/<span style="color:#7030a0;"><b>${MC}</b></span>. | |
− | + | </dd></dl><h3> <span style="color:#0070c0">To build linux kernel</span> </h3> | |
− | + | <dl><dd>To create/continue a build environment | |
− | + | </dd> | |
− | + | <dd>Perform the following command in terminal console | |
− | + | <dl><dd>to do menuconfig | |
− | + | </dd></dl></dd></dl><div style="margin-left: 5em"><pre class="fck_mw_syntaxhighlight"><syntaxhighlight lang="bash"> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | <div style="margin-left: 5em"><syntaxhighlight lang="bash"> | ||
$ bitbake linux-imx -c menuconfig | $ bitbake linux-imx -c menuconfig | ||
− | </syntaxhighlight></div> | + | </syntaxhighlight></pre></div> |
− | + | <dl><dd><dl><dd><dl><dd><dl><dd>* If you operate on docker images, please install tmux application before running this command. | |
− | + | <dl><dd><code>$ sudo apt-get install tmux</code> | |
− | + | </dd></dl></dd></dl></dd></dl></dd> | |
− | <div style="margin-left: 5em"><syntaxhighlight lang="bash"> | + | <dd>to do build |
+ | </dd></dl></dd></dl><div style="margin-left: 5em"><pre class="fck_mw_syntaxhighlight"><syntaxhighlight lang="bash"> | ||
$ bitbake linux-imx -c compile -f | $ bitbake linux-imx -c compile -f | ||
$ bitbake linux-imx -c compile_kernelmodules -f | $ bitbake linux-imx -c compile_kernelmodules -f | ||
$ bitbake linux-imx -c deploy | $ bitbake linux-imx -c deploy | ||
− | </syntaxhighlight></div> | + | </syntaxhighlight></pre></div> |
− | + | <dl><dd>The two files, zImage & zImage-<span style="color:#7030a0"><b>${IMX6PROC}</b></span>-<span style="color:#7030a0"><b>${BOARD}</b></span>-<span style="color:#7030a0"><b>${BOARD</b></span><b><span style="color:#7030a0">_REV</span><span style="color:#7030a0">}</span></b>.dtb, will be located in directory, ./tmp/deploy/images/<span style="color:#7030a0"><b>${MC}</b></span>. | |
− | + | </dd></dl><h2> <span style="color:#0070c0;">Creating boot-up on-board flash from prebuilt image</span> </h2> | |
− | + | <h3> <span style="color:#0070c0;">To create one boot-up SD card</span> </h3> | |
− | + | <dl><dd>Perform the following command in terminal console | |
− | + | <dl><dd><code>$ gunzip -c <b><span style="color:#7030a0;">${PREBUILT_IMAGE</span></b> | dd of=<span style="color:#7030a0;"><b>${SD_DEVICE}</b></span> bs=1M</code> | |
− | + | </dd> | |
− | + | <dd><code>$ sync</code> | |
− | + | </dd></dl></dd></dl><h3> <span style="color:#0070c0;">To transfer whole system to on-board flash</span> </h3> | |
− | + | <dl><dd>Boot up from SD card | |
− | + | </dd> | |
− | + | <dd>Perform the following commands in debug console | |
− | + | <dl><dd><code># cd /mk_inand</code> | |
− | + | </dd> | |
− | + | <dd><code># ./mksd-linux.sh /dev/mmcblk0</code> | |
− | + | </dd></dl></dd> | |
− | + | <dd>press y followed by Enter, if following message shows up: | |
− | + | <dl><dd><img src="/wiki/images/a/a7/All_data_will_be_destroyed.png" _fck_mw_filename="All data will be destroyed.png" _fck_mw_origimgwidth="640" _fck_mw_origimgheight="31" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /> | |
− | + | </dd></dl></dd> | |
− | + | <dd>While "[Done]" shows up means the transferring is finished. | |
− | + | </dd></dl><h2> <span style="color:#0070c0;">Creating boot-up on-board flash from built sdcard image</span> </h2> | |
− | + | <h3> <span style="color:#0070c0;">To create one boot-up SD card</span> </h3> | |
− | + | <dl><dd>Perform the following commands in terminal console | |
− | + | <dl><dd><code>$ pushd <span style="color:#7030a0;"><b>${BSP_HOME}</b></span>/<span style="color:#7030a0;"><b>${BDIR}</b></span>/tmp/deploy/images/<span style="color:#7030a0;"><b>${MC}</b></span></code> | |
− | + | </dd> | |
− | + | <dd><code>$ dd if=<span style="color:#7030a0;"><b>${SDCARD_IMAGE}</b></span> of=<span style="color:#7030a0;"><b>${SD_DEVICE}</b></span> bs=1M</code> | |
− | + | </dd> | |
− | + | <dd><code>$ sync</code> | |
− | + | </dd> | |
− | + | <dd><code>$ popd</code> | |
− | + | </dd></dl></dd></dl><h3> <span style="color:#0070c0;">To transfer whole system to on-board flash</span> </h3> | |
− | + | <dl><dd>Boot up from SD card | |
− | + | </dd> | |
− | + | <dd>Insert USB stick that contains <span style="color:#7030a0;"><b>${SDCARD_IMAGE}</b></span>, USB stick will be auto mounted to /run/media/sda1. | |
− | + | </dd> | |
− | + | <dd>Perform the following commands in debug console | |
− | + | <dl><dd><code># umount /dev/mmcblk0p?</code> | |
− | + | </dd> | |
− | + | <dd><code># cd /run/media/sda1</code> | |
− | + | </dd> | |
− | + | <dd><code># dd if=<span style="color:#7030a0;"><b>${SDCARD_IMAGE}</b></span> of=/dev/mmcblk0 bs=4M conv=fsync</code> | |
− | + | </dd> | |
− | + | <dd><code># P2START=$(fdisk -lu | grep mmcblk0p2 | awk '{print $2}')</code> | |
− | + | </dd> | |
− | + | <dd><code># echo -e "d\n2\nn\np\n2\n<span style="color:#7030a0;"><b>${P2START}</b></span>\n\nw\n" | fdisk -u /dev/mmcblk0</code> | |
− | + | </dd> | |
− | + | <dd><code># umount /dev/mmcblk0p2</code> | |
− | + | </dd> | |
− | + | <dd><code># e2fsck -f -y /dev/mmcblk0p2</code> | |
− | + | </dd> | |
− | + | <dd><code># resize2fs /dev/mmcblk0p2</code> | |
− | + | </dd> | |
− | :Navigate to the directory where fsl-image-adv.inc located | + | <dd><code># poweroff</code> |
− | + | </dd></dl></dd></dl><h1> Customization </h1> | |
− | + | <h2> <span style="color:#0070c0;">Package addition</span> </h2> | |
− | + | <h3> <span style="color:#0070c0;">To add tcf-agent & openssh-sftp-server</span> </h3> | |
− | + | <dl><dd>Navigate to the directory where fsl-image-adv.inc located | |
− | + | <dl><dd><code>$ cd <span style="color:#7030a0;"><b>${BSP_HOME}</b></span>/sources/meta-advantech/recipes-fsl/images</code> | |
− | + | </dd></dl></dd> | |
− | + | <dd>Add following line to fsl-image-adv.inc | |
− | + | <dl><dd><code>IMAGE_INSTALL += " tcf-agent openssh-sftp-server "</code> | |
− | + | </dd></dl></dd> | |
− | + | <dd><a href="IoTGateway%2FBSP%2FLinux%2FiMX6%2FYocto%20LBV5%20User%20Guide%23To%20continue%20an%20exist%20build%20environment">Continue an exist build environment</a> and <a href="IoTGateway%2FBSP%2FLinux%2FiMX6%2FYocto%20LBV5%20User%20Guide%23To%20build%20sdcard%20image">build sdcard image</a> | |
− | + | </dd></dl><h3> <span style="color:#0070c0">To add chromium browser</span> </h3> | |
− | + | <dl><dd>Navigate to the directory where local.conf located | |
− | + | <dl><dd><code>$ cd <span style="color:#7030a0"><b>${BSP_HOME}</b></span>/<span style="color:#7030a0"><b>${BDIR</b></span><b><span style="color:#7030a0">}</span></b>/conf</code> | |
− | + | </dd></dl></dd> | |
− | + | <dd>Add following two lines to local.conf | |
− | + | <dl><dd><code>CORE_IMAGE_EXTRA_INSTALL += "chromium"</code> | |
− | + | </dd> | |
− | + | <dd><code>LICENSE_FLAGS_WHITELIST="commercial"</code> | |
− | + | </dd></dl></dd> | |
− | + | <dd><a href="#To_continue_an_exist_build_environment">Continue an exist build environment</a> and <a href="#To_build_sdcard_image">build sdcard image</a><br /> | |
− | + | </dd></dl><h2> <span style="color:#0070c0">Setting up SDK</span> </h2> | |
− | + | <dl><dd>Please follow the section,<a href="IoTGateway%2FBSP%2FLinux%2FiMX6%2FYocto%20LBV5%20User%20Guide%23To%20build%20toolchain%20installer">To build toolchain installer</a>, to build one toolchain installer | |
− | + | </dd> | |
− | + | <dd>Perform the following command in terminal console | |
− | + | <dl><dd><code>$ cd <span style="color:#7030a0"><b>${BSP_HOME}</b></span>/<span style="color:#7030a0"><b>${BDIR}</b></span>/tmp/deploy/sdk</code> | |
− | = | + | </dd> |
− | + | <dd><code>$ sudo ./fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-<span style="color:#7030a0"><b>${KERNEL}</b></span>-1.1.0.sh</code><br /> | |
− | + | </dd></dl></dd> | |
− | + | <dd>Enter new installed directory or just press <code>Enter</code> to use default directory. | |
− | + | </dd> | |
− | + | <dd>While <code>Proceed[y/n]?</code> shows up, please enter the correct one. | |
− | + | </dd> | |
− | + | <dd>Waiting for the SDK installed (while the following messages show up completely) | |
− | + | <dl><dd><img src="/wiki/images/1/17/Setting_up_sdk_3.png" _fck_mw_filename="Setting up sdk 3.png" _fck_mw_origimgwidth="572" _fck_mw_origimgheight="65" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /> | |
− | + | </dd></dl></dd></dl><h2> <span style="color:#0070c0;">Setting up cross compiling environment</span> </h2> | |
− | + | <dl><dd>SDK has been set up (ref. <a href="#Setting_up_SDK">Setting up SDK</a>) | |
− | + | </dd> | |
− | + | <dd>Perform the following command in terminal console | |
− | + | <dl><dd><code>$ source <span style="color:#7030a0;"><b>${TOOLCHAIN}</b></span>/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi</code> | |
− | + | </dd></dl></dd></dl><h2> <span style="color:#0070c0;">Building & updating u-boot manually</span> </h2> | |
− | + | <h3> <span style="color:#0070c0;">To build u-boot</span> </h3> | |
− | + | <dl><dd>The cross compiling environment has been set up. (ref. <a href="#Setting_up_cross_compiling_environment">Setting up cross compiling environment</a>) | |
− | + | </dd> | |
− | + | <dd>Make one copy from Yocto working directory | |
− | + | <dl><dd><code>$ mkdir -p ~/code</code> | |
− | + | </dd> | |
− | + | <dd><code>$ pushd <span style="color:#7030a0;"><b>${BSP_HOME}</b></span>/<span style="color:#7030a0;"><b>${BDIR}</b></span>/tmp/work/<span style="color:#7030a0;"><b>${MC}</b></span>-poky-linux-gnueabi/</code> | |
− | + | </dd> | |
− | + | <dd><code>$ rm -rf ~/code/u-boot-imx</code> | |
− | + | </dd> | |
− | + | <dd><code>$ cp -a ./u-boot-imx/<span style="color:#7030a0;"><b>${UBOOT}</b></span>-r0/git ~/code/u-boot-imx</code> | |
− | + | </dd> | |
− | + | <dd><code>$ popd</code> | |
− | + | </dd></dl></dd> | |
− | + | <dd>Configure u-boot | |
− | + | <dl><dd><code>$ cd ~/code/u-boot-imx</code> | |
− | + | </dd> | |
− | + | <dd><code>$ make distclean</code> | |
− | + | </dd> | |
− | + | <dd><code>$ make <span style="color:#7030a0;"><b>${MX6PROC}${BOARD}${BOARD_REV}</b></span>_<span style="color:#7030a0;"><b>${MEM_SIZE}</b></span>_config</code> | |
− | + | </dd></dl></dd> | |
− | + | <dd>Start building u-boot | |
− | + | <dl><dd><code>$ make -j4 LDFLAGS=</code> | |
− | + | </dd></dl></dd> | |
− | + | <dd>The two files, u-boot_crc.bin & u-boot_crc.bin.crc, are located in directory "~/code/u-boot-imx". | |
− | + | </dd></dl><h3> <span style="color:#0070c0;">To update u-boot to target device</span> </h3> | |
− | + | <dl><dd>Perform the following command to transfer to exist boot-up SD card | |
− | + | <dl><dd><code>$ dd if=u-boot_crc.bin.crc of=<span style="color:#7030a0;"><b>${SD_DEVICE}</b></span> bs=512 seek=2 conv=fsync</code> | |
− | + | </dd> | |
− | + | <dd><code>$ dd if=u-boot_crc.bin of=<span style="color:#7030a0;"><b>${SD_DEVICE}</b></span> bs=512 seek=3 conv=fsync</code> | |
− | + | </dd></dl></dd> | |
− | + | <dd>Make sure new u-boot does work then perform the following commands to transfer to on-board flash | |
− | + | <dl><dd><code># dd if=u-boot_crc.bin.crc of=/dev/mmcblk0 bs=512 seek=2 conv=fsync</code> | |
− | + | </dd> | |
− | + | <dd><code># dd if=u-boot_crc.bin of=/dev/mmcblk0 bs=512 seek=3 conv=fsync</code> | |
− | + | </dd></dl></dd></dl><h2> <span style="color:#0070c0;">Building & updating kernel/modules/dtb manually</span> </h2> | |
− | + | <h3> <span style="color:#0070c0">To build kernel/modules/dtb</span> </h3> | |
− | + | <dl><dd>The cross compiling environment has been set up. (ref. <a href="#Setting_up_cross_compiling_environment">Setting up cross compiling environment</a>) | |
− | + | </dd></dl><dl><dd>Make one copy from Yocto working directory | |
− | + | <dl><dd><code>$ mkdir -p ~/code</code> | |
− | + | </dd> | |
− | + | <dd><code>$ pushd <span style="color:#7030a0"><b>${BSP_HOME}</b></span>/<span style="color:#7030a0"><b>${BDIR}</b></span>/tmp/work-shared/<span style="color:#7030a0"><b>${MC}</b></span>/</code> | |
− | + | </dd> | |
− | + | <dd><code>$ rm -rf ~/code/linux-imx</code> | |
− | + | </dd> | |
− | + | <dd><code>$ cp -a ./kernel-source ~/code/linux-imx</code><br /> | |
− | + | </dd> | |
− | + | <dd><code>$ popd</code> | |
− | + | </dd></dl></dd></dl><dl><dd>Configure linux kernel | |
− | + | <dl><dd><code>$ cd ~/code/linux-imx</code> | |
− | + | </dd> | |
− | + | <dd><code>$ make distclean</code> | |
− | + | </dd> | |
− | + | <dd><code>$ make imx_v7_adv_defconfig</code> | |
− | + | </dd> | |
− | + | <dd><code>$ make menuconfig PKG_CONFIG_SYSROOT_DIR= PKG_CONFIG_PATH=</code> | |
− | + | </dd></dl></dd></dl><dl><dd>Start building linux kernel | |
− | + | <dl><dd><code>$ make -j4 zImage LOADADDR=0x10008000 LDFLAGS=</code> | |
− | + | </dd></dl></dd></dl><dl><dd>The kernel image file, zImage, is located in the directory "./arch/arm/boot/". | |
− | + | </dd></dl><dl><dd>Start building kernel modules | |
− | + | <dl><dd><code>$ make -j4 modules LDFLAGS=</code> | |
− | + | </dd></dl></dd></dl><dl><dd>Copy all modules to a temporary rootfs directory, "~/temp/rootfs" | |
− | Please refer to | + | <dl><dd><code>$ make modules_install INSTALL_MOD_PATH=~/temp/rootfs</code> |
+ | </dd></dl></dd></dl><dl><dd>Start building device tree blob | ||
+ | <dl><dd><code>$ make -j4 <span style="color:#7030a0"><b>${IMX6PROC}</b></span>-<span style="color:#7030a0"><b>${BOARD}</b></span>-<span style="color:#7030a0"><b>${BOARD_REV}</b></span>.dtb</code> | ||
+ | </dd></dl></dd></dl><dl><dd>The device tree blob, <span style="color:#7030a0"><b>${IMX6PROC}</b></span>-<span style="color:#7030a0"><b>${BOARD}</b></span>-<span style="color:#7030a0"><b>${BOARD_REV}</b></span>.dtb, is located in the directory "./arch/arm/boot/dts/". | ||
+ | </dd></dl><h3> <span style="color:#0070c0;">To update kernel/modules/dtb to target device</span> </h3> | ||
+ | <dl><dd>Copy zImage & <span style="color:#7030a0;"><b>${IMX6PROC}</b></span>-<span style="color:#7030a0;"><b>${BOARD}</b></span>-<span style="color:#7030a0;"><b>${BOARD_REV}</b></span>.dtb to the 1<sup>st</sup> partition of SD card | ||
+ | </dd> | ||
+ | <dd>Copy modues to the 2<sup>nd</sup> partition of SD card. | ||
+ | </dd> | ||
+ | <dd>Make sure all new linux kernel, device tree and kernel modules work well, then copy all of them to the on-board flash | ||
+ | </dd></dl><h1> System Recovery </h1> | ||
+ | <p>Please refer to <a href="#Creating_boot-up_on-board_flash_from_prebuilt_image">Creating boot-up on-board flash from prebuilt image</a> / <a href="#Creating_boot-up_on-board_flash_from_built_sdcard_image">sdcard image</a> to create a boot-up SD card and transfer whole system to on-board flash. | ||
+ | </p> |
Revision as of 02:42, 18 March 2022
Contents
- 1 Getting Started
- 2 Customization
- 3 System Recovery
Getting Started
Prerequisites
All operations in this guide are based on Ubuntu 12.04 LTS 64bit only.
First please install Ubuntu 12.04 LTS 64bit* with minimum 2GB memory.
* ubuntu-12.04.1-desktop-amd64.iso
To install required packages
Please login and perform the following commands:
$ sudo apt-get install ssh $ sudo apt-get install ia32-libs libx11-dev:i386 libreadline6-dev:i386 \ libgl1-mesa-glx:i386 zlib1g-dev:i386 uuid-dev:i386 liblzo2-dev:i386 \ libncurses5-dev:i386 $ sudo apt-get install \ bison build-essential ccache dpkg flex gcc g++ gettext intltool \ libarchive-zip-perl libfreetype6-dev libdbus-glib-1-dev liborbit2-dev \ libxml2-dev libx11-dev libgtk2.0-dev liblzo2-2 libtool m4 \ patch rpm tcl uboot-mkimage uuid zlib1g zlib1g-dev \ git gnupg flex bison gperf build-essential zip \ curl libc6-dev libncurses5-dev x11proto-core-dev libx11-dev:i386 \ libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib \ mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 \ gcc-4.6 g++-4.6 cpp-4.6 gcc-4.6-multilib uuid-dev liblzo2-dev \ uboot-mkimage libarchive-zip-perl \ wget git-core unzip texinfo gawk diffstat build-essential chrpath \ sed cvs subversion coreutils texi2html \ docbook-utils python-pysqlite2 help2man make gcc g++ \ desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev mercurial \ autoconf automake groff curl lzop asciidoc xterm $ sudo apt-get install libncurses5-dev:i386 liblzo2-dev:i386 uuid-dev:i386 $ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so $ tar zcvf ~/usr_lib_i386-linux-gnu_for_Building_Android_KK.tar.gz \ /usr/lib/i386-linux-gnu/{libuuid.a,libuuid.so,liblzo2.so,liblzo2.a} $ sudo apt-get install uuid-dev liblzo2-dev $ sudo tar zxvf ~/usr_lib_i386-linux-gnu_for_Building_Android_KK.tar.gz -C /
To install JDK
Please download "jdk-6u45-linux-x64.bin" manually from <a href="http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR" alt="http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR" title="http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR">Oracle Official Website</a>
And put it to directory ~/FILES/ and perform the following commands:
$ cd /usr/lib $ sudo ~/FILES/jdk-6u45-linux-x64.bin $ sudo mkdir jvm $ cd jvm $ sudo mv ../jdk1.6.0_45 . $ cd jdk1.6.0_45/ $ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/jre/bin/java 2 $ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 2 $ sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_45/bin/jar 2 $ sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk1.6.0_45/bin/javap 2 $ sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_45/bin/javadoc 2 $ sudo update-alternatives --config javap $ sudo update-alternatives --config javadoc $ sudo update-alternatives --config java $ sudo update-alternatives --config javac $ sudo update-alternatives --config jar $ cd ~/ $ sudo sh -c "echo "JAVA_HOME=/usr/lib/jvm/jdk1.6.0_45" >> /etc/environment"
If you have some troubles on setting up build environment, we recommend that you use Docker, and it is more safely & quickly. Please refer to <a href="IoTGateway%2FDocker">Docker</a>
Conventions
${PREBUILT_IMAGE} : compressed prebuilt image (*.img.gz)
${BSP_TARBALL} : BSP tarball (*.tgz)
${BSP_HOME} : home directory of the BSP
${BDIR} : build directory (e.g. build_x11)
${MX6PROC} : i.MX6 Processor
- mx6q for iMX6 Quad Core / Dual Core
- mx6dl for iMX6 Dual Lite / Solo
${IMX6PROC} : i.MX6 Processor
- imx6q / imx6dl
${BOARD} : available target boards list below
- rom5420 / ubc220 / rom7421/ rom3420 / rom7420 / rsb4410 / rsb4411 / rsb6410 / ubcds31 / wise3310
${BOARD_REV} : board revision
- a1 / a2 / b1
${MC} : machine code combined with ${IMX6PROC}${BOARD}${BOARD_REV}
- for example,
- imx6dlrom5420b1 for ROM-5420-Solo B1
- imx6dlubc220a1 for UBC-220-Dual-Light A1
- imx6qprom7421a1 for ROM-7421-Dual/Quad-Plus A1
- imx6qrom3420a1 for ROM-3420-Dual/Quad A1
- imx6qrom5420a1 for ROM-5420-Dual/Quad A1
- imx6qrom5420b1 for ROM-5420-Dual/Quad B1
- imx6qrom7420a1 for ROM-7420-Dual/Quad A1
- imx6qrsb4410a2 for RSB-4410-Dual A2
- imx6qrsb4410a1 for RSB-4410-Dual A1
- imx6qrsb4411a1 for RSB-4411-Dual/Quad A1
- imx6qrsb6410a1 for RSB-6410-Dual A1
- imx6qubcds31a1 for UBC-DS31-Dual A1
- imx6qwise3310a1 for WISE-3310-Dual A1
${MEM_SIZE} : memory size
- 1G / 2G / 512M
${SD_DEVICE} : device name of SD card in Ubuntu (e.g. /dev/sdf)
${SDCARD_IMAGE} : sdcard image built by bitbake (*.sdcard)
${UBOOT} :u-boot version(e.g. 2015.04)
${KERNEL} : linux kernel version(e.g. 3.14.52)
${TOOLCHAIN} : toolchain installed directory(e.g. /opt/fsl-imx-x11/3.14.52-1.1.0)
debug console / serial console
- serial terminal program (e.g. minicom, putty, teraterm ...) that serial port is configured to 115200 8N1
terminal console
- terminal program (e.g. gnome-terminal, xfce4-terminal ...)
Introducing BSP
- The BSP is based on Yocto Project with Freescale enhanced features for i.MX6, plus specific target board features from Advantech Inc..
Naming Rule
- The tarball/prebuilt image name is consist of the model name followed by "LB" or "LI" plus version number and released date.
- For example, 4410A1LBV6000_2016-03-07.tgz which "4410A1" stands for RSB-4410 A1, "LB" is acronym of Linux BSP, "V6000" stands for Version 6.000
.
- For example, 4410A1LIV6000_DualQuad_2016-03-07.img.gz which "LI" is acronym for prebuilt Linux Image, DualQuad means this image is fit for Dual Core/Quad Core.
BSP tarball
- Unpack BSP tarball to home directory by performing the following command:
$ tar xvf ${BSP_TARBALL} -C ~/
Prebuilt image
- Perform the following command to build one boot-up SD card
$ gunzip -c ${PREBUILT_IMAGE} | dd of=${SD_DEVICE} bs=1M
Build Instructions
To create one new build environment
- Perform the following commands in terminal console
$ cd ${BSP_HOME}
$ MACHINE=${MC} source fsl-setup-release.sh -b ${BDIR} -e x11
- You need to read and accept the EULA.
- <img src="/wiki/images/1/1d/Accept_EULA.png" _fck_mw_filename="Accept EULA.png" _fck_mw_origimgwidth="444" _fck_mw_origimgheight="29" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" />
To continue an exist build environment
- Perform the following commands in terminal console
$ cd ${BSP_HOME}
$ source setup-environment ${BDIR}
To build sdcard image
- To create/continue a build environment
- Perform the following command in terminal console
$ bitbake fsl-image-qt5
- The file, fsl-image-qt5-${MC}.sdcard, will be located in directory, ./tmp/deploy/images/${MC}, while building process finished successfully.
To build toolchain installer
- To create/continue a build environment
- Perform the following command in terminal console
$ bitbake meta-toolchain-qt5
- The below installer will be located in the directory "./tmp/deploy/sdk".
- fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-${KERNEL}-1.1.0.sh
- fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-${KERNEL}-1.1.0.sh
To build u-boot
- To create/continue a build environment
- Perform the following command in terminal console
$ bitbake u-boot-imx
- The two files, u-boot_crc.bin & u-boot_crc.bin.crc, will be located in directory, ./tmp/deploy/images/${MC}.
To build linux kernel
- To create/continue a build environment
- Perform the following command in terminal console
- to do menuconfig
<syntaxhighlight lang="bash"> $ bitbake linux-imx -c menuconfig </syntaxhighlight>
- * If you operate on docker images, please install tmux application before running this command.
$ sudo apt-get install tmux
- * If you operate on docker images, please install tmux application before running this command.
- to do build
<syntaxhighlight lang="bash"> $ bitbake linux-imx -c compile -f $ bitbake linux-imx -c compile_kernelmodules -f $ bitbake linux-imx -c deploy </syntaxhighlight>
- The two files, zImage & zImage-${IMX6PROC}-${BOARD}-${BOARD_REV}.dtb, will be located in directory, ./tmp/deploy/images/${MC}.
Creating boot-up on-board flash from prebuilt image
To create one boot-up SD card
- Perform the following command in terminal console
$ gunzip -c ${PREBUILT_IMAGE | dd of=${SD_DEVICE} bs=1M
$ sync
To transfer whole system to on-board flash
- Boot up from SD card
- Perform the following commands in debug console
# cd /mk_inand
# ./mksd-linux.sh /dev/mmcblk0
- press y followed by Enter, if following message shows up:
- <img src="/wiki/images/a/a7/All_data_will_be_destroyed.png" _fck_mw_filename="All data will be destroyed.png" _fck_mw_origimgwidth="640" _fck_mw_origimgheight="31" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" />
- While "[Done]" shows up means the transferring is finished.
Creating boot-up on-board flash from built sdcard image
To create one boot-up SD card
- Perform the following commands in terminal console
$ pushd ${BSP_HOME}/${BDIR}/tmp/deploy/images/${MC}
$ dd if=${SDCARD_IMAGE} of=${SD_DEVICE} bs=1M
$ sync
$ popd
To transfer whole system to on-board flash
- Boot up from SD card
- Insert USB stick that contains ${SDCARD_IMAGE}, USB stick will be auto mounted to /run/media/sda1.
- Perform the following commands in debug console
# umount /dev/mmcblk0p?
# cd /run/media/sda1
# dd if=${SDCARD_IMAGE} of=/dev/mmcblk0 bs=4M conv=fsync
# P2START=$(fdisk -lu | grep mmcblk0p2 | awk '{print $2}')
# echo -e "d\n2\nn\np\n2\n${P2START}\n\nw\n" | fdisk -u /dev/mmcblk0
# umount /dev/mmcblk0p2
# e2fsck -f -y /dev/mmcblk0p2
# resize2fs /dev/mmcblk0p2
# poweroff
Customization
Package addition
To add tcf-agent & openssh-sftp-server
- Navigate to the directory where fsl-image-adv.inc located
$ cd ${BSP_HOME}/sources/meta-advantech/recipes-fsl/images
- Add following line to fsl-image-adv.inc
IMAGE_INSTALL += " tcf-agent openssh-sftp-server "
- <a href="IoTGateway%2FBSP%2FLinux%2FiMX6%2FYocto%20LBV5%20User%20Guide%23To%20continue%20an%20exist%20build%20environment">Continue an exist build environment</a> and <a href="IoTGateway%2FBSP%2FLinux%2FiMX6%2FYocto%20LBV5%20User%20Guide%23To%20build%20sdcard%20image">build sdcard image</a>
To add chromium browser
- Navigate to the directory where local.conf located
$ cd ${BSP_HOME}/${BDIR}/conf
- Add following two lines to local.conf
CORE_IMAGE_EXTRA_INSTALL += "chromium"
LICENSE_FLAGS_WHITELIST="commercial"
- <a href="#To_continue_an_exist_build_environment">Continue an exist build environment</a> and <a href="#To_build_sdcard_image">build sdcard image</a>
Setting up SDK
- Please follow the section,<a href="IoTGateway%2FBSP%2FLinux%2FiMX6%2FYocto%20LBV5%20User%20Guide%23To%20build%20toolchain%20installer">To build toolchain installer</a>, to build one toolchain installer
- Perform the following command in terminal console
$ cd ${BSP_HOME}/${BDIR}/tmp/deploy/sdk
$ sudo ./fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-${KERNEL}-1.1.0.sh
- Enter new installed directory or just press
Enter
to use default directory. - While
Proceed[y/n]?
shows up, please enter the correct one. - Waiting for the SDK installed (while the following messages show up completely)
- <img src="/wiki/images/1/17/Setting_up_sdk_3.png" _fck_mw_filename="Setting up sdk 3.png" _fck_mw_origimgwidth="572" _fck_mw_origimgheight="65" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" />
Setting up cross compiling environment
- SDK has been set up (ref. <a href="#Setting_up_SDK">Setting up SDK</a>)
- Perform the following command in terminal console
$ source ${TOOLCHAIN}/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
Building & updating u-boot manually
To build u-boot
- The cross compiling environment has been set up. (ref. <a href="#Setting_up_cross_compiling_environment">Setting up cross compiling environment</a>)
- Make one copy from Yocto working directory
$ mkdir -p ~/code
$ pushd ${BSP_HOME}/${BDIR}/tmp/work/${MC}-poky-linux-gnueabi/
$ rm -rf ~/code/u-boot-imx
$ cp -a ./u-boot-imx/${UBOOT}-r0/git ~/code/u-boot-imx
$ popd
- Configure u-boot
$ cd ~/code/u-boot-imx
$ make distclean
$ make ${MX6PROC}${BOARD}${BOARD_REV}_${MEM_SIZE}_config
- Start building u-boot
$ make -j4 LDFLAGS=
- The two files, u-boot_crc.bin & u-boot_crc.bin.crc, are located in directory "~/code/u-boot-imx".
To update u-boot to target device
- Perform the following command to transfer to exist boot-up SD card
$ dd if=u-boot_crc.bin.crc of=${SD_DEVICE} bs=512 seek=2 conv=fsync
$ dd if=u-boot_crc.bin of=${SD_DEVICE} bs=512 seek=3 conv=fsync
- Make sure new u-boot does work then perform the following commands to transfer to on-board flash
# dd if=u-boot_crc.bin.crc of=/dev/mmcblk0 bs=512 seek=2 conv=fsync
# dd if=u-boot_crc.bin of=/dev/mmcblk0 bs=512 seek=3 conv=fsync
Building & updating kernel/modules/dtb manually
To build kernel/modules/dtb
- The cross compiling environment has been set up. (ref. <a href="#Setting_up_cross_compiling_environment">Setting up cross compiling environment</a>)
- Make one copy from Yocto working directory
$ mkdir -p ~/code
$ pushd ${BSP_HOME}/${BDIR}/tmp/work-shared/${MC}/
$ rm -rf ~/code/linux-imx
$ cp -a ./kernel-source ~/code/linux-imx
$ popd
- Configure linux kernel
$ cd ~/code/linux-imx
$ make distclean
$ make imx_v7_adv_defconfig
$ make menuconfig PKG_CONFIG_SYSROOT_DIR= PKG_CONFIG_PATH=
- Start building linux kernel
$ make -j4 zImage LOADADDR=0x10008000 LDFLAGS=
- The kernel image file, zImage, is located in the directory "./arch/arm/boot/".
- Start building kernel modules
$ make -j4 modules LDFLAGS=
- Copy all modules to a temporary rootfs directory, "~/temp/rootfs"
$ make modules_install INSTALL_MOD_PATH=~/temp/rootfs
- Start building device tree blob
$ make -j4 ${IMX6PROC}-${BOARD}-${BOARD_REV}.dtb
- The device tree blob, ${IMX6PROC}-${BOARD}-${BOARD_REV}.dtb, is located in the directory "./arch/arm/boot/dts/".
To update kernel/modules/dtb to target device
- Copy zImage & ${IMX6PROC}-${BOARD}-${BOARD_REV}.dtb to the 1st partition of SD card
- Copy modues to the 2nd partition of SD card.
- Make sure all new linux kernel, device tree and kernel modules work well, then copy all of them to the on-board flash
System Recovery
Please refer to <a href="#Creating_boot-up_on-board_flash_from_prebuilt_image">Creating boot-up on-board flash from prebuilt image</a> / <a href="#Creating_boot-up_on-board_flash_from_built_sdcard_image">sdcard image</a> to create a boot-up SD card and transfer whole system to on-board flash.