Buildroot

Since November 2016 liteSOM is fully supported by Buildroot.

Buildroot is a tool that simplifies and automates the process of building a complete Linux system for an embedded system, using cross-compilation.

In order to achieve this, Buildroot is able to generate a cross-compilation toolchain, a root filesystem, a Linux kernel image and a bootloader for your target. Buildroot can be used for any combination of these options, independently (you can for example use an existing cross-compilation toolchain, and build only your root filesystem with Buildroot).

Buildroot is useful mainly for people working with embedded systems. Embedded systems often use processors that are not the regular x86 processors everyone is used to having in his PC. They can be PowerPC processors, MIPS processors, ARM processors, etc.

Buildroot supports numerous processors and their variants; it also comes with default configurations for several boards available off-the-shelf. Besides this, a number of third-party projects are based on, or develop their BSP or SDK on top of Buildroot.

from Buildroot user manual

Download Buildroot sources

Depends on your needs you can:

We recommends to use always the latest stable release.
Below we will use stable release 2016.11.2.

wget https://buildroot.org/downloads/buildroot-2016.11.2.tar.gz
tar xf buildroot-2016.11.2.tar.gz
cd buildroot-2016.11.2

Configure buildroot

Apply configuration from grinn_liteboard_defconfig file.

make grinn_liteboard_defconfig

Build firmware

make all

During the first build Buildroot will download and compile cross-compiler for liteSOM. This operation will take several minutes (around 30 minutes @ 8 x Intel® Core™ i7-2760QM CPU).

But after first build cross-compiler will be reused and build time will be reduced to the minimal value (in most cases it will take less than 1 minute).

Install firmware on SD card

sudo dd if=output/images/sdcard.img of=/dev/<SD card> bs=4M
sync

Where <SD card> points to your SD card device.

Show how to find SD card

Method 1

Insert SD cart to PC and check last lines from dmesg command output. Name assigned to the detected SD card will be presented as in the following example.

[ 6163.014768] mmc0: new high speed SDHC card at address 1234
[ 6163.024433] mmcblk0: mmc0:1234 SA16G 14.6 GiB 
[ 6163.025749]  mmcblk0: p1
[ 6163.375207] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)

Method 2

lsblk command will list all detected block devices where your SD card will be displayed.

NAME                      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                         8:0    0 238.5G  0 disk 
├─sda1                      8:1    0    28G  0 part /
├─sda2                      8:2    0     1K  0 part 
├─sda5                      8:5    0   9.3G  0 part 
└─sda6                      8:6    0 201.2G  0 part /home
sr0                        11:0    1  1024M  0 rom  
mmcblk0                   179:0    0  14.7G  0 disk 
└─mmcblk0p1               179:1    0  14.7G  0 part /media/foo/804b0b54-f37e-49cb-9299-87759d7b68d4

Device name

In both examples SD card was detected as mmcblk0 so valid dd … command syntax is

sudo dd if=output/images/sdcard.img of=/dev/mmcblk0 bs=4M

Run firmware on liteSOM

Insert programmed SD card to the liteboard card socket.

Configure boot switches to boot liteSOM from SD card.

Connect your liteboard to your PC via USB ↔ micro USB cable.

liteboard will be automatically powered-up and on debug console you should see starting Linux, as presented below.

Show log

U-Boot SPL 2016.09.01 (Feb 04 2017 - 20:06:45)
Trying to boot from MMC1


U-Boot 2016.09.01 (Feb 04 2017 - 20:06:45 +0100)

CPU:   Freescale i.MX6UL rev1.0 528 MHz (running at 396 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 41C
Reset cause: POR
Board: Grinn liteBoard
DRAM:  512 MiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
switch to partitions #0, OK
mmc0 is current device
Net:   FEC [PRIME]
Error: FEC address not set.

Hit any key to stop autoboot:  1  0 
switch to partitions #0, OK
mmc0 is current device
reading boot.scr
** Unable to read file boot.scr **
reading zImage
6067112 bytes read in 280 ms (20.7 MiB/s)
Booting from mmc ...
reading imx6ul-liteboard.dtb
21018 bytes read in 19 ms (1.1 MiB/s)
## Flattened Device Tree blob at 83000000
   Booting using the fdt blob at 0x83000000
   Using Device Tree in place at 83000000, end 83008219

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.8.0 (filug@oxygen) (gcc version 5.4.0 (Buildroot 2016.11.2) ) #1 SMP Sat Feb 4 20:24:00 CET 2017
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt:Machine model: Grinn i.MX6UL liteBoard
[    0.000000] cma: Reserved 16 MiB at 0x9f000000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] percpu: Embedded 14 pages/cpu @debcd000 s26024 r8192 d23128 u57344
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048
[    0.000000] Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk0p2 rootwait rw
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 481192K/524288K available (9216K kernel code, 442K rwdata, 2924K rodata, 1024K init, 8224K bss, 26712K reserved, 16384K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xe0800000 - 0xff800000   ( 496 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0a00000   (10208 kB)
[    0.000000]       .init : 0xc0d00000 - 0xc0e00000   (1024 kB)
[    0.000000]       .data : 0xc0e00000 - 0xc0e6e900   ( 443 kB)
[    0.000000]        .bss : 0xc0e70000 - 0xc16782fc   (8225 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Running RCU self tests
[    0.000000] Hierarchical RCU implementation.
[    0.000000] 	RCU lockdep checking is enabled.
[    0.000000] 	Build-time adjustment of leaf fanout to 32.
[    0.000000] 	RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=1.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=1
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] Switching to timer-based delay loop, resolution 41ns
[    0.000018] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000062] clocksource: mxc_timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.002512] Console: colour dummy device 80x30
[    0.002588] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[    0.002613] ... MAX_LOCKDEP_SUBCLASSES:  8
[    0.002636] ... MAX_LOCK_DEPTH:          48
[    0.002655] ... MAX_LOCKDEP_KEYS:        8191
[    0.002676] ... CLASSHASH_SIZE:          4096
[    0.002695] ... MAX_LOCKDEP_ENTRIES:     32768
[    0.002714] ... MAX_LOCKDEP_CHAINS:      65536
[    0.002735] ... CHAINHASH_SIZE:          32768
[    0.002754]  memory used by lock dependency info: 5167 kB
[    0.002774]  per task-struct memory footprint: 1536 bytes
[    0.002852] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
[    0.002897] pid_max: default: 32768 minimum: 301
[    0.003627] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.003666] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.007943] CPU: Testing write buffer coherency: ok
[    0.009640] /cpus/cpu@0 missing clock-frequency property
[    0.009692] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.009759] Setting up static identity map for 0x80100000 - 0x80100070
[    0.017417] Brought up 1 CPUs
[    0.017462] SMP: Total of 1 processors activated (48.00 BogoMIPS).
[    0.017485] CPU: All CPU(s) started in SVC mode.
[    0.022198] devtmpfs: initialized
[    0.064396] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.066318] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.068429] pinctrl core: initialized pinctrl subsystem
[    0.076823] NET: Registered protocol family 16
[    0.083895] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.088726] cpuidle: using governor menu
[    0.174504] No ATAGs?
[    0.174604] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.174638] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.181852] imx6ul-pinctrl 20e0000.iomuxc: initialized IMX pinctrl driver
[    0.265788] mxs-dma 1804000.dma-apbh: initialized
[    0.273720] vgaarb: loaded
[    0.275942] SCSI subsystem initialized
[    0.278980] usbcore: registered new interface driver usbfs
[    0.279420] usbcore: registered new interface driver hub
[    0.280001] usbcore: registered new device driver usb
[    0.282657] Linux video capture interface: v2.00
[    0.283238] pps_core: LinuxPPS API ver. 1 registered
[    0.283270] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.283572] PTP clock support registered
[    0.285711] Advanced Linux Sound Architecture Driver Initialized.
[    0.291962] Bluetooth: Core ver 2.21
[    0.292210] NET: Registered protocol family 31
[    0.292239] Bluetooth: HCI device and connection manager initialized
[    0.292389] Bluetooth: HCI socket layer initialized
[    0.292458] Bluetooth: L2CAP socket layer initialized
[    0.292906] Bluetooth: SCO socket layer initialized
[    0.300318] clocksource: Switched to clocksource mxc_timer1
[    0.301664] VFS: Disk quotas dquot_6.6.0
[    0.301994] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.376072] NET: Registered protocol family 2
[    0.379883] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[    0.380099] TCP bind hash table entries: 4096 (order: 5, 147456 bytes)
[    0.383962] TCP: Hash tables configured (established 4096 bind 4096)
[    0.384361] UDP hash table entries: 256 (order: 2, 20480 bytes)
[    0.384881] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes)
[    0.387111] NET: Registered protocol family 1
[    0.389811] RPC: Registered named UNIX socket transport module.
[    0.389858] RPC: Registered udp transport module.
[    0.389886] RPC: Registered tcp transport module.
[    0.389912] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.399439] futex hash table entries: 256 (order: 2, 16384 bytes)
[    0.404728] workingset: timestamp_bits=30 max_order=17 bucket_order=0
[    0.464310] NFS: Registering the id_resolver key type
[    0.464764] Key type id_resolver registered
[    0.464801] Key type id_legacy registered
[    0.465108] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    0.469829] fuse init (API version 7.25)
[    0.493977] io scheduler noop registered
[    0.494026] io scheduler deadline registered
[    0.495169] io scheduler cfq registered (default)
[    0.509189] imx-sdma 20ec000.sdma: Direct firmware load for imx/sdma/sdma-imx6q.bin failed with error -2
[    0.509257] imx-sdma 20ec000.sdma: external firmware not found, using ROM firmware
[    0.535444] 2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 18, base_baud = 5000000) is a IMX
[    1.201387] console [ttymxc0] enabled
[    1.211781] [drm] Initialized drm 1.1.0 20060810
[    1.302731] brd: module loaded
[    1.353229] loop: module loaded
[    1.369515] libphy: Fixed MDIO Bus: probed
[    1.376830] CAN device driver interface
[    1.384819] 2188000.ethernet supply phy not found, using dummy regulator
[    1.396251] pps pps0: new PPS source ptp0
[    1.401067] fec 2188000.ethernet (unnamed net_device) (uninitialized): Invalid MAC address: 00:00:00:00:00:00
[    1.411181] fec 2188000.ethernet (unnamed net_device) (uninitialized): Using random MAC address: 32:c5:1e:80:8a:07
[    1.423701] libphy: fec_enet_mii_bus: probed
[    1.438037] fec 2188000.ethernet eth0: registered PHC device 0
[    1.447577] usbcore: registered new interface driver asix
[    1.453727] usbcore: registered new interface driver ax88179_178a
[    1.460557] usbcore: registered new interface driver cdc_ether
[    1.466775] usbcore: registered new interface driver net1080
[    1.473037] usbcore: registered new interface driver cdc_subset
[    1.479324] usbcore: registered new interface driver zaurus
[    1.485665] usbcore: registered new interface driver cdc_ncm
[    1.491469] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.498046] ehci-pci: EHCI PCI platform driver
[    1.502930] ehci-mxc: Freescale On-Chip EHCI Host driver
[    1.509848] usbcore: registered new interface driver usb-storage
[    1.527647] ci_hdrc ci_hdrc.0: EHCI Host Controller
[    1.533524] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1
[    1.570446] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
[    1.585297] hub 1-0:1.0: USB hub found
[    1.589582] hub 1-0:1.0: 1 port detected
[    1.604334] mousedev: PS/2 mouse device common for all mice
[    1.615129] input: 20cc000.snvs:snvs-powerkey as /devices/soc0/soc/2000000.aips-bus/20cc000.snvs/20cc000.snvs:snvs-powerkey/input/input0
[    1.641213] snvs_rtc 20cc000.snvs:snvs-rtc-lp: rtc core: registered 20cc000.snvs:snvs-r as rtc0
[    1.650564] i2c /dev entries driver
[    1.655814] IR NEC protocol handler initialized
[    1.660536] IR RC5(x/sz) protocol handler initialized
[    1.665640] IR RC6 protocol handler initialized
[    1.670282] IR JVC protocol handler initialized
[    1.674860] IR Sony protocol handler initialized
[    1.679517] IR SANYO protocol handler initialized
[    1.684324] IR Sharp protocol handler initialized
[    1.689075] IR MCE Keyboard/mouse protocol handler initialized
[    1.695005] IR XMP protocol handler initialized
[    1.715093] imx2-wdt 20bc000.wdog: timeout 60 sec (nowayout=0)
[    1.721581] Bluetooth: HCI UART driver ver 2.3
[    1.726086] Bluetooth: HCI UART protocol H4 registered
[    1.731355] Bluetooth: HCI UART protocol LL registered
[    1.738489] sdhci: Secure Digital Host Controller Interface driver
[    1.744810] sdhci: Copyright(c) Pierre Ossman
[    1.749210] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.757736] sdhci-esdhc-imx 2190000.usdhc: Got CD GPIO
[    1.831511] mmc0: SDHCI controller on 2190000.usdhc [2190000.usdhc] using ADMA
[    1.909486] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.917756] mmc1: SDHCI controller on 2194000.usdhc [2194000.usdhc] using ADMA
[    1.942997] mmc0: new high speed SDHC card at address 1234
[    1.978846] usbcore: registered new interface driver usbhid
[    1.984608] usbhid: USB HID core driver
[    1.995026] mmcblk0: mmc0:1234 SA04G 3.64 GiB 
[    2.010527]  mmcblk0: p1 p2
[    2.040427] random: fast init done
[    2.055771] NET: Registered protocol family 10
[    2.060674] mmc1: new DDR MMC card at address 0001
[    2.072232] mmcblk1: mmc1:0001 MMC02G 1.79 GiB 
[    2.082455] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    2.092614] mmcblk1boot0: mmc1:0001 MMC02G partition 1 1.00 MiB
[    2.103998] NET: Registered protocol family 17
[    2.108594] can: controller area network core (rev 20120528 abi 9)
[    2.115230] mmcblk1boot1: mmc1:0001 MMC02G partition 2 1.00 MiB
[    2.123273] mmcblk1rpmb: mmc1:0001 MMC02G partition 3 128 KiB
[    2.135563] NET: Registered protocol family 29
[    2.145289] can: raw protocol (rev 20120528)
[    2.149873] can: broadcast manager protocol (rev 20160617 t)
[    2.168115] can: netlink gateway (rev 20130117) max_hops=1
[    2.175783] Key type dns_resolver registered
[    2.183776] cpu cpu0: dev_pm_opp_get_opp_count: OPP table not found (-19)
[    2.196849] Registering SWP/SWPB emulation handler
[    2.213038] snvs_rtc 20cc000.snvs:snvs-rtc-lp: setting system clock to 1970-01-01 00:00:58 UTC (58)
[    2.302257] vdd3p0: disabling
[    2.306262] ALSA device list:
[    2.309265]   No soundcards found.
[    2.327776] EXT4-fs (mmcblk0p2): couldn't mount as ext3 due to feature incompatibilities
[    2.481623] EXT4-fs (mmcblk0p2): recovery complete
[    2.490129] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    2.498590] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    2.507925] devtmpfs: mounted
[    2.514513] Freeing unused kernel memory: 1024K (c0d00000 - c0e00000)
[    2.658588] EXT4-fs (mmcblk0p2): re-mounted. Opts: errors=remount-ro,data=ordered
Starting logging: OK
Initializing random number generator... done.
Starting network: [    3.352162] Generic PHY 2188000.ethernet:00: attached PHY driver [Generic PHY] (mii_bus:phy_addr=2188000.ethernet:00, irq=-1)
[    3.364245] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
udhcpc: started, v1.25.1
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
udhcpc: no lease, failing
FAIL

Welcome to Buildroot
buildroot login: 

With default configuration you can log as a root (no password needed) and start to use your liteboard.

  • litesom/buildroot.txt
  • Last modified: 2019/04/12 14:08
  • by piotr.figlarek