Skip to content Skip to main navigation Skip to footer

Build simple ARM image with Buildroot and run with QEMU

Get Buildroot

# clone repository
$ git clone git://git.buildroot.net/buildroot
$ cd buildroot/
# checkout stable branch 2020.11
$ git checkout -b 2020.11
# apply default config
$ make qemu_arm_versatile_defconfig

Configure Buildroot toolchain

# run configuration menu
$ make menuconfig

Once menu appeared change toolchain:

  • Toolchain->Toolchain type->External toolchain->Sourcery CodeBench ARM 2014.05
  • Save changes
  • Exit

Build Images

it will take ~30 minutes, download ~350M and use ~6G on HDD

$ make

There are next files will be created:

  • versatile-pb.dtb – Device Three
  • zImage – Linux Kernel
  • rootfs.ext2 – Root File system
  • start-qemu.sh – QEMU start script
$ ls output/images/
rootfs.ext2 start-qemu.sh versatile-pb.dtb zImage

buildroot builds qemu binaries so it doesn’t require to install it separately

Run in console mode

Login: root (without password)

$ output/images/start-qemu.sh serial-only

Output log

vpb_sic_write: Bad register offset 0x2c
Booting Linux on physical CPU 0x0
Linux version 5.4.58 (myk@vinigret) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29)) #1 Sun Dec 6 02:05:28 EET 2020
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00093177
CPU: VIVT data cache, VIVT instruction cache
OF: fdt: Machine model: ARM Versatile PB
Memory policy: Data cache writeback
Built 1 zonelists, mobility grouping on.  Total pages: 32512
Kernel command line: rootwait root=/dev/sda console=ttyAMA0,115200
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
mem auto-init: stack:off, heap alloc:off, heap free:off
Memory: 124540K/131072K available (3802K kernel code, 149K rwdata, 844K rodata, 140K init, 201K bss, 6532K reserved, 0K cma-reserved)
SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
VIC @(ptrval): id 0x00041190, vendor 0x41
FPGA IRQ chip 0 "intc" @ (ptrval), 20 irqs, parent IRQ: 47
random: get_random_bytes called from start_kernel+0x260/0x3d8 with crng_init=0
clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 2147483647500ns
Failed to initialize '/amba/timer@101e3000': -22
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
Console: colour dummy device 80x30
Calibrating delay loop... 614.40 BogoMIPS (lpj=3072000)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x8400 - 0x8458
devtmpfs: initialized
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
futex hash table entries: 256 (order: -1, 3072 bytes, linear)
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
OF: amba_device_add() failed (-19) for /amba/smc@10100000
OF: amba_device_add() failed (-19) for /amba/mpmc@10110000
OF: amba_device_add() failed (-19) for /amba/sctl@101e0000
OF: amba_device_add() failed (-19) for /amba/watchdog@101e1000
OF: amba_device_add() failed (-19) for /amba/sci@101f0000
OF: amba_device_add() failed (-19) for /amba/spi@101f4000
OF: amba_device_add() failed (-19) for /amba/fpga/sci@a000
Serial: AMBA PL011 UART driver
101f1000.uart: ttyAMA0 at MMIO 0x101f1000 (irq = 28, base_baud = 0) is a PL011 rev1
printk: console [ttyAMA0] enabled
101f2000.uart: ttyAMA1 at MMIO 0x101f2000 (irq = 29, base_baud = 0) is a PL011 rev1
101f3000.uart: ttyAMA2 at MMIO 0x101f3000 (irq = 30, base_baud = 0) is a PL011 rev1
uart-pl011 10009000.uart: aliased and non-aliased serial devices found in device tree. Serial port enumeration may be unpredictable.
10009000.uart: ttyAMA3 at MMIO 0x10009000 (irq = 54, base_baud = 0) is a PL011 rev1
vgaarb: loaded
SCSI subsystem initialized
clocksource: Switched to clocksource arm,sp804
NET: Registered protocol family 2
tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
TCP: Hash tables configured (established 1024 bind 1024)
UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
NET: Registered protocol family 1
PCI: CLS 0 bytes, default 32
workingset: timestamp_bits=30 max_order=15 bucket_order=0
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler mq-deadline registered
io scheduler kyber registered
versatile-pci 10001000.pci: host bridge /amba/pci@10001000 ranges:
versatile-pci 10001000.pci:    IO 0x43000000..0x4300ffff -> 0x00000000
versatile-pci 10001000.pci:   MEM 0x50000000..0x5fffffff -> 0x50000000
versatile-pci 10001000.pci:   MEM 0x60000000..0x6fffffff -> 0x60000000
versatile-pci 10001000.pci: PCI core found (slot 11)
versatile-pci 10001000.pci: PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [bus 00-ff]
pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
pci_bus 0000:00: root bus resource [mem 0x50000000-0x5fffffff]
pci_bus 0000:00: root bus resource [mem 0x60000000-0x6fffffff pref]
pci 0000:00:0c.0: [10ec:8139] type 00 class 0x020000
pci 0000:00:0c.0: reg 0x10: [io  0x0000-0x00ff]
pci 0000:00:0c.0: reg 0x14: [mem 0x00000000-0x000000ff]
pci 0000:00:0c.0: reg 0x30: [mem 0x00000000-0x0003ffff pref]
pci 0000:00:0d.0: [1000:0012] type 00 class 0x010000
pci 0000:00:0d.0: reg 0x10: [io  0x0000-0x00ff]
pci 0000:00:0d.0: reg 0x14: [mem 0x00000000-0x000003ff]
pci 0000:00:0d.0: reg 0x18: [mem 0x00000000-0x00001fff]
PCI: bus0: Fast back to back transfers disabled
pci 0000:00:0c.0: BAR 6: assigned [mem 0x60000000-0x6003ffff pref]
pci 0000:00:0d.0: BAR 2: assigned [mem 0x50000000-0x50001fff]
pci 0000:00:0d.0: BAR 1: assigned [mem 0x50002000-0x500023ff]
pci 0000:00:0c.0: BAR 0: assigned [io  0x1000-0x10ff]
pci 0000:00:0c.0: BAR 1: assigned [mem 0x50002400-0x500024ff]
pci 0000:00:0d.0: BAR 0: assigned [io  0x1400-0x14ff]
clcd-pl11x 10120000.display: PL110 designer 41 rev0 at 0x10120000
clcd-pl11x: probe of 10120000.display failed with error -2
sym53c8xx 0000:00:0d.0: enabling device (0100 -> 0103)
sym0: <895a> rev 0x0 at pci 0000:00:0d.0 irq 67
sym0: No NVRAM, ID 7, Fast-40, LVD, parity checking
sym0: SCSI BUS has been reset.
scsi host0: sym-2.2.3
random: fast init done
scsi 0:0:0:0: Direct-Access     QEMU     QEMU HARDDISK    2.5+ PQ: 0 ANSI: 5
scsi target0:0:0: tagged command queuing enabled, command queue depth 16.
scsi target0:0:0: Beginning Domain Validation
scsi target0:0:0: Domain Validation skipping write tests
scsi target0:0:0: Ending Domain Validation
scsi 0:0:2:0: CD-ROM            QEMU     QEMU CD-ROM      2.5+ PQ: 0 ANSI: 5
scsi target0:0:2: tagged command queuing enabled, command queue depth 16.
scsi target0:0:2: Beginning Domain Validation
scsi target0:0:2: Domain Validation skipping write tests
scsi target0:0:2: Ending Domain Validation
libphy: Fixed MDIO Bus: probed
8139cp: 8139cp: 10/100 PCI Ethernet driver v1.3 (Mar 22, 2004)
8139cp 0000:00:0c.0: enabling device (0100 -> 0103)
8139cp 0000:00:0c.0 eth0: RTL-8139C+ at 0x(ptrval), 52:54:00:12:34:56, IRQ 66
versatile reboot driver registered
NET: Registered protocol family 10
sd 0:0:0:0: Power-on or device reset occurred
sd 0:0:0:0: [sda] 122880 512-byte logical blocks: (62.9 MB/60.0 MiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sd 0:0:0:0: [sda] Attached SCSI disk
Segment Routing with IPv6
sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
NET: Registered protocol family 17
input: AT Raw Set 2 keyboard as /devices/platform/amba/amba:fpga/10006000.kmi/serio0/input/input0
input: ImExPS/2 Generic Explorer Mouse as /devices/platform/amba/amba:fpga/10007000.kmi/serio1/input/input2
EXT4-fs (sda): mounting ext2 file system using the ext4 subsystem
EXT4-fs (sda): mounted filesystem without journal. Opts: (null)
VFS: Mounted root (ext2 filesystem) readonly on device 8:0.
devtmpfs: mounted
Freeing unused kernel memory: 140K
This architecture does not have kernel memory protection.
Run /sbin/init as init process
EXT4-fs (sda): re-mounted. Opts: (null)
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Saving random seed: random: dd: uninitialized urandom read (512 bytes read)
OK
Starting network: 8139cp 0000:00:0c.0 eth0: link up, 100Mbps, full-duplex, lpa 0x05E1
udhcpc: started, v1.32.0
udhcpc: sending discover
udhcpc: sending select for 10.0.2.15
udhcpc: lease of 10.0.2.15 obtained, lease time 86400
deleting routers
adding dns 10.0.2.3
OK

Welcome to Buildroot
buildroot login: root
# uname -a
Linux buildroot 5.4.58 #1 Sun Dec 6 02:05:28 EET 2020 armv5tejl GNU/Linux
# 

Print CPU info

$ cat /proc/cpuinfo 
processor	: 0
model name	: ARM926EJ-S rev 5 (v5l)
BogoMIPS	: 1558.11
Features	: swp half thumb fastmult edsp java 
CPU implementer	: 0x41
CPU architecture: 5TEJ
CPU variant	: 0x0
CPU part	: 0x926
CPU revision	: 5

Hardware	: ARM-Versatile (Device Tree Support)
Revision	: 0000
Serial		: 0000000000000000

How-to exit a QEMU console

Press Ctrl+A x to quit