Difference between revisions of "IoTGateway/Features/Linux/Software"
(→boot up to Linux) |
|||
(90 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:Linux Software Features}} | {{DISPLAYTITLE:Linux Software Features}} | ||
− | ==Console== | + | |
− | ===How to enable framebuffer console=== | + | == Console == |
+ | |||
+ | === How to enable framebuffer console === | ||
+ | |||
The following operations are performed with RSB-4410(4410LBV2080) | The following operations are performed with RSB-4410(4410LBV2080) | ||
− | * linux kernel config | + | |
− | <tt> | + | *linux kernel config |
− | + | ||
− | :::Graphics support ---> | + | |
− | ::::<<span style="color:red">*</span>> Framebuffer Console support | + | |
− | </tt> | + | ::<tt>Device Drivers ---> </tt> |
− | * u-boot | + | :::<tt>Graphics support ---> </tt> |
− | <div style="margin-left: 2em | + | ::::<tt><<span style="color:red">*</span>> Framebuffer Console support</tt> |
+ | |||
+ | |||
+ | |||
+ | *u-boot | ||
+ | <div style="margin-left: 2em"> | ||
setenv bootargs_base 'setenv bootargs console=ttymxc0,115200 <span style="color:red">console=tty0</span> enable_wait_mode=off video_mode=extension | setenv bootargs_base 'setenv bootargs console=ttymxc0,115200 <span style="color:red">console=tty0</span> enable_wait_mode=off video_mode=extension | ||
</div> | </div> | ||
− | * files need to be updated | + | *files need to be updated |
+ | |||
:<tt>/etc/inittab</tt> | :<tt>/etc/inittab</tt> | ||
− | <div style="margin-left: 2em | + | <div style="margin-left: 2em"> |
tty0::respawn:-/bin/bash | tty0::respawn:-/bin/bash | ||
</div> | </div> | ||
Notice: | Notice: | ||
+ | |||
:If the kernel config is set to "<tt><<span style="color:red">M</span>> Framebuffer Console support</tt>", console will show up after module ,<tt>fbcon</tt>, is loaded. | :If the kernel config is set to "<tt><<span style="color:red">M</span>> Framebuffer Console support</tt>", console will show up after module ,<tt>fbcon</tt>, is loaded. | ||
− | ===How to change debug console port=== | + | === How to change debug console port === |
+ | |||
+ | ==== Ltib ==== | ||
+ | |||
The following operations demonstrate how to change UBC-DS31's(based on DS31LBV1150) debug console from UART1(ttymxc0) to UART2(ttymxc1). | The following operations demonstrate how to change UBC-DS31's(based on DS31LBV1150) debug console from UART1(ttymxc0) to UART2(ttymxc1). | ||
*u-boot | *u-boot | ||
+ | |||
:<tt>include/configs/mx6q_ubc-d31_recovery.h</tt> | :<tt>include/configs/mx6q_ubc-d31_recovery.h</tt> | ||
− | <div style="margin-left: 3em | + | <div style="margin-left: 3em"><syntaxhighlight lang="C"> |
#define CONFIG_UART_BASE_ADDR UART2_BASE_ADDR | #define CONFIG_UART_BASE_ADDR UART2_BASE_ADDR | ||
− | </ | + | </syntaxhighlight></div> |
:<tt>include/configs/mx6q_ubc-d31_1G_recovery.h</tt> | :<tt>include/configs/mx6q_ubc-d31_1G_recovery.h</tt> | ||
::modify the settings of <code>bootargs_base</code> contained in the pre-defined macro <code>#define CONFIG_EXTRA_ENV_SETTINGS</code> | ::modify the settings of <code>bootargs_base</code> contained in the pre-defined macro <code>#define CONFIG_EXTRA_ENV_SETTINGS</code> | ||
− | <div style="margin-left: 3em | + | <div style="margin-left: 3em"><syntaxhighlight lang="C"> |
console=ttymxc1,115200 | console=ttymxc1,115200 | ||
− | </ | + | </syntaxhighlight></div> |
− | |||
:<tt>board/freescale/mx6q_ubc-d31/mx6q_ubc-d31.c</tt> | :<tt>board/freescale/mx6q_ubc-d31/mx6q_ubc-d31.c</tt> | ||
::insert the following two lines into <code>static void setup_uart(void)</code> | ::insert the following two lines into <code>static void setup_uart(void)</code> | ||
− | <div style="margin-left: 3em | + | <div style="margin-left: 3em"><syntaxhighlight lang="C"> |
mxc_iomux_v3_setup_pad(MX6Q_PAD_EIM_D27__UART2_TXD); | mxc_iomux_v3_setup_pad(MX6Q_PAD_EIM_D27__UART2_TXD); | ||
mxc_iomux_v3_setup_pad(MX6Q_PAD_EIM_D27__UART2_RXD); | mxc_iomux_v3_setup_pad(MX6Q_PAD_EIM_D27__UART2_RXD); | ||
− | </ | + | </syntaxhighlight></div> |
+ | *linux kernel | ||
− | |||
:<tt>arch/arm/mach-mx6/board-mx6q_advantech.c</tt> | :<tt>arch/arm/mach-mx6/board-mx6q_advantech.c</tt> | ||
::modify the following two lines in <code>static void __init mx6_sabresd_timer_init(void)</code> | ::modify the following two lines in <code>static void __init mx6_sabresd_timer_init(void)</code> | ||
− | <div style="margin-left: 3em | + | <div style="margin-left: 3em"><syntaxhighlight lang="C"> |
uart_clk = clk_get_sys("imx-uart.1", NULL); | uart_clk = clk_get_sys("imx-uart.1", NULL); | ||
early_console_setup(UART2_BASE_ADDR, uart_clk); | early_console_setup(UART2_BASE_ADDR, uart_clk); | ||
− | </ | + | </syntaxhighlight> |
+ | |||
+ | |||
+ | ==== Ltib ==== | ||
+ | |||
+ | The following operations demonstrate how to change ROM-3420 's(based on imx6LBV2310_2014-04-30) debug console from UART1(ttymxc0) to UART2(ttymxc1)「Hardward Pin Define '''MX6Q_PAD_SD3_DAT5__UART2 _TXD & MX6Q_PAD_SD3_DAT4__UART2_RXD''' 」 | ||
+ | <br/><syntaxhighlight lang="C">U-boot modified port: | ||
+ | |||
+ | Path : ROM-3420\imx6LBV2310_2014-04-30\source\u-boot-2009.08\board\freescale\mx6q_rom-3420\mx6q_rom-3420.c | ||
+ | static void setup_uart(void) | ||
+ | |||
+ | { | ||
+ | |||
+ | #if defined CONFIG_MX6Q | ||
+ | |||
+ | /* UART1 TXD */ | ||
+ | |||
+ | //mxc_iomux_v3_setup_pad(MX6Q_PAD_CSI0_DAT10__UART1_TXD); | ||
+ | |||
+ | |||
+ | |||
+ | /* UART1 RXD */ | ||
+ | |||
+ | //mxc_iomux_v3_setup_pad(MX6Q_PAD_CSI0_DAT11__UART1_RXD); | ||
+ | |||
+ | |||
− | <!-- | + | /* UART2 TXD */ |
+ | |||
+ | mxc_iomux_v3_setup_pad(MX6Q_PAD_SD3_DAT5__UART2_TXD); | ||
+ | |||
+ | |||
+ | |||
+ | /* UART2 RXD */ | ||
+ | |||
+ | mxc_iomux_v3_setup_pad(MX6Q_PAD_SD3_DAT4__UART2_RXD); | ||
+ | |||
+ | |||
+ | |||
+ | #elif defined CONFIG_MX6DL | ||
+ | |||
+ | /* UART1 TXD */ | ||
+ | |||
+ | mxc_iomux_v3_setup_pad(MX6DL_PAD_CSI0_DAT10__UART1_TXD); | ||
+ | |||
+ | |||
+ | |||
+ | /* UART1 RXD */ | ||
+ | |||
+ | mxc_iomux_v3_setup_pad(MX6DL_PAD_CSI0_DAT11__UART1_RXD); | ||
+ | |||
+ | #endif | ||
+ | |||
+ | }</syntaxhighlight>.<syntaxhighlight lang="C">Path: \ROM-3420\imx6LBV2310_2014-04-30\source\u-boot-2009.08\include\configs\mx6q_rom-3420_1G.h | ||
+ | |||
+ | |||
+ | |||
+ | /* | ||
+ | |||
+ | * Hardware drivers | ||
+ | |||
+ | */ | ||
+ | |||
+ | #define CONFIG_MXC_UART | ||
+ | |||
+ | //#define CONFIG_UART_BASE_ADDR UART1_BASE_ADDR | ||
+ | |||
+ | #define CONFIG_UART_BASE_ADDR UART2_BASE_ADDR</syntaxhighlight><br/><syntaxhighlight lang="C">Kernel modified port : | ||
+ | |||
+ | |||
+ | |||
+ | Path: ROM-3420\imx6LBV2310_2014-04-30\source\linux-3.0.35\arch\arm\mach-mx6\board-mx6q_advantech.c | ||
+ | |||
+ | |||
+ | |||
+ | static void __init mx6_sabresd_timer_init(void) | ||
+ | |||
+ | { | ||
+ | |||
+ | struct clk *uart_clk; | ||
+ | |||
+ | #ifdef CONFIG_LOCAL_TIMERS | ||
+ | |||
+ | twd_base = ioremap(LOCAL_TWD_ADDR, SZ_256); | ||
+ | |||
+ | BUG_ON(!twd_base); | ||
+ | |||
+ | #endif | ||
+ | |||
+ | mx6_clocks_init(32768, 24000000, 0, 0); | ||
+ | |||
+ | |||
+ | |||
+ | //uart_clk = clk_get_sys("imx-uart.0", NULL); | ||
+ | |||
+ | //early_console_setup(UART1_BASE_ADDR, uart_clk); | ||
+ | |||
+ | uart_clk = clk_get_sys("imx-uart.1", NULL); | ||
+ | |||
+ | early_console_setup(UART2_BASE_ADDR, uart_clk); | ||
+ | |||
+ | }</syntaxhighlight><syntaxhighlight lang="C">Rebuild BSP | ||
+ | U-boot Rebuild: | ||
+ | |||
+ | ~/ROM-3420/imx6LBV2310_2014-04-30/scripts$ . setenv.sh | ||
+ | |||
+ | (To configure the development environment automatically) | ||
+ | |||
+ | ~/ROM-3420/imx6LBV2310_2014-04-30/scripts$ ./cfg_uboot.sh mx6q_rom-3420_1G_config | ||
+ | |||
+ | (To set the u-boot configuration automatically) | ||
+ | |||
+ | ~/ROM-3420/imx6LBV2310_2014-04-30/scripts$ ./mk_uboot.sh | ||
+ | |||
+ | (Start to build the u-boot) | ||
+ | |||
+ | |||
+ | |||
+ | Then you can see u-boot_crc.bin and u-boot_crc.bin.crc are being built and | ||
+ | |||
+ | located in ../image. | ||
+ | |||
+ | =================================================================================== | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | Kernel Rebuild: | ||
+ | |||
+ | ~/ROM-3420/imx6LBV2310_2014-04-30/scripts$ . setenv.sh | ||
+ | |||
+ | (To configure the development environment automatically) | ||
+ | |||
+ | ~/ROM-3420/imx6LBV2310_2014-04-30/scripts$./cfg_kernel.sh imx6_rom3420_defconfig | ||
+ | |||
+ | (To set the uImage configuration automatically) | ||
+ | |||
+ | ~/ROM-3420/imx6LBV2310_2014-04-30/scripts$ ./mk_kernel.sh | ||
+ | |||
+ | (Start to build the uImage) | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | Then you can see uImage is being built and located in ../image. | ||
+ | |||
+ | =================================================================================== | ||
+ | |||
+ | </syntaxhighlight><syntaxhighlight lang="C">U-boot parameter modified port when you turn on the device . | ||
+ | Command: | ||
+ | |||
+ | setenv bootargs_base setenv bootargs console=ttymxc1,115200 enable_wait_mode=off video_mode=extension pcie_testmode=off</syntaxhighlight></div><!-- | ||
:<tt></tt> | :<tt></tt> | ||
− | <div style="margin-left: 2em;"><source lang="C"> | + | <div style="margin-left: 2em;"><span _fck_mw_customtag="true" _fck_mw_tagname="source" _fck_mw_tagtype="t" lang="C" _fck_mw_tagattributes="lang" class="fck_mw_special">fckLR</span></div> |
− | </ | ||
--> | --> | ||
+ | ==== Yocto ==== | ||
+ | |||
+ | *Modify u-boot | ||
+ | |||
+ | Here we take ROM-5420 as an example | ||
+ | |||
+ | We want to change debug port from UART1 to UART2 | ||
+ | |||
+ | include/configs/mx6rom5420.h | ||
+ | |||
+ | -#define CONFIG_MXC_UART_BASE UART1_BASE | ||
+ | -#define CONFIG_CONSOLE_DEV "ttymxc0" | ||
+ | +#define CONFIG_MXC_UART_BASE UART2_BASE | ||
+ | +#define CONFIG_CONSOLE_DEV "ttymxc1" | ||
+ | |||
+ | board/freescale/mx6advantech/mx6advantech.c | ||
+ | |||
+ | static iomux_v3_cfg_t const uart1_pads[] = { | ||
+ | MX6_PAD_CSI0_DAT10__UART1_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL), | ||
+ | MX6_PAD_CSI0_DAT11__UART1_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL), | ||
+ | }; | ||
+ | |||
+ | +static iomux_v3_cfg_t const uart2_pads[] = { | ||
+ | + MX6_PAD_EIM_D26__UART2_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL), | ||
+ | + MX6_PAD_EIM_D27__UART2_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL), | ||
+ | +}; | ||
+ | + | ||
+ | |||
+ | static void setup_iomux_uart(void) | ||
+ | { | ||
+ | imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads)); | ||
+ | + imx_iomux_v3_setup_multiple_pads(uart2_pads, ARRAY_SIZE(uart2_pads)); | ||
+ | } | ||
+ | |||
+ | After re-compile u-boot and replace , you may be need to clear u-boot env to make kernel debug message output from uart2 | ||
+ | |||
+ | env default -a | ||
+ | env save | ||
+ | reset | ||
+ | |||
+ | |||
+ | |||
+ | *Note(in rootfs) | ||
+ | |||
+ | Due to /etc/init.d/rc_mxc.S only get ttymxc0~ttymxc3 from u-boot parameter If you want to change to ttymxc4 and so on, you need to modify this file first /etc/init.d/rc_mxc.S | ||
+ | |||
+ | if grep -sq ttymxc0 /proc/cmdline; then | ||
+ | /sbin/getty -L ttymxc0 115200 vt100 | ||
+ | elif grep -sq ttymxc1 /proc/cmdline; then | ||
+ | /sbin/getty -L ttymxc1 115200 vt100 | ||
+ | elif grep -sq ttymxc2 /proc/cmdline; then | ||
+ | /sbin/getty -L ttymxc2 115200 vt100 | ||
+ | elif grep -sq ttymxc3 /proc/cmdline; then | ||
+ | /sbin/getty -L ttymxc3 115200 vt100 | ||
+ | '''elif grep -sq ttymxc4 /proc/cmdline; then''' | ||
+ | '''/sbin/getty -L ttymxc4 115200 vt100''' | ||
+ | else | ||
+ | sleep 100000 | ||
+ | fi | ||
+ | |||
+ | === How to disable debug console === | ||
+ | |||
+ | ==== Ltib ==== | ||
− | |||
The following operations demonstrate how to disable UBC-DS31's(based on DS31LBV1150) debug console. | The following operations demonstrate how to disable UBC-DS31's(based on DS31LBV1150) debug console. | ||
*u-boot | *u-boot | ||
+ | |||
:<tt>board/freescale/mx6q_ubc-d31/mx6q_ubc-d31.c</tt> | :<tt>board/freescale/mx6q_ubc-d31/mx6q_ubc-d31.c</tt> | ||
::comment out all the code within <code>static void setup_uart(void)</code> | ::comment out all the code within <code>static void setup_uart(void)</code> | ||
Line 65: | Line 291: | ||
:<tt>common/console.c</tt> | :<tt>common/console.c</tt> | ||
::modify the following line in <code>int console_init_f(void)</code> | ::modify the following line in <code>int console_init_f(void)</code> | ||
− | <div style="margin-left: 3em | + | <div style="margin-left: 3em"><syntaxhighlight lang="C"> |
gd->have_console = 0; | gd->have_console = 0; | ||
− | </ | + | </syntaxhighlight></div> |
− | + | *u-boot environment variable | |
− | * u-boot environment variable | + | <div style="margin-left: 3em"><syntaxhighlight lang="C"> |
− | <div style="margin-left: 3em | ||
setenv silent=y | setenv silent=y | ||
− | </ | + | </syntaxhighlight></div> |
: | : | ||
− | <div style="margin-left: 3em | + | <div style="margin-left: 3em"> |
change console setting, <code>console=none</code>, within <tt>bootargs_base</tt> | change console setting, <code>console=none</code>, within <tt>bootargs_base</tt> | ||
</div> | </div> | ||
+ | *linux kernel config | ||
+ | |||
+ | |||
+ | |||
+ | ::<tt>Device Drivers ---> Character devices ---> Serial drivers ---> </tt> | ||
+ | :::<tt><span style="color:red">'''[*]'''</span> IMX serial port support</tt> | ||
+ | :::<tt>[ ] Support 4 IMX serial ports</tt> | ||
+ | :::<tt><span style="color:red">'''[ ]'''</span> Console on IMX serial port</tt> | ||
+ | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
*linux kernel (recommended) | *linux kernel (recommended) | ||
+ | |||
:<tt>arch/arm/boot/compressed/misc.c</tt> | :<tt>arch/arm/boot/compressed/misc.c</tt> | ||
::comment out the following lines in <code>void decompress_kernel (...</code> | ::comment out the following lines in <code>void decompress_kernel (...</code> | ||
− | <div style="margin-left: 3em | + | <div style="margin-left: 3em"><syntaxhighlight lang="C"> |
//putstr("Uncompressing Linux..."); | //putstr("Uncompressing Linux..."); | ||
− | </ | + | </syntaxhighlight></div> |
: | : | ||
− | <div style="margin-left: 3em | + | <div style="margin-left: 3em"><syntaxhighlight lang="C"> |
/* | /* | ||
if (ret) | if (ret) | ||
Line 100: | Line 328: | ||
putstr(" done, booting the kernel.\n"); | putstr(" done, booting the kernel.\n"); | ||
*/ | */ | ||
− | </ | + | </syntaxhighlight></div> |
+ | *target root file system | ||
− | |||
::comment out the following line in <code>/etc/inittab</code> | ::comment out the following line in <code>/etc/inittab</code> | ||
− | <div style="margin-left: 3em | + | <div style="margin-left: 3em"><syntaxhighlight lang="bash"> |
#::respawn:/etc/rc.d/rc_mxc.S | #::respawn:/etc/rc.d/rc_mxc.S | ||
− | </source></div> | + | </syntaxhighlight></div><!-- |
+ | :<tt></tt> | ||
+ | <div style="margin-left: 2em;"><span _fck_mw_customtag="true" _fck_mw_tagname="source" _fck_mw_tagtype="t" lang="C" _fck_mw_tagattributes="lang" class="fck_mw_special">fckLR</span></div> | ||
+ | --> | ||
− | + | == Device Tree == | |
− | |||
− | |||
− | |||
− | |||
− | |||
Customize device tree | Customize device tree | ||
− | ==GStreamer== | + | == File System == |
− | ===Play Video=== | + | |
− | ====Audio Information==== | + | === NTFS === |
+ | |||
+ | The following operations demonstrate how to add NTFS support for Yocto Linux (ROM-5420 with imx6LBV6120_2016-06-14). | ||
+ | |||
+ | *linux kernel config (please refer to [[IoTGateway/BSP/Linux/iMX6/Yocto_LBV6_User_Guide#To_build_linux_kernel|'''this''']] for details) | ||
+ | |||
+ | |||
+ | |||
+ | ::<tt>File systems ---> </tt> | ||
+ | :::<tt>DOS/FAT/NT Filesystems ---> </tt> | ||
+ | ::::<tt>'''<<span style="color:red">*</span>>''' NTFS file system support</tt> | ||
+ | |||
+ | |||
+ | |||
+ | *BSP | ||
+ | |||
+ | :add one line to <tt>meta-advantech/recipes-fsl/images/fsl-image-adv.inc</tt> | ||
+ | <div style="margin-left: 2em"><syntaxhighlight lang="bash"> | ||
+ | IMAGE_INSTALL += " fuse ntfs-3g ntfs-3g-ntfsprogs " | ||
+ | </syntaxhighlight></div> | ||
+ | *rebuild the sdcard image (please refer to [[IoTGateway/BSP/Linux/iMX6/Yocto_LBV6_User_Guide#To_build_sdcard_image|'''this''']] for details) | ||
+ | <div style="margin-left: 2em"><syntaxhighlight lang="bash"> | ||
+ | $ bitbake fsl-image-qt5 | ||
+ | </syntaxhighlight></div> | ||
+ | == Fonts == | ||
+ | |||
+ | === Chinese Font === | ||
+ | |||
+ | The following operations demonstrate how to install Chinese font on Yocto Linux (RSB-4410 with 4410A1LIV6000). | ||
+ | |||
+ | *get the free Chinese font "WenQuanYi Micro Hei" from [[https://sourceforge.net/projects/wqy/files/wqy-microhei/ SourceForge]] and extract the tarball | ||
+ | *put the <tt>'''wqy-microhei.ttc'''</tt> to <tt><span style="color:red">'''/usr/share/fonts/ttf'''</span></tt>, then execute the following commands | ||
+ | <div style="margin-left: 2em"><syntaxhighlight lang="bash"> | ||
+ | $ ln -s /usr/share/fonts/ttf/wqy-microhei.ttc /usr/lib/fonts/ | ||
+ | $ fc-cache -fv | ||
+ | </syntaxhighlight></div> | ||
+ | *use the the following command to check if the font is recognized. | ||
+ | <div style="margin-left: 2em"><syntaxhighlight lang="bash"> | ||
+ | $ fc-list | ||
+ | </syntaxhighlight>[[File:Fc-list.png|RTENOTITLE]]</div> | ||
+ | *set the Chinese locale | ||
+ | |||
+ | :install the suitable locale if needed | ||
+ | <div style="margin-left: 3em"><syntaxhighlight lang="bash"> | ||
+ | $ rpm -ivh locale-base-zh-tw-2.21-r0.cortexa9hf_vfp_neon.rpm glibc-binary-localedata-zh-tw-2.21-r0.cortexa9hf_vfp_neon.rpm | ||
+ | $ rpm -ivh locale-base-zh-cn-2.21-r0.cortexa9hf_vfp_neon.rpm glibc-binary-localedata-zh-cn-2.21-r0.cortexa9hf_vfp_neon.rpm | ||
+ | </syntaxhighlight></div> | ||
+ | :put the suitable LC_ALL setting to the /etc/profile | ||
+ | <div style="margin-left: 3em"><syntaxhighlight lang="bash"> export LC_ALL=zh_TW.UTF-8 </syntaxhighlight>or<syntaxhighlight lang="bash"> export LC_ALL=zh_CN.UTF-8 </syntaxhighlight></div> | ||
+ | :reboot the target device | ||
+ | |||
+ | *verification | ||
+ | |||
+ | :plug in the USB stick that the following directories and files already existed | ||
+ | <div style="margin-left: 3em"> | ||
+ | chinese_test/ | ||
+ | 繁體目錄/ | ||
+ | 繁體檔案 | ||
+ | chinese_test/ | ||
+ | 简体目录/ | ||
+ | 简体档案 | ||
+ | </div> | ||
+ | :check if the keyword "utf8" is existed | ||
+ | <div style="margin-left: 3em"> | ||
+ | $ mount | ||
+ | |||
+ | [[File:Chinese test check utf8.png|RTENOTITLE]] | ||
+ | </div> | ||
+ | :if not, execute the following command then check again | ||
+ | <div style="margin-left: 3em"><syntaxhighlight lang="bash"> | ||
+ | $ umount /dev/sda1 | ||
+ | $ mount -o iocharset=utf8 /dev/sda1 /run/media/sda1 | ||
+ | ## NOTICE: the following format also works | ||
+ | ## mount -o utf8 /dev/sda1 /run/media/sda1 | ||
+ | $ mount | ||
+ | </syntaxhighlight>[[File:Chinese test utf8.png|RTENOTITLE]] or [[File:Chinese test utf8 2.png|RTENOTITLE]]</div> | ||
+ | :if it is, execute the following command to list the directories and files | ||
+ | <div style="margin-left: 3em"> | ||
+ | $ ls -al /run/media/sda1/chinese_test/* | ||
+ | |||
+ | [[File:Chinese test list.png|RTENOTITLE]] | ||
+ | </div> | ||
+ | == GStreamer == | ||
+ | |||
+ | === Play Video === | ||
+ | |||
+ | ==== Audio Information ==== | ||
+ | |||
*When the system is turned on, you can see the following audio information: | *When the system is turned on, you can see the following audio information: | ||
+ | |||
... | ... | ||
ALSA device list: | ALSA device list: | ||
Line 128: | Line 442: | ||
... | ... | ||
− | ====Frame Buffer Information==== | + | ==== Frame Buffer Information ==== |
+ | |||
*After the system is turned on, you can type command to see frame buffer information. For example: | *After the system is turned on, you can type command to see frame buffer information. For example: | ||
+ | |||
1. Type command "ls /dev/video", you will see all frame buffer devices ID: | 1. Type command "ls /dev/video", you will see all frame buffer devices ID: | ||
+ | |||
$ video16 video17 video18 video19 video20 | $ video16 video17 video18 video19 video20 | ||
− | 2. Type command "cat /sys/class/graphics/fb0/fsl_disp_dev_property", you will see frame buffer name: | + | |
+ | 2. Type command "cat /sys/class/graphics/fb0/fsl_disp_dev_property", you will see frame buffer name: | ||
+ | |||
$ hdmi | $ hdmi | ||
Line 138: | Line 457: | ||
4. Type command "cat /sys/class/graphics/fb1/fsl_disp_dev_property", you will see frame buffer name: | 4. Type command "cat /sys/class/graphics/fb1/fsl_disp_dev_property", you will see frame buffer name: | ||
+ | |||
$ overlay | $ overlay | ||
Line 143: | Line 463: | ||
6. Type command "cat /sys/class/graphics/fb2/fsl_disp_dev_property", you will see frame buffer name: | 6. Type command "cat /sys/class/graphics/fb2/fsl_disp_dev_property", you will see frame buffer name: | ||
+ | |||
$ lcd | $ lcd | ||
Line 148: | Line 469: | ||
8. Type command "cat /sys/class/graphics/fb3/fsl_disp_dev_property", you will see frame buffer name: | 8. Type command "cat /sys/class/graphics/fb3/fsl_disp_dev_property", you will see frame buffer name: | ||
+ | |||
$ overlay | $ overlay | ||
Line 153: | Line 475: | ||
10. Type command "cat /sys/class/graphics/fb4/fsl_disp_dev_property", you will see frame buffer name: | 10. Type command "cat /sys/class/graphics/fb4/fsl_disp_dev_property", you will see frame buffer name: | ||
+ | |||
$ ldb | $ ldb | ||
11. The device ID of "ldb" frame buffer layer is "video20". | 11. The device ID of "ldb" frame buffer layer is "video20". | ||
− | ====Play Video Command==== | + | ==== Play Video Command ==== |
− | * The format of display video command: | + | |
+ | *The format of display video command: | ||
+ | |||
$ GST_COMMAND uri=file://VIDEO_PATH video-sink="VIDEO_COMMAND device=DISPLAY_ID" audio-sink="alsasink device=plughw:AUDIO_ID" | $ GST_COMMAND uri=file://VIDEO_PATH video-sink="VIDEO_COMMAND device=DISPLAY_ID" audio-sink="alsasink device=plughw:AUDIO_ID" | ||
− | ====Play Video Command On Yocto 1.5==== | + | ==== Play Video Command On Yocto 1.5 ==== |
+ | |||
1. For example: | 1. For example: | ||
+ | |||
GST_COMMAND = "gst-launch playbin2" | GST_COMMAND = "gst-launch playbin2" | ||
VIDEO_PATH = "/tools/Advantech.avi" | VIDEO_PATH = "/tools/Advantech.avi" | ||
Line 169: | Line 496: | ||
AUDIO_ID = "0"(audio-sgtl5000) or "1"(audio-hdmi) | AUDIO_ID = "0"(audio-sgtl5000) or "1"(audio-hdmi) | ||
AUDIO = ""(Audio) or "volume=0"(No audio) | AUDIO = ""(Audio) or "volume=0"(No audio) | ||
+ | |||
2. Play video with audio from sgtl5000 audio command: | 2. Play video with audio from sgtl5000 audio command: | ||
+ | |||
$ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="mfw_v4lsink device=/dev/video17" audio-sink="alsasink device=plughw:0" | $ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="mfw_v4lsink device=/dev/video17" audio-sink="alsasink device=plughw:0" | ||
+ | |||
3. Play video with audio from HDMI audio command: | 3. Play video with audio from HDMI audio command: | ||
+ | |||
$ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="mfw_v4lsink device=/dev/video17" audio-sink="alsasink device=plughw:1" | $ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="mfw_v4lsink device=/dev/video17" audio-sink="alsasink device=plughw:1" | ||
+ | |||
4. Play video with no audio command: | 4. Play video with no audio command: | ||
+ | |||
$ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="mfw_v4lsink device=/dev/video17" \ | $ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="mfw_v4lsink device=/dev/video17" \ | ||
audio-sink="alsasink device=plughw:0" volume=0 | audio-sink="alsasink device=plughw:0" volume=0 | ||
Line 180: | Line 513: | ||
audio-sink="alsasink device=plughw:1" volume=0 | audio-sink="alsasink device=plughw:1" volume=0 | ||
− | ====Play Video Command On Yocto 1.7==== | + | ==== Play Video Command On Yocto 1.7 ==== |
+ | |||
1. For example: | 1. For example: | ||
+ | |||
GST_COMMAND = "gst-launch playbin2" or "gst-launch-0.10 playbin2" or "gst-launch-1.0 playbin" | GST_COMMAND = "gst-launch playbin2" or "gst-launch-0.10 playbin2" or "gst-launch-1.0 playbin" | ||
VIDEO_PATH = "/tools/Advantech.avi" | VIDEO_PATH = "/tools/Advantech.avi" | ||
Line 188: | Line 523: | ||
AUDIO_ID = "0"(audio-sgtl5000) or "1"(audio-hdmi) | AUDIO_ID = "0"(audio-sgtl5000) or "1"(audio-hdmi) | ||
AUDIO = ""(Audio) or "volume=0"(No audio) | AUDIO = ""(Audio) or "volume=0"(No audio) | ||
+ | |||
2. Play video with audio from SGTL5000 audio command: | 2. Play video with audio from SGTL5000 audio command: | ||
+ | |||
$ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:0" | $ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:0" | ||
or | or | ||
Line 194: | Line 531: | ||
or | or | ||
$ gst-launch-1.0 playbin uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:0" | $ gst-launch-1.0 playbin uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:0" | ||
+ | |||
3. Play video with audio from HDMI audio command: | 3. Play video with audio from HDMI audio command: | ||
+ | |||
$ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:1" | $ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:1" | ||
or | or | ||
Line 200: | Line 539: | ||
or | or | ||
$ gst-launch-1.0 playbin uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:1" | $ gst-launch-1.0 playbin uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:1" | ||
+ | |||
4. Play video with no audio command: | 4. Play video with no audio command: | ||
+ | |||
$ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" \ | $ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" \ | ||
audio-sink="alsasink device=plughw:0" volume=0 | audio-sink="alsasink device=plughw:0" volume=0 | ||
Line 207: | Line 548: | ||
audio-sink="alsasink device=plughw:0" volume=0 | audio-sink="alsasink device=plughw:0" volume=0 | ||
− | ====Play Video Command On Yocto 1.8==== | + | ==== Play Video Command On Yocto 1.8 ==== |
+ | |||
1. For example: | 1. For example: | ||
+ | |||
GST_COMMAND = "gst-launch-1.0 playbin" | GST_COMMAND = "gst-launch-1.0 playbin" | ||
VIDEO_PATH = "/tools/Advantech.avi" | VIDEO_PATH = "/tools/Advantech.avi" | ||
Line 215: | Line 558: | ||
AUDIO_ID = "0"(audio-sgtl5000) or "1"(audio-hdmi) | AUDIO_ID = "0"(audio-sgtl5000) or "1"(audio-hdmi) | ||
AUDIO = ""(Audio) or "volume=0"(No audio) | AUDIO = ""(Audio) or "volume=0"(No audio) | ||
+ | |||
2. Play video with audio from SGTL5000 audio command: | 2. Play video with audio from SGTL5000 audio command: | ||
+ | |||
$ gst-launch-1.0 playbin uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:0" | $ gst-launch-1.0 playbin uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:0" | ||
+ | |||
3. Play video with audio from HDMI audio command: | 3. Play video with audio from HDMI audio command: | ||
+ | |||
$ gst-launch-1.0 playbin uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:1" | $ gst-launch-1.0 playbin uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:1" | ||
+ | |||
4. Play video with no audio command: | 4. Play video with no audio command: | ||
+ | |||
$ gst-launch-1.0 playbin uri=file://tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" \ | $ gst-launch-1.0 playbin uri=file://tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" \ | ||
audio-sink="alsasink device=plughw:0" volume=0 | audio-sink="alsasink device=plughw:0" volume=0 | ||
Line 226: | Line 575: | ||
audio-sink="alsasink device=plughw:1" volume=0 | audio-sink="alsasink device=plughw:1" volume=0 | ||
− | ===SMPTE color bar=== | + | === SMPTE color bar === |
− | gst-launch videotestsrc ! autovideosink | + | |
+ | gst-launch videotestsrc ! autovideosink | ||
+ | |||
+ | === video rotation === | ||
+ | |||
+ | gst-launch filesrc location=/tools/Advantech.avi typefind=true ! aiurdemux name=demux demux. ! \ | ||
+ | queue max-size-buffers=0 max-size-time=0 ! vpudec ! mfw_v4lsink <span style="color:red">rotate=180</span> demux. ! \ | ||
+ | queue max-size-buffers=0 max-size-time=0 ! beepdec ! autoaudiosink | ||
− | |||
− | |||
− | |||
− | |||
:(valid rotate value: 0, 90, 180 or 270) | :(valid rotate value: 0, 90, 180 or 270) | ||
− | :(While the angle of rotation is | + | :(While the angle of rotation is 90° or 270°, the maximum video resolution can not be larget than 1024*1024.) |
+ | |||
+ | or | ||
− | |||
gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="mfw_isink <span style="color:red">rotation=0</span>" | gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="mfw_isink <span style="color:red">rotation=0</span>" | ||
+ | |||
:(valid rotation value: 0~7) | :(valid rotation value: 0~7) | ||
− | ===webcam=== | + | === webcam === |
− | ====realtime video==== | + | |
− | gst-launch v4l2src ! video/x-raw-yuv,width=640,height=480,framerate=20/1 ! autovideosink | + | ==== realtime video ==== |
− | ====take one snapshot==== | + | |
− | gst-launch v4l2src num-buffers=1 ! jpegenc ! filesink location=sample.jpeg | + | gst-launch v4l2src ! video/x-raw-yuv,width=640,height=480,framerate=20/1 ! autovideosink |
− | ====show one snapshot==== | + | |
− | VSALPHA=1 gst-launch filesrc location=sample.jpeg ! jpegdec ! imagefreeze ! mfw_isink | + | ==== take one snapshot ==== |
+ | |||
+ | gst-launch v4l2src num-buffers=1 ! jpegenc ! filesink location=sample.jpeg | ||
+ | |||
+ | ==== show one snapshot ==== | ||
+ | |||
+ | VSALPHA=1 gst-launch filesrc location=sample.jpeg ! jpegdec ! imagefreeze ! mfw_isink | ||
+ | |||
+ | === network streaming === | ||
+ | |||
+ | ==== RTSP(unicast) ==== | ||
− | |||
− | |||
sender (ip: 192.168.203.41) | sender (ip: 192.168.203.41) | ||
− | vlc -I rc H.264.mp4 --screen-fps=10 :screen-caching=100 --sout='#rtp{sdp=rtsp://8554/}' -vvv | + | |
+ | vlc -I rc H.264.mp4 --screen-fps=10 :screen-caching=100 --sout='#rtp{sdp=rtsp://8554/}' -vvv | ||
receiver | receiver | ||
+ | |||
gst-launch rtspsrc location=rtsp://192.168.203.41:8554 \ | gst-launch rtspsrc location=rtsp://192.168.203.41:8554 \ | ||
− | latency=200 name=r r. ! application/x-rtp,media=video ! \ | + | latency=200 name=r r. ! application/x-rtp,media=video ! \ |
− | queue max-size-buffers=0 max-size-time=0 ! rtph264depay ! \ | + | queue max-size-buffers=0 max-size-time=0 ! rtph264depay ! \ |
− | vpudec ! mfw_v4lsink sync=false async=false r. ! \ | + | vpudec ! mfw_v4lsink sync=false async=false r. ! \ |
− | 'application/x-rtp, media=(string)audio' ! queue max-size-buffers=0 max-size-time=0 ! \ | + | 'application/x-rtp, media=(string)audio' ! queue max-size-buffers=0 max-size-time=0 ! \ |
− | rtpmp4gdepay ! beepdec ! alsasink sync=false async=false -vvv | + | rtpmp4gdepay ! beepdec ! alsasink sync=false async=false -vvv |
+ | |||
+ | ==== RTP(multicast) ==== | ||
− | |||
sender | sender | ||
− | vlc -I rc H.264.mp4 --screen-fps=10 :screen-caching=100 --sout='#rtp{mux=ts,dst=239.1.1.1,port=5004}' -vvv | + | |
+ | vlc -I rc H.264.mp4 --screen-fps=10 :screen-caching=100 --sout='#rtp{mux=ts,dst=239.1.1.1,port=5004}' -vvv | ||
receiver | receiver | ||
+ | |||
route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0 | route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0 | ||
gst-launch udpsrc uri=udp://239.1.1.1:5004 \ | gst-launch udpsrc uri=udp://239.1.1.1:5004 \ | ||
caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264"\ | caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264"\ | ||
− | ! .recv_rtp_sink_0 gstrtpbin ! queue max-size-buffers=0 max-size-time=0 ! \ | + | ! .recv_rtp_sink_0 gstrtpbin ! queue max-size-buffers=0 max-size-time=0 ! \ |
− | rtpmp2tdepay ! mpegtsdemux name=tsdem tsdem. ! queue max-size-buffers=0 max-size-time=0 ! \ | + | rtpmp2tdepay ! mpegtsdemux name=tsdem tsdem. ! queue max-size-buffers=0 max-size-time=0 ! \ |
− | vpudec ! mfw_isink sync=false tsdem. tsdem. ! queue max-size-buffers=0 max-size-time=0 ! \ | + | vpudec ! mfw_isink sync=false tsdem. tsdem. ! queue max-size-buffers=0 max-size-time=0 ! \ |
− | beepdec | + | beepdec ! alsasink sync=false -vvv |
+ | |||
+ | == Java == | ||
− | |||
How to install Java | How to install Java | ||
− | ==Linux Kernel== | + | == Linux Kernel == |
− | ===Get kernel configs from running OS=== | + | |
+ | === Get kernel configs from running OS === | ||
+ | |||
You can get the .config file in running Linux OS by the following command. | You can get the .config file in running Linux OS by the following command. | ||
+ | |||
# zcat /proc/config.gz > current.config | # zcat /proc/config.gz > current.config | ||
+ | |||
Furthermore, this feature is enabled by ''CONFIG_IKCONFIG_PROC''. | Furthermore, this feature is enabled by ''CONFIG_IKCONFIG_PROC''. | ||
− | ===Debug kernel panic and oops=== | + | === Debug kernel panic and oops === |
− | To enable kernel symbols & debug information, you have to turn on these options and re-build kernel image. | + | |
− | Just remember to keep the '''vmlinux''' & '''System.map''' files for debugging. They should be located at kernel root folder. | + | To enable kernel symbols & debug information, you have to turn on these options and re-build kernel image. Just remember to keep the '''vmlinux''' & '''System.map''' files for debugging. They should be located at kernel root folder. |
+ | |||
CONFIG_DEBUG_KERNEL=y | CONFIG_DEBUG_KERNEL=y | ||
CONFIG_KALLSYMS=y | CONFIG_KALLSYMS=y | ||
Line 292: | Line 665: | ||
Here is an example of Oops case. | Here is an example of Oops case. | ||
+ | |||
Unable to handle kernel NULL pointer dereference at virtual address 00000000 | Unable to handle kernel NULL pointer dereference at virtual address 00000000 | ||
pgd = d8e3c000 | pgd = d8e3c000 | ||
Line 301: | Line 675: | ||
<span style="color:red">PC is at dac_get_volsw+0x60/0x74</span> | <span style="color:red">PC is at dac_get_volsw+0x60/0x74</span> | ||
LR is at dac_get_volsw+0x5c/0x74 | LR is at dac_get_volsw+0x5c/0x74 | ||
− | <span style="color:red">pc : [<80558e68>]</span> lr : [<80558e64>] psr: 60070013 | + | <span style="color:red">pc : [<80558e68>]</span> lr : [<80558e64>] psr: 60070013 |
− | sp : d8b6dea8 ip : 00000000 fp : d8617400 | + | sp : d8b6dea8 ip : 00000000 fp : d8617400 |
− | r10: 7ef214f8 r9 : d8b6c000 r8 : d866e280 | + | r10: 7ef214f8 r9 : d8b6c000 r8 : d866e280 |
− | r7 : d861757c r6 : d8617600 r5 : d8948800 r4 : 00000000 | + | r7 : d861757c r6 : d8617600 r5 : d8948800 r4 : 00000000 |
− | r3 : 00000000 r2 : 00000000 r1 : 00000001 r0 : 0000e564 | + | r3 : 00000000 r2 : 00000000 r1 : 00000001 r0 : 0000e564 |
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user | Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user | ||
Control: 10c53c7d Table: 68e3c04a DAC: 00000015 | Control: 10c53c7d Table: 68e3c04a DAC: 00000015 | ||
Line 329: | Line 703: | ||
1. Check the PC (Program Counter) to find out where crash occurs. | 1. Check the PC (Program Counter) to find out where crash occurs. | ||
+ | |||
PC is at dac_get_volsw+<span style="color:blue">0x60</span>/0x74 | PC is at dac_get_volsw+<span style="color:blue">0x60</span>/0x74 | ||
2. Grep dac_get_volsw() in System.map and get the symbol name address | 2. Grep dac_get_volsw() in System.map and get the symbol name address | ||
+ | |||
$ cd <kernel root folder> | $ cd <kernel root folder> | ||
$ grep dac_get_volsw System.map | $ grep dac_get_volsw System.map | ||
<span style="color:green">80558e08</span> t dac_get_volsw | <span style="color:green">80558e08</span> t dac_get_volsw | ||
− | '''Note:''' You can find the program counter is equaled to the sum of function entry address & offset. | + | '''Note:''' You can find the program counter is equaled to the sum of function entry address & offset. |
− | |||
+ | pc : [<<span style="color:red">80558e68</span>>] = <span style="color:green">80558e08</span> + <span style="color:blue">0x60</span> | ||
3. Run addr2line to read the exact line number in source code. | 3. Run addr2line to read the exact line number in source code. | ||
+ | |||
$ arm-linux-gnueabi-addr2line -f -e vmlinux <span style="color:red">80558e68</span> | $ arm-linux-gnueabi-addr2line -f -e vmlinux <span style="color:red">80558e68</span> | ||
dac_get_volsw | dac_get_volsw | ||
/home/root/Projects/Linux/fsl-yocto-3.14.52_1.1.0/linux-imx/<span style="color:purple">sound/soc/codecs/sgtl5000.c:335</span> | /home/root/Projects/Linux/fsl-yocto-3.14.52_1.1.0/linux-imx/<span style="color:purple">sound/soc/codecs/sgtl5000.c:335</span> | ||
+ | 4-1. In alternative way, you can run objdump to get the disassembly and source code mapping. | ||
− | |||
$ arm-linux-gnueabi-objdump -DS vmlinux > kernel.objdump | $ arm-linux-gnueabi-objdump -DS vmlinux > kernel.objdump | ||
'''Note:''' This step may take very long time to generate the dump file. So, maybe you can stop it, once you can find the function symbols in the file. | '''Note:''' This step may take very long time to generate the dump file. So, maybe you can stop it, once you can find the function symbols in the file. | ||
+ | 4-2. Find dac_get_volsw() in ''kernel.objdump'', and check the pc address [<<span style="color:red">80558e68</span>>]. Then, you can find the problem occurs at the same line of source code. | ||
− | |||
<span style="color:green">80558e08</span> <dac_get_volsw>: | <span style="color:green">80558e08</span> <dac_get_volsw>: | ||
* ------------------------------ | * ------------------------------ | ||
Line 367: | Line 744: | ||
80558e60: eb0501a0 bl 806994e8 <printk> | 80558e60: eb0501a0 bl 806994e8 <printk> | ||
<span style="color:purple">'''printk("%d\n", *p);'''</span> | <span style="color:purple">'''printk("%d\n", *p);'''</span> | ||
− | 80558e64: e30e0564 movw r0, #58724 | + | 80558e64: e30e0564 movw r0, #58724 ; 0xe564 |
<span style="color:red">80558e68</span>: e5941000 ldr r1, [r4] | <span style="color:red">80558e68</span>: e5941000 ldr r1, [r4] | ||
− | 80558e6c: e3480080 movt r0, #32896 | + | 80558e6c: e3480080 movt r0, #32896 ; 0x8080 |
80558e70: eb05019c bl 806994e8 <printk> | 80558e70: eb05019c bl 806994e8 <printk> | ||
− | ==NFS== | + | === Dynamic Voltage and Frequency Scaling (DVFS) === |
− | ===boot up to Linux=== | + | |
− | The following operations demonstrate how to boot-up RSB-4410(4410LBV3480/4410LBV2080) with loading | + | ==== <span style="color:#0070c0">CPUFreq & OPP</span> ==== |
− | * prerequisites for NFS server (e.g. ip: 172.22.15.145) | + | |
+ | CPUFreq is a feature in Linux kernel to allow users to change the clock speed of the CPUs. It can save battery power, because the lower the clock speed, the less power the CPU consumes. Different SoC vendors should implement their own mapping table for CPU frequency and voltage pairs. These pairs that the device will support per domain are called Operating Performance Points or OPPs. | ||
+ | |||
+ | Below are OPP tables for each platform: | ||
+ | |||
+ | '''NXP i.MX6 Quad/Dual''' | ||
+ | |||
+ | {| class="wikitable" style="text-align: center; width: 300px;" | ||
+ | |- | ||
+ | | CPU Frequency (kHz) | ||
+ | | Voltage (uV) | ||
+ | |- | ||
+ | | 1200000 (*) | ||
+ | | 1275000 | ||
+ | |- | ||
+ | | 996000 (*) | ||
+ | | 1250000 | ||
+ | |- | ||
+ | | 852000 (*) | ||
+ | | 1250000 | ||
+ | |- | ||
+ | | 792000 | ||
+ | | 1175000 | ||
+ | |- | ||
+ | | 396000 | ||
+ | | 975000 | ||
+ | |} | ||
+ | |||
+ | (*) The highest frequency depends on the CPU types (08/10/12 which means 800MHz, 1GHz, and 1.2GHz respectively). Now most our projects are 1GHz. | ||
+ | |||
+ | '''NXP i.MX6 Dual Lite/Solo''' | ||
+ | |||
+ | {| class="wikitable" style="text-align: center; width: 300px;" | ||
+ | |- | ||
+ | | CPU Frequency (kHz) | ||
+ | | Voltage (uV) | ||
+ | |- | ||
+ | | 996000 | ||
+ | | 1250000 | ||
+ | |- | ||
+ | | 792000 | ||
+ | | 1175000 | ||
+ | |- | ||
+ | | 396000 | ||
+ | | 1150000 | ||
+ | |} | ||
+ | |||
+ | '''TI AM335x''' | ||
+ | |||
+ | {| class="wikitable" style="text-align: center; width: 300px;" | ||
+ | |- | ||
+ | | CPU Frequency (kHz) | ||
+ | | Voltage (uV) | ||
+ | |- | ||
+ | | 1000000 | ||
+ | | 1325000 | ||
+ | |- | ||
+ | | 800000 | ||
+ | | 1260000 | ||
+ | |- | ||
+ | | 720000 | ||
+ | | 1200000 | ||
+ | |- | ||
+ | | 600000 | ||
+ | | 1100000 | ||
+ | |- | ||
+ | | 300000 (*) | ||
+ | | 1100000 | ||
+ | |} | ||
+ | |||
+ | (*) We disable this frequency after V1.140. | ||
+ | |||
+ | '''TI AM57xx''' | ||
+ | |||
+ | {| class="wikitable" style="text-align: center; width: 300px;" | ||
+ | |- | ||
+ | | CPU Frequency (kHz) | ||
+ | | Voltage (uV) | ||
+ | |- | ||
+ | | 1500000 | ||
+ | | 1210000 | ||
+ | |- | ||
+ | | 1176000 | ||
+ | | 1160000 | ||
+ | |- | ||
+ | | 1000000 | ||
+ | | 1060000 | ||
+ | |} | ||
+ | |||
+ | '''Qualcomm APQ8016''' | ||
+ | |||
+ | {| class="wikitable" style="text-align: center; width: 300px;" | ||
+ | |- | ||
+ | | CPU Frequency (kHz) | ||
+ | | Voltage (uV) | ||
+ | |- | ||
+ | | 1209600 | ||
+ | | 1350000 | ||
+ | |- | ||
+ | | 1152000 | ||
+ | | 1350000 | ||
+ | |- | ||
+ | | 1094400 | ||
+ | | 1350000 | ||
+ | |- | ||
+ | | 998400 | ||
+ | | 1350000 | ||
+ | |- | ||
+ | | 800000 | ||
+ | | 1150000 | ||
+ | |- | ||
+ | | 533330 | ||
+ | | 1150000 | ||
+ | |- | ||
+ | | 400000 | ||
+ | | 1050000 | ||
+ | |- | ||
+ | | 200000 | ||
+ | | 1050000 | ||
+ | |} | ||
+ | |||
+ | ==== <span style="color:#0070c0">CPU Governor</span> ==== | ||
+ | |||
+ | In order to offer dynamic frequency scaling, Linux kernel provides a feature named "cpufreq governors". There are 6 modes in recent version. | ||
+ | |||
+ | {| class="wikitable" style="text-align: left;" | ||
+ | |- | ||
+ | | '''Governor''' | ||
+ | | '''Description''' | ||
+ | |- | ||
+ | | ''performance'' | ||
+ | | Set the CPU to the <span style="color:#0000FF;">highest frequency</span> | ||
+ | |- | ||
+ | | ''powersave'' | ||
+ | | Set the CPU to the <span style="color:#0000FF;">lowest frequency</span> | ||
+ | |- | ||
+ | | ''userspace'' | ||
+ | | Allows the user to set the CPU to a <span style="color:#0000FF;">specific frequency</span> by making a sysfs file "scaling_setspeed" available in the CPU-device directory. | ||
+ | |- | ||
+ | | ''ondemand'' | ||
+ | | Sets the CPU depending on the <span style="color:#0000FF;">current usage</span>. | ||
+ | |- | ||
+ | | ''conservative'' | ||
+ | | Much like the "ondemand" governor, sets the CPU depending on the <span style="color:#0000FF;">current usage</span>. It differs in behavior in that it <u>gracefully increases and decreases</u> the CPU speed rather than jumping to max speed the moment there is any load on the CPU. | ||
+ | |- | ||
+ | | ''interactive'' | ||
+ | | Sets the CPU speed depending on <span style="color:#0000FF;">usage</span>, similar to "ondemand" and "conservative" governors, but with <u>a different set of configurable behaviors</u>. It's is designed for latency-sensitive, interactive workloads. | ||
+ | |} | ||
+ | |||
+ | For more CPU frequency settings, you can check the path below. | ||
+ | |||
+ | $ ls /sys/devices/system/cpu/cpu0/cpufreq/ | ||
+ | affected_cpus cpuinfo_transition_latency scaling_cur_freq scaling_min_freq | ||
+ | cpuinfo_cur_freq related_cpus scaling_driver scaling_setspeed | ||
+ | cpuinfo_max_freq scaling_available_frequencies scaling_governor stats | ||
+ | cpuinfo_min_freq scaling_available_governors scaling_max_freq | ||
+ | |||
+ | For example, you can list the available governor, and know current governor. | ||
+ | |||
+ | $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors | ||
+ | interactive conservative userspace powersave ondemand performance | ||
+ | |||
+ | $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor | ||
+ | ondemand | ||
+ | |||
+ | You can change to new governor. | ||
+ | |||
+ | $ echo "performance" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor | ||
+ | $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor | ||
+ | performance | ||
+ | |||
+ | In ondemand, interactive or conservative mode, you can configure further. | ||
+ | |||
+ | $ ls /sys/devices/system/cpu/cpufreq/'''ondemand''' | ||
+ | ignore_nice_load powersave_bias sampling_rate up_threshold | ||
+ | io_is_busy sampling_down_factor sampling_rate_min | ||
+ | |||
+ | $ ls /sys/devices/system/cpu/cpufreq/'''interactive''' | ||
+ | above_hispeed_delay boostpulse_duration io_is_busy timer_rate | ||
+ | boost go_hispeed_load min_sample_time timer_slack | ||
+ | boostpulse hispeed_freq target_loads | ||
+ | |||
+ | $ ls /sys/devices/system/cpu/cpufreq/'''conservative''' | ||
+ | down_threshold ignore_nice_load sampling_rate up_threshold | ||
+ | freq_step sampling_down_factor sampling_rate_min | ||
+ | |||
+ | == NFS == | ||
+ | |||
+ | === boot up to Linux === | ||
+ | |||
+ | The following operations demonstrate how to boot-up RSB-4410(4410LBV3480/4410LBV2080) with loading kernel image and mounting the root filesystem via NFS. | ||
+ | |||
+ | *prerequisites for NFS server (e.g. ip: 172.22.15.145) | ||
**NFS root | **NFS root | ||
− | *:*add the following line to <tt>/etc/exports</tt> | + | *: |
− | *::<tt><small | + | *add the following line to <tt>/etc/exports</tt> |
− | *:*execute the following command to export all directories | + | *::<pre><tt><small>/NFS *(rw,sync,wdelay,hide,nocrossmnt,insecure,no_root_squash,no_all_squash,subtree_check,secure_locks,acl,anonuid=65534,anongid=65534)</small></tt></pre> |
+ | |||
+ | *: | ||
+ | *execute the following command to export all directories | ||
*::<tt>$ sudo exportfs -a</tt> | *::<tt>$ sudo exportfs -a</tt> | ||
*:*make one copy of the individual BSP's rootfs located in the directory, <tt>/NFS</tt> | *:*make one copy of the individual BSP's rootfs located in the directory, <tt>/NFS</tt> | ||
Line 388: | Line 960: | ||
*::*copy the <tt>uImage</tt> (which <span style="color:red">CONFIG_ROOT_NFS</span> is set) to <tt>/NFS/4410lbv2</tt> | *::*copy the <tt>uImage</tt> (which <span style="color:red">CONFIG_ROOT_NFS</span> is set) to <tt>/NFS/4410lbv2</tt> | ||
*::*set the following lines to <tt>/NFS/4410lbv2/etc/rc.d/rc.conf</tt> | *::*set the following lines to <tt>/NFS/4410lbv2/etc/rc.d/rc.conf</tt> | ||
− | <div style="margin-left: 6em | + | <div style="margin-left: 6em"><syntaxhighlight lang="null"> |
export DEPLOYMENT_STYLE="NFS" | export DEPLOYMENT_STYLE="NFS" | ||
export IPADDR0="dhcp" | export IPADDR0="dhcp" | ||
− | </ | + | </syntaxhighlight></div> |
− | * u-boot | + | *u-boot |
+ | |||
:Hit any key to stop autoboot then perform the following commands: | :Hit any key to stop autoboot then perform the following commands: | ||
::<u>for 4410LBV3480</u> | ::<u>for 4410LBV3480</u> | ||
− | <div style="margin-left: 4em | + | <div style="margin-left: 4em"><syntaxhighlight lang="text"> |
> setenv serverip 172.22.15.145; setenv autoload n; dhcp | > setenv serverip 172.22.15.145; setenv autoload n; dhcp | ||
> setenv nfsroot /NFS/rsb-4410_rootfs | > setenv nfsroot /NFS/rsb-4410_rootfs | ||
Line 402: | Line 975: | ||
> nfs ${fdt_addr} ${nfsroot}/${fdt_file} | > nfs ${fdt_addr} ${nfsroot}/${fdt_file} | ||
> bootm ${loadaddr} - ${fdt_addr} | > bootm ${loadaddr} - ${fdt_addr} | ||
− | </ | + | </syntaxhighlight></div> |
::<u>for 4410LBV2080</u> | ::<u>for 4410LBV2080</u> | ||
− | <div style="margin-left: 4em | + | <div style="margin-left: 4em"><syntaxhighlight lang="text"> |
> setenv serverip 172.22.15.145; setenv autoload n; dhcp | > setenv serverip 172.22.15.145; setenv autoload n; dhcp | ||
> setenv nfsroot /NFS/4410lbv2 | > setenv nfsroot /NFS/4410lbv2 | ||
Line 411: | Line 984: | ||
> nfs ${loadaddr} ${nfsroot}/uImage | > nfs ${loadaddr} ${nfsroot}/uImage | ||
> bootm | > bootm | ||
− | </ | + | </syntaxhighlight></div> |
− | * screenshot | + | *screenshot |
+ | |||
::<u>for 4410LBV3480</u> | ::<u>for 4410LBV3480</u> | ||
− | :::[[File: | + | :::[[File:Rsb-4410 booting from network.png|800px|Rsb-4410 booting from network.png]] |
::<u>for 4410LBV2080</u> | ::<u>for 4410LBV2080</u> | ||
− | :::[[File: | + | :::[[File:Rsb-4410 lbv2080 booting from network.png|800px|Rsb-4410 lbv2080 booting from network.png]] |
+ | |||
+ | === boot up to U-Boot === | ||
− | |||
The following operations demonstrate how to boot-up RSB-4410(4410LBV3480) with loading u-boot via NFS. | The following operations demonstrate how to boot-up RSB-4410(4410LBV3480) with loading u-boot via NFS. | ||
− | * Keep the DEL key | + | |
− | * While <tt>"SPL >"</tt> shows up, release the DEL key, and type <tt>"CTRL+C"</tt> in | + | *Keep the DEL key pressed in terminal emulator, then reset RSB-4410. |
− | * SPL | + | *While <tt>"SPL >"</tt> shows up, release the DEL key, and type <tt>"CTRL+C"</tt> in terminal emulator to clear all invisible keystrokes. |
− | <div style="margin-left: 2em | + | *SPL |
+ | <div style="margin-left: 2em"><syntaxhighlight lang="text"> | ||
> setenv serverip 172.22.15.145 | > setenv serverip 172.22.15.145 | ||
> dhcp | > dhcp | ||
> nfs ${loadaddr} /NFS/rsb-4410_rootfs/u-boot_crc.bin | > nfs ${loadaddr} /NFS/rsb-4410_rootfs/u-boot_crc.bin | ||
> go ${loadaddr} | > go ${loadaddr} | ||
− | </ | + | </syntaxhighlight></div> |
− | * Screenshot | + | *Screenshot |
− | :[[File: | + | |
+ | :[[File:Rsb-4410 boot up to U-Boot.png|640px|Rsb-4410 boot up to U-Boot.png]] | ||
+ | |||
+ | == OpenCV == | ||
− | |||
Open source computer vision | Open source computer vision | ||
− | ==Python== | + | == Python == |
+ | |||
Install Python | Install Python | ||
− | ==SSH== | + | == Qt == |
+ | |||
+ | === [[IoTGateway/BSP/Linux/iMX6/QtCreator|Setting-up QtCreator to cross compile for iMX6 series]]] === | ||
+ | |||
+ | === Writing the Qt application with displaying Chinese === | ||
+ | |||
+ | The section will demonstrate how to install Chinese font, and let Qt application to display Chinese; all operations are performed with RSB-4410 (4410A1LIV6000) and Ubuntu 12.04. | ||
+ | |||
+ | *install Chinese font | ||
+ | |||
+ | :On target side (RSB-4410) | ||
+ | ::Please refer to [[#Chinese_Font|'''this''']] for details. | ||
+ | |||
+ | :On host side (Ubuntu 12.04) | ||
+ | ::perform the following command | ||
+ | <div style="margin-left: 4em"> | ||
+ | # sudo apt-get install ttf-wqy-microhei | ||
+ | </div> | ||
+ | *start QtCreator (on host side) | ||
+ | |||
+ | ::create one project named hello_qt that contains one label which text is "哈囉 Qt" and font is "WenQuanYi Micro Hei, 72" | ||
+ | :::(please refer to [[IoTGateway/BSP/Linux/iMX6/QtCreator|'''Setting-up QtCreator to cross compile for iMX6 series''']] if needed) | ||
+ | :::[[File:Hello qt chinese.png|800px|Hello qt chinese.png]] | ||
+ | ::build , deploy and run | ||
+ | :::[[File:Hello qt build deploy run.png|RTENOTITLE]] | ||
+ | :::[[File:Hello qt runtime.png|RTENOTITLE]] | ||
+ | |||
+ | == SSH == | ||
+ | |||
SSH connection | SSH connection | ||
− | ==Yocto== | + | == TFTP == |
+ | |||
+ | === boot up to Linux === | ||
+ | |||
+ | The following operations demonstrate how to boot-up RSB-4410(4410LBV3480/4410LBV2080) with loading kernel image via TFTP and mounting the root filesystem via NFS. | ||
+ | |||
+ | *prerequisites for NFS server (This section is identical with the one of '''[[IoTGateway/Features/Linux/Software#NFS|NFS]]'''.) | ||
+ | *prerequisites for TFTP server (e.g. ip: 172.22.15.145) | ||
+ | |||
+ | : | ||
+ | |||
+ | *<tt>/etc/xinetd.d/tftp</tt> | ||
+ | <div style="margin-left: 4em"><syntaxhighlight lang="text"> | ||
+ | service tftp | ||
+ | { | ||
+ | socket_type = dgram | ||
+ | protocol = udp | ||
+ | wait = yes | ||
+ | user = root | ||
+ | server = /usr/sbin/in.tftpd | ||
+ | server_args = -s /tftpboot | ||
+ | disable = no | ||
+ | } | ||
+ | </syntaxhighlight></div> | ||
+ | : | ||
+ | |||
+ | *<tt>/etc/services</tt> | ||
+ | <div style="margin-left: 4em"><syntaxhighlight lang="text"> | ||
+ | tftp 69/tcp | ||
+ | tftp 69/udp | ||
+ | </syntaxhighlight></div> | ||
+ | : | ||
+ | |||
+ | *restart the xinetd service | ||
+ | |||
+ | *u-boot | ||
+ | |||
+ | :Hit any key to stop autoboot then perform the following commands: | ||
+ | ::<u>for 4410LBV3480</u> | ||
+ | <div style="margin-left: 4em"><syntaxhighlight lang="text"> | ||
+ | > setenv serverip 172.22.15.145 | ||
+ | > setenv nfsroot /NFS/rsb-4410_rootfs | ||
+ | > run netboot | ||
+ | </syntaxhighlight></div> | ||
+ | ::<u>for 4410LBV2080</u> | ||
+ | <div style="margin-left: 4em"><syntaxhighlight lang="text"> | ||
+ | > setenv serverip 172.22.15.145; setenv autoload n; dhcp | ||
+ | > setenv nfsroot /NFS/4410lbv2 | ||
+ | > setenv bootargs_base ${bootargs_base} 'fec_mac=${ethaddr}' | ||
+ | > run bootcmd_net | ||
+ | </syntaxhighlight></div> | ||
+ | == WiFi AP mode == | ||
+ | |||
+ | The following operations demonstrate how to turn UBC-220(U220LBV8220) with EMM-160M2 plugged to a wireless AP. | ||
+ | |||
+ | === before [[IoTGateway/BSP/Linux/iMX6/Yocto_LBV8_User_Guide#To_build_sdcard_image|buildinging sdcard image]] === | ||
+ | |||
+ | *./meta-advantech/meta-fsl-imx6/recipes-fsl/images/fsl-image-adv.inc | ||
+ | |||
+ | :add the following line | ||
+ | <div style="margin-left: 2em"><syntaxhighlight lang="text"> | ||
+ | IMAGE_INSTALL += " hostapd " | ||
+ | </syntaxhighlight></div> | ||
+ | :If you also want to setup bridge, add the following line | ||
+ | <div style="margin-left: 2em"><syntaxhighlight lang="text"> | ||
+ | IMAGE_INSTALL += " bridge-utils " | ||
+ | </syntaxhighlight></div> | ||
+ | === after booting-up === | ||
+ | |||
+ | */etc/sysctl.conf | ||
+ | <div style="margin-left: 2em"><syntaxhighlight lang="text"> | ||
+ | net.ipv4.ip_forward=1 | ||
+ | </syntaxhighlight></div> | ||
+ | */etc/network/interfaces | ||
+ | <div style="margin-left: 2em"><syntaxhighlight lang="text"> | ||
+ | # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) | ||
+ | |||
+ | # The loopback interface | ||
+ | auto lo | ||
+ | iface lo inet loopback | ||
+ | |||
+ | # Wired or wireless interfaces | ||
+ | auto eth0 | ||
+ | iface eth0 inet dhcp | ||
+ | |||
+ | auto eth0:0 | ||
+ | iface eth0:0 inet static | ||
+ | address 192.168.203.220 | ||
+ | netmask 255.255.255.0 | ||
+ | |||
+ | # Wireless interfaces | ||
+ | auto wlan0 | ||
+ | #allow-hotplug wlan0 | ||
+ | iface wlan0 inet static | ||
+ | address 192.168.1.1 | ||
+ | netmask 255.255.255.0 | ||
+ | gateway 192.168.1.1 | ||
+ | dns-nameservers 8.8.8.8 | ||
+ | </syntaxhighlight></div> | ||
+ | */etc/network/if-up.d/dhcp_ap | ||
+ | <div style="margin-left: 2em"><syntaxhighlight lang="text"> | ||
+ | #!/bin/sh | ||
+ | case $IFACE in | ||
+ | eth0) | ||
+ | udhcpc -i eth0 | ||
+ | ;; | ||
+ | wlan0) | ||
+ | hostapd -B /etc/hostapd.conf | ||
+ | udhcpd | ||
+ | ;; | ||
+ | esac | ||
+ | </syntaxhighlight></div> | ||
+ | */etc/udhcpd.conf | ||
+ | <div style="margin-left: 2em"><syntaxhighlight lang="text"> | ||
+ | start 192.168.1.101 | ||
+ | end 192.168.1.254 | ||
+ | interface wlan0 | ||
+ | |||
+ | pidfile /var/run/udhcpd.pid | ||
+ | |||
+ | opt dns 192.168.1.1 | ||
+ | option subnet 255.255.255.0 | ||
+ | opt router 192.168.1.1 | ||
+ | opt wins 192.168.1.1 | ||
+ | option lease 864000 | ||
+ | </syntaxhighlight></div> | ||
+ | */etc/hostapd.conf | ||
+ | <div style="margin-left: 2em"><syntaxhighlight lang="text"> | ||
+ | interface=wlan0 | ||
+ | driver=nl80211 | ||
+ | ssid=UBC220AP | ||
+ | hw_mode=g | ||
+ | channel=11 | ||
+ | wpa=1 | ||
+ | wpa_passphrase=UBC220AP | ||
+ | wpa_key_mgmt=WPA-PSK | ||
+ | wpa_pairwise=TKIP CCMP | ||
+ | wpa_ptk_rekey=600 | ||
+ | ctrl_interface=/var/run/hostapd | ||
+ | </syntaxhighlight></div> | ||
+ | *reboot the device | ||
+ | |||
+ | === after reboot === | ||
+ | |||
+ | You have to setup IP forwarding. There are two different methods to configure. | ||
+ | |||
+ | Method 1 : Modify IP table | ||
+ | <div style="margin-left: 2em"><syntaxhighlight lang="text"> | ||
+ | iptables -t nat -F | ||
+ | iptables -F | ||
+ | iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE | ||
+ | iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT | ||
+ | </syntaxhighlight></div> | ||
+ | Method 2 : Set up bridge | ||
+ | |||
+ | *Modify /etc/network/interfaces | ||
+ | <div style="margin-left: 2em"><syntaxhighlight lang="text"> | ||
+ | auto lo br0 | ||
+ | iface lo inet loopback | ||
+ | |||
+ | # Wired or wireless interfaces | ||
+ | auto eth0 | ||
+ | iface eth0 inet dhcp | ||
+ | |||
+ | auto eth0:0 | ||
+ | iface eth0:0 inet static | ||
+ | address 192.168.203.220 | ||
+ | netmask 255.255.255.0 | ||
+ | |||
+ | # Wireless interfaces | ||
+ | auto wlan0 | ||
+ | #allow-hotplug wlan0 | ||
+ | iface wlan0 inet manual | ||
+ | |||
+ | iface br0 inet static | ||
+ | bridge_ports wlan0 eth0 | ||
+ | address 192.168.1.1 | ||
+ | netmask 255.255.255.0 | ||
+ | gateway 192.168.1.1 | ||
+ | dns-nameservers 8.8.8.8 | ||
+ | </syntaxhighlight></div> | ||
+ | *Add this line into /etc/hostapd.conf | ||
+ | <div style="margin-left: 2em"><syntaxhighlight lang="text"> | ||
+ | bridge=br0 | ||
+ | </syntaxhighlight></div> | ||
+ | == Yocto == | ||
+ | |||
In this section, we share some tips to use & modify BB files and related configurations for Yocto. | In this section, we share some tips to use & modify BB files and related configurations for Yocto. | ||
− | ===How to delete temporary workspace after build process=== | + | |
− | By default, the build system preserves the temporary files under the '''${TMPDIR}/work''' directory of each recipe for inspection and possible debugging purposes. If you would rather have these files deleted to save disk space as the build progresses, you can enable rm_work by adding the following to your '''local.conf file''', which is found in the Build Directory. | + | === How to delete temporary workspace after build process === |
+ | |||
+ | By default, the build system preserves the temporary files under the '''${TMPDIR}/work''' directory of each recipe for inspection and possible debugging purposes. If you would rather have these files deleted to save disk space as the build progresses, you can enable rm_work by adding the following to your '''local.conf file''', which is found in the Build Directory. | ||
+ | |||
INHERIT += "rm_work" | INHERIT += "rm_work" | ||
To exclude some recipes from having their work directories deleted by rm_work, you can add the names of the recipe or recipes you are working on to the RM_WORK_EXCLUDE variable, which can also be set in your local.conf file. Here is an example: | To exclude some recipes from having their work directories deleted by rm_work, you can add the names of the recipe or recipes you are working on to the RM_WORK_EXCLUDE variable, which can also be set in your local.conf file. Here is an example: | ||
+ | |||
RM_WORK_EXCLUDE += "busybox glibc" | RM_WORK_EXCLUDE += "busybox glibc" | ||
− | ===How to get multi-sources from GIT server=== | + | === How to get multi-sources from GIT server === |
− | You can assign a '''name''' to distinguish the different GIT URIs, and define different '''destsuffix''' to save them respectively. | + | |
− | Furthermore, to override SRCREV with the '''name''', you can assign different commit id for each GIT branch. | + | You can assign a '''name''' to distinguish the different GIT URIs, and define different '''destsuffix''' to save them respectively. Furthermore, to override SRCREV with the '''name''', you can assign different commit id for each GIT branch. |
SRC_URI = " \ | SRC_URI = " \ | ||
− | <nowiki>git://git.allseenalliance.org/gerrit/core/alljoyn.git</nowiki>;protocol=https;branch=${GIT_BRANCH};'''name'''=<span style="color:red">router</span>;'''destsuffix'''=git/core/alljoyn \ | + | |
− | + | ||
− | + | ||
− | + | <nowiki>git://git.allseenalliance.org/gerrit/core/alljoyn.git</nowiki> | |
− | + | ||
+ | ;protocol=https;branch=${GIT_BRANCH};'''name'''=<span style="color:red">router</span>;'''destsuffix'''=git/core/alljoyn \<nowiki>git://git.allseenalliance.org/gerrit/services/base.git</nowiki> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ;protocol=https;branch=${GIT_BRANCH};'''name'''=<span style="color:blue">services</span>;'''destsuffix'''=git/services/base \ file | ||
+ | ://modify_flags_for_yocto.patch" SRCREV_<span style="color:red">router</span> = "0d71b216bb3a3cadc615c3eda6f8200093c5e117" SRCREV_<span style="color:blue">services</span> = "403cda579242701d42d2d7c0da308d63a8f46070" | ||
+ | |||
+ | === Skip QA check === | ||
− | |||
You can skip the specific QA check for your packages. For details, check the [https://www.yoctoproject.org/docs/2.0/ref-manual/ref-manual.html#ref-classes-insane insane.bbclass] bbclass in Yocto Project Reference Manual. | You can skip the specific QA check for your packages. For details, check the [https://www.yoctoproject.org/docs/2.0/ref-manual/ref-manual.html#ref-classes-insane insane.bbclass] bbclass in Yocto Project Reference Manual. | ||
+ | |||
INSANE_SKIP_${PN} += "dev-so" | INSANE_SKIP_${PN} += "dev-so" | ||
− | ===Create BB file to install pre-built SO binaries=== | + | === Create BB file to install pre-built SO binaries === |
+ | |||
Below is an example to add SO binaries into your image. You may need to modify the <span style="color:blue">blue items</span> for your make install path & library name. | Below is an example to add SO binaries into your image. You may need to modify the <span style="color:blue">blue items</span> for your make install path & library name. | ||
+ | |||
SRC_URI = "file://test.tar.gz" | SRC_URI = "file://test.tar.gz" | ||
Line 488: | Line 1,306: | ||
RPROVIDES_${PN} = "<span style="color:blue">libtest-1.00.so</span>" | RPROVIDES_${PN} = "<span style="color:blue">libtest-1.00.so</span>" | ||
− | ===Install Node-RED packages=== | + | === Install Node-RED packages === |
+ | |||
For Node-RED package installation, you can refer to the example below. Please note this example is based on the imyller's [https://github.com/imyller/meta-nodejs meta-nodejs] layer for Node.js infrastructure. | For Node-RED package installation, you can refer to the example below. Please note this example is based on the imyller's [https://github.com/imyller/meta-nodejs meta-nodejs] layer for Node.js infrastructure. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ===How to add additional gst-plugins=== | + | SRC_URI = " |
− | * add new settings in Yocto's <tt>conf/local.conf</tt> | + | |
− | <div style="margin-left: 2em | + | |
+ | <nowiki>git://github.com/ADVANTECH-Corp/node-red-contrib-alljoyn.git</nowiki> | ||
+ | |||
+ | ;protocol=git" SRCREV = "677333b1ed1a26a966c32d98af073d0b9a2b9088" S = "${WORKDIR}/git" <span style="color:green"># Inherit NPM class</span> inherit npm-install-global <span style="color:green"># Do node-gyp rebuild in do_install() phase</span> NPM_INSTALL_FLAGS = "--unsafe-perm" <span style="color:green"># Skip QA check</span> INSANE_SKIP_${PN} = "staticdev" | ||
+ | |||
+ | === How to add additional gst-plugins === | ||
+ | |||
+ | *add new settings in Yocto's <tt>conf/local.conf</tt> | ||
+ | <div style="margin-left: 2em"><syntaxhighlight lang="bash"> | ||
LICENSE_FLAGS_WHITELIST = "commercial" | LICENSE_FLAGS_WHITELIST = "commercial" | ||
Line 523: | Line 1,337: | ||
gst-ffmpeg \ | gst-ffmpeg \ | ||
" | " | ||
− | </ | + | </syntaxhighlight></div> |
− | + | *overwrite original hash code specified in the recipe <tt>x264_git</tt> | |
− | * overwrite original hash code specified in the recipe <tt>x264_git</tt> | + | <div style="margin-left: 2em"><syntaxhighlight lang="bash"> |
− | <div style="margin-left: 2em | ||
cat << EOF > meta-advantech/recipes-multimedia/x264/x264_git.bbappend | cat << EOF > meta-advantech/recipes-multimedia/x264/x264_git.bbappend | ||
SRCREV = "ffc3ad4945da69f3caa2b40e4eed715a9a8d9526" | SRCREV = "ffc3ad4945da69f3caa2b40e4eed715a9a8d9526" | ||
EOF | EOF | ||
− | </ | + | </syntaxhighlight></div> |
+ | *snapshot verified | ||
+ | |||
+ | :[[File:Additional gst-plugins verified.png|RTENOTITLE]] | ||
− | + | === How to use Yocto Project Application Development Toolkit (ADT) === | |
− | |||
− | |||
(see [[IoTGateway/BSP/Linux/iMX6/Eclipse_Plug-in|Setting-up Eclipse Plug-in to cross compile for iMX6 series]]) | (see [[IoTGateway/BSP/Linux/iMX6/Eclipse_Plug-in|Setting-up Eclipse Plug-in to cross compile for iMX6 series]]) | ||
− | ===How to add & use Chromium browser=== | + | === How to add & use Chromium browser === |
− | * add new settings in <tt>conf/local.conf</tt> | + | |
− | <div style="margin-left: 2em | + | *add new settings in <tt>conf/local.conf</tt> |
+ | <div style="margin-left: 2em"><syntaxhighlight lang="bash"> | ||
LICENSE_FLAGS_WHITELIST = "commercial" | LICENSE_FLAGS_WHITELIST = "commercial" | ||
CORE_IMAGE_EXTRA_INSTALL += "chromium" | CORE_IMAGE_EXTRA_INSTALL += "chromium" | ||
− | </ | + | </syntaxhighlight></div> |
+ | *switch "OpenGL ES H/W acceleration" on | ||
− | |||
:edit <tt>/usr/share/applications/google-chrome.desktop</tt> | :edit <tt>/usr/share/applications/google-chrome.desktop</tt> | ||
− | <div style="margin-left: 2em | + | <div style="margin-left: 2em"> |
[Desktop Entry] | [Desktop Entry] | ||
... | ... | ||
− | Exec=/usr/bin/google-chrome <span style="color:red">--use-gl=egl</span> %U | + | Exec=/usr/bin/google-chrome <span style="color:red">--use-gl=egl</span> %U |
... | ... | ||
</div> | </div> | ||
− | * HTML5 scores | + | *HTML5 scores |
− | :[[File: | + | |
− | :[[File: | + | :[[File:Chromium html5 scores.png|RTENOTITLE]] |
+ | :[[File:Chromium html5 details.png|RTENOTITLE]] | ||
+ | |||
+ | == CC2650 Sensortag == | ||
+ | |||
+ | CC2650STK – Multi standard supporting Bluetooth low energy, 6LoWPAN, and ZigBee. | ||
+ | |||
+ | These web pages provides gives details for CC2650 : | ||
+ | |||
+ | *[Http://processors.wiki.ti.com/index.php/SensorTag2015 SensorTag2015] | ||
+ | *[Http://www.ti.com/ww/en/wireless%20connectivity/sensortag/index.html CC2650 SensorTag User's Guide] | ||
+ | |||
+ | === Set up bluetooth module === | ||
+ | |||
+ | 1. Enable RFKill configure in kernel | ||
+ | |||
+ | + CONFIG_RFKILL=y | ||
+ | |||
+ | 2. Mount your bluetooth driver | ||
+ | |||
+ | 3. Install bluez5 package on Yocto | ||
+ | |||
+ | IMAGE_INSTALL += " bluez5 " | ||
+ | |||
+ | === Test Sensor === | ||
+ | |||
+ | Enable bluetooth function | ||
+ | |||
+ | hciconfig hci0 up | ||
+ | |||
+ | You can check your bluetooth device by | ||
+ | |||
+ | hcitool dev | grep hci | ||
+ | |||
+ | Scanning sensor by | ||
+ | |||
+ | hcitool lescan | ||
+ | |||
+ | It will find the CC2650 sensortag | ||
+ | |||
+ | LE Scan ... | ||
+ | 00:00:00:00:00:00 (unknown) | ||
+ | B0:B4:48:B8:DB:02 CC2650 SensorTag | ||
+ | B0:B4:48:B8:DB:02 CC2650 SensorTag | ||
+ | ... | ||
+ | |||
+ | If your device name shows unknown, you have to update this [[:File:hcitool_fix_lescan.patch|patch]] to hcitool of bluez5. | ||
+ | |||
+ | You can use gatttool of bluze5 to get sensor data from SensorTag: | ||
+ | |||
+ | '''Interactive mode''': | ||
+ | |||
+ | gatttool -b B0:B4:48:B8:DB:02 -I | ||
+ | connect | ||
+ | char-write-cmd 0x24 01 | ||
+ | char-read-hnd 0x21 | ||
+ | exit | ||
+ | |||
+ | '''Command line''': | ||
+ | |||
+ | gatttool -b B0:B4:48:B8:DB:02 --char-write --handle 0x24 --value 01 | ||
+ | gatttool -b B0:B4:48:B8:DB:02 --char-read --handle 0x21 | ||
+ | |||
+ | === Set up NodeRed === | ||
+ | |||
+ | 1. Install sensortag and node-red-node-sensortag by npm on your target board. | ||
+ | |||
+ | npm install sensortag | ||
+ | npm install node-red-node-sensortag | ||
+ | |||
+ | 2. Drag the following nodes from the left bar in Node-Red browser interface | ||
+ | |||
+ | *sensorTag | ||
+ | *Debug | ||
+ | |||
+ | 3. Fill the MAC of your SensorTag in the UUID blank | ||
+ | |||
+ | 4. Click on the Deploy button. | ||
+ | |||
+ | Reference: [https://software.intel.com/en-us/articles/getting-started-with-node-red-and-texas-instruments-sensortag|Getting Started With Node-RED] | ||
+ | |||
+ | === Sending Data to Azure IoT Hub by NodeRed === | ||
+ | |||
+ | 1. To install node-red-contrib-azure-iot-hub on your target board. | ||
+ | |||
+ | npm install -g node-red-contrib-azure-iot-hub | ||
+ | |||
+ | 2. Paste the following code into the "Import nodes" dialog | ||
+ | |||
+ | [{"id":"3dc559f2.f78a56","type":"azureiothubregistry","z":"ee5c9c0f.63449","name":"Azure IoT Hub Registry","x":398,"y":449,"wires":[["8810a39.828d76"|"8810a39.828d76"]]},{"id":"1babf1f6.57f37e","type":"inject","z":"ee5c9c0f.63449","name":"Register Payload","topic":"","payload":"{\"deviceId\": \"device160\"}","payloadType":"json","repeat":"","crontab":"","once":false,"x":168,"y":449,"wires":[["3dc559f2.f78a56"|"3dc559f2.f78a56"]]},{"id":"8810a39.828d76","type":"debug","z":"ee5c9c0f.63449","name":"Log","active":true,"console":"false","complete":"true","x":678,"y":449,"wires":[]},{"id":"8409d8b1.98cfb8","type":"debug","z":"ee5c9c0f.63449","name":"Log","active":true,"console":"false","complete":"true","x":678,"y":389,"wires":[]},{"id":"48ebe85c.f1a238","type":"azureiothub","z":"ee5c9c0f.63449","name":"Azure IoT Hub","protocol":"mqtt","x":368,"y":389,"wires":[["8409d8b1.98cfb8"|"8409d8b1.98cfb8"]]},{"id":"74099c94.1dc994","type":"inject","z":"ee5c9c0f.63449","name":"Send Payload","topic":"","payload":"{ \"deviceId\": \"device150\", \"key\": \"HostName=AdvTest.azure-devices.net;DeviceId=device150;SharedAccessKey=qkPiSp247kpsrfF6iRFVpTDcnd9Gm2+NzsjPergqyWE=\", \"protocol\": \"mqtt\", \"data\": \"{tem: 25, wind: 20}\" }","payloadType":"json","repeat":"","crontab":"","once":false,"x":158,"y":389,"wires":[["48ebe85c.f1a238"|"48ebe85c.f1a238"]]}] | ||
+ | |||
+ | 3. To Register your SensorTag to your Azure IoT Hub Server | ||
+ | |||
+ | *Double click on '''Register Payload''' Node to fill following code format in Node-Red browser interface. | ||
+ | |||
+ | For example: | ||
+ | |||
+ | {"deviceId": "device167"} | ||
+ | |||
+ | *Double click on '''Azure IoT Hub Registry''' Node to fill following code format in Node-Red browser interface. | ||
+ | |||
+ | For example: | ||
+ | |||
+ | HostName=AdvTest.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=rsIruTdoINPSjUy7YyF2T1DJ1pTiFY+jrswbPc4ybyk= | ||
+ | |||
+ | 4. To send data to Azure IoT Hub | ||
+ | |||
+ | *Double click on '''Send Payload''' Node to fill information followed payload format in Node-Red browser interface. | ||
+ | |||
+ | For example: | ||
+ | |||
+ | { | ||
+ | "deviceId": "device143", | ||
+ | "key": "LLgyZaqAwYXk1uidzM27aO1YIA76fjv55Zs7unExFz8=", | ||
+ | "protocol": "http", | ||
+ | "data": "{tem: 25, wind: 20}" | ||
+ | } | ||
+ | |||
+ | *Double click on '''Azure IoT Hub''' Node to fill information | ||
+ | |||
+ | For example: | ||
+ | |||
+ | Name: Azure IoT Hub | ||
+ | Protocol: http | ||
+ | Hostname: AdvTest.azure-devices.net | ||
+ | |||
+ | Reference: [https://www.npmjs.com/package/node-red-contrib-azure-iot-hub node-red-contrib-azure-iot-hub] | ||
+ | |||
+ | '''Note''': | ||
+ | |||
+ | 1. If it can not connect to Azure IoT Hub, you maybe reinstall node-gyp. | ||
+ | |||
+ | npm install -g node-gyp | ||
+ | |||
+ | 2. Check status of connection with Azure IoT Hub | ||
+ | |||
+ | [https://github.com/Azure/azure-iot-sdk-csharp/tree/master/tools/DeviceExplorer DeviceExplorer] | ||
+ | |||
+ | === Sending Data to Azure IoT Hub by tools of Azure IoT SDK === | ||
+ | |||
+ | We suggest all operations of compiling AZure IoT Hub on Docker Images because it will be updated some packages of OS after the following steps, | ||
+ | |||
+ | '''Get source code''' | ||
+ | |||
+ | git clone --recursive [https://github.com/azure/azure-iot-sdk-c.git https://github.com/azure/azure-iot-sdk-c.git] | ||
+ | |||
+ | '''Compilation''' | ||
+ | |||
+ | 1. Upgrade CMake | ||
+ | |||
+ | sudo add-apt-repository ppa:kalakris/cmake | ||
+ | sudo apt-get update | ||
+ | |||
+ | 2. Set up environment | ||
+ | |||
+ | sudo ./build_all/linux/setup.sh | ||
+ | |||
+ | 3. To create one new build environment of Yocto | ||
+ | |||
+ | For example: | ||
+ | |||
+ | EULA=1 DISTRO=fsl-imx-x11 MACHINE=imx6qrom7420a1 source fsl-setup-release.sh -b build-x11 | ||
+ | |||
+ | 4. Create cmake file, yocto_1.7.cmake, depended on your Yocto SDK environment in ./buill_all/linux | ||
+ | |||
+ | # compiler | ||
+ | include(CMakeForceCompiler) | ||
+ | |||
+ | # this is required | ||
+ | SET(CMAKE_SYSTEM_NAME Linux) | ||
+ | SET(CMAKE_SYSTEM_PROCESSOR arm) | ||
+ | SET(CMAKE_SYSTEM_VERSION 1) | ||
+ | |||
+ | SET(CMAKE_SYSROOT /opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi) | ||
+ | |||
+ | cmake_force_c_compiler(/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc GNU) | ||
+ | cmake_force_cxx_compiler(/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ GNU) | ||
+ | # sysroot location | ||
+ | set(MYSYSROOT /opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi) | ||
+ | # compiler/linker flags | ||
+ | add_definitions("--sysroot=${MYSYSROOT}") | ||
+ | # compiler/linker flags | ||
+ | add_definitions("--sysroot=${MYSYSROOT}") | ||
+ | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a -std=gnu99 -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE) | ||
+ | set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -std=gnu99 -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE) | ||
+ | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -std=gnu99 -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE) | ||
+ | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -std=gnu99 -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE) | ||
+ | # cmake built-in settings to use find_xxx() functions | ||
+ | set(CMAKE_FIND_ROOT_PATH ${MYSYSROOT}) | ||
+ | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
+ | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
+ | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
+ | |||
+ | 5. modify connectionString of your SensorTag in ./iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c | ||
+ | |||
+ | For example: | ||
+ | |||
+ | static const char* connectionString = "HostName=AdvTest.azure-devices.net;DeviceId=device143;SharedAccessKey=LLgyZaqAwYXk1uidzM27aO1YIA76fjv55Zs7unExFz8="; | ||
+ | |||
+ | 6. Compile by | ||
+ | |||
+ | cd ./build_all/linux/ | ||
+ | sudo ./build.sh --toolchain-file yocto_1.7.cmake | ||
+ | |||
+ | 7. The output file is '''iothub_client_sample_http '''in ./cmake/iotsdk_linux/iothub_client/samples/iothub_client_sample_http/ | ||
+ | |||
+ | == Bluetooth == | ||
+ | |||
+ | Install bluetooth tool on Debial/Ubuntu | ||
+ | |||
+ | sudo apt-get update | ||
+ | sudo apt-get install bluetooth blueman bluez bluez-tools | ||
+ | |||
+ | Connect with smart phone | ||
+ | |||
+ | [[File:BT phone.jpg|600x700px|BT_phone.jpg]] | ||
+ | |||
+ | Connect with laptop | ||
+ | |||
+ | [[File:BT NB.jpg|600x700px|BT_NB.jpg]] | ||
+ | |||
+ | == Bluetooth_Yocto == | ||
+ | |||
+ | Test bluetooth tool on Yocto | ||
+ | |||
+ | == GPS == | ||
+ | |||
+ | Support on APQ8016 project | ||
+ | |||
+ | First install some packages (reference from "Using the onboard GPS" in [https://builds.96boards.org/releases/dragonboard410c/linaro/debian/17.06/ Linaro]) | ||
+ | |||
+ | sudo apt-get install gpsd-clients gnss-gpsd | ||
+ | |||
+ | Start service on DSP | ||
+ | |||
+ | systemctl start gpsd.socket | ||
+ | systemctl start gpsd | ||
+ | systemctl start qdsp-start | ||
+ | systemctl start gnss-gpsd | ||
+ | |||
+ | Using gpsd client to monitor | ||
+ | |||
+ | gpsmon: | ||
+ | |||
+ | [[File:Gpsmon.png|645x426px|gpsmon.png]] | ||
+ | |||
+ | If you want to analyze NMEA sentences, you can reference information on [http://www.gpsinformation.org/dale/nmea.htm NMEA] | ||
+ | |||
+ | == Touch == | ||
+ | |||
+ | Support the Zytronic TOUCH on i.MX6 Yocto Liunx | ||
+ | |||
+ | Download the SWAP and Calibration Tools for zytronic.co.uk. [http://zytronic.co.uk/support/downloads/ http://zytronic.co.uk/support/downloads/] | ||
+ | |||
+ | Linux Kernel : Need to enable CONFIG_HID_MULTITOUCH config | ||
+ | |||
+ | #CONFIG_HID_MULTITOUCH=y | ||
+ | |||
+ | Step1 : For your application, you need to SWAP or Calibration your panel. | ||
+ | |||
+ | Step2 : Download the tools from [http://zytronic.co.uk/support/downloads/ http://zytronic.co.uk/support/downloads/] . | ||
+ | |||
+ | Step3 : In ZXY100 32 Input Controller Drivers, choose your version (win7 ,win8 or win10). | ||
+ | |||
+ | Step4 : Unzip the "Windows-01-03-2016" folder. | ||
+ | |||
+ | Step4 : Plug into the usb. | ||
+ | |||
+ | Step5 : Run Zyconfig (Administrator) in ZyConfig_Tool_02.07.29_04.07.16. | ||
+ | |||
+ | [[File:Zyconfig2.jpg|500px|Zyconfig2.jpg]] | ||
+ | |||
+ | Step6: If your application need to swap the x and y axes, your can choose the (Swap X-Y axes). | ||
+ | |||
+ | [[File:Zyconfig1.jpg|500px|Zyconfig1.jpg]] | ||
+ | |||
+ | == RT-Patch == | ||
+ | |||
+ | === Description === | ||
+ | |||
+ | *Only support to patch patch_4.1.15_rt18_patch files on i.MX6 Liunx Yocto 2.1. | ||
+ | |||
+ | *Download file: [[File:RT Patch.zip]] | ||
+ | |||
+ | *Linux OS version: Yocto 2.1 (Krogoth, L4.1.15_2.0.0_ga) | ||
+ | |||
+ | *Patch patch_4.1.15_rt18_patch files to kernel code | ||
+ | |||
+ | === Implementation Steps === | ||
+ | |||
+ | *Set up the compiler environment. You can refer following URL to install tool chain | ||
+ | |||
+ | [http://ess-wiki.advantech.com.tw/view/IoTGateway/BSP/Linux/iMX6/Yocto_LBV8_User_Guide#Setting_up_SDK <span style="font-size:large"><small><span style="font-family:times new roman,times,serif"><span style="color:#0000FF">Setting_up_SDK</span></span></small></span>] | ||
+ | |||
+ | *Assuming the installation tool chain position is as follows | ||
+ | <div style="margin-left: 1em;"><syntaxhighlight lang="TEXT"> | ||
+ | /opt/poky/2.1/environment-setup-cortexa9hf-neon-poky-linux-gnueabi | ||
+ | </syntaxhighlight></div> | ||
+ | *Generate kernel image (zImage) | ||
+ | |||
+ | Step 1: Enter the directory of kernel source code | ||
+ | <div style="margin-left: 1em;"><syntaxhighlight lang="TEXT"> | ||
+ | $ cd linux-imx6/ | ||
+ | </syntaxhighlight></div> | ||
+ | Step 2: Patch two patch files to kernel code | ||
+ | <div style="margin-left: 1em;"><syntaxhighlight lang="TEXT"> | ||
+ | $ patch -p1 -i 0001-patch-4.1.15-rt18.patch | ||
+ | $ patch -p1 -i 0002-add-defconfig-and-fix-compiler-failed-and-fix-error.patch | ||
+ | </syntaxhighlight></div> | ||
+ | Step 3: Initialize the building environment | ||
+ | <div style="margin-left: 1em;"><syntaxhighlight lang="TEXT"> | ||
+ | $ source /opt/poky/2.1/environment-setup-cortexa9hf-neon-poky-linux-gnueabi | ||
+ | </syntaxhighlight></div> | ||
+ | Step 4: Set the configuration of kernel | ||
+ | <div style="margin-left: 1em;"><syntaxhighlight lang="TEXT"> | ||
+ | $ make imx_v7_adv_defconfig | ||
+ | </syntaxhighlight></div> | ||
+ | Step 5: Build kernel image | ||
+ | <div style="margin-left: 1em;"><syntaxhighlight lang="TEXT"> | ||
+ | $ make -j 4 zImage | ||
+ | |||
+ | After building kernel image, it will be generated kernel image (zImage) in "arch/arm/boot" | ||
+ | </syntaxhighlight></div> | ||
+ | Step 6: Copy kernel image (zImage) to USB disk | ||
+ | |||
+ | *Insert the USB disk to the device and boot on the device | ||
+ | |||
+ | *After login the device, enter to USB disk directory. For Example: | ||
+ | <div style="margin-left: 1em;"><syntaxhighlight lang="TEXT"> | ||
+ | $ cd /run/media/sda1 | ||
+ | </syntaxhighlight></div> | ||
+ | *Remove kernel image (zImage) from eMMC | ||
+ | <div style="margin-left: 1em;"><syntaxhighlight lang="TEXT"> | ||
+ | $ rm /run/media/mmcblk0p1/zImage | ||
+ | $ sync | ||
+ | </syntaxhighlight></div> | ||
+ | *Copy kernel image (zImage) to eMMC | ||
+ | <div style="margin-left: 1em;"><syntaxhighlight lang="TEXT"> | ||
+ | $ cp zImage /run/media/mmcblk0p1/ | ||
+ | $ sync | ||
+ | </syntaxhighlight></div> | ||
+ | *Restart the device, the kernel image has RT feature. | ||
+ | |||
+ | === Real-Time Kernel Performance === | ||
+ | |||
+ | *cyclictest is a realtime benchmark tool. It can determine the realtime performance of your new preempt-rt patched kernel. For more detail about cyclictest, please refer below link | ||
+ | |||
+ | [https://wiki.linuxfoundation.org/realtime/documentation/howto/tools/cyclictest <span style="font-size:large"><small><span style="font-family:times new roman,times,serif"><span style="color:#0000FF">Cyclictest Link URL</span></span></small></span>] | ||
+ | |||
+ | *I provide cyclictest test tool for i.MX6 in RT_Patch_and_Test_Tool.zip file | ||
+ | |||
+ | *Copy cyclictest test tool to the device | ||
+ | |||
+ | *Below command is an example of using cyclictest | ||
+ | <div style="margin-left: 1em;"><syntaxhighlight lang="TEXT"> | ||
+ | $ ./cyclictest -p 90 -t5 -n | ||
+ | </syntaxhighlight></div> | ||
+ | *The snapshot results show performance comparisons of non-RT patch and RT patch. The final column displays the maximum latency of real-time task. | ||
+ | |||
+ | [[File:Non real time patch.png|RTENOTITLE]] | ||
+ | |||
+ | Linux_Yocto_4.1.15 (Non real-time patch) | ||
+ | |||
+ | [[File:Real time patch.png|RTENOTITLE]] | ||
+ | |||
+ | Linux_Yocto_4.1.15-rt18 (real-time patch) | ||
+ | |||
+ | *The RT kernel better performance than non-RT kernel in above results. | ||
+ | |||
+ | == USB-Boot == | ||
+ | |||
+ | === Description === | ||
+ | |||
+ | *Only support USB boot function on i.MX6 Liunx Yocto 2.1. | ||
+ | |||
+ | *Linux OS version: Yocto 2.1 (Krogoth, L4.1.15_2.0.0_ga) | ||
+ | |||
+ | === Implementation Steps === | ||
+ | |||
+ | *For example: Add USB boot function to UBC-220 project | ||
+ | |||
+ | *Modify in uboot-imx6/include/configs/mx6ubc220.h | ||
+ | <div style="margin-left: 1em;"><syntaxhighlight lang="TEXT"> | ||
+ | @@ -10,6 +10,9 @@ | ||
+ | #define __MX6QSABRESD_CONFIG_H | ||
+ | |||
+ | #ifdef CONFIG_SPL | ||
+ | +#define CONFIG_USB_BOOT | ||
+ | +#define CONFIG_SPL_LIBGENERIC_SUPPORT | ||
+ | +#define CONFIG_SPL_LIBDISK_SUPPORT | ||
+ | #define CONFIG_SPL_LIBCOMMON_SUPPORT | ||
+ | #define CONFIG_SPL_MMC_SUPPORT | ||
+ | #include "imx6_spl_advantech.h" | ||
+ | @@ -86,7 +89,7 @@ | ||
+ | #define CONFIG_USB_ETHER_ASIX | ||
+ | #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) | ||
+ | #define CONFIG_MXC_USB_FLAGS 0 | ||
+ | -#define CONFIG_USB_MAX_CONTROLLER_COUNT 1 /* Enabled USB controller number */ | ||
+ | +#define CONFIG_USB_MAX_CONTROLLER_COUNT 2 /* Enabled USB controller number */ | ||
+ | #endif | ||
+ | </syntaxhighlight></div> | ||
+ | |||
+ | == Customized GPIO Function == | ||
+ | |||
+ | === Description === | ||
+ | |||
+ | *Only support USB boot function on i.MX6 Liunx Yocto 2.1. | ||
+ | |||
+ | *Linux OS version: Yocto 2.1 (Krogoth, L4.1.15_2.0.0_ga) | ||
+ | |||
+ | *For example: We implement a customized GPIO function for RSB-4411. We setting 20 GPIO pings. | ||
+ | |||
+ | *Input-High GPIO: GPIO1,GPIO3,GPIO5,GPIO7,GPIO9,GPIO11,GPIO13,GPIO15,GPIO17,GPIO19 | ||
+ | |||
+ | *Output-Low GPIO: GPIO2,GPIO4,GPIO6,GPIO8,GPIO10,GPIO12,GPIO14,GPIO16,GPIO18,GPIO20 | ||
+ | |||
+ | *Download file: [[:Customized_GPIO_Function_Patch_Files.zip]] |
Latest revision as of 02:49, 28 November 2022
Contents
- 1 Console
- 2 Device Tree
- 3 File System
- 4 Fonts
- 5 GStreamer
- 6 Java
- 7 Linux Kernel
- 8 NFS
- 9 OpenCV
- 10 Python
- 11 Qt
- 12 SSH
- 13 TFTP
- 14 WiFi AP mode
- 15 Yocto
- 15.1 How to delete temporary workspace after build process
- 15.2 How to get multi-sources from GIT server
- 15.3 Skip QA check
- 15.4 Create BB file to install pre-built SO binaries
- 15.5 Install Node-RED packages
- 15.6 How to add additional gst-plugins
- 15.7 How to use Yocto Project Application Development Toolkit (ADT)
- 15.8 How to add & use Chromium browser
- 16 CC2650 Sensortag
- 17 Bluetooth
- 18 Bluetooth_Yocto
- 19 GPS
- 20 Touch
- 21 RT-Patch
- 22 USB-Boot
- 23 Customized GPIO Function
Console
How to enable framebuffer console
The following operations are performed with RSB-4410(4410LBV2080)
- linux kernel config
- Device Drivers --->
- Graphics support --->
- <*> Framebuffer Console support
- Graphics support --->
- Device Drivers --->
- u-boot
setenv bootargs_base 'setenv bootargs console=ttymxc0,115200 console=tty0 enable_wait_mode=off video_mode=extension
- files need to be updated
- /etc/inittab
tty0::respawn:-/bin/bash
Notice:
- If the kernel config is set to "<M> Framebuffer Console support", console will show up after module ,fbcon, is loaded.
How to change debug console port
Ltib
The following operations demonstrate how to change UBC-DS31's(based on DS31LBV1150) debug console from UART1(ttymxc0) to UART2(ttymxc1).
- u-boot
- include/configs/mx6q_ubc-d31_recovery.h
#define CONFIG_UART_BASE_ADDR UART2_BASE_ADDR
- include/configs/mx6q_ubc-d31_1G_recovery.h
- modify the settings of
bootargs_base
contained in the pre-defined macro#define CONFIG_EXTRA_ENV_SETTINGS
- modify the settings of
console=ttymxc1,115200
- board/freescale/mx6q_ubc-d31/mx6q_ubc-d31.c
- insert the following two lines into
static void setup_uart(void)
- insert the following two lines into
mxc_iomux_v3_setup_pad(MX6Q_PAD_EIM_D27__UART2_TXD);
mxc_iomux_v3_setup_pad(MX6Q_PAD_EIM_D27__UART2_RXD);
- linux kernel
- arch/arm/mach-mx6/board-mx6q_advantech.c
- modify the following two lines in
static void __init mx6_sabresd_timer_init(void)
- modify the following two lines in
uart_clk = clk_get_sys("imx-uart.1", NULL);
early_console_setup(UART2_BASE_ADDR, uart_clk);
Ltib
The following operations demonstrate how to change ROM-3420 's(based on imx6LBV2310_2014-04-30) debug console from UART1(ttymxc0) to UART2(ttymxc1)「Hardward Pin Define MX6Q_PAD_SD3_DAT5__UART2 _TXD & MX6Q_PAD_SD3_DAT4__UART2_RXD 」
U-boot modified port:
Path : ROM-3420\imx6LBV2310_2014-04-30\source\u-boot-2009.08\board\freescale\mx6q_rom-3420\mx6q_rom-3420.c
static void setup_uart(void)
{
#if defined CONFIG_MX6Q
/* UART1 TXD */
//mxc_iomux_v3_setup_pad(MX6Q_PAD_CSI0_DAT10__UART1_TXD);
/* UART1 RXD */
//mxc_iomux_v3_setup_pad(MX6Q_PAD_CSI0_DAT11__UART1_RXD);
/* UART2 TXD */
mxc_iomux_v3_setup_pad(MX6Q_PAD_SD3_DAT5__UART2_TXD);
/* UART2 RXD */
mxc_iomux_v3_setup_pad(MX6Q_PAD_SD3_DAT4__UART2_RXD);
#elif defined CONFIG_MX6DL
/* UART1 TXD */
mxc_iomux_v3_setup_pad(MX6DL_PAD_CSI0_DAT10__UART1_TXD);
/* UART1 RXD */
mxc_iomux_v3_setup_pad(MX6DL_PAD_CSI0_DAT11__UART1_RXD);
#endif
}
Path: \ROM-3420\imx6LBV2310_2014-04-30\source\u-boot-2009.08\include\configs\mx6q_rom-3420_1G.h
/*
* Hardware drivers
*/
#define CONFIG_MXC_UART
//#define CONFIG_UART_BASE_ADDR UART1_BASE_ADDR
#define CONFIG_UART_BASE_ADDR UART2_BASE_ADDR
Kernel modified port :
Path: ROM-3420\imx6LBV2310_2014-04-30\source\linux-3.0.35\arch\arm\mach-mx6\board-mx6q_advantech.c
static void __init mx6_sabresd_timer_init(void)
{
struct clk *uart_clk;
#ifdef CONFIG_LOCAL_TIMERS
twd_base = ioremap(LOCAL_TWD_ADDR, SZ_256);
BUG_ON(!twd_base);
#endif
mx6_clocks_init(32768, 24000000, 0, 0);
//uart_clk = clk_get_sys("imx-uart.0", NULL);
//early_console_setup(UART1_BASE_ADDR, uart_clk);
uart_clk = clk_get_sys("imx-uart.1", NULL);
early_console_setup(UART2_BASE_ADDR, uart_clk);
}
Rebuild BSP
U-boot Rebuild:
~/ROM-3420/imx6LBV2310_2014-04-30/scripts$ . setenv.sh
(To configure the development environment automatically)
~/ROM-3420/imx6LBV2310_2014-04-30/scripts$ ./cfg_uboot.sh mx6q_rom-3420_1G_config
(To set the u-boot configuration automatically)
~/ROM-3420/imx6LBV2310_2014-04-30/scripts$ ./mk_uboot.sh
(Start to build the u-boot)
Then you can see u-boot_crc.bin and u-boot_crc.bin.crc are being built and
located in ../image.
===================================================================================
Kernel Rebuild:
~/ROM-3420/imx6LBV2310_2014-04-30/scripts$ . setenv.sh
(To configure the development environment automatically)
~/ROM-3420/imx6LBV2310_2014-04-30/scripts$./cfg_kernel.sh imx6_rom3420_defconfig
(To set the uImage configuration automatically)
~/ROM-3420/imx6LBV2310_2014-04-30/scripts$ ./mk_kernel.sh
(Start to build the uImage)
Then you can see uImage is being built and located in ../image.
===================================================================================
U-boot parameter modified port when you turn on the device .
Command:
setenv bootargs_base setenv bootargs console=ttymxc1,115200 enable_wait_mode=off video_mode=extension pcie_testmode=off
Yocto
- Modify u-boot
Here we take ROM-5420 as an example
We want to change debug port from UART1 to UART2
include/configs/mx6rom5420.h
-#define CONFIG_MXC_UART_BASE UART1_BASE -#define CONFIG_CONSOLE_DEV "ttymxc0" +#define CONFIG_MXC_UART_BASE UART2_BASE +#define CONFIG_CONSOLE_DEV "ttymxc1"
board/freescale/mx6advantech/mx6advantech.c
static iomux_v3_cfg_t const uart1_pads[] = { MX6_PAD_CSI0_DAT10__UART1_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL), MX6_PAD_CSI0_DAT11__UART1_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL), }; +static iomux_v3_cfg_t const uart2_pads[] = { + MX6_PAD_EIM_D26__UART2_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL), + MX6_PAD_EIM_D27__UART2_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL), +}; +
static void setup_iomux_uart(void) { imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads)); + imx_iomux_v3_setup_multiple_pads(uart2_pads, ARRAY_SIZE(uart2_pads)); }
After re-compile u-boot and replace , you may be need to clear u-boot env to make kernel debug message output from uart2
env default -a env save reset
- Note(in rootfs)
Due to /etc/init.d/rc_mxc.S only get ttymxc0~ttymxc3 from u-boot parameter If you want to change to ttymxc4 and so on, you need to modify this file first /etc/init.d/rc_mxc.S
if grep -sq ttymxc0 /proc/cmdline; then /sbin/getty -L ttymxc0 115200 vt100 elif grep -sq ttymxc1 /proc/cmdline; then /sbin/getty -L ttymxc1 115200 vt100 elif grep -sq ttymxc2 /proc/cmdline; then /sbin/getty -L ttymxc2 115200 vt100 elif grep -sq ttymxc3 /proc/cmdline; then /sbin/getty -L ttymxc3 115200 vt100 elif grep -sq ttymxc4 /proc/cmdline; then /sbin/getty -L ttymxc4 115200 vt100 else sleep 100000 fi
How to disable debug console
Ltib
The following operations demonstrate how to disable UBC-DS31's(based on DS31LBV1150) debug console.
- u-boot
- board/freescale/mx6q_ubc-d31/mx6q_ubc-d31.c
- comment out all the code within
static void setup_uart(void)
- comment out all the code within
- common/console.c
- modify the following line in
int console_init_f(void)
- modify the following line in
gd->have_console = 0;
- u-boot environment variable
setenv silent=y
change console setting, console=none
, within bootargs_base
- linux kernel config
- Device Drivers ---> Character devices ---> Serial drivers --->
- [*] IMX serial port support
- [ ] Support 4 IMX serial ports
- [ ] Console on IMX serial port
- Device Drivers ---> Character devices ---> Serial drivers --->
- linux kernel (recommended)
- arch/arm/boot/compressed/misc.c
- comment out the following lines in
void decompress_kernel (...
- comment out the following lines in
//putstr("Uncompressing Linux...");
/*
if (ret)
error("decompressor returned an error");
else
putstr(" done, booting the kernel.\n");
*/
- target root file system
- comment out the following line in
/etc/inittab
- comment out the following line in
#::respawn:/etc/rc.d/rc_mxc.S
Device Tree
Customize device tree
File System
NTFS
The following operations demonstrate how to add NTFS support for Yocto Linux (ROM-5420 with imx6LBV6120_2016-06-14).
- linux kernel config (please refer to this for details)
- File systems --->
- DOS/FAT/NT Filesystems --->
- <*> NTFS file system support
- DOS/FAT/NT Filesystems --->
- File systems --->
- BSP
- add one line to meta-advantech/recipes-fsl/images/fsl-image-adv.inc
IMAGE_INSTALL += " fuse ntfs-3g ntfs-3g-ntfsprogs "
- rebuild the sdcard image (please refer to this for details)
$ bitbake fsl-image-qt5
Fonts
Chinese Font
The following operations demonstrate how to install Chinese font on Yocto Linux (RSB-4410 with 4410A1LIV6000).
- get the free Chinese font "WenQuanYi Micro Hei" from [SourceForge] and extract the tarball
- put the wqy-microhei.ttc to /usr/share/fonts/ttf, then execute the following commands
$ ln -s /usr/share/fonts/ttf/wqy-microhei.ttc /usr/lib/fonts/
$ fc-cache -fv
- use the the following command to check if the font is recognized.
- set the Chinese locale
- install the suitable locale if needed
$ rpm -ivh locale-base-zh-tw-2.21-r0.cortexa9hf_vfp_neon.rpm glibc-binary-localedata-zh-tw-2.21-r0.cortexa9hf_vfp_neon.rpm
$ rpm -ivh locale-base-zh-cn-2.21-r0.cortexa9hf_vfp_neon.rpm glibc-binary-localedata-zh-cn-2.21-r0.cortexa9hf_vfp_neon.rpm
- put the suitable LC_ALL setting to the /etc/profile
export LC_ALL=zh_TW.UTF-8
export LC_ALL=zh_CN.UTF-8
- reboot the target device
- verification
- plug in the USB stick that the following directories and files already existed
chinese_test/ 繁體目錄/ 繁體檔案 chinese_test/ 简体目录/ 简体档案
- check if the keyword "utf8" is existed
- if not, execute the following command then check again
$ umount /dev/sda1
$ mount -o iocharset=utf8 /dev/sda1 /run/media/sda1
## NOTICE: the following format also works
## mount -o utf8 /dev/sda1 /run/media/sda1
$ mount
- if it is, execute the following command to list the directories and files
GStreamer
Play Video
Audio Information
- When the system is turned on, you can see the following audio information:
... ALSA device list: #0: imx-audio-sgtl5000 #1: imx-hdmi-soc ...
Frame Buffer Information
- After the system is turned on, you can type command to see frame buffer information. For example:
1. Type command "ls /dev/video", you will see all frame buffer devices ID:
$ video16 video17 video18 video19 video20
2. Type command "cat /sys/class/graphics/fb0/fsl_disp_dev_property", you will see frame buffer name:
$ hdmi
3. The device ID of "hdmi" frame buffer layer is "video16".
4. Type command "cat /sys/class/graphics/fb1/fsl_disp_dev_property", you will see frame buffer name:
$ overlay
5. The device ID of "hdmi" overlay layer is "video17".
6. Type command "cat /sys/class/graphics/fb2/fsl_disp_dev_property", you will see frame buffer name:
$ lcd
7. The device ID of "lcd" frame buffer layer is "video18".
8. Type command "cat /sys/class/graphics/fb3/fsl_disp_dev_property", you will see frame buffer name:
$ overlay
9. The device ID of "lcd" overlay layer is "video19".
10. Type command "cat /sys/class/graphics/fb4/fsl_disp_dev_property", you will see frame buffer name:
$ ldb
11. The device ID of "ldb" frame buffer layer is "video20".
Play Video Command
- The format of display video command:
$ GST_COMMAND uri=file://VIDEO_PATH video-sink="VIDEO_COMMAND device=DISPLAY_ID" audio-sink="alsasink device=plughw:AUDIO_ID"
Play Video Command On Yocto 1.5
1. For example:
GST_COMMAND = "gst-launch playbin2" VIDEO_PATH = "/tools/Advantech.avi" VIDEO_COMMAND = "mfw_v4lsink" DISPLAY_ID = "/dev/video17"(hdmi overlay layer) AUDIO_ID = "0"(audio-sgtl5000) or "1"(audio-hdmi) AUDIO = ""(Audio) or "volume=0"(No audio)
2. Play video with audio from sgtl5000 audio command:
$ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="mfw_v4lsink device=/dev/video17" audio-sink="alsasink device=plughw:0"
3. Play video with audio from HDMI audio command:
$ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="mfw_v4lsink device=/dev/video17" audio-sink="alsasink device=plughw:1"
4. Play video with no audio command:
$ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="mfw_v4lsink device=/dev/video17" \ audio-sink="alsasink device=plughw:0" volume=0 or $ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="mfw_v4lsink device=/dev/video17" \ audio-sink="alsasink device=plughw:1" volume=0
Play Video Command On Yocto 1.7
1. For example:
GST_COMMAND = "gst-launch playbin2" or "gst-launch-0.10 playbin2" or "gst-launch-1.0 playbin" VIDEO_PATH = "/tools/Advantech.avi" VIDEO_COMMAND = "imxv4l2sink" DISPLAY_ID = "/dev/video17"(hdmi overlay layer) AUDIO_ID = "0"(audio-sgtl5000) or "1"(audio-hdmi) AUDIO = ""(Audio) or "volume=0"(No audio)
2. Play video with audio from SGTL5000 audio command:
$ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:0" or $ gst-launch-0.10 playbin2 uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:0" or $ gst-launch-1.0 playbin uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:0"
3. Play video with audio from HDMI audio command:
$ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:1" or $ gst-launch-0.10 playbin2 uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:1" or $ gst-launch-1.0 playbin uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:1"
4. Play video with no audio command:
$ gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" \ audio-sink="alsasink device=plughw:0" volume=0 or $ gst-launch-1.0 playbin uri=file://tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" \ audio-sink="alsasink device=plughw:0" volume=0
Play Video Command On Yocto 1.8
1. For example:
GST_COMMAND = "gst-launch-1.0 playbin" VIDEO_PATH = "/tools/Advantech.avi" VIDEO_COMMAND = "imxv4l2sink" DISPLAY_ID = "/dev/video17"(hdmi overlay layer) AUDIO_ID = "0"(audio-sgtl5000) or "1"(audio-hdmi) AUDIO = ""(Audio) or "volume=0"(No audio)
2. Play video with audio from SGTL5000 audio command:
$ gst-launch-1.0 playbin uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:0"
3. Play video with audio from HDMI audio command:
$ gst-launch-1.0 playbin uri=file:///tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" audio-sink="alsasink device=plughw:1"
4. Play video with no audio command:
$ gst-launch-1.0 playbin uri=file://tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" \ audio-sink="alsasink device=plughw:0" volume=0 or $ gst-launch-1.0 playbin uri=file://tools/Advantech.avi video-sink="imxv4l2sink device=/dev/video17" \ audio-sink="alsasink device=plughw:1" volume=0
SMPTE color bar
gst-launch videotestsrc ! autovideosink
video rotation
gst-launch filesrc location=/tools/Advantech.avi typefind=true ! aiurdemux name=demux demux. ! \
queue max-size-buffers=0 max-size-time=0 ! vpudec ! mfw_v4lsink rotate=180 demux. ! \
queue max-size-buffers=0 max-size-time=0 ! beepdec ! autoaudiosink
- (valid rotate value: 0, 90, 180 or 270)
- (While the angle of rotation is 90° or 270°, the maximum video resolution can not be larget than 1024*1024.)
or
gst-launch playbin2 uri=file:///tools/Advantech.avi video-sink="mfw_isink rotation=0"
- (valid rotation value: 0~7)
webcam
realtime video
gst-launch v4l2src ! video/x-raw-yuv,width=640,height=480,framerate=20/1 ! autovideosink
take one snapshot
gst-launch v4l2src num-buffers=1 ! jpegenc ! filesink location=sample.jpeg
show one snapshot
VSALPHA=1 gst-launch filesrc location=sample.jpeg ! jpegdec ! imagefreeze ! mfw_isink
network streaming
RTSP(unicast)
sender (ip: 192.168.203.41)
vlc -I rc H.264.mp4 --screen-fps=10 :screen-caching=100 --sout='#rtp{sdp=rtsp://8554/}' -vvv
receiver
gst-launch rtspsrc location=rtsp://192.168.203.41:8554 \ latency=200 name=r r. ! application/x-rtp,media=video ! \ queue max-size-buffers=0 max-size-time=0 ! rtph264depay ! \ vpudec ! mfw_v4lsink sync=false async=false r. ! \ 'application/x-rtp, media=(string)audio' ! queue max-size-buffers=0 max-size-time=0 ! \ rtpmp4gdepay ! beepdec ! alsasink sync=false async=false -vvv
RTP(multicast)
sender
vlc -I rc H.264.mp4 --screen-fps=10 :screen-caching=100 --sout='#rtp{mux=ts,dst=239.1.1.1,port=5004}' -vvv
receiver
route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0 gst-launch udpsrc uri=udp://239.1.1.1:5004 \ caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264"\ ! .recv_rtp_sink_0 gstrtpbin ! queue max-size-buffers=0 max-size-time=0 ! \ rtpmp2tdepay ! mpegtsdemux name=tsdem tsdem. ! queue max-size-buffers=0 max-size-time=0 ! \ vpudec ! mfw_isink sync=false tsdem. tsdem. ! queue max-size-buffers=0 max-size-time=0 ! \ beepdec ! alsasink sync=false -vvv
Java
How to install Java
Linux Kernel
Get kernel configs from running OS
You can get the .config file in running Linux OS by the following command.
# zcat /proc/config.gz > current.config
Furthermore, this feature is enabled by CONFIG_IKCONFIG_PROC.
Debug kernel panic and oops
To enable kernel symbols & debug information, you have to turn on these options and re-build kernel image. Just remember to keep the vmlinux & System.map files for debugging. They should be located at kernel root folder.
CONFIG_DEBUG_KERNEL=y CONFIG_KALLSYMS=y CONFIG_DEBUG_INFO=y # CONFIG_DEBUG_INFO_REDUCED is not set
Here is an example of Oops case.
Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = d8e3c000 [00000000] *pgd=68d76831, *pte=00000000, *ppte=00000000 Internal error: Oops: 17 [#1] PREEMPT SMP ARM Modules linked in: CPU: 1 PID: 1030 Comm: pulseaudio Not tainted 3.14.52-svn2009 #3 task: d8f90000 ti: d8b6c000 task.ti: d8b6c000 PC is at dac_get_volsw+0x60/0x74 LR is at dac_get_volsw+0x5c/0x74 pc : [<80558e68>] lr : [<80558e64>] psr: 60070013 sp : d8b6dea8 ip : 00000000 fp : d8617400 r10: 7ef214f8 r9 : d8b6c000 r8 : d866e280 r7 : d861757c r6 : d8617600 r5 : d8948800 r4 : 00000000 r3 : 00000000 r2 : 00000000 r1 : 00000001 r0 : 0000e564 Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user Control: 10c53c7d Table: 68e3c04a DAC: 00000015 Process pulseaudio (pid: 1030, stack limit = 0xd8b6c238) Stack: (0xd8b6dea8 to 0xd8b6e000) dea0: 80558e08 00000001 d8948800 80535bf4 f01ad000 d861757c dec0: 00000000 00000009 00000009 00000009 0035f648 00000000 00000000 00000000 dee0: 00000000 00000000 00000000 80967f28 00000007 8001a3c4 6df18338 d8b6dfb0 df00: 00000003 0035f960 7ef21aa4 d80cb410 7ef214f8 d87d53c0 c2c85512 0000000d df20: d8b6c000 00000000 7ef217f4 800e7f4c d87d53c8 800ebfc0 6ddcf000 800d2e14 df40: 80962860 0000000d 0035ccf8 8069fa10 0000000d 800f19e4 d87d53c0 d87d53c0 df60: 7ef21d94 8069fc88 00000802 d87d53c0 7ef214f8 d87d53c0 c2c85512 0000000d df80: d8b6c000 00000000 7ef217f4 800e8140 00361b58 00361cbc 00000000 00000036 dfa0: 8000e5e4 8000e460 00361b58 00361cbc 0000000d c2c85512 7ef214f8 0035cdd8 dfc0: 00361b58 00361cbc 00000000 00000036 00361ab0 00361b68 00000007 7ef217f4 dfe0: 6dfa73ac 7ef214ec 6df0efa4 76a5ecbc 20070010 0000000d 00000000 00000000 [<80558e68>] (dac_get_volsw) from [<80535bf4>] (snd_ctl_ioctl+0x5dc/0xb18) [<80535bf4>] (snd_ctl_ioctl) from [<800e7f4c>] (do_vfs_ioctl+0x3dc/0x59c) [<800e7f4c>] (do_vfs_ioctl) from [<800e8140>] (SyS_ioctl+0x34/0x5c) [<800e8140>] (SyS_ioctl) from [<8000e460>] (ret_fast_syscall+0x0/0x38) Code: e26330fc e585304c eb0501a0 e30e0564 (e5941000) ---[ end trace 7c4f0a24c41cc488 ]---
1. Check the PC (Program Counter) to find out where crash occurs.
PC is at dac_get_volsw+0x60/0x74
2. Grep dac_get_volsw() in System.map and get the symbol name address
$ cd <kernel root folder>
$ grep dac_get_volsw System.map
80558e08 t dac_get_volsw
Note: You can find the program counter is equaled to the sum of function entry address & offset.
pc : [<80558e68>] = 80558e08 + 0x60
3. Run addr2line to read the exact line number in source code.
$ arm-linux-gnueabi-addr2line -f -e vmlinux 80558e68 dac_get_volsw /home/root/Projects/Linux/fsl-yocto-3.14.52_1.1.0/linux-imx/sound/soc/codecs/sgtl5000.c:335
4-1. In alternative way, you can run objdump to get the disassembly and source code mapping.
$ arm-linux-gnueabi-objdump -DS vmlinux > kernel.objdump
Note: This step may take very long time to generate the dump file. So, maybe you can stop it, once you can find the function symbols in the file.
4-2. Find dac_get_volsw() in kernel.objdump, and check the pc address [<80558e68>]. Then, you can find the problem occurs at the same line of source code.
80558e08 <dac_get_volsw>: * ------------------------------ * userspace value 0xc0 0 */ static int dac_get_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { 80558e08: e92d4038 push {r3, r4, r5, lr} 80558e0c: e1a05001 mov r5, r1 ... //TEST printk("crash test!\n"); 80558e60: eb0501a0 bl 806994e8 <printk> printk("%d\n", *p); 80558e64: e30e0564 movw r0, #58724 ; 0xe564 80558e68: e5941000 ldr r1, [r4] 80558e6c: e3480080 movt r0, #32896 ; 0x8080 80558e70: eb05019c bl 806994e8 <printk>
Dynamic Voltage and Frequency Scaling (DVFS)
CPUFreq & OPP
CPUFreq is a feature in Linux kernel to allow users to change the clock speed of the CPUs. It can save battery power, because the lower the clock speed, the less power the CPU consumes. Different SoC vendors should implement their own mapping table for CPU frequency and voltage pairs. These pairs that the device will support per domain are called Operating Performance Points or OPPs.
Below are OPP tables for each platform:
NXP i.MX6 Quad/Dual
CPU Frequency (kHz) | Voltage (uV) |
1200000 (*) | 1275000 |
996000 (*) | 1250000 |
852000 (*) | 1250000 |
792000 | 1175000 |
396000 | 975000 |
(*) The highest frequency depends on the CPU types (08/10/12 which means 800MHz, 1GHz, and 1.2GHz respectively). Now most our projects are 1GHz.
NXP i.MX6 Dual Lite/Solo
CPU Frequency (kHz) | Voltage (uV) |
996000 | 1250000 |
792000 | 1175000 |
396000 | 1150000 |
TI AM335x
CPU Frequency (kHz) | Voltage (uV) |
1000000 | 1325000 |
800000 | 1260000 |
720000 | 1200000 |
600000 | 1100000 |
300000 (*) | 1100000 |
(*) We disable this frequency after V1.140.
TI AM57xx
CPU Frequency (kHz) | Voltage (uV) |
1500000 | 1210000 |
1176000 | 1160000 |
1000000 | 1060000 |
Qualcomm APQ8016
CPU Frequency (kHz) | Voltage (uV) |
1209600 | 1350000 |
1152000 | 1350000 |
1094400 | 1350000 |
998400 | 1350000 |
800000 | 1150000 |
533330 | 1150000 |
400000 | 1050000 |
200000 | 1050000 |
CPU Governor
In order to offer dynamic frequency scaling, Linux kernel provides a feature named "cpufreq governors". There are 6 modes in recent version.
Governor | Description |
performance | Set the CPU to the highest frequency |
powersave | Set the CPU to the lowest frequency |
userspace | Allows the user to set the CPU to a specific frequency by making a sysfs file "scaling_setspeed" available in the CPU-device directory. |
ondemand | Sets the CPU depending on the current usage. |
conservative | Much like the "ondemand" governor, sets the CPU depending on the current usage. It differs in behavior in that it gracefully increases and decreases the CPU speed rather than jumping to max speed the moment there is any load on the CPU. |
interactive | Sets the CPU speed depending on usage, similar to "ondemand" and "conservative" governors, but with a different set of configurable behaviors. It's is designed for latency-sensitive, interactive workloads. |
For more CPU frequency settings, you can check the path below.
$ ls /sys/devices/system/cpu/cpu0/cpufreq/ affected_cpus cpuinfo_transition_latency scaling_cur_freq scaling_min_freq cpuinfo_cur_freq related_cpus scaling_driver scaling_setspeed cpuinfo_max_freq scaling_available_frequencies scaling_governor stats cpuinfo_min_freq scaling_available_governors scaling_max_freq
For example, you can list the available governor, and know current governor.
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors interactive conservative userspace powersave ondemand performance $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ondemand
You can change to new governor.
$ echo "performance" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor performance
In ondemand, interactive or conservative mode, you can configure further.
$ ls /sys/devices/system/cpu/cpufreq/ondemand ignore_nice_load powersave_bias sampling_rate up_threshold io_is_busy sampling_down_factor sampling_rate_min $ ls /sys/devices/system/cpu/cpufreq/interactive above_hispeed_delay boostpulse_duration io_is_busy timer_rate boost go_hispeed_load min_sample_time timer_slack boostpulse hispeed_freq target_loads $ ls /sys/devices/system/cpu/cpufreq/conservative down_threshold ignore_nice_load sampling_rate up_threshold freq_step sampling_down_factor sampling_rate_min
NFS
boot up to Linux
The following operations demonstrate how to boot-up RSB-4410(4410LBV3480/4410LBV2080) with loading kernel image and mounting the root filesystem via NFS.
- prerequisites for NFS server (e.g. ip: 172.22.15.145)
- NFS root
- add the following line to /etc/exports
<tt><small>/NFS *(rw,sync,wdelay,hide,nocrossmnt,insecure,no_root_squash,no_all_squash,subtree_check,secure_locks,acl,anonuid=65534,anongid=65534)</small></tt>
- execute the following command to export all directories
- $ sudo exportfs -a
- make one copy of the individual BSP's rootfs located in the directory, /NFS
- for 4410LBV3480
- copy the following three files included in 4410LBV3480 to /NFS/rsb-4410_rootfs
- uImage imx6q-rsb4410.dtb u-boot_crc.bin
- for 4410LBV2080
- copy the uImage (which CONFIG_ROOT_NFS is set) to /NFS/4410lbv2
- set the following lines to /NFS/4410lbv2/etc/rc.d/rc.conf
export DEPLOYMENT_STYLE="NFS"
export IPADDR0="dhcp"
- u-boot
- Hit any key to stop autoboot then perform the following commands:
- for 4410LBV3480
> setenv serverip 172.22.15.145; setenv autoload n; dhcp
> setenv nfsroot /NFS/rsb-4410_rootfs
> run netargs
> nfs ${loadaddr} ${nfsroot}/${uimage}
> nfs ${fdt_addr} ${nfsroot}/${fdt_file}
> bootm ${loadaddr} - ${fdt_addr}
- for 4410LBV2080
> setenv serverip 172.22.15.145; setenv autoload n; dhcp
> setenv nfsroot /NFS/4410lbv2
> setenv bootargs_base ${bootargs_base} 'fec_mac=${ethaddr}'
> run bootargs_base bootargs_nfs
> nfs ${loadaddr} ${nfsroot}/uImage
> bootm
- screenshot
boot up to U-Boot
The following operations demonstrate how to boot-up RSB-4410(4410LBV3480) with loading u-boot via NFS.
- Keep the DEL key pressed in terminal emulator, then reset RSB-4410.
- While "SPL >" shows up, release the DEL key, and type "CTRL+C" in terminal emulator to clear all invisible keystrokes.
- SPL
> setenv serverip 172.22.15.145
> dhcp
> nfs ${loadaddr} /NFS/rsb-4410_rootfs/u-boot_crc.bin
> go ${loadaddr}
- Screenshot
OpenCV
Open source computer vision
Python
Install Python
Qt
Setting-up QtCreator to cross compile for iMX6 series]
Writing the Qt application with displaying Chinese
The section will demonstrate how to install Chinese font, and let Qt application to display Chinese; all operations are performed with RSB-4410 (4410A1LIV6000) and Ubuntu 12.04.
- install Chinese font
- On target side (RSB-4410)
- Please refer to this for details.
- On host side (Ubuntu 12.04)
- perform the following command
# sudo apt-get install ttf-wqy-microhei
- start QtCreator (on host side)
- create one project named hello_qt that contains one label which text is "哈囉 Qt" and font is "WenQuanYi Micro Hei, 72"
- (please refer to Setting-up QtCreator to cross compile for iMX6 series if needed)
- build , deploy and run
- create one project named hello_qt that contains one label which text is "哈囉 Qt" and font is "WenQuanYi Micro Hei, 72"
SSH
SSH connection
TFTP
boot up to Linux
The following operations demonstrate how to boot-up RSB-4410(4410LBV3480/4410LBV2080) with loading kernel image via TFTP and mounting the root filesystem via NFS.
- prerequisites for NFS server (This section is identical with the one of NFS.)
- prerequisites for TFTP server (e.g. ip: 172.22.15.145)
- /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
}
- /etc/services
tftp 69/tcp
tftp 69/udp
- restart the xinetd service
- u-boot
- Hit any key to stop autoboot then perform the following commands:
- for 4410LBV3480
> setenv serverip 172.22.15.145
> setenv nfsroot /NFS/rsb-4410_rootfs
> run netboot
- for 4410LBV2080
> setenv serverip 172.22.15.145; setenv autoload n; dhcp
> setenv nfsroot /NFS/4410lbv2
> setenv bootargs_base ${bootargs_base} 'fec_mac=${ethaddr}'
> run bootcmd_net
WiFi AP mode
The following operations demonstrate how to turn UBC-220(U220LBV8220) with EMM-160M2 plugged to a wireless AP.
before buildinging sdcard image
- ./meta-advantech/meta-fsl-imx6/recipes-fsl/images/fsl-image-adv.inc
- add the following line
IMAGE_INSTALL += " hostapd "
- If you also want to setup bridge, add the following line
IMAGE_INSTALL += " bridge-utils "
after booting-up
- /etc/sysctl.conf
net.ipv4.ip_forward=1
- /etc/network/interfaces
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
auto lo
iface lo inet loopback
# Wired or wireless interfaces
auto eth0
iface eth0 inet dhcp
auto eth0:0
iface eth0:0 inet static
address 192.168.203.220
netmask 255.255.255.0
# Wireless interfaces
auto wlan0
#allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8
- /etc/network/if-up.d/dhcp_ap
#!/bin/sh
case $IFACE in
eth0)
udhcpc -i eth0
;;
wlan0)
hostapd -B /etc/hostapd.conf
udhcpd
;;
esac
- /etc/udhcpd.conf
start 192.168.1.101
end 192.168.1.254
interface wlan0
pidfile /var/run/udhcpd.pid
opt dns 192.168.1.1
option subnet 255.255.255.0
opt router 192.168.1.1
opt wins 192.168.1.1
option lease 864000
- /etc/hostapd.conf
interface=wlan0
driver=nl80211
ssid=UBC220AP
hw_mode=g
channel=11
wpa=1
wpa_passphrase=UBC220AP
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
wpa_ptk_rekey=600
ctrl_interface=/var/run/hostapd
- reboot the device
after reboot
You have to setup IP forwarding. There are two different methods to configure.
Method 1 : Modify IP table
iptables -t nat -F
iptables -F
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
Method 2 : Set up bridge
- Modify /etc/network/interfaces
auto lo br0
iface lo inet loopback
# Wired or wireless interfaces
auto eth0
iface eth0 inet dhcp
auto eth0:0
iface eth0:0 inet static
address 192.168.203.220
netmask 255.255.255.0
# Wireless interfaces
auto wlan0
#allow-hotplug wlan0
iface wlan0 inet manual
iface br0 inet static
bridge_ports wlan0 eth0
address 192.168.1.1
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8
- Add this line into /etc/hostapd.conf
bridge=br0
Yocto
In this section, we share some tips to use & modify BB files and related configurations for Yocto.
How to delete temporary workspace after build process
By default, the build system preserves the temporary files under the ${TMPDIR}/work directory of each recipe for inspection and possible debugging purposes. If you would rather have these files deleted to save disk space as the build progresses, you can enable rm_work by adding the following to your local.conf file, which is found in the Build Directory.
INHERIT += "rm_work"
To exclude some recipes from having their work directories deleted by rm_work, you can add the names of the recipe or recipes you are working on to the RM_WORK_EXCLUDE variable, which can also be set in your local.conf file. Here is an example:
RM_WORK_EXCLUDE += "busybox glibc"
How to get multi-sources from GIT server
You can assign a name to distinguish the different GIT URIs, and define different destsuffix to save them respectively. Furthermore, to override SRCREV with the name, you can assign different commit id for each GIT branch.
SRC_URI = " \
git://git.allseenalliance.org/gerrit/core/alljoyn.git
- protocol=https;branch=${GIT_BRANCH};name=router;destsuffix=git/core/alljoyn \git://git.allseenalliance.org/gerrit/services/base.git
- protocol=https;branch=${GIT_BRANCH};name=services;destsuffix=git/services/base \ file
- //modify_flags_for_yocto.patch" SRCREV_router = "0d71b216bb3a3cadc615c3eda6f8200093c5e117" SRCREV_services = "403cda579242701d42d2d7c0da308d63a8f46070"
Skip QA check
You can skip the specific QA check for your packages. For details, check the insane.bbclass bbclass in Yocto Project Reference Manual.
INSANE_SKIP_${PN} += "dev-so"
Create BB file to install pre-built SO binaries
Below is an example to add SO binaries into your image. You may need to modify the blue items for your make install path & library name.
SRC_URI = "file://test.tar.gz" S = "${WORKDIR}/test" do_install() { install -d ${D}/usr/lib cp -axr ${S}/lib*.* ${D}/usr/lib/ } # Avoid package splitting into run-time and debug components INHIBIT_PACKAGE_DEBUG_SPLIT = "1" # Avoid QA Error for already-stripped INHIBIT_PACKAGE_STRIP = "1" # List the files for Package FILES_${PN} += "/usr/lib" # Put all SO files in main rpm package FILES_SOLIBSDEV = "" INSANE_SKIP_${PN} += "dev-so" # Set alias name to satisfy runtime dependencies RPROVIDES_${PN} = "libtest-1.00.so"
Install Node-RED packages
For Node-RED package installation, you can refer to the example below. Please note this example is based on the imyller's meta-nodejs layer for Node.js infrastructure.
SRC_URI = "
git://github.com/ADVANTECH-Corp/node-red-contrib-alljoyn.git
- protocol=git" SRCREV = "677333b1ed1a26a966c32d98af073d0b9a2b9088" S = "${WORKDIR}/git" # Inherit NPM class inherit npm-install-global # Do node-gyp rebuild in do_install() phase NPM_INSTALL_FLAGS = "--unsafe-perm" # Skip QA check INSANE_SKIP_${PN} = "staticdev"
How to add additional gst-plugins
- add new settings in Yocto's conf/local.conf
LICENSE_FLAGS_WHITELIST = "commercial"
COMMERCIAL_AUDIO_PLUGINS ?= " \
gst-plugins-ugly-mad \
gst-plugins-ugly-mpegaudioparse \
"
COMMERCIAL_VIDEO_PLUGINS ?= " \
gst-plugins-ugly-mpeg2dec \
gst-plugins-ugly-mpegstream \
gst-plugins-bad-mpegvideoparse \
"
CORE_IMAGE_EXTRA_INSTALL += " \
gst-plugins-bad-mpegtsdemux \
gst-plugins-bad-fbdevsink \
gst-ffmpeg \
"
- overwrite original hash code specified in the recipe x264_git
cat << EOF > meta-advantech/recipes-multimedia/x264/x264_git.bbappend
SRCREV = "ffc3ad4945da69f3caa2b40e4eed715a9a8d9526"
EOF
- snapshot verified
How to use Yocto Project Application Development Toolkit (ADT)
(see Setting-up Eclipse Plug-in to cross compile for iMX6 series)
How to add & use Chromium browser
- add new settings in conf/local.conf
LICENSE_FLAGS_WHITELIST = "commercial"
CORE_IMAGE_EXTRA_INSTALL += "chromium"
- switch "OpenGL ES H/W acceleration" on
- edit /usr/share/applications/google-chrome.desktop
[Desktop Entry]
...
Exec=/usr/bin/google-chrome --use-gl=egl %U
...
- HTML5 scores
CC2650 Sensortag
CC2650STK – Multi standard supporting Bluetooth low energy, 6LoWPAN, and ZigBee.
These web pages provides gives details for CC2650 :
Set up bluetooth module
1. Enable RFKill configure in kernel
+ CONFIG_RFKILL=y
2. Mount your bluetooth driver
3. Install bluez5 package on Yocto
IMAGE_INSTALL += " bluez5 "
Test Sensor
Enable bluetooth function
hciconfig hci0 up
You can check your bluetooth device by
hcitool dev | grep hci
Scanning sensor by
hcitool lescan
It will find the CC2650 sensortag
LE Scan ... 00:00:00:00:00:00 (unknown) B0:B4:48:B8:DB:02 CC2650 SensorTag B0:B4:48:B8:DB:02 CC2650 SensorTag ...
If your device name shows unknown, you have to update this patch to hcitool of bluez5.
You can use gatttool of bluze5 to get sensor data from SensorTag:
Interactive mode:
gatttool -b B0:B4:48:B8:DB:02 -I connect char-write-cmd 0x24 01 char-read-hnd 0x21 exit
Command line:
gatttool -b B0:B4:48:B8:DB:02 --char-write --handle 0x24 --value 01 gatttool -b B0:B4:48:B8:DB:02 --char-read --handle 0x21
Set up NodeRed
1. Install sensortag and node-red-node-sensortag by npm on your target board.
npm install sensortag npm install node-red-node-sensortag
2. Drag the following nodes from the left bar in Node-Red browser interface
- sensorTag
- Debug
3. Fill the MAC of your SensorTag in the UUID blank
4. Click on the Deploy button.
Reference: Started With Node-RED
Sending Data to Azure IoT Hub by NodeRed
1. To install node-red-contrib-azure-iot-hub on your target board.
npm install -g node-red-contrib-azure-iot-hub
2. Paste the following code into the "Import nodes" dialog
[{"id":"3dc559f2.f78a56","type":"azureiothubregistry","z":"ee5c9c0f.63449","name":"Azure IoT Hub Registry","x":398,"y":449,"wires":"8810a39.828d76"},{"id":"1babf1f6.57f37e","type":"inject","z":"ee5c9c0f.63449","name":"Register Payload","topic":"","payload":"{\"deviceId\": \"device160\"}","payloadType":"json","repeat":"","crontab":"","once":false,"x":168,"y":449,"wires":"3dc559f2.f78a56"},{"id":"8810a39.828d76","type":"debug","z":"ee5c9c0f.63449","name":"Log","active":true,"console":"false","complete":"true","x":678,"y":449,"wires":[]},{"id":"8409d8b1.98cfb8","type":"debug","z":"ee5c9c0f.63449","name":"Log","active":true,"console":"false","complete":"true","x":678,"y":389,"wires":[]},{"id":"48ebe85c.f1a238","type":"azureiothub","z":"ee5c9c0f.63449","name":"Azure IoT Hub","protocol":"mqtt","x":368,"y":389,"wires":"8409d8b1.98cfb8"},{"id":"74099c94.1dc994","type":"inject","z":"ee5c9c0f.63449","name":"Send Payload","topic":"","payload":"{ \"deviceId\": \"device150\", \"key\": \"HostName=AdvTest.azure-devices.net;DeviceId=device150;SharedAccessKey=qkPiSp247kpsrfF6iRFVpTDcnd9Gm2+NzsjPergqyWE=\", \"protocol\": \"mqtt\", \"data\": \"{tem: 25, wind: 20}\" }","payloadType":"json","repeat":"","crontab":"","once":false,"x":158,"y":389,"wires":"48ebe85c.f1a238"}]
3. To Register your SensorTag to your Azure IoT Hub Server
- Double click on Register Payload Node to fill following code format in Node-Red browser interface.
For example:
{"deviceId": "device167"}
- Double click on Azure IoT Hub Registry Node to fill following code format in Node-Red browser interface.
For example:
HostName=AdvTest.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=rsIruTdoINPSjUy7YyF2T1DJ1pTiFY+jrswbPc4ybyk=
4. To send data to Azure IoT Hub
- Double click on Send Payload Node to fill information followed payload format in Node-Red browser interface.
For example:
{ "deviceId": "device143", "key": "LLgyZaqAwYXk1uidzM27aO1YIA76fjv55Zs7unExFz8=", "protocol": "http", "data": "{tem: 25, wind: 20}" }
- Double click on Azure IoT Hub Node to fill information
For example:
Name: Azure IoT Hub Protocol: http Hostname: AdvTest.azure-devices.net
Reference: node-red-contrib-azure-iot-hub
Note:
1. If it can not connect to Azure IoT Hub, you maybe reinstall node-gyp.
npm install -g node-gyp
2. Check status of connection with Azure IoT Hub
DeviceExplorer
Sending Data to Azure IoT Hub by tools of Azure IoT SDK
We suggest all operations of compiling AZure IoT Hub on Docker Images because it will be updated some packages of OS after the following steps,
Get source code
git clone --recursive https://github.com/azure/azure-iot-sdk-c.git
Compilation
1. Upgrade CMake
sudo add-apt-repository ppa:kalakris/cmake sudo apt-get update
2. Set up environment
sudo ./build_all/linux/setup.sh
3. To create one new build environment of Yocto
For example:
EULA=1 DISTRO=fsl-imx-x11 MACHINE=imx6qrom7420a1 source fsl-setup-release.sh -b build-x11
4. Create cmake file, yocto_1.7.cmake, depended on your Yocto SDK environment in ./buill_all/linux
# compiler include(CMakeForceCompiler) # this is required SET(CMAKE_SYSTEM_NAME Linux) SET(CMAKE_SYSTEM_PROCESSOR arm) SET(CMAKE_SYSTEM_VERSION 1) SET(CMAKE_SYSROOT /opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi) cmake_force_c_compiler(/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc GNU) cmake_force_cxx_compiler(/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ GNU) # sysroot location set(MYSYSROOT /opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi) # compiler/linker flags add_definitions("--sysroot=${MYSYSROOT}") # compiler/linker flags add_definitions("--sysroot=${MYSYSROOT}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a -std=gnu99 -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE) set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -std=gnu99 -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -std=gnu99 -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -std=gnu99 -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE) # cmake built-in settings to use find_xxx() functions set(CMAKE_FIND_ROOT_PATH ${MYSYSROOT}) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
5. modify connectionString of your SensorTag in ./iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c
For example:
static const char* connectionString = "HostName=AdvTest.azure-devices.net;DeviceId=device143;SharedAccessKey=LLgyZaqAwYXk1uidzM27aO1YIA76fjv55Zs7unExFz8=";
6. Compile by
cd ./build_all/linux/ sudo ./build.sh --toolchain-file yocto_1.7.cmake
7. The output file is iothub_client_sample_http in ./cmake/iotsdk_linux/iothub_client/samples/iothub_client_sample_http/
Bluetooth
Install bluetooth tool on Debial/Ubuntu
sudo apt-get update sudo apt-get install bluetooth blueman bluez bluez-tools
Connect with smart phone
Connect with laptop
Bluetooth_Yocto
Test bluetooth tool on Yocto
GPS
Support on APQ8016 project
First install some packages (reference from "Using the onboard GPS" in Linaro)
sudo apt-get install gpsd-clients gnss-gpsd
Start service on DSP
systemctl start gpsd.socket systemctl start gpsd systemctl start qdsp-start systemctl start gnss-gpsd
Using gpsd client to monitor
gpsmon:
If you want to analyze NMEA sentences, you can reference information on NMEA
Touch
Support the Zytronic TOUCH on i.MX6 Yocto Liunx
Download the SWAP and Calibration Tools for zytronic.co.uk. http://zytronic.co.uk/support/downloads/
Linux Kernel : Need to enable CONFIG_HID_MULTITOUCH config
- CONFIG_HID_MULTITOUCH=y
Step1 : For your application, you need to SWAP or Calibration your panel.
Step2 : Download the tools from http://zytronic.co.uk/support/downloads/ .
Step3 : In ZXY100 32 Input Controller Drivers, choose your version (win7 ,win8 or win10).
Step4 : Unzip the "Windows-01-03-2016" folder.
Step4 : Plug into the usb.
Step5 : Run Zyconfig (Administrator) in ZyConfig_Tool_02.07.29_04.07.16.
Step6: If your application need to swap the x and y axes, your can choose the (Swap X-Y axes).
RT-Patch
Description
- Only support to patch patch_4.1.15_rt18_patch files on i.MX6 Liunx Yocto 2.1.
- Download file: File:RT Patch.zip
- Linux OS version: Yocto 2.1 (Krogoth, L4.1.15_2.0.0_ga)
- Patch patch_4.1.15_rt18_patch files to kernel code
Implementation Steps
- Set up the compiler environment. You can refer following URL to install tool chain
- Assuming the installation tool chain position is as follows
/opt/poky/2.1/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
- Generate kernel image (zImage)
Step 1: Enter the directory of kernel source code
$ cd linux-imx6/
Step 2: Patch two patch files to kernel code
$ patch -p1 -i 0001-patch-4.1.15-rt18.patch
$ patch -p1 -i 0002-add-defconfig-and-fix-compiler-failed-and-fix-error.patch
Step 3: Initialize the building environment
$ source /opt/poky/2.1/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
Step 4: Set the configuration of kernel
$ make imx_v7_adv_defconfig
Step 5: Build kernel image
$ make -j 4 zImage
After building kernel image, it will be generated kernel image (zImage) in "arch/arm/boot"
Step 6: Copy kernel image (zImage) to USB disk
- Insert the USB disk to the device and boot on the device
- After login the device, enter to USB disk directory. For Example:
$ cd /run/media/sda1
- Remove kernel image (zImage) from eMMC
$ rm /run/media/mmcblk0p1/zImage
$ sync
- Copy kernel image (zImage) to eMMC
$ cp zImage /run/media/mmcblk0p1/
$ sync
- Restart the device, the kernel image has RT feature.
Real-Time Kernel Performance
- cyclictest is a realtime benchmark tool. It can determine the realtime performance of your new preempt-rt patched kernel. For more detail about cyclictest, please refer below link
- I provide cyclictest test tool for i.MX6 in RT_Patch_and_Test_Tool.zip file
- Copy cyclictest test tool to the device
- Below command is an example of using cyclictest
$ ./cyclictest -p 90 -t5 -n
- The snapshot results show performance comparisons of non-RT patch and RT patch. The final column displays the maximum latency of real-time task.
Linux_Yocto_4.1.15 (Non real-time patch)
Linux_Yocto_4.1.15-rt18 (real-time patch)
- The RT kernel better performance than non-RT kernel in above results.
USB-Boot
Description
- Only support USB boot function on i.MX6 Liunx Yocto 2.1.
- Linux OS version: Yocto 2.1 (Krogoth, L4.1.15_2.0.0_ga)
Implementation Steps
- For example: Add USB boot function to UBC-220 project
- Modify in uboot-imx6/include/configs/mx6ubc220.h
@@ -10,6 +10,9 @@
#define __MX6QSABRESD_CONFIG_H
#ifdef CONFIG_SPL
+#define CONFIG_USB_BOOT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_LIBDISK_SUPPORT
#define CONFIG_SPL_LIBCOMMON_SUPPORT
#define CONFIG_SPL_MMC_SUPPORT
#include "imx6_spl_advantech.h"
@@ -86,7 +89,7 @@
#define CONFIG_USB_ETHER_ASIX
#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
#define CONFIG_MXC_USB_FLAGS 0
-#define CONFIG_USB_MAX_CONTROLLER_COUNT 1 /* Enabled USB controller number */
+#define CONFIG_USB_MAX_CONTROLLER_COUNT 2 /* Enabled USB controller number */
#endif
Customized GPIO Function
Description
- Only support USB boot function on i.MX6 Liunx Yocto 2.1.
- Linux OS version: Yocto 2.1 (Krogoth, L4.1.15_2.0.0_ga)
- For example: We implement a customized GPIO function for RSB-4411. We setting 20 GPIO pings.
- Input-High GPIO: GPIO1,GPIO3,GPIO5,GPIO7,GPIO9,GPIO11,GPIO13,GPIO15,GPIO17,GPIO19
- Output-Low GPIO: GPIO2,GPIO4,GPIO6,GPIO8,GPIO10,GPIO12,GPIO14,GPIO16,GPIO18,GPIO20
- Download file: Customized_GPIO_Function_Patch_Files.zip