Difference between revisions of "IoTGateway/BSP/Linux/iMX6/FAQ"

From ESS-WIKI
Jump to: navigation, search
(Boot Logo)
 
(39 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:Frequently Asked Questions for i.MX6 Linux}}
+
{{DISPLAYTITLE:Frequently Asked Questions for i.MX6 Linux}} <!--
 
{| align="right"
 
{| align="right"
  | __TOC__
+
  | <span class="fck_mw_magic" _fck_mw_customtag="true" _fck_mw_tagname="TOC" _fck_mw_tagtype="c">_</span>
 
  |}
 
  |}
<!--
 
 
-->
 
-->
  
==Compiling==
+
== Compiling ==
===U-boot===
+
 
 +
=== U-boot ===
 +
 
 
Please refer to the following sections for details
 
Please refer to the following sections for details
  
* Getting Started / Build Instructions / To build u-boot <sub>([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV3_User_Guide#To_build_u-boot|LBV3]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#To_build_u-boot| LBV5]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV6_User_Guide#To_build_u-boot|LBV6]])</sub>
+
*Getting Started / Build Instructions / To build u-boot <sub>([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV3_User_Guide#To_build_u-boot|LBV3]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#To_build_u-boot|LBV5]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV6_User_Guide#To_build_u-boot|LBV6]])</sub>
 +
 
 +
*Customization / Building & updating u-boot manually <sub>([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV3_User_Guide#To_build_u-boot_2|LBV3]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#To_build_u-boot_2|LBV5]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV6_User_Guide#To_build_u-boot_2|LBV6]])</sub>
  
* Customization / Building & updating u-boot manually <sub>([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV3_User_Guide#To_build_u-boot_2|LBV3]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#To_build_u-boot_2|LBV5]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV6_User_Guide#To_build_u-boot_2|LBV6]])</sub>
+
=== Kernel ===
  
===Kernel===
 
 
Please refer to the following sections for details
 
Please refer to the following sections for details
  
* Getting Started / Build Instructions / To build linux kernel <sub>([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV3_User_Guide#To_build_linux_kernel|LBV3]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#To_build_linux_kernel| LBV5]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV6_User_Guide#To_build_linux_kernel|LBV6]])</sub>
+
*Getting Started / Build Instructions / To build linux kernel <sub>([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV3_User_Guide#To_build_linux_kernel|LBV3]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#To_build_linux_kernel|LBV5]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV6_User_Guide#To_build_linux_kernel|LBV6]])</sub>
* Customization / Building & updating kernel/modules/dtb manually <sub>([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV3_User_Guide#To_build_kernel.2Fmodules.2Fdtb|LBV3]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#To_build_kernel.2Fmodules.2Fdtb|LBV5]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV6_User_Guide#To_build_kernel.2Fmodules.2Fdtb|LBV6]])</sub>
+
*Customization / Building & updating kernel/modules/dtb manually <sub>([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV3_User_Guide#To_build_kernel.2Fmodules.2Fdtb|LBV3]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#To_build_kernel.2Fmodules.2Fdtb|LBV5]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV6_User_Guide#To_build_kernel.2Fmodules.2Fdtb|LBV6]])</sub>
 +
 
 +
== Boot Logo ==
 +
 
 +
=== U-boot ===
  
==Application==
+
=== Kernel ===
  
==Boot Logo==
 
===U-boot===
 
===Kernel===
 
 
In Yocto Project, it is called "boot splashscreen", please refer to the each BSP's corresponding official Yocto website (list as below) for details
 
In Yocto Project, it is called "boot splashscreen", please refer to the each BSP's corresponding official Yocto website (list as below) for details
* Yocto Project Reference Manual / Other Tips. <sub>([https://www.yoctoproject.org/docs/1.5.1/ref-manual/ref-manual.html#usingpoky-debugging-others LBV3]) ([https://www.yoctoproject.org/docs/1.7/ref-manual/ref-manual.html#usingpoky-debugging-others LBV5]) ([https://www.yoctoproject.org/docs/1.8.1/ref-manual/ref-manual.html#usingpoky-debugging-others LBV6])</sub>
 
  
==SDcard image==
+
*Yocto Project Reference Manual / Other Tips. <sub>([https://www.yoctoproject.org/docs/1.5.1/ref-manual/ref-manual.html#usingpoky-debugging-others LBV3]) ([https://www.yoctoproject.org/docs/1.7/ref-manual/ref-manual.html#usingpoky-debugging-others LBV5]) ([https://www.yoctoproject.org/docs/1.8.1/ref-manual/ref-manual.html#usingpoky-debugging-others LBV6])</sub>
 +
 
 +
== SDcard image ==
 +
 
 
To build from prebuilt image, please refer to the following sections for details.
 
To build from prebuilt image, please refer to the following sections for details.
* Getting Started / Introducing BSP / Prebuilt image <sub>([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV3_User_Guide#Prebuilt_image|LBV3]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#Prebuilt_image|LBV5]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV6_User_Guide#Prebuilt_image|LBV6]])</sub>
+
 
 +
*Getting Started / Introducing BSP / Prebuilt image <sub>([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV3_User_Guide#Prebuilt_image|LBV3]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#Prebuilt_image|LBV5]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV6_User_Guide#Prebuilt_image|LBV6]])</sub>
 +
 
 
To build from BSP, please refer to the following sections for details.
 
To build from BSP, please refer to the following sections for details.
* Getting Started / Build Instructions / To build sdcard image <sub>([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV3_User_Guide#To_build_sdcard_image|LBV3]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#To_build_sdcard_image|LBV5]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV6_User_Guide#To_build_sdcard_image|LBV6]])</sub>
 
  
==Mini-PCIe==
+
*Getting Started / Build Instructions / To build sdcard image <sub>([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV3_User_Guide#To_build_sdcard_image|LBV3]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#To_build_sdcard_image|LBV5]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV6_User_Guide#To_build_sdcard_image|LBV6]])</sub>
 +
 
 +
== How To Stress Test On a Linux ==
 +
 
 +
Perform the command as below:
 +
 
 +
stress -c 4 -i 4  -d 1 --hdd-bytes 512
 +
 
 +
== How to fix sata can't be detected issue ==
 +
 
 +
find ahci_imx.c in kernel source code
 +
 
 +
drivers/ata/ahci_imx.c
 +
 
 +
Mark modification as below:
 +
 
 +
      // else if(IS_RSB_4411)
 +
      // {
 +
      //        sata_gen_phy_reg[0] = 0x059194f6;
 +
      //        sata_gen_phy_reg[1] = 0x059194f6;
 +
      //        sata_gen_phy_reg[2] = 0x059194f6;
 +
      //}
 +
       
 +
 
 +
This modification are sata si test value, but it may result in some sata disk can't be detected
 +
 
 +
== How To Create One LIV Disk Image of SD Card ==
 +
 
 +
The LIV disk image of SD card is used to boot target device up and to install the entire system to on-baord eMMC.
 +
 
 +
*Prerequisites
 +
*#one free loop device
 +
*#prewritten script, mksd-linux.sh (extracted from [[Media:mksd-linux.sh.gz|mksd-linux.sh.gz]])
 +
*#the built sdcard image <sub>([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV3_User_Guide#To_build_sdcard_image|LBV3]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#To_build_sdcard_image|LBV5]]) ([[IoTGateway/BSP/Linux/iMX6/Yocto_LBV6_User_Guide#To_build_sdcard_image|LBV6]])</sub> (e.g. fsl-image-qt5-imx6qrsb4410a1.sdcard)
 +
*#5GB more available disk space for LIV disk image (e.g. 4410A1LIV6000.img & 4410A1LIV6000.img.gz)
 +
*Commands
 +
<div style="margin-left: 3em"><syntaxhighlight lang="bash">
 +
$ LODEV=$(sudo losetup -f)
 +
$ MKSD=mksd-linux.sh
 +
$ gunzip -c mksd-linux.sh.gz > ${MKSD}
 +
$ SDCARD=fsl-image-qt5-imx6qrsb4410a1.sdcard
 +
$ LIV=4410A1LIV6000.img
 +
$ cp ${SDCARD} ${LIV}
 +
$ dd if=/dev/zero of=${LIV} bs=1M seek=3700 count=0
 +
$ echo -e "d\n2\nn\np\n2\n24576\n\nw" | sudo fdisk -u ${LIV}
 +
$ sudo losetup -o $((24576*512)) ${LODEV} ${LIV}
 +
$ sudo e2fsck ${LODEV}
 +
$ sudo resize2fs ${LODEV}
 +
$ mkdir -p ~/mnt
 +
$ sudo mount ${LODEV} ~/mnt
 +
$ sudo mkdir ~/mnt/{mk_inand,image}
 +
$ sudo cp ${MKSD} ~/mnt/mk_inand/
 +
$ sudo chmod +x ~/mnt/mk_inand/${MKSD}
 +
$ sudo cp ${SDCARD} ~/mnt/image/
 +
$ sudo umount ~/mnt
 +
$ sudo losetup -d ${LODEV}
 +
$ gzip -c9 ${LIV} > ${LIV}.gz
 +
</syntaxhighlight></div>
 +
== How To fix "SF: Unsupported DataFlash ID 40" issue ==
 +
 
 +
Because we will change new spi flash on new version of the hardware, if you still use the old version u-boot, it can't be recognized.
 +
 
 +
We remove the compare spi flash id mechanism in the spi flash driver.
 +
 
 +
So we can use the patch file as belowand recompile it ,then replace the u-boot binary file in our image.
 +
 
 +
[[:File:0001-Remove-compare-spi-flash-id-mechanism.patch]]
 +
 
 +
== How To modify u-boot env in rootfs ==
 +
 
 +
'''Just support for Winbond spi flash(JEDEC ID: 0xef:0x40:0x16)'''
 +
 
 +
*Download [[:File:imx6_fw_env.zip]] ,then run setup_env.sh
 +
*Print env
 +
 
 +
./fw_printenv                    //print all env
 +
./fw_printenv [env_name]        //print specific env
 +
 
 +
*Set env
 +
 
 +
./fw_setenv [env_name] [value]  //set new env
 +
 
 +
*Delete env
 +
 
 +
./fw_setenv [env_name]
 +
 
 +
 
 +
 
 +
== How To Get unique ID for iMX SOC ==
 +
 
 +
*iMX6
 +
 
 +
OTP Bank0 Word1 - containsthe first word of the UID.
 +
 
 +
OTP Bank0 Word2 - contains the second word of the UID.
 +
 
 +
We can refer to iMX6 DRM Chap46.5.10
 +
 
 +
root@imx6dlebcrs03a1:~# cat /sys/fsl_otp/HW_OCOTP_CFG0
 +
0xea9b8ea3
 +
root@imx6dlebcrs03a1:~# cat /sys/fsl_otp/HW_OCOTP_CFG1
 +
0x200e11d4
 +
 
 +
 
 +
 
 +
*iMX7
 +
 
 +
cat /sys/fsl_otp/HW_OCOTP_TESTER0
 +
0xac98b953
 +
cat /sys/fsl_otp/HW_OCOTP_TESTER1
 +
0x67
 +
 
 +
 
 +
 
 +
*iMX8M
 +
 
 +
root@imx8mqevk:/# cat /sys/bus/soc/devices/soc0/soc_uid
 +
180959D6F060954C
 +
 
 +
== How To Rotate Screen for iMX6 (Yocto) ==
 +
 
 +
root@imx6dlrsb4411a1:~# export DISPLAY=:0
 +
// rotate to the left
 +
root@imx6dlrsb4411a1:~# xrandr -o left
 +
// rotate to the right
 +
root@imx6dlrsb4411a1:~# xrandr -o right
 +
// flip
 +
root@imx6dlrsb4411a1:~# xrandr -o inverted
 +
// back to a normal
 +
root@imx6dlrsb4411a1:~# xrandr -o normal
 +
 
 +
== How To Support UIO-4036 board for iMX6 (Yocto 2.1) ==
 +
 
 +
1. Add usb ethernet driver about SMSC75XX
 +
 
 +
[https://github.com/ADVANTECH-Corp/linux-imx6/commit/e3e871914c858d8d838115d3b73ec5823f56baa6 https://github.com/ADVANTECH-Corp/linux-imx6/commit/e3e871914c858d8d838115d3b73ec5823f56baa6]
 +
 
 +
2. Add the rtl8368MBI lan switch driver:
 +
 
 +
[https://github.com/ADVANTECH-Corp/linux-imx6/commit/2dc4a32514ad402e521d8fdb5a79fac94376c95a https://github.com/ADVANTECH-Corp/linux-imx6/commit/2dc4a32514ad402e521d8fdb5a79fac94376c95a]
 +
 
 +
3. Add the device tree setting:
 +
 
 +
[https://github.com/ADVANTECH-Corp/linux-imx6/commit/16695ab8a8cb5137b14185d225e76cbdd072831b https://github.com/ADVANTECH-Corp/linux-imx6/commit/16695ab8a8cb5137b14185d225e76cbdd072831b]
 +
 
 +
[https://github.com/ADVANTECH-Corp/linux-imx6/commit/15de59dc0ffb0d035630b644ba3ed887bbb938c9 https://github.com/ADVANTECH-Corp/linux-imx6/commit/15de59dc0ffb0d035630b644ba3ed887bbb938c9]
 +
 
 +
== Other Features ==
  
==UART==
+
*see [[IoTGateway/Features/Linux|Linux Features]]

Latest revision as of 02:53, 13 July 2020


Compiling

U-boot

Please refer to the following sections for details

  • Getting Started / Build Instructions / To build u-boot (LBV3) (LBV5) (LBV6)
  • Customization / Building & updating u-boot manually (LBV3) (LBV5) (LBV6)

Kernel

Please refer to the following sections for details

  • Getting Started / Build Instructions / To build linux kernel (LBV3) (LBV5) (LBV6)
  • Customization / Building & updating kernel/modules/dtb manually (LBV3) (LBV5) (LBV6)

U-boot

Kernel

In Yocto Project, it is called "boot splashscreen", please refer to the each BSP's corresponding official Yocto website (list as below) for details

  • Yocto Project Reference Manual / Other Tips. (LBV3) (LBV5) (LBV6)

SDcard image

To build from prebuilt image, please refer to the following sections for details.

  • Getting Started / Introducing BSP / Prebuilt image (LBV3) (LBV5) (LBV6)

To build from BSP, please refer to the following sections for details.

  • Getting Started / Build Instructions / To build sdcard image (LBV3) (LBV5) (LBV6)

How To Stress Test On a Linux

Perform the command as below:

stress -c 4 -i 4  -d 1 --hdd-bytes 512

How to fix sata can't be detected issue

find ahci_imx.c in kernel source code

drivers/ata/ahci_imx.c

Mark modification as below:

      // else if(IS_RSB_4411)
      // {
      //         sata_gen_phy_reg[0] = 0x059194f6;
      //         sata_gen_phy_reg[1] = 0x059194f6;
      //         sata_gen_phy_reg[2] = 0x059194f6;
      //}
       

This modification are sata si test value, but it may result in some sata disk can't be detected

How To Create One LIV Disk Image of SD Card

The LIV disk image of SD card is used to boot target device up and to install the entire system to on-baord eMMC.

  • Prerequisites
    1. one free loop device
    2. prewritten script, mksd-linux.sh (extracted from mksd-linux.sh.gz)
    3. the built sdcard image (LBV3) (LBV5) (LBV6) (e.g. fsl-image-qt5-imx6qrsb4410a1.sdcard)
    4. 5GB more available disk space for LIV disk image (e.g. 4410A1LIV6000.img & 4410A1LIV6000.img.gz)
  • Commands
$ LODEV=$(sudo losetup -f)
$ MKSD=mksd-linux.sh
$ gunzip -c mksd-linux.sh.gz > ${MKSD}
$ SDCARD=fsl-image-qt5-imx6qrsb4410a1.sdcard
$ LIV=4410A1LIV6000.img
$ cp ${SDCARD} ${LIV}
$ dd if=/dev/zero of=${LIV} bs=1M seek=3700 count=0
$ echo -e "d\n2\nn\np\n2\n24576\n\nw" | sudo fdisk -u ${LIV}
$ sudo losetup -o $((24576*512)) ${LODEV} ${LIV}
$ sudo e2fsck ${LODEV}
$ sudo resize2fs ${LODEV}
$ mkdir -p ~/mnt
$ sudo mount ${LODEV} ~/mnt
$ sudo mkdir ~/mnt/{mk_inand,image}
$ sudo cp ${MKSD} ~/mnt/mk_inand/
$ sudo chmod +x ~/mnt/mk_inand/${MKSD}
$ sudo cp ${SDCARD} ~/mnt/image/
$ sudo umount ~/mnt
$ sudo losetup -d ${LODEV}
$ gzip -c9 ${LIV} > ${LIV}.gz

How To fix "SF: Unsupported DataFlash ID 40" issue

Because we will change new spi flash on new version of the hardware, if you still use the old version u-boot, it can't be recognized.

We remove the compare spi flash id mechanism in the spi flash driver.

So we can use the patch file as belowand recompile it ,then replace the u-boot binary file in our image.

File:0001-Remove-compare-spi-flash-id-mechanism.patch

How To modify u-boot env in rootfs

Just support for Winbond spi flash(JEDEC ID: 0xef:0x40:0x16)

./fw_printenv                    //print all env 
./fw_printenv [env_name]         //print specific env
  • Set env
./fw_setenv [env_name] [value]   //set new env
  • Delete env
./fw_setenv [env_name]


How To Get unique ID for iMX SOC

  • iMX6

OTP Bank0 Word1 - containsthe first word of the UID.

OTP Bank0 Word2 - contains the second word of the UID.

We can refer to iMX6 DRM Chap46.5.10

root@imx6dlebcrs03a1:~# cat /sys/fsl_otp/HW_OCOTP_CFG0
0xea9b8ea3
root@imx6dlebcrs03a1:~# cat /sys/fsl_otp/HW_OCOTP_CFG1
0x200e11d4


  • iMX7
cat /sys/fsl_otp/HW_OCOTP_TESTER0
0xac98b953
cat /sys/fsl_otp/HW_OCOTP_TESTER1
0x67


  • iMX8M
root@imx8mqevk:/# cat /sys/bus/soc/devices/soc0/soc_uid
180959D6F060954C

How To Rotate Screen for iMX6 (Yocto)

root@imx6dlrsb4411a1:~# export DISPLAY=:0
// rotate to the left
root@imx6dlrsb4411a1:~# xrandr -o left
// rotate to the right
root@imx6dlrsb4411a1:~# xrandr -o right
// flip
root@imx6dlrsb4411a1:~# xrandr -o inverted
// back to a normal
root@imx6dlrsb4411a1:~# xrandr -o normal

How To Support UIO-4036 board for iMX6 (Yocto 2.1)

1. Add usb ethernet driver about SMSC75XX

https://github.com/ADVANTECH-Corp/linux-imx6/commit/e3e871914c858d8d838115d3b73ec5823f56baa6

2. Add the rtl8368MBI lan switch driver:

https://github.com/ADVANTECH-Corp/linux-imx6/commit/2dc4a32514ad402e521d8fdb5a79fac94376c95a

3. Add the device tree setting:

https://github.com/ADVANTECH-Corp/linux-imx6/commit/16695ab8a8cb5137b14185d225e76cbdd072831b

https://github.com/ADVANTECH-Corp/linux-imx6/commit/15de59dc0ffb0d035630b644ba3ed887bbb938c9

Other Features