liteSOM SDK
AGENDA
● Linux on embedded devices.● How to cross-compile software.● Device tree – why?● Build systems overview.● How to use Buildroot.● How to integrate custom
software with Buildroot.
AGENDA
3
Linux system architecture
4
Userspace
Linux kernel
Bootloader
Linux system architecture
5
cURL Qt json-c Python
UserspaceOpenSLL systemd ALSA ncurses
openVPN Wget nginx SQLite
Scheduler Device drivers
Linux kernelNetwork Filesystems
3rd stage bootloader
Bootloader2nd stage bootloader
1st stage bootloader
Linux system architecture
6
cURL Qt json-c Python
UserspaceOpenSLL systemd ALSA ncurses
openVPN Wget nginx SQLite
Scheduler Device drivers
Linux kernelNetwork Filesystems
2nd stage bootloaderBootloader
1st stage bootloader
Linux system architecture
7
custom software
UserspacecURL Qt json-c Python
OpenSLL systemd ALSA ncurses
OpenVPN Wget nginx SQLite
Scheduler Device drivers
Linux kernelNetwork Filesystems
2nd stage bootloaderBootloader
1st stage bootloader
1st stage bootloader
8
U-Boot - figures
9
● 16 architectures ● ARM● AVR32● m68k● Microblaze● MIPS● PowerPC● x86
U-Boot - figures
10
● 16 architectures● ~230 boards
● Raspberry Pi● BeagleBone● Amazon Kindle Fire● IMX6 Cubox-i● TP-LINK TL-WDR4300● Nokia N900● D-Link DNS-325
U-Boot - figures
11
● 16 architectures● ~230 boards
● Atmel AT91SAM9260● TI TMDSSK3358● Xilinx ZC706● Olimex MX23 Olinuxino● Intel Intel Galileo● NXP I.MX6 SABRE
U-Boot - figures
12
● 16 architectures● ~230 boards● 48 peripherals
● ADC converter● DMA● GPIO● I2C● Network● MMC● PWM● SPI● USB● Video
U-Boot - figures
13
● 16 architectures● ~230 boards● 48 peripherals● 9 filesystems
● coreboot ● cramfs● ext4● fat● JFFS2● ReiserFS● UBIFS● YAFFS2● ZFS
U-Boot – customized boot order
14
eMMC
RESET
U-Boot – customized boot order
15
eMMC SD
RESET RESET
U-Boot – customized boot order
16
eMMC
eMMC
SD SD
RESET RESET RESET
U-Boot – customized boot order
17
eMMC
eMMC
SD SD SD
LAN
RESET RESET RESET RESET
U-Boot – real use case
18
NAND
UART
USB
LAN
RESET
U-Boot – download source code
19
git clone git://git.freescale.com/imx/uboot-imx.git
U-Boot - compilation
20
git clone git://git.freescale.com/imx/uboot-imx.git
cd u-bootCROSS_COMPILE=arm-linux-gnueabihf- make liteboard_defconfigCROSS_COMPILE=arm-linux-gnueabihf- make
U-Boot – installation on SD card
21
git clone git://git.freescale.com/imx/uboot-imx.git
cd u-bootCROSS_COMPILE=arm-linux-gnueabihf- make liteboard_defconfigCROSS_COMPILE=arm-linux-gnueabihf- make
dd if=u-boot.imx of=/dev/<sd-card> bs=1k seek=1sync
source: i.MX 6UltraLite Applications Processor Reference Manual
U-Boot – running on liteboard
22
U-Boot 2015.04 (Sep 05 2016 – 12:34:38)
CPU: Freescale i.MX6UL rev1.0 at 396 MHzCPU: Temperature 42 CReset cause: PORBoard: Grinn liteBoardDRAM: 512 MiBMMC: FSL_SDHC: 0, FSL_SDHC: 1*** Warning - bad CRC, using default environment
In: serialOut: serialErr: serial
switch to partitions #0, OKmmc0 is current deviceNet: FEC0Error: FEC0 address not set.
Normal BootHit any key to stop autoboot: 0 switch to partitions #0, OKmmc0 is current deviceswitch to partitions #0, OKmmc0 is current device** No partition table - mmc 0 **** No partition table - mmc 0 **Booting from net …FEC0 Waiting for PHY auto negotiation to complete......... TIMEOUT !
U-Boot – customization
23
Linux
24
Linux - figures
25
● 32-bit architectures
– ARM, AVR32, Blackfin, c6x, m68k, Microblaze, MIPS, S+core, SPARC,
● 64-bit architectures
– Alpha, ARM64, IA-64,
Linux – lines of code
26
drivers (57%)arch (16%)fs (6%)sound (5%)net (4%)include (4%)documentation (3%)tools (1%)kernel (1%)firmware (>1%)lib (>1%)mm (>1%)scripts (>1%)crypto (>1%)security (>1%)block (>1%)
drivers (57%)arch (16%)fs (6%)sound (5%)net (4%)include (4%)documentation (3%)tools (1%)kernel (1%)firmware (>1%)lib (>1%)mm (>1%)scripts (>1%)crypto (>1%)security (>1%)block (>1%)
drivers (57%)arch (16%)fs (6%)sound (5%)net (4%)include (4%)documentation (3%)tools (1%)kernel (1%)firmware (>1%)lib (>1%)mm (>1%)scripts (>1%)crypto (>1%)security (>1%)block (>1%)
Linux – lines of code
27
source: free-electrons.com
drivers (57%)arch (16%)fs (6%)sound (5%)net (4%)include (4%)documentation (3%)tools (1%)kernel (1%)firmware (>1%)lib (>1%)mm (>1%)scripts (>1%)crypto (>1%)security (>1%)block (>1%)
Linux – download source code
28
git clone git://git.freescale.com/imx/linux-2.6-imx.git
Linux – default configuration
29
git clone git://git.freescale.com/imx/linux-2.6-imx.git
cd linuxARCH=arm CROSS_COMPILE=arm-linux- make imx_v7_defconfig
Linux – configuration
30
git clone git://git.freescale.com/imx/linux-2.6-imx.git
cd linuxARCH=arm CROSS_COMPILE=arm-linux- make imx_v7_defconfig
ARCH=arm CROSS_COMPILE=arm-linux- make menuconfig
Linux – compilation
31
git clone git://git.freescale.com/imx/linux-2.6-imx.git
cd linuxARCH=arm CROSS_COMPILE=arm-linux- make imx_v7_defconfig
ARCH=arm CROSS_COMPILE=arm-linux- make menuconfig
ARCH=arm CROSS_COMPILE=arm-linux- make zImage
Linux – modules
32
git clone git://git.freescale.com/imx/linux-2.6-imx.git
cd linuxARCH=arm CROSS_COMPILE=arm-linux- make imx_v7_defconfig
ARCH=arm CROSS_COMPILE=arm-linux- make menuconfig
ARCH=arm CROSS_COMPILE=arm-linux- make zImage
ARCH=arm CROSS_COMPILE=arm-linux- INSTALL_MOD_PATH=<dir>/ make modules_install
Linux – installation on SD card
33
U-Bootu-boot.imx
LinuxzImage
rootfs
↑ 1 kB
↑8 MB
↑24 MB
Linux – boot
34
U-Boot 2015.04 (Sep 05 2016 - 12:34:38)
CPU: Freescale i.MX6UL rev1.0 at 396 MHzCPU: Temperature 42 CReset cause: PORBoard: Grinn liteBoardDRAM: 512 MiBMMC: FSL_SDHC: 0, FSL_SDHC: 1*** Warning - bad CRC, using default environment
In: serialOut: serialErr: serialswitch to partitions #0, OKmmc0 is current deviceNet: FEC0Error: FEC0 address not set.
Normal BootHit any key to stop autoboot: 0 switch to partitions #0, OKmmc0 is current deviceswitch to partitions #0, OKmmc0 is current devicereading boot.scr** Unable to read file boot.scr **reading zImage6047040 bytes read in 280 ms (20.6 MiB/s)Booting from mmc ...reading imx6ul-liteboard.dtb** Unable to read file imx6ul-liteboard.dtb **Kernel image @ 0x80800000 [ 0x000000 - 0x5c4540 ]
Starting kernel ...
Linux – installation on SD card
35
U-Bootu-boot.imx
Linuxzimage
device-tree
rootfs
↑ 1 kB
↑8 MB
↑24 MB
Device tree
36
The devicetree is a data structure for describing hardware. Rather than hard coding every detail of a
device into an operating system, many aspects of the hardware can be described in a data structure that is
passed to the operating system at boot time.
source: www.devicetree.org
Device tree
37
The devicetree is used by OpenFirmware, OpenPOWER Abstraction Layer (OPAL), Power Architecture Platform Requirements (PAPR) and in the standalone Flattened
Device Tree (FDT) form.
source: www.devicetree.org
Device tree - example
38
&fec1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet1>;
phy-mode = "rmii"; phy-handle = <ðphy0>; status = "okay"; }
doc: Documentation/devicetree/bindings/net/fsl-fec.txt
Device tree - example
39
&fec1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet1>;
phy-mode = "rmii"; phy-handle = <ðphy0>; status = "okay"; }
mdio { ethphy0: ethernet-phy@0 { compatible = "smsc,lan8720"; reg = <0>; }
doc: Documentation/devicetree/bindings/net/fsl-fec.txt
doc: Documentation/devicetree/bindings/net/phy.txt
Device tree - example
40
&fec1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet1>;
phy-mode = "rmii"; phy-handle = <ðphy0>; status = "okay"; }
mdio { ethphy0: ethernet-phy@0 { compatible = "smsc,lan8720"; reg = <0>; }
pinctrl_enet1: enet1grp { fsl,pins = < MX6UL_PAD_GPIO1_IO07__ENET1_MDC 0x1b0b0 MX6UL_PAD_GPIO1_IO06__ENET1_MDIO 0x1b0b0 MX6UL_PAD_ENET1_RX_EN__ENET1_RX_EN 0x1b0b0 MX6UL_PAD__RX_ER__ENET1_RX_ER 0x1b0b0 MX6UL_PAD_ENET1_RX_DATA0__ENET1_RDATA00 0x1b0b0 MX6UL_PAD_ENET1_RX_DATA1__ENET1_RDATA01 0x1b0b0 MX6UL_PAD_ENET1_TX_EN__ENET1_TX_EN 0x1b0b0 MX6UL_PAD_ENET1_TX_DATA0__ENET1_TDATA00 0x1b0b0 MX6UL_PAD_ENET1_TX_DATA1__ENET1_TDATA01 0x1b0b0 MX6UL_PAD_ENET1_TX_CLK__ENET1_REF_CLK1 0x4001b031 >; }
doc: Documentation/devicetree/bindings/net/fsl-fec.txt
doc: Documentation/devicetree/bindings/net/phy.txt
docs: Documentation/devicetree/bindings/pinctrl/fsl,imx6ul-pinctrl.txtdocs: Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt
Device tree – pinmux
41
MX6UL_PAD_ENET1_RX_DATA0__ENET1_RDATA00 0x1b0b0
Device tree – pinmux
42
MX6UL_PAD_ENET1_RX_DATA0__ENET1_RDATA00 0x1b0b0
1
1 0 1 1 0 1 0 1 1 0 0
source: i.MX 6UltraLite Applications Processor Reference Manual
Device tree – pinmux
43
MX6UL_PAD_ENET1_RX_DATA0__ENET1_RDATA00 0x1b0b0
1
1 0 1 1 0 1 0 1 1 0 0
source: i.MX 6UltraLite Applications Processor Reference Manual
Slow Slew Rate, Drive Strength 43Ω, Speed medium(100MHz), 100KΩ Pull Up Enabled, Hysteresis Enabled
Device tree – default output
44
chosen { stdout-path = &uart1; };
&uart1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart1>; status = "okay"; };
pinctrl_uart1: uart1grp { fsl,pins = < MX6UL_PAD_UART1_TX_DATA__UART1_DCE_TX 0x1b0b1 MX6UL_PAD_UART1_RX_DATA__UART1_DCE_RX 0x1b0b1 >; };
doc: Documentation/devicetree/bindings/chosen.txt
doc: Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
docs: Documentation/devicetree/bindings/pinctrl/fsl,imx6ul-pinctrl.txtdocs: Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt
Device tree – peripheral configuration
45
uart1: serial@02020000 { compatible = "fsl,imx6ul-uart", "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02020000 0x4000>; interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6UL_CLK_UART1_IPG>, <&clks IMX6UL_CLK_UART1_SERIAL>; clock-names = "ipg", "per"; status = "disabled"; };
source: i.MX 6UltraLite Applications Processor Reference Manual
Device tree – peripheral configuration
46
uart1: serial@02020000 { compatible = "fsl,imx6ul-uart", "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02020000 0x4000>; interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6UL_CLK_UART1_IPG>, <&clks IMX6UL_CLK_UART1_SERIAL>; clock-names = "ipg", "per"; status = "disabled"; };
source: i.MX 6UltraLite Applications Processor Reference Manual
Device tree – peripheral configuration
47
uart1: serial@02020000 { compatible = "fsl,imx6ul-uart", "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02020000 0x4000>; interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6UL_CLK_UART1_IPG>, <&clks IMX6UL_CLK_UART1_SERIAL>; clock-names = "ipg", "per"; status = "disabled"; };
&uart1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart1>; status = "okay"; };
pinctrl_uart1: uart1grp { fsl,pins = < MX6UL_PAD_UART1_TX_DATA__UART1_DCE_TX 0x1b0b1 MX6UL_PAD_UART1_RX_DATA__UART1_DCE_RX 0x1b0b1 >; };
Device tree - imx6ul-liteboard.dts
48
● USB OTG● PHY● UART● SD
imx6ul-litesom.dtsi
imx6ul.dtsi
skeleton.dtsi
imx6ul-liteboard.dts
Device tree - imx6ul-litesom.dtsi
49
● DDR● eMMC● LDO
imx6ul-liteboard.dts
imx6ul.dtsi
skeleton.dtsi
imx6ul-litesom.dtsi
Device tree - imx6ul.dtsi
50
● CPU● interrupts● clocks● peripherals● LDO
imx6ul-liteboard.dts
imx6ul-litesom.dtsi
skeleton.dtsi
imx6ul.dtsi
Device tree - skeleton.dtsi
51
● skeleton device tree● the bare minimum
needed to boot
imx6ul-liteboard.dts
imx6ul-litesom.dtsi
imx6ul.dtsi
skeleton.dtsi
skeleton.dtsi
Device tree – imx6u-liteboard.dtb
52
imx6ul-liteboard.dts
imx6ul-litesom.dtsi
imx6ul.dtsi
imx6ul-liteboard.dtb
Linux – installation on SD card
53
U-Bootu-boot.imx
Linuxzimage
device-treeimx6ul-liteboard.dtb
rootfs
↑ 1 kB
↑8 MB
↑24 MB
First boot
54
Starting kernel ...
Booting Linux on physical CPU 0x0Linux version 4.1.15 (filug@gwork) (gcc version 4.9.3 (Buildroot 2016.08-git-gf51d8a9) ) #1 SMP PREEMPT Mon Sep 5 12:46:23 CEST 2016CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c53c7dCPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cacheMachine model: Grinn i.MX6UL liteBoardReserved memory: created CMA memory pool at 0x8c000000, size 320 MiBReserved memory: initialized node linux,cma, compatible id shared-dma-poolMemory policy: Data cache writeallocPERCPU: Embedded 12 pages/cpu @8bb37000 s16960 r8192 d24000 u49152Built 1 zonelists in Zone order, mobility grouping on. Total pages: 130048Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk0p2 rootwait rwPID hash table entries: 2048 (order: 1, 8192 bytes)Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)Memory: 178704K/524288K available (8351K kernel code, 435K rwdata, 2896K rodata, 428K init, 450K bss, 17904K reserved, 327680K cma-reserved, 0K highmem)
reading zImage6047040 bytes read in 280 ms (20.6 MiB/s)Booting from mmc ...reading imx6ul-liteboard.dtb26282 bytes read in 20 ms (1.3 MiB/s)Kernel image @ 0x80800000 [ 0x000000 - 0x5c4540 ]## Flattened Device Tree blob at 83000000 Booting using the fdt blob at 0x83000000 Using Device Tree in place at 83000000, end 830096a9
First boot
55
dhd_module_init insnvs_rtc 20cc000.snvs:snvs-rtc-lp: setting system clock to 1970-01-01 18:09:38 UTC (65378)ALSA device list: No soundcards found.VFS: Cannot open root device "mmcblk0p2" or unknown-block(179,2): error -6Please append a correct "root=" boot option; here are the available partitions:0100 65536 ram0 (driver?)0101 65536 ram1 (driver?)0102 65536 ram2 (driver?)0103 65536 ram3 (driver?)0104 65536 ram4 (driver?)0105 65536 ram5 (driver?)0106 65536 ram6 (driver?)0107 65536 ram7 (driver?)0108 65536 ram8 (driver?)0109 65536 ram9 (driver?)010a 65536 ram10 (driver?)010b 65536 ram11 (driver?)010c 65536 ram12 (driver?)010d 65536 ram13 (driver?)010e 65536 ram14 (driver?)010f 65536 ram15 (driver?)b300 3813376 mmcblk0 driver: mmcblk b301 16384 mmcblk0p1 00000000-01b308 1875968 mmcblk1 driver: mmcblkb320 128 mmcblk1rpmb (driver?)b318 1024 mmcblk1boot1 (driver?)b310 1024 mmcblk1boot0 (driver?)Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,2)---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,2)
Busybox – minimal rootfs
56
BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides
replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc.
Busybox – configuration
57
Busybox – network utilities
58
Busybox – editors
59
Busybox – archival utilities
60
Busybox – archival utilities
61
Busybox – minimal rootfs
62
# ls -l /bin/total 641lrwxrwxrwx 1 root root 7 Sep 5 2016 ash -> busybox-rwsr-xr-x 1 root root 654012 Sep 5 2016 busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 cat -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 catv -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 chattr -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 chgrp -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 chmod -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 chown -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 cp -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 cpio -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 date -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 dd -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 df -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 dmesg -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 dumpkmap -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 echo -> busybox
Busybox – compilation
63
git clone git://busybox.net/busybox.git
cd busybox
make defconfigmake menuconfig
CROSS_COMPILE=arm-linux-gnueabihf- make
CROSS_COMPILE=arm-linux-gnueabihf- install
Busybox – compilation output
64
_install/├── bin│ ├── ash -> busybox│ ├── base64 -> busybox│ ├── busybox… …│ └── zcat -> busybox├── linuxrc -> bin/busybox├── sbin│ ├── acpid -> ../bin/busybox… …│ └── zcip -> ../bin/busybox└── usr ├── bin │ ├── [ -> ../../bin/busybox … … │ └── yes -> ../../bin/busybox └── sbin ├── addgroup -> ../../bin/busybox … └── udhcpd -> ../../bin/busybox
Busybox – running
65
?
Busybox – running
66
?
missing
● shared libraries,● configuration files,● user accounts,● confiuration for
peripherials.
Network Manager
67
NetworkManager is a set of co-operative tools that make networking simple and
straightforward.
Whether WiFi, wired, 3G, or Bluetooth, NetworkManager allows you to quickly move
from one network to another.
Once a network has been configured and joined once, it can be detected and re-joined
automatically the next time it's available.
Network Manager - dependencies
68
networkmanager
Network Manager - dependencies
69
networkmanager
ppp
An implementation of the Point-to-point protocol.
Network Manager - dependencies
70
networkmanager
pppzlib
Standard (de)compression library.Used by things like gzip and libpng.
Network Manager - dependencies
71
networkmanager
mm pppzlib
ModemManager is a DBus-activated daemon whichcontrols mobile broadband (2G/3G/4G) devices and connections.
Network Manager - dependencies
72
libgudev
networkmanager
mm pppzlib
This library provides GObject bindings for libudev.
Network Manager - dependencies
73
dbus-glib
libgudev
networkmanager
mm pppzlib
GLib bindings for D-Bus.
Network Manager - dependencies
74
dbus-glib
libgudev
networkmanager
mm pppzlib
pcre
Perl Compatible Regular Expressions.
Network Manager - dependencies
75
dbus-glib
libgudev
networkmanager
mm pppzlib libffi
pcre
The libffi library provides a portable,high level programming interface to various calling conventions.
Network Manager - dependencies
76
dbus-glib
libndp libgudev
networkmanager
mm pppzlib libffi
pcre
This package contains a library which provides a wrapper for IPv6 Neighbor Discovery Protocol.
Network Manager - dependencies
77
dbus-glib readline
libndp libgudev
networkmanager
mm pppzlib libffi
pcre
The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in.
Network Manager - dependencies
78
dbus-glib readline
libndp libgudev
networkmanager
mm pppzlib libffi
pcre ncurses
The Ncurses (new curses) library is a free software emulation of curses in System V Release 4.0, and more.
Network Manager - dependencies
79
dbus-glib
util-linux
readline
libndp libgudev
networkmanager
mm pppzlib libffi
pcre ncurses
Various useful/essential linux libraries and utilities.Things like mkfs, mkswap, swapon, fdisk, mount, dmesg, etc...
Network Manager - dependencies
80
dbus-glibwireless
tools
util-linux
readline
libndp libgudev
networkmanager
mm pppzlib libffi
pcre ncurses
A collection of tools to configure wireless lan cards.
Network Manager - dependencies
81
dbus-glib
libcrypt
wirelesstools
util-linux
readline
libndp libgudev
networkmanager
mm pppzlib libffi
pcre ncurses
GNU's basic cryptographic library.
Network Manager - dependencies
82
dbus-glib
libcrypt
wirelesstools
util-linux
readline
libndp libgudev
networkmanager
mm pppzlib libffi
pcre ncurseslibgpgerror
Libgpg-error is a small library with error codes anddescriptions shared by most GnuPG related software.
Network Manager - dependencies
83
dbus-glib gnutls
libcrypt
wirelesstools
util-linux
readline
libndp libgudev
networkmanager
mm pppzlib libffi
pcre ncurseslibgpgerror
Secure communications library implementingthe SSL and TLS protocols and technologies around them.
Network Manager - dependencies
84
libtasn1
dbus-glib gnutls
libcrypt
wirelesstools
util-linux
readline
libndp libgudev
networkmanager
mm pppzlib libffi
pcre ncurseslibgpgerror
ASN.1 (Abstract Syntax Notation One) library.
Network Manager - dependencies
85
libtasn1
dbus-glib gnutls
libcrypt
wirelesstools
util-linux
readline
libndp libgudev
networkmanager
mm pppzlib libffi
pcre ncurseslibgpgerror
nettle
Nettle is a cryptographic library that is designedto fit easily in more or less any context.
Network Manager - dependencies
86
libtasn1
gmp
dbus-glib gnutls
libcrypt
wirelesstools
util-linux
readline
libndp libgudev
networkmanager
mm pppzlib libffi
pcre ncurseslibgpgerror
nettle
GNU Multiple Precision Arithmetic Library.
Network Manager - dependencies
87
libtasn1
gmp
dbus-glib
libnl
gnutls
libcrypt
wirelesstools
util-linux
readline
libndp libgudev
networkmanager
mm pppzlib libffi
pcre ncurseslibgpgerror
nettle
A library for applications dealing with netlink socket.
Network Manager - dependencies
88
libtasn1
gmp
dbus-glib
libnl
gnutls
libcrypt
wirelesstools
util-linux
readline
libndp libgudev
networkmanager
mm pppzlib
libglib2
libffi
pcre ncurseslibgpgerror
nettle
Low-level core library that forms the basis of GTK+ and GNOME.
Network Manager - dependencies
89
libtasn1
gmp
dbus-glib
libnl
gnutls
libcrypt
wirelesstools
util-linux
readline
libndp libgudev
networkmanager
mm pppzlib
libglib2
libffi
pcre ncurseslibgpgerror
nettle
dbus
Message bus system.
Network Manager - dependencies
90
libtasn1
gmp
dbus-glib
libnl
gnutls
libcrypt
wirelesstools
util-linux
readline
libndp libgudev
networkmanager
mm pppzlib
libglib2
libffi
pcre ncurseslibgpgerror
nettle
dbus
expat
XML Parser.
Network Manager - dependencies
91
libtasn1
gmp
udev
dbus-glib
libnl
gnutls
libcrypt
wirelesstools
util-linux
readline
libndp libgudev
networkmanager
mm pppzlib
libglib2
libffi
pcre ncurseslibgpgerror
nettle
dbus
expat
Device manager for the Linux kernel.
Network Manager - dependencies
92
libtasn1
gmp
udev
dbus-glib
libnl
gnutls
libcrypt
wirelesstools
util-linux
readline
libndp libgudev
networkmanager
mm ppp
kmod
zlib
libglib2
libffi
pcre ncurseslibgpgerror
nettle
dbus
expat
Kernel modules handler.
Network Manager - dependencies
93
libtasn1
gmp
udev
dbus-glib
libnl
gnutls
libcrypt
wirelesstools
util-linux
readline
libndp libgudev
networkmanager
mm ppp
kmod
zlib
libglib2
libffi
pcre ncurseslibgpgerror
nettle
dbus
expat
1 Network manager + 24 additional packages
Network Manager – build guide
94
Build systems
95
● Open Embedded
● Buildroot
● OpenADK
● PTXdist
● Linux From Scratch
● Nard SDK
● LTIB
● OpenBricks
● Building Embedded Userlands
● Scratchbox
● OpenWRT
● Yocto Project
source: elinux.org
Build systems
96
● Open Embedded
● Buildroot
● OpenADK
● PTXdist
● Linux From Scratch
● Nard SDK
● LTIB
● OpenBricks
● Building Embedded Userlands
● Scratchbox
● OpenWRT
● Yocto Project
source: elinux.org
Build systems – build flow
97
downloading patching configuration
compilation
packing
OpenWRT
98
source: public domain
● First device Linksys WRT54G,● First release Jan 2006,● ~1300 source packages,● ~3500 binary packages,● Package manager - opkg,● Web interface – LuCI,● IPv4, IPv6, TR-069, …
OpenWRT – as a build system
99
● Based on modified Buildroot,● Configuration via kconfig,● Support for:
– automake, autoconf,– cmake,– SCons.
Yocto Project
100
source: freeelectrons.com
Yocto Project
101
source: www.yoctoproject.org
Yocto Project – key features
102
● Support for the major architectures: ARM, MIPS, PowerPC, x86,
● Well defined roles for core recipes and layers,● Separated configuration:
– distribution configuration,– machine configuration,– image recipe,
● Detection of configuration changes,● Possibility to exclude GPLv3 packages.
Yocto Project – drawbacks
103
● Steeper learning curve,● Recipes are written in a mix of bitbake specific
language, python and shell script,● Recommended 50 GB free space for each image,● Long build time.
Buildroot
104
● Started in 2001,● Supported architectures: ARC, ARM, Blackfin, m68k,
Microblaze, MIPS, Nios II, PowerPC, SPARC, x86, Xtensa,
● Support for > 1600 packages,● > 130 default configs,● support for ~ 70 boards.
Buildroot - structure
105
├ arch board├ boot├ configs├ doc├ fs├ linux├ packages├ support├ system├ toolchain├
configuration for each supported architecture
Buildroot - structure
106
├ arch ├ board boot├ configs├ doc├ fs├ linux├ packages├ support├ system├ toolchain├
configuration for each supported board
Buildroot - structure
107
├ arch ├ board ├ boot configs├ doc├ fs├ linux├ packages├ support├ system├ toolchain├
bootloader packages
Buildroot - structure
108
├ arch ├ board ├ boot ├ configs doc├ fs├ linux├ packages├ support├ system├ toolchain├
default configs
for
supported boards
Buildroot - structure
109
├ arch ├ board ├ boot ├ configs ├ doc fs├ linux├ packages├ support├ system├ toolchain├
documentation
Buildroot - structure
110
├ arch ├ board ├ boot ├ configs ├ doc ├ fs linux├ packages├ support├ system├ toolchain├
tools to generate
target filesystem
Buildroot - structure
111
├ arch ├ board ├ boot ├ configs ├ doc ├ fs ├ linux packages├ support├ system├ toolchain├
tools to compile
Linux kernel
Buildroot - structure
112
├ arch ├ board
├ boot├ configs├ doc├ fs├ linux├ packages
support├ system├ toolchain├
tools to compile
all supported
packages
Buildroot - structure
113
├ arch├ board├ boot├ configs├ doc├ fs├ linux├ packages├ support
system├ toolchain├
utility tools
required by Busybox
Buildroot - structure
114
├ arch├ board├ boot├ configs├ doc├ fs├ linux├ packages├ support├ system
toolchain├
target rootfs skeleton
Buildroot - structure
115
├ arch├ board├ boot├ configs├ doc├ fs├ linux├ packages├ support├ system├ toolchain
cross-compiler configuration
Buildroot – how to start
116
cd buildroot
make grinn_liteboard_defconfig
make menuconfig
make all
Buildroot – output
117
buildroot/├ dl/└ output/ ├ build/ ├ host/ ├ images/ ├ staging/ └ target/
Buildroot – download directory
118
buildroot/├ dl/│ ├ autoconf-2.69.tar.xz│ ├ dosfstools-4.0.tar.xz│ ├ gcc-4.9.3.tar.bz2│ └ …└ output/ ├ build/ ├ host/ ├ images/ ├ staging/ └ target/
Buildroot – host tools
119
buildroot/├ dl/└ output/ ├ build/ ├ host/ │ ├ etc/ │ ├ sbin/ │ └ usr/ │ ├ arm-buildroot-linux... │ ├ bin/ │ ├ include/ │ ├ lib/ │ └ … ├ images/ ├ staging/ └ target/
Buildroot – build directory
120
buildroot/├ dl/└ output/ ├ build/ │ ├ host-autoconf-2.69/ │ ├ host-fakeroot-1.20.2/ │ ├ glibc-2.23/ │ └ … ├ host/ ├ images/ ├ staging/ └ target/
Buildroot – target sysroot
121
buildroot/├ dl/└ output/ ├ build/ ├ host/ ├ images/ ├ staging/ │ ├ bin/ │ ├ etc/ │ ├ lib/ │ ├ lib32/ │ ├ sbin/ │ ├ usr/ │ └ var/ └ target/
Buildroot – target root filesystem
122
buildroot/├ dl/└ output/ ├ build/ ├ host/ ├ images/ ├ staging/ └ target/ ├ bin/ ├ dev/ ├ etc/ ├ lib/ ├ lib32/ ├ linuxrc ├ media/ ├ mnt/ └ …
Buildroot – target images, etc…
123
buildroot/├ dl/└ output/ ├ build/ ├ host/ ├ images/ │ ├ boot.vfat │ ├ imx6ul-liteboard.dtb │ ├ rootfs.ext2 │ ├ rootfs.ext4 │ ├ rootfs.tar │ ├ sdcard.img │ ├ u-boot.imx │ └ zImage ├ staging/ └ target/
Buildroot – deploying on SD card
124
sudo dd if=output/images/sdcard.img of=/dev/<sdcard> bs=4M
Sensor sandwich
125
IC sensors I2C address
U3: BME280 temperature, pressure, humidity 0x76
U4: LTR329 light 0x29
Sensor sandwich @ liteboard
126
sensor sandwich
liteboard
Device tree – enabling I2C1
127
&iomuxc {imx6ul-liteboard-ws {
pinctrl_i2c1: i2c1grp {fsl,pins = <
MX6UL_PAD_CSI_MCLK__I2C1_SDA 0x4001b8b0MX6UL_PAD_CSI_PIXCLK__I2C1_SCL 0x4001b8b0
>;};
};};
&i2c1 {clock-frequency = <100000>;pinctrl-names = "default";pinctrl-0 = <&pinctrl_i2c1>;status = "okay";
};
Device tree – result
128
# i2cdetect -y 0 0 1 2 3 4 5 6 7 8 9 a b c d e f00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- 18 19 -- -- 1c -- -- -- 20: 20 -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- 76 --
Device tree – result
129
# i2cdetect -y 0 0 1 2 3 4 5 6 7 8 9 a b c d e f00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- 18 19 -- -- 1c -- -- -- 20: 20 -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- 76 --
0x29 – LTR329,0x76 – BME280,
Device tree – result
130
# i2cdetect -y 0 0 1 2 3 4 5 6 7 8 9 a b c d e f00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- 18 19 -- -- 1c -- -- -- 20: 20 -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- 76 --
0x29 – LTR329,0x76 – BME280,0x1C – MCP9808,0x19 – LIS3DHTR.
Device tree – result
131
# i2cdetect -y 0 0 1 2 3 4 5 6 7 8 9 a b c d e f00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- 18 19 -- -- 1c -- -- -- 20: 20 -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- 76 --
0x29 – LTR329,0x76 – BME280,0x1C – MCP9808,0x19 – LIS3DHTR.
0x18 – TLC320AIC,0x20 – MCP23008.
BME280
132
The BME280 is as combined digital humidity, pressure and temperature sensor based on proven sensing principles.
The sensor module is housed in an extremely compact metal-lid LGA package with a footprint of only 2.5 × 2.5 mm2 with a height of 0.93 mm.
Its small dimensions and its low power consumption allow the implementation in battery driven devices such as handsets, GPS modules
or watches.
The BME280 is register and performance compatible to the Bosch Sensortec BMP280 digital pressure sensor.
source: BME280 Final data sheet
BME280
133
source: BME280 Final data sheet
Enabling BME280 - driver
134
make linux-menuconfig
Enabling BME280 - driver
135
make linux-menuconfig
● Device Drivers● Industrial I/O support
● Pressure sensors● Bosch Sensortec BMP280 pressure sensor driver
Enabling BME280 - driver
136
make linux-menuconfig
● Device Drivers● Industrial I/O support
● Pressure sensors● Bosch Sensortec BMP280 pressure sensor driver
Enabling BME280 – device tree
137
&i2c1 { bme280: bme280@76 { compatible = "bmp280"; reg = <0x76>; };};
Rebuild
138
make linux-rebuild
make all
Rebuild
139
make linux-rebuild all
Result
140
?
Software development with Buildroot
141
Override file
142
BR2_PACKAGE_OVERRIDE_FILE
Buildroot reads an override file, which allows the user to tell Buildroot the location of the source for certain packages.
By default this override file is named local.mk and located in the top directory of the Buildroot source tree,
Override file – local.mk
143
<pkg1>_OVERRIDE_SRCDIR = /path/to/pkg1/sources<pkg2>_OVERRIDE_SRCDIR = /path/to/pkg2/sources
Override file – local.mk
144
<pkg1>_OVERRIDE_SRCDIR = /path/to/pkg1/sources<pkg2>_OVERRIDE_SRCDIR = /path/to/pkg2/sources
LINUX_OVERRIDE_SRCDIR = /home/bob/linux/BUSYBOX_OVERRIDE_SRCDIR = /home/bob/busybox/
Override file – local.mk
145
<pkg1>_OVERRIDE_SRCDIR = /path/to/pkg1/sources<pkg2>_OVERRIDE_SRCDIR = /path/to/pkg2/sources
LINUX_OVERRIDE_SRCDIR = ../linux/
BME230 userspace interface
146
# cd /sys/bus/iio/devices/iio:device0/# lsdev of_nodein_humidityrelative_input powerin_pressure_input subsystemin_temp_input ueventname
# cat in_humidityrelative_input
# cat in_pressure_input
# cat in_temp_input
LTR329
147
source: LTR-329ALS-01 DATA SHEET
The LTR-329ALS-01 is a low voltage I2C digital light sensor [ALS] in a low cost miniature chipled lead-free surface mount
package.
This sensor converts light intensity to a digital output signal capable of direct I2C interface.
It provides a linear response response over a wide dynamic range from 0.01 lux to 64k lux and is well suited to
applications under high ambient brightness.
There are altogether six gain settings (1X, 2X, 4X, 8X, 48X and 96X) available for user to configure.
LTR329 – block diagram
148
source: LTR-329ALS-01 DATA SHEET
LTR329 – measurement channels
149
source: LTR-329ALS-01 DATA SHEET
LTR329 – measurement channels
150
source: LTR-329ALS-01 DATA SHEET
LTR329 – measure current light
151
#!/bin/sh
I2C_BUS=0I2C_ADDR=0x29
LIGHT_RANGE=64000LIGHT_OFFSET=1
# Start measurementi2cset -fy ${I2C_BUS} ${I2C_ADDR} 0x80 0x01
# Read measured valueVALUE=`i2cget -fy 0 0x29 0x8a w`
VALUE_LUX=$((${VALUE}*${LIGHT_RANGE}/0xFFFF + ${LIGHT_OFFSET}))
echo ${VALUE_LUX}
Rootfs overlay
152
BR2_ROOTFS_OVERLAY
Specify a list of directories that are copied over the target root filesystem after the build has finished and
before it is packed into the selected filesystem images.
Rootfs overlay
153
Rootfs overlay
154
Rootfs overlay
155
buildroot/└ board/ └ grinn/ └ liteboard/ └ rootfs-overlay/ └ usr/ └ bin/ ├ get-light └ get-light-loop
BR2_ROOTFS_OVERLAY=board/grinn/liteboard/rootfs-overlay
Display @ liteboard
156
Display @ liteboard
157
LCD_EN pin - driver
158
make linux-menuconfig
● Device Drivers● GPIO Support
● SPI GPIO expanders● Microchip MCP23xxx I/O expander
LCD_EN pin – device tree
159
&i2c1 { mcp23008: mcp230008@20 { compatible = "microchip,mcp23008"; gpio-controller; #gpio-cells = <2>; reg = <0x20>;
lcd_en { gpio-hog; gpios = <7 0>; output-high; line-name = "lcd-en"; }; };};
doc: Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt
LCD_EN pin – device tree
160
&i2c1 { mcp23008: mcp230008@20 { compatible = "microchip,mcp23008"; gpio-controller; #gpio-cells = <2>; reg = <0x20>;
lcd_en { gpio-hog; gpios = <7 0>; output-high; line-name = "lcd-en"; }; };};
doc: Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt
LCD - driver
161
make linux-menuconfig
● Device Drivers● Graphics support
● Frame buffer Devices● MXS LCD framebuffer support
LCD data pins
162
&iomuxc { imx6ul-liteboard-demo { pinctrl_lcdif_dat: lcdifdatgrp { fsl,pins = < MX6UL_PAD_LCD_DATA00__LCDIF_DATA00 0x79 MX6UL_PAD_LCD_DATA01__LCDIF_DATA01 0x79 MX6UL_PAD_LCD_DATA02__LCDIF_DATA02 0x79 MX6UL_PAD_LCD_DATA03__LCDIF_DATA03 0x79 MX6UL_PAD_LCD_DATA04__LCDIF_DATA04 0x79 MX6UL_PAD_LCD_DATA05__LCDIF_DATA05 0x79 MX6UL_PAD_LCD_DATA06__LCDIF_DATA06 0x79 MX6UL_PAD_LCD_DATA07__LCDIF_DATA07 0x79 MX6UL_PAD_LCD_DATA08__LCDIF_DATA08 0x79 ... MX6UL_PAD_LCD_DATA23__LCDIF_DATA23 0x79 >; }; };};
LCD control pins
163
&iomuxc { imx6ul-liteboard-demo { pinctrl_lcdif_ctrl: lcdifctrlgrp { fsl,pins = < MX6UL_PAD_LCD_CLK__LCDIF_CLK 0x79 MX6UL_PAD_LCD_ENABLE__LCDIF_ENABLE 0x79 MX6UL_PAD_LCD_HSYNC__LCDIF_HSYNC 0x79 MX6UL_PAD_LCD_VSYNC__LCDIF_VSYNC 0x79 >; }; };};
LCD display configuration
164
&lcdif { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_lcdif_dat &pinctrl_lcdif_ctrl>; display = <&display0>; status = "okay";}
Display configuration @ device-tree
165
+----------+-------------------------------------+----------+-------+| | ↑ | | || | |vback_porch | | || | ↓ | | |+----------#######################################----------+-------+| # ↑ # | || # | # | || hback # | # hfront | hsync || porch # | hactive # porch | len ||<-------->#<-------+--------------------------->#<-------->|<----->|| # | # | || # |vactive # | || # | # | || # ↓ # | |+----------#######################################----------+-------+| | ↑ | | || | |vfront_porch | | || | ↓ | | |+----------+-------------------------------------+----------+-------+| | ↑ | | || | |vsync_len | | || | ↓ | | |+----------+-------------------------------------+----------+-------+
source: Documentation/devicetree/bindings/video/display-timing.txt
Display configuration @ device-tree
166
+----------+-------------------------------------+----------+-------+| | ↑ | | || | | 46 lines | | || | ↓ | | |+----------#######################################----------+-------+| # ↑ # | || # | # | || 46 # | # 210 | 2 || pixels # | 800 pixels # pixels | pixels||<-------->#<-------+--------------------------->#<-------->|<----->|| # | # | || # | 480 pixels # | || # | # | || # ↓ # | |+----------#######################################----------+-------+| | ↑ | | || | | 22 lines | | || | ↓ | | |+----------+-------------------------------------+----------+-------+| | ↑ | | || | | 2 lines | | || | ↓ | | |+----------+-------------------------------------+----------+-------+
LCD display configuration
167
display-timings { native-mode = <&timing0>; timing0: timing0 { clock-frequency = <30000000>; hactive = <800>; vactive = <480>; hfront-porch = <210>; hsync-len = <2>; hback-porch = <46>; vfront-porch = <22>; vsync-len = <2>; vback-porch = <23>; hsync-active = <1>; vsync-active = <1>; de-active = <1>; pixelclk-active = <0>; };};
doc: Documentation/devicetree/bindings/video/display-timing.txt
Touchscreen - driver
168
make linux-menuconfig
● Device Drivers● Input device support
● Generic input layer● Touchscreens
● Freescale i.MX6UL touchscreen controller
Touchscreen – device tree
169
&tsc { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_tsc>; status = "okay";
xnur-gpio = <&gpio1 3 GPIO_ACTIVE_LOW>; measure_delay_time = <0xffff>; pre_charge_time = <0xfff>;};
doc: Documentation/devicetree/bindings/input/touchscreen/imx6ul_tsc.txt
LCD Backlight - driver
170
make linux-menuconfig
● Device Drivers● Graphics support
● Backlight & LCD device support● Lowlevel Backlight controls
● Generic PWM based Backlight Driver
PWM - driver
171
make linux-menuconfig
● Device Drivers● Pulse-Width Modulation (PWM) Support
● i.MX PWM support
LCD Backlight – device tree
172
/ { backlight { compatible = "pwm-backlight"; pwms = <&pwm2 0 5000000>; brightness-levels = <0 4 8 16 32 64 128 255>; default-brightness-level = <6>; status = "okay"; };};
doc: Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
PWM – device tree
173
&pwm2 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_pwm2>; status = "okay"; clocks = <&clks IMX6UL_CLK_PWM2>, <&clks IMX6UL_CLK_PWM2>;};
&iomuxc { imx6ul-liteboard-demo { pinctrl_pwm2: pwm2 { fsl,pins = < MX6UL_PAD_GPIO1_IO09__PWM2_OUT 0x110b0 >; }; };};
doc: Documentation/devicetree/bindings/pwm/imx-pwm.txt
How to test LCD panel?
174
cat /dev/urandom > /dev/fb0
hexdump /dev/input/event1
Touchscreen calibration - tslib
175
make menuconfig
● Target packages ● Libraries
● Hardware handling● tslib
Touchscreen calibration
176
ts_calibrate
Touchscreen calibration - verification
177
ts_test
Touchscreen calibration - customization
178
buildroot/└ board/ └ grinn/ └ liteboard/ └ rootfs-overlay/ └ etc/ └ profile.d/ └ ts.sh
export TSLIB_TSDEVICE=/dev/input/event1
Calibration output file
179
/etc/pointercal
cat /etc/pointercal -14809 -664 58312948 745 -10548 34531164 65536 800 480
Calibration output file – during development
180
buildroot/└ board/ └ grinn/ └ liteboard/ └ rootfs-overlay/ └ etc/ └ pointercal
Calibration output file – during development
181
buildroot/└ board/ └ grinn/ └ liteboard/ └ rootfs-overlay/ └ etc/ └ pointercal
buildroot/└ output/ └ target/ └ etc/ └ pointercal
Calibration output file – during development
182
buildroot/└ board/ └ grinn/ └ liteboard/ └ rootfs-overlay/ └ etc/ └ pointercal
buildroot/└ output/ └ target/ └ etc/ └ pointercalbuildroot/
└ board/ └ grinn/ └ liteboard/ └ post-image.sh
cp SRC ${TARGET_DIR}/etc/pointercal
Qt library - history
183
● 1995 – first release,● 1997 – KDE is using Qt,● 2000 – Qt/Embedded has been released,● 2005 – Qt released as GPL software,● 2008 – Qt acquired by Nokia, ● 2008 – Qt released as LGPL software,● 2010 – Qt as based framework for Symbian^4,● 2012 – Qt acquired by Digia.
Qt library - releases
184
● 1995 – Qt 0.9,● 1996 – Qt 1.0,● 1999 – Qt 2.0,● 2001 – Qt 3.0,● 2005 – Qt 4.0, ● 2012 – Qt 5.0.
Qt as SDK - QtCreator
185
Demo GUI
186
Demo GUI
187
demoqt/├ 3rdParty/│ └ qcustomplot/│ ├ changelog.txt│ ├ GPL.txt│ ├ qcustomplot.cpp│ └ qcustomplot.h├ init/│ └ S50demoqt├ src/│ ├ Activity.cpp│ ├ Activity.h│ ├ activity.ui│ └ main.cpp├ CMakeLists.txt├ LICENSE└ README
QCustomPlot
source: qcustomplot.com
Demo GUI
188
QCustomPlot
source: qcustomplot.com
demoqt/├ 3rdParty/│ └ qcustomplot/│ ├ changelog.txt│ ├ GPL.txt│ ├ qcustomplot.cpp│ └ qcustomplot.h├ init/│ └ S50demoqt├ src/│ ├ Activity.cpp│ ├ Activity.h│ ├ activity.ui│ └ main.cpp├ CMakeLists.txt├ LICENSE└ README
Demo GUI
189
QCustomPlot
source: qcustomplot.com
demoqt/├ 3rdParty/│ └ qcustomplot/│ ├ changelog.txt│ ├ GPL.txt│ ├ qcustomplot.cpp│ └ qcustomplot.h├ init/│ └ S50demoqt├ src/│ ├ Activity.cpp│ ├ Activity.h│ ├ activity.ui│ └ main.cpp├ CMakeLists.txt├ LICENSE└ README
Demo GUI
190
QCustomPlot
source: qcustomplot.com
demoqt/├ 3rdParty/│ └ qcustomplot/│ ├ changelog.txt│ ├ GPL.txt│ ├ qcustomplot.cpp│ └ qcustomplot.h├ init/│ └ S50demoqt├ src/│ ├ Activity.cpp│ ├ Activity.h│ ├ activity.ui│ └ main.cpp├ CMakeLists.txt├ LICENSE└ README
Demo GUI
191
demoqt/├ 3rdParty/│ └ qcustomplot/│ ├ changelog.txt│ ├ GPL.txt│ ├ qcustomplot.cpp│ └ qcustomplot.h├ init/│ └ S50demoqt├ src/│ ├ Activity.cpp│ ├ Activity.h│ ├ activity.ui│ └ main.cpp├ CMakeLists.txt├ LICENSE└ README
#!/bin/sh## Start the QT GUI#
case "$1" in start) echo "Starting QT GUI ..." export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0 export QT_QPA_FB_TSLIB=1 /usr/bin/wsgui & ;; stop) printf "Stopping QT GUI ..." killall -9 wsgui ;; restart|reload) "$0" stop "$0" start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1esac
exit $?
Demo GUI
192
demoqt/├ 3rdParty/│ └ qcustomplot/│ ├ changelog.txt│ ├ GPL.txt│ ├ qcustomplot.cpp│ └ qcustomplot.h├ init/│ └ S50demoqt├ src/│ ├ Activity.cpp│ ├ Activity.h│ ├ activity.ui│ └ main.cpp├ CMakeLists.txt├ LICENSE└ README
Demo GUI
193
demoqt/├ 3rdParty/│ └ qcustomplot/│ ├ changelog.txt│ ├ GPL.txt│ ├ qcustomplot.cpp│ └ qcustomplot.h├ init/│ └ S50demoqt├ src/│ ├ Activity.cpp│ ├ Activity.h│ ├ activity.ui│ └ main.cpp├ CMakeLists.txt├ LICENSE└ README
Demo GUI – integration with Buildroot
194
BR2_EXTERNAL
BR2_EXTERNAL is an environment variable that can be used to point to a directory that contains Buildroot customizations.
It can be passed to any Buildroot make invocation. It is automatically saved in the hidden .br-external file in the output
directory.
Thanks to this, there is no need to pass BR2_EXTERNAL at every make invocation. It can however be changed at any time by passing
a new value, and can be removed by passing an empty value.
Demo GUI – integration with Buildroot
195
buildroot-ext/└ package/ └ demoqt/ ├ Config.in └ demoqt.mk
config BR2_PACKAGE_DEMOQT bool "QT5 based Demo GUI for liteboard" depends on BR2_PACKAGE_QT5
help This will build GUI application able to measure temperature, pressure, humidity and light.
Each parameter history is presented on LCD as separate plot.
Demo GUI – integration with Buildroot
196
buildroot-ext/└ package/ └ demoqt/ ├ Config.in └ demoqt.mk
################################################################################## DemoQT#################################################################################
DEMOQT_VERSION = aa48c8298a9d3e05001bd7059413f43b65c45747DEMOQT_SITE_METHOD = gitDEMOQT_SITE = [email protected]:litesom-example/demoqt.git
DEMOQT_LICENSE = GPLv3DEMOQT_LICENSE_FILES = LICENSE
DEMOQT_INSTALL_STAGING = NODEMOQT_INSTALL_TARGET = YES
DEMOQT_DEPENDENCIES = qt5base
define DEMOQT_INSTALL_INIT_SYSV $(INSTALL) -D -m 0755 $(@D)/init/S50demoqt ${TARGET_DIR}/etc/init.d/S50demoqtendef
$(eval $(cmake-package))
Demo GUI – integration with Buildroot
197
################################################################################## DemoQT#################################################################################
DEMOQT_VERSION = aa48c8298a9d3e05001bd7059413f43b65c45747DEMOQT_SITE_METHOD = gitDEMOQT_SITE = [email protected]:litesom-example/demoqt.git
DEMOQT_LICENSE = GPLv3DEMOQT_LICENSE_FILES = LICENSE
DEMOQT_INSTALL_STAGING = NODEMOQT_INSTALL_TARGET = YES
DEMOQT_DEPENDENCIES = qt5base
define DEMOQT_INSTALL_INIT_SYSV $(INSTALL) -D -m 0755 $(@D)/init/S50demoqt ${TARGET_DIR}/etc/init.d/S50demoqtendef
$(eval $(cmake-package))
Demo GUI – integration with Buildroot
198
make BR2_EXTERNAL=../buildroot-ext menuconfig
QPA - Qt Platform Abstraction Layer
199
QPA is the platform abstraction layer for Qt 5 and replaces QWS and the platform ports from Qt 4.
There is currently little documentation for QPA. The best approach for developing a new platform plugin is to look
at the other plugins and see how they implement the APIs in question.
QPA - Qt Platform Abstraction Layer
200
There are multiple platform plugins that are potentially usable on Embedded Linux systems: EGLFS, LinuxFB,
KMS, DirectFB, Wayland.
The availability of these depend on the configuration of Qt. The default platform plugin is also device-specific.
For instance, on many boards eglfs is chosen as the default one.
source: doc.qt.io/qt-5/embedded-linux.html
QPA - Qt Platform Abstraction Layer
201
If the default is not suitable, the QT_QPA_PLATFORM environment variable parameter can be used to request
another plugin.
source: doc.qt.io/qt-5/embedded-linux.html
Qt with liteboard display
202
source: doc.qt.io/qt-5/embedded-linux.html
LinuxFB
This plugin writes directly to the framebuffer. Only software-rendered content is supported. Note that on some setups the display performance is expected to be limited.
The linuxfb plugin allows specifying additional settings by passing them in the QT_QPA_PLATFORM environment variable or -platform command-line option.
For example, QT_QPA_PLATFORM=linuxfb:fb=/dev/fb1 specifies that the framebuffer device /dev/fb1 must be used instead of the default fb0. Multiple settings can be specified by separating them with a colon.
Qt with liteboard touchpanel
203
source: doc.qt.io/qt-5/embedded-linux.html
Touch
For some resistive, single-touch touch screens it may be necessary to fall back to using tslib instead of relying on the Linux multi-touch protocol and the event devices. For modern touch screens this is not necessary.
tslib support can be enabled by setting the environment variable QT_QPA_EGLFS_TSLIB or QT_QPA_FB_TSLIB to 1.
To change the device, set the environment variable TSLIB_TSDEVICE or pass the device name on the command-line.
Note that the tslib input handler generates mouse events and supports single touch only, as opposed to evdevtouch which generates true multi-touch QTouchEvent events too.
Demo GUI - configuration
204
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0export QT_QPA_FB_TSLIB=1
demoqt/└ init/ └ S50demoqt
buildroot/└ board/ └ grinn/ └ liteboard/ └ rootfs-overlay/ └ etc/ └ profile.d/ └ qt5.sh
WEB interface
205
demoweb/├ cgi-bin/│ ├ get-humidity│ ├ get-light│ ├ get-pressure│ └ get-temp├ scripts/│ ├ exporting.js│ ├ highcharts.js│ └ jquery-3.1.0.min.js└ src/ └ index.html
#!/bin/sh
echo "Content-type: text/html"echo ""
cat /sys/bus/iio/devices/iio:device0/in_humidityrelative_input
WEB interface
206
demoweb/├ cgi-bin/│ ├ get-humidity│ ├ get-light│ ├ get-pressure│ └ get-temp├ scripts/│ ├ exporting.js│ ├ highcharts.js│ └ jquery-3.1.0.min.js└ src/ └ index.html
WEB interface
207
demoweb/├ cgi-bin/│ ├ get-humidity│ ├ get-light│ ├ get-pressure│ └ get-temp├ scripts/│ ├ exporting.js│ ├ highcharts.js│ └ jquery-3.1.0.min.js└ src/ └ index.html
<!DOCTYPE html><html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="/scripts/jquery-3.1.0.min.js"></script>
DHCP server
208
make busybox-menuconfig
● Networking Utilities● udhcp server (udhcpd)
DHCP server – config file
209
make busybox-menuconfig
● Networking Utilities● udhcp server (udhcpd)
buildroot/└ board/ └ grinn/ └ liteboard/ └ rootfs-overlay/ ├ etc/ │ ├ udhcpd.conf │ └ init.d/ │ └ S50dhcpd └ network/ └ interfaces
HTTP server
210
make busybox-menuconfig
● Networking Utilities● httpd
HTTP server - configuration
211
make busybox-menuconfig
● Networking Utilities● httpd
buildroot/└ board/ └ grinn/ └ liteboard/ └ rootfs-overlay/ └ etc/ ├ init.d/ │ └ S51httpd └ httpd.conf
Graphs – build time
212
make graph-build
Graphs – dependencies
213
make graph-depends
Graphs – package size on target filesystem
214
make graph-size
Legal info
215
make legal-info
output/├ legal-info/│ ├ host-licenses│ ├ host-sources│ ├ licenses│ └ sources└ README
Workshop summary
216
● How to build software for embedded device,● How to configure dedicated hardware,● How to modify open source software,● How to develop embedded software on PC,● How to build custom and open source software
together,● How to prepare materials for lawyers.
Contact
Robert OtrebaMobile: +48 509 618 007r.otreba@grinn-global .com
GrinnWagonowa 2 53 – 609 WroclawPolandTel + 48 71 716 40 99
www.grinn-global.com
If you are interested in our electronics design services please contact:
THANK YOU FOR YOUR TIME