Yocto中UBOOT_CONFIG的用法

Yocto中u-boot的bb文件中出现以下写法:

UBOOT_CONFIG[sd] = "mx6ull_14x14_evk_sd_config,sdcard"

此处意思为,uboot的sd配置使用mx6ull_14x14_evk_sd_config配置文件,如果要构建sdcard文件时,应该使用sd配置生成的imx文件。

原始定义为:

UBOOT_CONFIG[foo] = "config,images"

Reference:
a couple notes/questions on UBOOT_CONFIG

Jenkins无法与Docker连接

搭建好Jenkins后,在script中使用Ubuntu:16.04的镜像测试,构建后提示如下:

Cannot connect to the Docker daemon. Is the docker daemon running on this host?
Build step 'Execute shell' marked build as failure

Docker实际已经运行,应该是权限方面的问题:

sudo gpasswd -a jenkins docker

重新启动Jenkins的服务即可。

周立功IoT-6G2C-L开发板简测

IoT-6G2C-L开发板分为两个部分,核心板和底板。核心板型号是A6G2C-W128LI,搭载NXP的i.MX6系列的PCIMX6G2C芯片。这款芯片可以说是目前i.MX6系列中性价比很不错的芯片。我拿到的这款是DDR 256MB,NAND 256MB的配置,上面还有一片WiFi芯片,型号为AP6181。整体上看,这块核心板比市面上大多数基于i.MX6UL芯片的核心板都要小很多,官方宣传图上和壹元硬币一样的高度,实际上要比硬币要高出个5mm。整体眄看,能让这块核心板显得小巧,开发团队做了两件事情:

官方宣传图
A6G2C.png

实际比较图
A6G2C-Coin.png

  • 使用较小封装的NAND和DDR芯片
  • 使用更小间距的进口板对板连接器,信号和体积都有兼顾

启动模式

IoT-6G2C-L支持三种启动方式,SD,NAND和SPI。由于QSPI与NAND功能的复用,所以只能选择SPI方式。

启动日志分析

从启动日志看出,U-Boot版本为2015.04,Linux版本为4.1.15。工具链使用Linaro arm Hardfloat 4.9-2014.09版本的。

U-Boot 2015.04-14493-g6403c9b (Sep 20 2016 - 11:40:40)

CPU:   Freescale i.MX6UL rev1.1 at 396 MHz
CPU:   Temperature 41 C
Reset cause: POR
Board: EPC-M6G2C
I2C:   ready
DRAM:  256 MiB
NAND:  256 MiB
MMC:   FSL_SDHC: 0
*** Warning - bad CRC, using default environment

panel name: TFT435Q
Display: TFT435Q (480x272)
Video: 480x272x16

NAND read: device 0 offset 0x1500000, size 0x100000
 1048576 bytes read: OK
In:    serial
Out:   serial
Err:   serial
Net:   FEC1
Normal Boot
Hit any key to stop autoboot:  0
Booting from NAND...

NAND read: device 0 offset 0x400000, size 0x100000
 1048576 bytes read: OK

NAND read: device 0 offset 0x500000, size 0x800000
 8388608 bytes read: OK
Kernel image @ 0x80800000 [ 0x000000 - 0x59b790 ]
## Flattened Device Tree blob at 83000000
   Booting using the fdt blob at 0x83000000
   Using Device Tree in place at 83000000, end 8300bb79

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 4.1.15-224247-gb0fdb78 (xxxx@linux-compiler) (gcc version 4.9.2 20140904 (prerelease) (crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09) ) #1 SMP PREEMPT Mon Jul 18 15:12:30 CST 2016
CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: ZLG EPC-A6G2C Board
Reserved memory: created CMA memory pool at 0x8e000000, size 32 MiB
Reserved memory: initialized node linux,cma, compatible id shared-dma-pool
Memory policy: Data cache writealloc
PERCPU: Embedded 12 pages/cpu @8ddc2000 s17152 r8192 d23808 u49152
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
Kernel command line: console=ttymxc0,115200 ubi.mtd=5 ro root=ubi0:rootfs rootfstype=ubifs g_mass_storage.stall=0 g_mass_storage.removable=1 g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF g_mass_storage.iSerialNumber=""
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 215896K/262144K available (7423K kernel code, 291K rwdata, 2348K rodata, 432K init, 429K bss, 13480K reserved, 32768K cma-reserved, 0K highmem)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0x90800000 - 0xff000000   (1768 MB)
    lowmem  : 0x80000000 - 0x90000000   ( 256 MB)
    pkmap   : 0x7fe00000 - 0x80000000   (   2 MB)
    modules : 0x7f000000 - 0x7fe00000   (  14 MB)
      .text : 0x80008000 - 0x809931d8   (9773 kB)
      .init : 0x80994000 - 0x80a00000   ( 432 kB)
      .data : 0x80a00000 - 0x80a48c80   ( 292 kB)
       .bss : 0x80a4b000 - 0x80ab647c   ( 430 kB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Preemptible hierarchical RCU implementation.
    Additional per-CPU info printed with stalls.
    RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=1.
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
NR_IRQS:16 nr_irqs:16 16
mxc_clocksource_init 24000000
Switching to timer-based delay loop, resolution 41ns
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
clocksource mxc_timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
Console: colour dummy device 80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
/cpus/cpu@0 missing clock-frequency property
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x80008280 - 0x800082d8
Brought up 1 CPUs
SMP: Total of 1 processors activated (48.00 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
device-tree: Duplicate name in lcdif@021c8000, renamed to "display#1"
VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
clocksource jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor ladder
cpuidle: using governor menu
hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
hw-breakpoint: maximum watchpoint size is 8 bytes.
imx6ul-pinctrl 20e0000.iomuxc: initialized IMX pinctrl driver
mxs-dma 1804000.dma-apbh: initialized
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
i2c-gpio analog-i2c: using pins 136 (SDA) and 135 (SCL)
Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
Advanced Linux Sound Architecture Driver Initialized.
Bluetooth: Core ver 2.20
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: L2CAP socket layer initialized
Bluetooth: SCO socket layer initialized
Switched to clocksource mxc_timer1
NET: Registered protocol family 2
TCP established hash table entries: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
UDP hash table entries: 256 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Bus freq driver module loaded
futex hash table entries: 256 (order: 2, 16384 bytes)
VFS: Disk quotas dquot_6.6.0
VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
fuse init (API version 7.23)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
zlg gpio watchdog driver registered.
imx2-wdt 20bc000.wdog: timeout 60 sec (nowayout=0)
backlight supply power not found, using dummy regulator
21c8000.lcdif supply lcd not found, using dummy regulator
mxsfb 21c8000.lcdif: failed to find mxc display driver
Console: switching to colour frame buffer device 60x34
mxsfb 21c8000.lcdif: initialized
imx-sdma 20ec000.sdma: no event needs to be remapped
imx-sdma 20ec000.sdma: loaded firmware 3.3
imx-sdma 20ec000.sdma: initialized
2018000.serial: ttymxc6 at MMIO 0x2018000 (irq = 21, base_baud = 5000000) is a IMX
2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 22, base_baud = 5000000) is a IMX
console [ttymxc0] enabled
2024000.serial: ttymxc7 at MMIO 0x2024000 (irq = 23, base_baud = 5000000) is a IMX
21e8000.serial: ttymxc1 at MMIO 0x21e8000 (irq = 236, base_baud = 5000000) is a IMX
21ec000.serial: ttymxc2 at MMIO 0x21ec000 (irq = 237, base_baud = 5000000) is a IMX
21f0000.serial: ttymxc3 at MMIO 0x21f0000 (irq = 238, base_baud = 5000000) is a IMX
21f4000.serial: ttymxc4 at MMIO 0x21f4000 (irq = 239, base_baud = 5000000) is a IMX
21fc000.serial: ttymxc5 at MMIO 0x21fc000 (irq = 240, base_baud = 5000000) is a IMX
[drm] Initialized drm 1.1.0 20060810
[drm] Initialized vivante 1.0.0 20120216 on minor 0
brd: module loaded
loop: module loaded
nand: device found, Manufacturer ID: 0x01, Chip ID: 0xda
nand: AMD/Spansion S34ML02G2
nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 128
gpmi-nand 1806000.gpmi-nand: mode:4 ,failed in set feature.
Bad block table found at page 131008, version 0x01
Bad block table found at page 130944, version 0x01
7 ofpart partitions found on MTD device gpmi-nand
Creating 7 MTD partitions on "gpmi-nand":
0x000000000000-0x000000400000 : "u-boot"
0x000000400000-0x000000500000 : "dtb"
0x000000500000-0x000000d00000 : "kernel-0"
0x000000d00000-0x000001500000 : "kernel-1"
0x000001500000-0x000001900000 : "logo"
0x000001900000-0x000006200000 : "rootfs"
0x000006200000-0x000010000000 : "opt"
gpmi-nand 1806000.gpmi-nand: driver registered.
spi_imx 2008000.ecspi: probed
CAN device driver interface
2090000.can supply xceiver not found, using dummy regulator
flexcan 2090000.can: device registered (reg_base=90a28000, irq=32)
2094000.can supply xceiver not found, using dummy regulator
flexcan 2094000.can: device registered (reg_base=90a30000, irq=33)
20b4000.ethernet supply phy not found, using dummy regulator
pps pps0: new PPS source ptp0
libphy: fec_enet_mii_bus: probed
fec 20b4000.ethernet eth0: registered PHC device 0
2188000.ethernet supply phy not found, using dummy regulator
pps pps1: new PPS source ptp1
fec 2188000.ethernet eth1: registered PHC device 1
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-mxc: Freescale On-Chip EHCI Host driver
usbcore: registered new interface driver usb-storage
usbcore: registered new interface driver usb_ehset_test
2184800.usbmisc supply vbus-wakeup not found, using dummy regulator
2184000.usb supply vbus not found, using dummy regulator
2184200.usb supply vbus not found, using dummy regulator
ci_hdrc ci_hdrc.1: EHCI Host Controller
ci_hdrc ci_hdrc.1: new USB bus registered, assigned bus number 1
ci_hdrc ci_hdrc.1: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Mass Storage Function, version: 2009/09/11
LUN: removable file: (no medium)
LUN: removable file: (no medium)
Number of LUNs=1
Number of LUNs=1
g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
g_mass_storage gadget: g_mass_storage ready
mousedev: PS/2 mouse device common for all mice
input: 20cc000.snvs:snvs-powerkey as /devices/platform/soc/2000000.aips-bus/20cc000.snvs/20cc000.snvs:snvs-powerkey/input/input0
input: iMX6UL TouchScreen Controller as /devices/virtual/input/input1
rtc-pcf85063 4-0051: chip found, driver version 0.4.3
rtc-pcf85063 4-0051: rtc core: registered rtc-pcf85063 as rtc0
snvs_rtc 20cc000.snvs:snvs-rtc-lp: rtc core: registered 20cc000.snvs:snvs-r as rtc1
i2c /dev entries driver
pxp-v4l2 pxp_v4l2: initialized
Bluetooth: HCI UART driver ver 2.3
Bluetooth: HCI UART protocol H4 registered
Bluetooth: HCI UART protocol BCSP registered
Bluetooth: HCI UART protocol ATH3K registered
usbcore: registered new interface driver bcm203x
usbcore: registered new interface driver btusb
usbcore: registered new interface driver ath3k
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
/soc/aips-bus@02100000/usdhc@02190000: voltage-ranges unspecified
sdhci-esdhc-imx 2190000.usdhc: Got CD GPIO
sdhci-esdhc-imx 2190000.usdhc: Got WP GPIO
sdhci-esdhc-imx 2190000.usdhc: No vmmc regulator found
sdhci-esdhc-imx 2190000.usdhc: No vqmmc regulator found
mmc0: SDHCI controller on 2190000.usdhc [2190000.usdhc] using ADMA
/soc/aips-bus@02100000/usdhc@02194000: voltage-ranges unspecified
sdhci-esdhc-imx 2194000.usdhc: assigned as wifi host
sdhci-esdhc-imx 2194000.usdhc: No vmmc regulator found
sdhci-esdhc-imx 2194000.usdhc: No vqmmc regulator found
mmc1: SDHCI controller on 2194000.usdhc [2194000.usdhc] using ADMA
caam 2140000.caam: Entropy delay = 3200
caam 2140000.caam: Instantiated RNG4 SH0
mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
caam 2140000.caam: Instantiated RNG4 SH1
caam 2140000.caam: device ID = 0x0a16030000000000 (Era -524)
caam 2140000.caam: job rings = 3, qi = 0
mmc1: new high speed SDIO card at address 0001
caam algorithms registered in /proc/crypto
caam_jr 2141000.jr0: registering rng-caam
signature pass.
snvs-secvio 20cc000.caam-snvs: can't get snvs clock
snvs-secvio 20cc000.caam-snvs: violation handlers armed - non-secure state
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
2198000.adc supply vref not found, using dummy regulator
fsl-asrc 2034000.asrc: driver registered
imx-mqs sound-mqs: fsl-mqs-dai <-> 2028000.sai mapping ok
imx-mqs sound-mqs: snd-soc-dummy-dai <-> 2034000.asrc mapping ok
imx-mqs sound-mqs: fsl-mqs-dai <-> 2028000.sai mapping ok
NET: Registered protocol family 26
nf_conntrack version 0.5.0 (3885 buckets, 15540 max)
ip_tables: (C) 2000-2006 Netfilter Core Team
NET: Registered protocol family 10
sit: IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
can: controller area network core (rev 20120528 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20120528)
can: broadcast manager protocol (rev 20120528 t)
can: netlink gateway (rev 20130117) max_hops=1
Bluetooth: RFCOMM TTY layer initialized
Bluetooth: RFCOMM socket layer initialized
Bluetooth: RFCOMM ver 1.11
Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Bluetooth: BNEP filters: protocol multicast
Bluetooth: BNEP socket layer initialized
Bluetooth: HIDP (Human Interface Emulation) ver 1.2
Bluetooth: HIDP socket layer initialized
8021q: 802.1Q VLAN Support v1.8
Key type dns_resolver registered
ubi0: attaching mtd5
ubi0: scanning is finished
ubi0: attached mtd5 (name "rootfs", size 73 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 584, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 3/1, WL threshold: 4096, image sequence number: 1611341197
ubi0: available PEBs: 0, total reserved PEBs: 584, PEBs reserved for bad PEB handling: 40
ubi0: background thread "ubi_bgt0d" started, PID 141
rtc-pcf85063 4-0051: setting system clock to 2016-10-17 17:46:25 UTC (1476726385)
ALSA device list:
  #0: mqs-audio
UBIFS (ubi0:0): recovery needed
UBIFS (ubi0:0): recovery deferred
UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs", R/O mode
UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
UBIFS (ubi0:0): FS size: 67170304 bytes (64 MiB, 529 LEBs), journal size 9015296 bytes (8 MiB, 71 LEBs)
UBIFS (ubi0:0): reserved for root: 0 bytes (0 KiB)
UBIFS (ubi0:0): media format: w4/r0 (latest is w4/r0), UUID ACBC6A91-C455-4A77-AF48-4831C452919B, small LPT model
VFS: Mounted root (ubifs filesystem) readonly on device 0:15.
devtmpfs: mounted
Freeing unused kernel memory: 432K (80994000 - 80a00000)
random: nonblocking pool is initialized
Starting logging: OK
Populating /dev using udev: udevd[155]: starting version 3.1.2
done
Starting portmap: done
read-only file system detected...done
Starting system message bus: done
Starting network...
No persistent location to store SSH host keys. New keys will be
generated at each boot. Are you sure this is what you want to do?
Starting dropbear sshd: OK
Starting sshd: UBIFS (ubi0:0): completing deferred recovery
UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 216
UBIFS (ubi0:0): deferred recovery completed
OK
Starting telnetd: OK
Starting vsftpd: OK
Start mount /opt: ubi1: attaching mtd6
ubi1: scanning is finished
ubi1: attached mtd6 (name "opt", size 158 MiB)
ubi1: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi1: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi1: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi1: good PEBs: 1260, bad PEBs: 4, corrupted PEBs: 0
ubi1: user volume: 1, internal volumes: 1, max. volumes count: 128
ubi1: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 977678455
ubi1: available PEBs: 0, total reserved PEBs: 1260, PEBs reserved for bad PEB handling: 36
ubi1: background thread "ubi_bgt1d" started, PID 228
UBI device number 1, total 1260 LEBs (159989760 bytes, 152.6 MiB), available 0 LEBs (0 bytes), LEB size 126976 bytes (124.0 KiB)
UBIFS (ubi1:0): background thread "ubifs_bgt1_0" started, PID 230
UBIFS (ubi1:0): recovery needed
UBIFS (ubi1:0): recovery completed
UBIFS (ubi1:0): UBIFS: mounted UBI device 1, volume 0, name "opt"
UBIFS (ubi1:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
UBIFS (ubi1:0): FS size: 153513984 bytes (146 MiB, 1209 LEBs), journal size 7745536 bytes (7 MiB, 61 LEBs)
UBIFS (ubi1:0): reserved for root: 4952683 bytes (4836 KiB)
UBIFS (ubi1:0): media format: w4/r0 (latest is w4/r0), UUID 3B5FDC64-8572-4BFC-A875-7DC6F05B682F, small LPT model
Mount /opt ok
fec 20b4000.ethernet eth0: Freescale FEC PHY driver [Generic PHY] (mii_bus:phy_addr=20b4000.ethernet:05, irq=-1)
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
fec 2188000.ethernet eth1: Freescale FEC PHY driver [Generic PHY] (mii_bus:phy_addr=20b4000.ethernet:01, irq=-1)
IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready

Welcome to ZHIYUAN IoT-A6G2C Board
IoT-A6G2C login: root
Password:

有趣的地方是,这里的NAND被分成了七个分区。kernel有两个分区,kernel-0和kernel-1分区。opt是独立于rootfs的,这样看来是希望让系统的kernel有备份恢复功能,而rootfs和opt分离,大概是想让用户把应用放在opt分区内,这样可以减少rootfs的写频度,NAND在运行中即便断电之类的原因造成数据丢失也是在opt分区,对rootfs没有太大的影响。

Creating 7 MTD partitions on "gpmi-nand":
0x000000000000-0x000000400000 : "u-boot"
0x000000400000-0x000000500000 : "dtb"
0x000000500000-0x000000d00000 : "kernel-0"
0x000000d00000-0x000001500000 : "kernel-1"
0x000001500000-0x000001900000 : "logo"
0x000001900000-0x000006200000 : "rootfs"
0x000006200000-0x000010000000 : "opt"

进入系统后看了下磁盘分区,也确实如上面所说,rootfs只有58.6MB,opt有134.7MB。文件系统这么小,估计也不会包含Qt图形库了。

[root@IoT-A6G2C ~]# df -h
Filesystem                Size      Used Available Use% Mounted on
ubi0:rootfs              58.6M     45.1M     13.4M  77% /
devtmpfs                105.4M         0    105.4M   0% /dev
tmpfs                   121.6M         0    121.6M   0% /dev/shm
tmpfs                   121.6M     84.0K    121.5M   0% /tmp
tmpfs                   121.6M    172.0K    121.5M   0% /run
ubi1_0                  134.7M     68.0K    129.9M   0% /opt

再来看下各个分区的挂载方式,rootfs挂载为只读,opt是可读写。这样子就符合前面的分析了,主要是避免系统瘫痪,造成设备无法启动和工作。然而理想是很美好,现实很残酷。如果应用需要动态修改系统中的etc目录中文件时,就需要程序上动态加载或其他方法了。ZLG的文档上也提供了应用更新到系统中的多种方法,但也缺少一些现代设备上常用到的OTA升级,远程升级方式。

[root@IoT-A6G2C ~]# mount
ubi0:rootfs on / type ubifs (ro,sync,relatime)
devtmpfs on /dev type devtmpfs (rw,relatime,size=107948k,nr_inodes=26987,mode=755)
proc on /proc type proc (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,relatime,mode=777)
tmpfs on /tmp type tmpfs (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
sysfs on /sys type sysfs (rw,relatime)
ubi1_0 on /opt type ubifs (rw,relatime)

另外一点比较疑惑的是,ZLG的文档上并没有提到如何构建文件系统,对于高级开发者来说,只能自行使用Buildroot来构建自定义的系统了。实际上产品开发中,很多业务层需要的第三方的软件库,官方系统中并没有包含。对于这款开发板,如果使用官方提供的系统,就要自己交叉编译需要的库,再部置到opt目录下了。

文档中提到的Qt开发,也需要开发者选交叉编译后,再配置到QtCreator和开发板opt目录下。

Freescale i.MX6ULL Yocto分析

使用repo要先初始化仓库信息,先从repo目录下的manifest.xml文件分析项目结构。

<?xml version="1.0" encoding="UTF-8"?>
<manifest>

  <default sync-j="2"/>

  <remote fetch="git://git.yoctoproject.org" name="yocto"/>
  <remote fetch="git://github.com/Freescale" name="freescale"/>
  <remote fetch="git://git.openembedded.org" name="oe"/>
  <remote fetch="git://github.com/OSSystems" name="OSSystems"/>
  <remote fetch="git://github.com/meta-qt5"  name="QT5"/>
  <remote fetch="git://git.freescale.com/imx" name="fsl-release" />

  <project remote="yocto" revision="f5da2a5913319ad6ac2141438ba1aa17576326ab" name="poky" path="sources/poky"/>
  <project remote="yocto" revision="be78894e4682f111575470fb23e51e6ba523508d" name="meta-fsl-arm" path="sources/meta-fsl-arm"/>

  <project remote="oe" revision="247b1267bbe95719cd4877d2d3cfbaf2a2f4865a" name="meta-openembedded" path="sources/meta-openembedded"/>

  <project remote="freescale" revision="krogoth" name="fsl-community-bsp-base" path="sources/base">
     <copyfile dest="README" src="README"/>
     <copyfile dest="setup-environment" src="setup-environment"/>
  </project>

  <project remote="freescale" revision="3dfb82fc7e703eae9891b3ffda0e9393701f2396" name="meta-fsl-arm-extra" path="sources/meta-fsl-arm-extra"/>
  <project remote="freescale" revision="a165068f8a0d1cf29aabe4b4053f28be1c2aa492" name="meta-fsl-demos" path="sources/meta-fsl-demos"/>

  <project remote="OSSystems" revision="77736988073a5d90fcff9d0005c8477332ede387" name="meta-browser" path="sources/meta-browser" />
  <project remote="QT5" revision="ccae79be69c5268df3b47e4e14cea0591c39a531" name="meta-qt5" path="sources/meta-qt5" />

  <project remote="fsl-release" name="meta-fsl-bsp-release" path="sources/meta-fsl-bsp-release" revision="krogoth_4.1.15-2.0.1" >
     <copyfile src="imx/tools/fsl-setup-release.sh" dest="fsl-setup-release.sh"/>
     <copyfile src="imx/README" dest="README-IMXBSP"/>
  </project>

</manifest>

FSL提供的Yocto项目里有6个远端的项目URL,分别是Yocto, freescale, oe, OSSystems, QT5, fsl-release。从URL地址上看出,Yocto和oe是Yocto和OpenEmbedded开源项目各自的仓库地址。fsl-release是Freescale官方自己的仓库。freescale是Freescale在github上的仓库。

Yocto远端URL上有两个project, poky和meta-fsl-arm。poky是Yocto是参考构建系统。meta-fsl-arm是FSL的BSP相关代码。

oe远端URL上是meta-openembedded项目。

从freescale远端URL下载三个项目fsl-community-bsp-base, fsl-arm-extra, fsl-arm-demos。meta-community-bsp-base是FSL的社区版BSP代码。下载好后并将README和setup-environment放在当前目录下。fsl-arm-extra是第三方的一软库和软件包。fsl-arm-demos是包含一些demo程序。

从OSSystem远端URL下载了meta-browser。

从QT5远端URL下载meta-qt5 layer代码,用于构建qt5。

从fsl-release远端URL下载meta-fsl-bsp-release layer。这是FSL官方的Yocto评估和测试项目,大部分系统镜像从这里构建出。并且将imx/tools/fsl-setup-release.sh和imx/README文件放在当前目录下。

fsl-setup-release.sh  README  README-IMXBSP  setup-environment  sources

这也就是repo sync成功后,fsl-release-yocto目录下看到的文件或目录。sources下是所有的代码,fsl-setup-release.sh是yocto构建项目的助手,用于选择不同开发板型号和特性。README和README-IMXBSP是简要文档。setup-environment用于yocto是环境变量的加载。

FSL有两种个yocto项目,Official和Community。Official不接受其他人的代码贡献,属于FSL自己维护BSP,主要是为官方的评估板做系统测试和评估使用,不会保持更持的更新。Community是由社区推动的BSP部分,基于官方BSP修改,支持更多开发板或芯片型号,同时接受其他人的贡献和bug汇报修复动作。同时,项目也会一直保持更新。

多个标准C库实现的比较

http://www.etalabs.net/compare_libcs.html

Linux上用的C库实现大多是GNU开发的glibc实现,还有uclibc,musl之类的。Yocto提供的toolchain是有glibc,uclibc和musl三种的,默认是使用glibc的实现。

生成snapweb的Access Key

给Snappy Ubuntu Core系统安装snapweb应用,默认snapweb访问是4200端口,需要使Access Key会跳转至https的4201端口。生成key的方法如下:

sudo snapweb.generate-token

DroneCI启用privileged

有一个构建任务,需要把squash格式的镜像挂载使用,但是在drone里面一直报错。在自己的ubuntu 虚拟机测试可以。然后就手动在docker内测试,发现mount确实无法挂载这个镜像。提示如下

mount failed: Unknown error -1

这里需要给docker添加'--privileged'就可以了。查询drone的相关文档,并询问了相关开发者,才知道如何在drone中开启privileged特性。

  1. drone的服务需要配置DRONE_ADMIN环境变量,值是Gogs的用户名,以','隔开
services:
    drone-server:
        image: drone/drone:latest
        ports:
            - 8000:8000
        volumes:
            - /var/lib/drone:/var/lib/drone/
        restart: always
        environment:
            - DRONE_ADMIN=admin-dev,test
            - DRONE_OPEN=true
            - DRONE_HOST=http://192.168.2.12:8000
            - DRONE_GOGS=true
            - DRONE_GOGS_URL=http://192.168.2.12:3000
            - DRONE_SECRET="Bearer"
            - DRONE_GOGS_SKIP_VERIFY=true
  1. 在drone项目的设置参数中启用'Trusted'开关
  2. 添加'privileged: true'到drone.yml文件
workspace:
    path: /dronebuild
pipeline:
    build:
        image: ubuntu:latest
        privileged: true
        commands:
            - /bin/bash

体验Snappy Ubuntu Core系统

Snappy Ubuntu Core是由Ubuntu开发的一款面向IoT设备的操作系统,主要亮点是snap软件包,事务化的系统升级方案。Linux平台一直以开放著称,但不同发行版间的软件包也有很大差异,很多时候软件开发者需要制做不同发行版的软件包,才能让安装使用的体验更为舒服。snap软件包在技术上并没有前无古人的东东,自身是squashfs的镜像,包含了应用自身需要的相关依赖库,对应有目录结构,这一点有类似macOS上应用的bundle做法。

将做好的ubuntu core系统的img镜像写入到sdcard上,配置开发板从sdcard启动。ubuntu core系统启动后,并不能从串口登录,默认是推荐使用ssh方式。ubuntu默认是以ubuntu SSO的用户名来登录,密码需要生成ssh key然后上传public key到SSO账户上。然后ubuntu core启动后会在串口自动运行个wizard的程序来添加SSO账户名,这样就从远端把ssh public key下载到设备内,这样PC才可以使用ssh来登录。

最新文章

最近回复

  • Blackrose: 感谢拍砖!嗯,那句话...
  • aa: “Raspberry...
  • Blackrose: 外部只是帮你把芯片启...
  • : 内部时钟比外部的频率...
  • Blackrose: 你这评论比正文更有内容么
  • 7hao: CR+LF ...
  • Blackrose: 可以是你更新软件源后...
  • sxk: 博主,我的系统是ub...
  • Blackrose: 你深得精髓么
  • qihao: 这篇文章的简单总结就...

分类

归档

其它