Buildroot
About 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.
How to use Buildroot and chiliSOM
Download Buildroot sources
Depends on your needs you can:
- download stable release from https://buildroot.org/downloads/,
- clone latest from https://git.buildroot.net/buildroot repository.
We recommends to use always the latest stable release.
Below we will use stable release 2018.11.1.
wget https://buildroot.org/downloads/buildroot-2018.11.1.tar.gz tar xf buildroot-2018.11.1.tar.gz cd buildroot-2018.11.1
Configure buildroot
Apply configuration from grinn_chiliboard_defconfig file.
make grinn_chiliboard_defconfig
Build firmware
make all
During the first build Buildroot will download and compile cross-compiler for chiliSOM. 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.
dd …
command.of=…
points to your SD card. In case of mistake (when of=…
points to your system disk) you can damage data on your system disk.
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 chiliSOM
Insert programmed SD card to the chiliboard card socket.
Configure boot switches as presented below.
BOOT0 | BOOT1 | BOOT2 | BOOT3 | BOOT4 | BOOT5 |
---|---|---|---|---|---|
ON | ON | ON | |||
OFF | OFF | OFF | |||
1 | 2 | 3 | 4 | 5 | 6 |
Connect your chiliboard to your PC via USB ↔ micro USB cable.
chiliboard will be automatically powered-up and on debug console you should see starting Linux, as presented below.
U-Boot SPL 2019.01 (Jan 17 2019 - 21:15:07 +0100) Trying to boot from MMC1 U-Boot 2019.01 (Jan 17 2019 - 21:15:07 +0100) CPU : AM335X-GP rev 2.1 I2C: ready DRAM: 512 MiB NAND: 256 MiB MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1 <ethaddr> not set. Validating first E-fuse MAC Net: Net Initialization Skipped No ethernet found. Hit any key to stop autoboot: 0 switch to partitions #0, OK mmc0 is current device SD/MMC found on device 0 5354504 bytes read in 335 ms (15.2 MiB/s) 32924 bytes read in 4 ms (7.8 MiB/s) ## Flattened Device Tree blob at 87800000 Booting using the fdt blob at 0x87800000 Loading Device Tree to 9df7b000, end 9df8609b ... OK Starting kernel ... [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 4.9.66 (mucka@winston) (gcc version 7.3.0 (Buildroot 2018.11.1-g570495e-dirty) ) #1 SMP Thu Jan 17 18:18:09 [ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache [ 0.000000] OF: fdt:Machine model: Grinn chiliboard with serials: RS232, RS485, CAN [ 0.000000] cma: Reserved 16 MiB at 0x9e800000 [ 0.000000] Memory policy: Data cache writeback [ 0.000000] CPU: All CPU(s) started in SVC mode. [ 0.000000] AM335X ES2.1 (sgx neon) [ 0.000000] percpu: Embedded 15 pages/cpu @df942000 s31592 r8192 d21656 u61440 [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 129412 [ 0.000000] Kernel command line: console=ttyO0,115200n8,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: 480376K/522240K available (7168K kernel code, 779K rwdata, 2396K rodata, 1024K init, 8137K bss, 25480K reserved,) [ 0.000000] Virtual kernel memory layout: [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB) [ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB) [ 0.000000] vmalloc : 0xe0000000 - 0xff800000 ( 504 MB) [ 0.000000] lowmem : 0xc0000000 - 0xdfe00000 ( 510 MB) [ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB) [ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB) [ 0.000000] .text : 0xc0008000 - 0xc0800000 (8160 kB) [ 0.000000] .init : 0xc0b00000 - 0xc0c00000 (1024 kB) [ 0.000000] .data : 0xc0c00000 - 0xc0cc2e14 ( 780 kB) [ 0.000000] .bss : 0xc0cc4000 - 0xc14b65a0 (8138 kB) [ 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=2 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] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts [ 0.000000] OMAP clockevent source: timer2 at 24000000 Hz [ 0.000014] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns [ 0.000038] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns [ 0.000079] OMAP clocksource: timer1 at 24000000 Hz [ 0.000512] clocksource_probe: no matching clocksources found [ 0.001402] Console: colour dummy device 80x30 [ 0.001459] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar [ 0.001468] ... MAX_LOCKDEP_SUBCLASSES: 8 [ 0.001476] ... MAX_LOCK_DEPTH: 48 [ 0.001484] ... MAX_LOCKDEP_KEYS: 8191 [ 0.001491] ... CLASSHASH_SIZE: 4096 [ 0.001499] ... MAX_LOCKDEP_ENTRIES: 32768 [ 0.001507] ... MAX_LOCKDEP_CHAINS: 65536 [ 0.001514] ... CHAINHASH_SIZE: 32768 [ 0.001522] memory used by lock dependency info: 5167 kB [ 0.001530] per task-struct memory footprint: 1536 bytes [ 0.001563] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736) [ 0.078839] pid_max: default: 32768 minimum: 301 [ 0.079314] Security Framework initialized [ 0.079458] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes) [ 0.079471] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes) [ 0.082912] CPU: Testing write buffer coherency: ok [ 0.084392] CPU0: thread -1, cpu 0, socket -1, mpidr 0 [ 0.084463] Setting up static identity map for 0x80100000 - 0x80100070 [ 0.088672] Brought up 1 CPUs [ 0.088696] SMP: Total of 1 processors activated (996.14 BogoMIPS). [ 0.088706] CPU: All CPU(s) started in SVC mode. [ 0.092699] devtmpfs: initialized [ 0.127583] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3 [ 0.128471] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns [ 0.128533] futex hash table entries: 256 (order: 2, 16384 bytes) [ 0.130321] pinctrl core: initialized pinctrl subsystem [ 0.135027] NET: Registered protocol family 16 [ 0.140991] DMA: preallocated 256 KiB pool for atomic coherent allocations [ 0.183437] omap_hwmod: debugss: _wait_target_disable failed [ 0.239571] cpuidle: using governor menu [ 0.256739] OMAP GPIO hardware version 0.1 [ 0.293303] omap-gpmc 50000000.gpmc: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/nandflash_pins, defe [ 0.296429] No ATAGs? [ 0.296453] hw-breakpoint: debug architecture 0x4 unsupported. [ 0.296654] omap4_sram_init:Unable to allocate sram needed to handle errata I688 [ 0.296670] omap4_sram_init:Unable to get sram pool needed to handle errata I688 [ 0.342166] edma 49000000.edma: TI EDMA DMA engine driver [ 0.345753] SCSI subsystem initialized [ 0.347356] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins, defe [ 0.347633] pps_core: LinuxPPS API ver. 1 registered [ 0.347644] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it> [ 0.347693] PTP clock support registered [ 0.352141] clocksource: Switched to clocksource timer1 [ 0.453274] VFS: Disk quotas dquot_6.6.0 [ 0.453459] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes) [ 0.484182] NET: Registered protocol family 2 [ 0.486104] TCP established hash table entries: 4096 (order: 2, 16384 bytes) [ 0.486202] TCP bind hash table entries: 4096 (order: 5, 147456 bytes) [ 0.487365] TCP: Hash tables configured (established 4096 bind 4096) [ 0.487542] UDP hash table entries: 256 (order: 2, 20480 bytes) [ 0.487711] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes) [ 0.488533] NET: Registered protocol family 1 [ 0.490605] RPC: Registered named UNIX socket transport module. [ 0.490629] RPC: Registered udp transport module. [ 0.490639] RPC: Registered tcp transport module. [ 0.490649] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 0.493911] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available [ 0.498160] audit: initializing netlink subsys (disabled) [ 0.498391] audit: type=2000 audit(0.490:1): initialized [ 0.502259] workingset: timestamp_bits=14 max_order=17 bucket_order=3 [ 0.505335] NFS: Registering the id_resolver key type [ 0.505671] Key type id_resolver registered [ 0.505686] Key type id_legacy registered [ 0.505835] jffs2: version 2.2. (NAND) (SUMMARY) �© 2001-2006 Red Hat, Inc. [ 0.510952] io scheduler noop registered [ 0.510978] io scheduler deadline registered [ 0.511095] io scheduler cfq registered (default) [ 0.513119] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568 [ 0.516547] Serial: 8250/16550 driver, 6 ports, IRQ sharing enabled [ 0.524487] omap_uart 44e09000.serial: no wakeirq for uart0 [ 0.525025] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 158, base_baud = 3000000) is a OMAP UART0 [ 1.218875] console [ttyO0] enabled [ 1.224401] omap_uart 48022000.serial: no wakeirq for uart1 [ 1.230675] 48022000.serial: ttyO1 at MMIO 0x48022000 (irq = 159, base_baud = 3000000) is a OMAP UART1 [ 1.241938] omap_uart 481a8000.serial: no wakeirq for uart4 [ 1.248167] 481a8000.serial: ttyO4 at MMIO 0x481a8000 (irq = 160, base_baud = 3000000) is a OMAP UART4 [ 1.296991] brd: module loaded [ 1.323946] loop: module loaded [ 1.329577] mtdoops: mtd device (mtddev=name/number) must be supplied [ 1.339431] libphy: Fixed MDIO Bus: probed [ 1.344319] vcan: Virtual CAN interface driver [ 1.348964] CAN device driver interface [ 1.355927] c_can_platform 481cc000.can: c_can_platform device registered (regs=fa1cc000, irq=164) [ 1.442173] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6 [ 1.448559] davinci_mdio 4a101000.mdio: detected phy mask fffffffe [ 1.458933] libphy: 4a101000.mdio: probed [ 1.463310] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC LAN8710/LAN8720 [ 1.474229] cpsw 4a100000.ethernet: Detected MACID = 84:eb:18:e1:f2:ab [ 1.487278] mousedev: PS/2 mouse device common for all mice [ 1.493245] i2c /dev entries driver [ 1.499385] omap_hsmmc 48060000.mmc: Got CD GPIO [ 1.507086] ledtrig-cpu: registered to indicate activity on CPUs [ 1.514459] oprofile: using arm/armv7 [ 1.519002] Initializing XFRM netlink socket [ 1.523960] NET: Registered protocol family 10 [ 1.531781] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver [ 1.540536] NET: Registered protocol family 17 [ 1.545392] NET: Registered protocol family 15 [ 1.550038] can: controller area network core (rev 20120528 abi 9) [ 1.556680] NET: Registered protocol family 29 [ 1.561358] can: raw protocol (rev 20120528) [ 1.565987] can: broadcast manager protocol (rev 20161123 t) [ 1.571938] can: netlink gateway (rev 20130117) max_hops=1 [ 1.578165] Key type dns_resolver registered [ 1.582853] omap_voltage_late_init: Voltage driver support not added [ 1.589504] sr_dev_init: No voltage domain specified for smartreflex0. Cannot initialize [ 1.597993] sr_dev_init: No voltage domain specified for smartreflex1. Cannot initialize [ 1.607151] ThumbEE CPU extension supported. [ 1.611653] Registering SWP/SWPB emulation handler [ 1.616731] SmartReflex Class3 initialized [ 1.641847] omap-gpmc 50000000.gpmc: GPMC revision 6.0 [ 1.647627] gpmc_mem_init: disabling cs 0 mapped at 0x0-0x1000000 [ 1.658439] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xda [ 1.665247] nand: Micron MT29F2G08ABAEAH4 [ 1.669441] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64 [ 1.677448] nand: using OMAP_ECC_BCH8_CODE_HW ECC scheme [ 1.736150] random: fast init done [ 1.745222] tps65217 0-0024: TPS65217 ID 0xe version 1.2 [ 1.750927] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz [ 1.757985] omap_hsmmc 48060000.mmc: Got CD GPIO [ 1.825143] hctosys: unable to open rtc device (rtc0) [ 1.830431] sr_init: No PMIC hook to init smartreflex [ 1.836067] sr_init: platform driver register failed for SR [ 1.849095] Waiting for root device /dev/mmcblk0p2... [ 1.890008] mmc0: host does not support reading read-only switch, assuming write-enable [ 1.900530] mmc0: new high speed SDHC card at address 1234 [ 1.909812] mmcblk0: mmc0:1234 SA08G 7.21 GiB [ 1.918963] mmcblk0: p1 p2 [ 1.975858] EXT4-fs (mmcblk0p2): couldn't mount as ext3 due to feature incompatibilities [ 2.301414] EXT4-fs (mmcblk0p2): recovery complete [ 2.312371] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null) [ 2.321020] VFS: Mounted root (ext4 filesystem) on device 179:2. [ 2.330058] devtmpfs: mounted [ 2.335311] Freeing unused kernel memory: 1024K [ 2.446166] EXT4-fs (mmcblk0p2): re-mounted. Opts: data=ordered Starting logging: OK Initializing random number generator... done. Starting network: [ 2.890135] net eth0: initializing cpsw version 1.12 (0) [ 2.992785] SMSC LAN8710/LAN8720 4a101000.mdio:00: attached PHY driver [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=4a101000.mdio:00, ir) [ 3.015661] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready udhcpc: started, v1.29.3 udhcpc: sending discover udhcpc: sending discover udhcpc: sending discover udhcpc: no lease, failing [ 12.196832] c_can_platform 481cc000.can can0: setting BTR=1c0b BRPE=0000 FAIL Welcome to Buildroot buildroot login:
With default configuration you can log as a root
(no password needed) and start to use your chiliboard.