Monday, 23 August 2021

Raspberry Pi OS on QEMU raspi2b - System Information

Raspberry Pi OS

The popular Raspberry Pi (Wikipedia) is often used with a tuned Linux distribution: Raspberry Pi OS (formerly Raspbian), which is based on Debian Linux.

QEMU

The system emulator QEMU provides machine profiles for a selection of Raspberry Pi models:

The 32-bit ARM models, ARMv6 & ARMv7:

$ qemu-system-arm -machine help | grep rasp
raspi0               Raspberry Pi Zero (revision 1.2)
raspi1ap             Raspberry Pi A+ (revision 1.1)
raspi2               Raspberry Pi 2B (revision 1.1) (alias of raspi2b)
raspi2b              Raspberry Pi 2B (revision 1.1)

The 64-bit ARM models, ARMv8:

$ qemu-system-aarch64 -machine help | grep rasp
raspi0               Raspberry Pi Zero (revision 1.2)
raspi1ap             Raspberry Pi A+ (revision 1.1)
raspi2               Raspberry Pi 2B (revision 1.1) (alias of raspi2b)
raspi2b              Raspberry Pi 2B (revision 1.1)
raspi3ap             Raspberry Pi 3A+ (revision 1.0)
raspi3               Raspberry Pi 3B (revision 1.2) (alias of raspi3b)
raspi3b              Raspberry Pi 3B (revision 1.2)

The 64-bit emulation presumably includes the 32-bit models in order to allow for hypothetical upgraded versions of these systems by swapping the ARM processor core. This also provides support for the revisions of the Raspberry Pi 2B, the original board used a BCM2836 SoC with a 32-bit ARM v7 processor, but later versions of the 2B board used a BCM2837 with a 64-bit ARM v8 processor.

These options cover three processors:

  • Broadcom BCM2835 SoC in the Zero and A+
    • ARM1176JZF-S @ 700 Mhz core, 32-bit ARMv6
  • Broadcom BCM2836 SoC in the 2B
    • ARM Cortex-A7 @ 900 MHz, quad-core, 32-bit ARMv7
  • Broadcom BCM2837 SoC in the 3A+ and 3B
    • ARM Cortex-A53 @ 1.2 GHz or 1.4 GHz, quad-core, 64-bit ARMv8

That is three generations of the ARM architecture and coverage of the older models.

Emulation Command

Getting Raspberry Pi OS booting in QEMU has taken a bit of mucking about... and I've only gotten the Raspberry Pi 2B machine (raspi2b) to work so far. The general process goes like this...

Check your QEMU supports the Raspberry Pi machines (see above). I'm using the package from 'backports' on Debian Linux 10 (buster) which has a recent version:

$ qemu-system-aarch64 -version
QEMU emulator version 5.2.0 (Debian 1:5.2+dfsg-9~bpo10+1)
Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers

Set-up a location for the various files and download the Raspberry Pi OS distribution:

$ mkdir Raspbian
$ cd Raspbian
$ mkdir 2021-05-07-raspios-buster-armhf-lite
$ cd 2021-05-07-raspios-buster-armhf-lite
$ wget https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2021-05-28/2021-05-07-raspios-buster-armhf-lite.zip

Unpack the distribution archive, convert the raw SD card image to qcow2 and resize to 8 GiB:

$ unzip 2021-05-07-raspios-buster-armhf-lite.zip
$ qemu-img convert -f raw -O qcow2 2021-05-07-raspios-buster-armhf-lite.img 2021-05-07-raspios-buster-armhf-lite.qcow2
$ qemu-img resize 2021-05-07-raspios-buster-armhf-lite.qcow2 8G

Extract the kernel (kernel*.img), device tree (*.dtb), and kernel options (cmdline.txt) files from the SD card image using 'libguestfs-tools':

$ mkdir tmp_mnt
$ guestmount -a 2021-05-07-raspios-buster-armhf-lite.qcow2 -m /dev/sda1 tmp_mnt
$ cp -v tmp_mnt/*.dtb ./
$ cp -v tmp_mnt/kernel*.img ./
$ cp -v tmp_mnt/cmdline.txt ./
$ guestunmount tmp_mnt
$ sleep 3  # Wait for unmount to take full effect.
$ rmdir tmp_mnt

Start the 'raspi2b' QEMU machine:

$ qemu-system-arm \
    -machine raspi2b \
    -m 1G \
    -dtb 2021-05-07-raspios-buster-armhf-lite/bcm2709-rpi-2-b.dtb \
    -sd 2021-05-07-raspios-buster-armhf-lite/2021-05-07-raspios-buster-armhf-lite.qcow2 \
    -kernel 2021-05-07-raspios-buster-armhf-lite/kernel7.img \
    -append 'rw earlyprintk loglevel=8 console=ttyAMA0,115200 console=tty1 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 fsck.repair=yes rootwait' \
    -no-reboot \
    -serial telnet:localhost:4321,server,nowait \
    -name 'Raspberry Pi 2B on QEMU'

Then in another terminal connect to the serial console using telnet (you may need to hit return to get the login prompt):

$ telnet localhost 4321

Login using the default user (pi) and password (raspberry). The use 'raspi-config' to resize the root partition to fill the SD card:

  • $ sudo raspi-config
  • Select option "6 Advanced Options"
  • Select option "A1 Expand Filesystem"

And wait while the partition table is updated and written back to the card. Once it has finished exits back out the config tool and the system will be set to reboot. Which ends in a kernel error (possibly due to the -no-reboot option), but the changes have been made.

Restart the QEMU machine and connect as before, and you should be good to go.

System Information

So now we are running, let's see what the system has to say about itself...

Note: the equivalent information for a Raspberry Pi Model B rev. 2 might be useful for comparison.

uname

Operating system information:

$ uname -a
Linux raspberrypi 5.10.17-v7+ #1414 SMP Fri Apr 30 13:18:35 BST 2021 armv7l GNU/Linux

So a "Linux" kernel, running on a node named "raspberrypi", kernel release "5.10.17-v7+", kernel version "#1414 SMP Fri Apr 30 13:18:35 BST 2021", platform architecture "armv7l" (ARMv7 little-endian) as part of operating system "GNU/Linux".

lsb_release

Linux Standard Base (LSB) distribution release information:

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 10 (buster)
Release:	10
Codename:	buster

Yep, this is Raspbian 10, based on Debian Linux 10 (buster).

lscpu and /proc/cpuinfo

System processor(s) information:

$ lscpu
Architecture:        armv7l
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           1
Vendor ID:           ARM
Model:               5
Model name:          Cortex-A7
Stepping:            r0p5
BogoMIPS:            125.00
Flags:               half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
pi@raspberrypi:~$ cat /proc/cpuinfo
processor	: 0
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 125.00
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 1
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 125.00
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 2
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 125.00
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 3
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 125.00
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

Hardware	: BCM2835
Revision	: 0000
Serial		: 0000000000000000
Model		: Raspberry Pi 2 Model B

So the system is seeing a BCM2835 containing a Cortex-A7 with 4 cores, supporting ARMv7 in little-endian mode. The Cortex-A7 core is consistent with the original 2B board, but it used a BCM2836... the BCM2835 was used in the first generation boards (Raspberry Pi Model A and Model B) and should have a ARMv6 processor core.

The Linux kernel doesn't attempt to identify the members of the Broadcom SoC family, instead reporting the fixed value of "BCM2835" on all Raspberry Pi boards. While this is a little confusing, the "Model" information identifies the specific board and the CPU details reflect the actual processor cores present in the SoC, so is not an issue.

For an overview of the various CPU feature flags see the ARM answer in linux - What do the flags in /proc/cpuinfo mean? - Unix & Linux Stack Exchange.

lsusb

USB bus, hubs and devices:

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

So the root hub is getting generated, but the expected devices are missing. In particular the ethernet device is not present, meaning no networking.

dmesg

System log messages:

$ dmesg
[    0.000000] Booting Linux on physical CPU 0xf00
[    0.000000] Linux version 5.10.17-v7+ (dom@buildbot) (arm-linux-gnueabihf-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1414 SMP Fri Apr 30 13:18:35 BST 2021
[    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: Raspberry Pi 2 Model B
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] Reserved memory: created CMA memory pool at 0x38000000, size 64 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000000000000-0x000000003bffffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000003bffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000003bffffff]
[    0.000000] On node 0 totalpages: 245760
[    0.000000]   DMA zone: 2160 pages used for memmap
[    0.000000]   DMA zone: 0 pages reserved
[    0.000000]   DMA zone: 245760 pages, LIFO batch:63
[    0.000000] percpu: Embedded 20 pages/cpu s50700 r8192 d23028 u81920
[    0.000000] pcpu-alloc: s50700 r8192 d23028 u81920 alloc=20*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 243600
[    0.000000] Kernel command line: rw earlyprintk loglevel=8 console=ttyAMA0,115200 console=tty1 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 fsck.repair=yes rootwait
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes, linear)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 891980K/983040K available (9216K kernel code, 1311K rwdata, 2940K rodata, 1024K init, 860K bss, 25524K reserved, 65536K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] ftrace: allocating 31910 entries in 63 pages
[    0.000000] ftrace: allocated 63 pages with 6 groups
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] 	Rude variant of Tasks RCU enabled.
[    0.000000] 	Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] random: get_random_bytes called from start_kernel+0x3ac/0x580 with crng_init=0
[    0.000000] arch_timer: cp15 timer(s) running at 62.50MHz (virt).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1cd42e208c, max_idle_ns: 881590405314 ns
[    0.000463] sched_clock: 56 bits at 62MHz, resolution 16ns, wraps every 4398046511096ns
[    0.000800] Switching to timer-based delay loop, resolution 16ns
[    0.018911] Console: colour dummy device 80x30
[    0.023298] printk: console [tty1] enabled
[    0.026611] Calibrating delay loop (skipped), value calculated using timer frequency.. 125.00 BogoMIPS (lpj=625000)
[    0.027186] pid_max: default: 32768 minimum: 301
[    0.029320] LSM: Security Framework initializing
[    0.035634] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.035868] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.089015] Disabling memory control group subsystem
[    0.091671] CPU: Testing write buffer coherency: ok
[    0.117585] CPU0: update cpu_capacity 1024
[    0.117807] CPU0: thread -1, cpu 0, socket 15, mpidr 80000f00
[    0.136063] Setting up static identity map for 0x100000 - 0x10003c
[    0.138118] rcu: Hierarchical SRCU implementation.
[    0.149308] smp: Bringing up secondary CPUs ...
[    0.158752] CPU1: update cpu_capacity 1024
[    0.158829] CPU1: thread -1, cpu 1, socket 15, mpidr 80000f01
[    0.171227] CPU2: update cpu_capacity 1024
[    0.171268] CPU2: thread -1, cpu 2, socket 15, mpidr 80000f02
[    0.176888] CPU3: update cpu_capacity 1024
[    0.176919] CPU3: thread -1, cpu 3, socket 15, mpidr 80000f03
[    0.177716] smp: Brought up 1 node, 4 CPUs
[    0.178266] SMP: Total of 4 processors activated (500.00 BogoMIPS).
[    0.178424] CPU: All CPU(s) started in SVC mode.
[    0.203643] devtmpfs: initialized
[    0.262064] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.288078] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.289698] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.313097] pinctrl core: initialized pinctrl subsystem
[    0.343347] NET: Registered protocol family 16
[    0.392026] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.410027] audit: initializing netlink subsys (disabled)
[    0.416305] audit: type=2000 audit(0.380:1): state=initialized audit_enabled=0 res=1
[    0.426909] thermal_sys: Registered thermal governor 'step_wise'
[    0.433766] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.434015] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.436131] Serial: AMBA PL011 UART driver
[    0.506372] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[    0.535478] raspberrypi-firmware soc:firmware: Attached to firmware from 1970-01-05T00:12:17, variant unknown
[    0.555102] raspberrypi-firmware soc:firmware: Firmware hash is 8165b810000000008151fd5c8151fd4880719a24
[    0.746740] bcm2835-dma 3f007000.dma: DMA legacy API manager, dmachans=0x1
[    0.757396] SCSI subsystem initialized
[    0.760363] usbcore: registered new interface driver usbfs
[    0.761142] usbcore: registered new interface driver hub
[    0.761513] usbcore: registered new device driver usb
[    0.799771] clocksource: Switched to clocksource arch_sys_counter
[    2.338970] VFS: Disk quotas dquot_6.6.0
[    2.339458] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    2.341081] FS-Cache: Loaded
[    2.353816] CacheFiles: Loaded
[    2.431679] NET: Registered protocol family 2
[    2.446779] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    2.447110] TCP established hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    2.447522] TCP bind hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    2.448006] TCP: Hash tables configured (established 8192 bind 8192)
[    2.457541] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[    2.458122] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[    2.466745] NET: Registered protocol family 1
[    2.479120] RPC: Registered named UNIX socket transport module.
[    2.479667] RPC: Registered udp transport module.
[    2.479770] RPC: Registered tcp transport module.
[    2.479872] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    2.495701] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 5 counters available
[    2.511275] Initialise system trusted keyrings
[    2.515346] workingset: timestamp_bits=14 max_order=18 bucket_order=4
[    2.543565] zbud: loaded
[    2.554091] FS-Cache: Netfs 'nfs' registered for caching
[    2.558541] NFS: Registering the id_resolver key type
[    2.559409] Key type id_resolver registered
[    2.559537] Key type id_legacy registered
[    2.560530] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    2.567748] Key type asymmetric registered
[    2.568048] Asymmetric key parser 'x509' registered
[    2.568450] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[    2.568873] io scheduler mq-deadline registered
[    2.569401] io scheduler kyber registered
[    2.585110] bcm2708_fb soc:fb: More displays reported from firmware than supported in driver (935808672 vs 3)
[    2.585299] bcm2708_fb soc:fb: FB found 3 display(s)
[    2.677627] Console: switching to colour frame buffer device 100x30
[    2.696855] bcm2708_fb soc:fb: Registered framebuffer for display 0, size 800x480
[    2.703685] bcm2708_fb soc:fb: Registered framebuffer for display 1, size 800x480
[    2.715320] bcm2708_fb soc:fb: Registered framebuffer for display 2, size 800x480
[    2.749520] bcm2835-rng 3f104000.rng: hwrng registered
[    2.755362] vc-mem: phys_addr:0x00000000 mem_base=0x00000000 mem_size:0x00000000(0 MiB)
[    2.762834] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
[    2.857358] brd: module loaded
[    2.910626] loop: module loaded
[    2.917274] bcm2835-power bcm2835-power: ASB register ID returned 0x00000000
[    2.926513] Loading iSCSI transport class v2.0-870.
[    2.942956] libphy: Fixed MDIO Bus: probed
[    2.947599] usbcore: registered new interface driver lan78xx
[    2.951656] usbcore: registered new interface driver smsc95xx
[    2.957295] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    3.175342] Core Release: 2.94a
[    3.179039] Setting default values for core params
[    3.185239] Finished setting default values for core params
[    3.403096] Using Buffer DMA mode
[    3.406684] Periodic Transfer Interrupt Enhancement - disabled
[    3.409730] Multiprocessor Interrupt Enhancement - disabled
[    3.414450] OTG VER PARAM: 0, OTG VER FLAG: 0
[    3.418294] Shared Tx FIFO mode

[    3.427541] WARN::dwc_otg_hcd_init:1074: FIQ DMA bounce buffers: virt = b8054000 dma = 0xf8054000 len=9024
[    3.439653] FIQ FSM acceleration enabled for :
               Non-periodic Split Transactions
               Periodic Split Transactions
               High-Speed Isochronous Endpoints
               Interrupt/Control Split Transaction hack enabled
[    3.457293] dwc_otg: Microframe scheduler enabled

[    3.461426] WARN::hcd_init_fiq:457: FIQ on core 1

[    3.470262] WARN::hcd_init_fiq:458: FIQ ASM at 807be568 length 36

[    3.475687] WARN::hcd_init_fiq:497: MPHI regs_base at bc810000
[    3.482357] dwc_otg 3f980000.usb: DWC OTG Controller
[    3.488011] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[    3.497633] dwc_otg 3f980000.usb: irq 89, io mem 0x00000000
[    3.505429] Init: Port Power? op_state=1
[    3.508702] Init: Power Port (1)
[    3.526500] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.10
[    3.530180] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    3.533287] usb usb1: Product: DWC OTG Controller
[    3.536388] usb usb1: Manufacturer: Linux 5.10.17-v7+ dwc_otg_hcd
[    3.542431] usb usb1: SerialNumber: 3f980000.usb
[    3.556107] hub 1-0:1.0: USB hub found
[    3.562423] hub 1-0:1.0: 1 port detected
[    3.575445] dwc_otg: FIQ enabled
[    3.580592] dwc_otg: NAK holdoff enabled
[    3.585253] dwc_otg: FIQ split-transaction FSM enabled
[    3.588042] Module dwc_common_port init
[    3.594848] usbcore: registered new interface driver usb-storage
[    3.604590] mousedev: PS/2 mouse device common for all mice
[    3.621141] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[    3.625461] cpu cpu0: Cannot get clock for CPU0
[    3.628443] raspberrypi-cpufreq: probe of raspberrypi-cpufreq failed with error -2
[    3.637506] sdhci: Secure Digital Host Controller Interface driver
[    3.641095] sdhci: Copyright(c) Pierre Ossman
[    3.655368] sdhost-bcm2835 3f202000.mmc: could not get clk, deferring probe
[    3.664785] sdhci-pltfm: SDHCI platform and OF driver helper
[    3.687705] ledtrig-cpu: registered to indicate activity on CPUs
[    3.694490] hid: raw HID events driver (C) Jiri Kosina
[    3.699486] usbcore: registered new interface driver usbhid
[    3.705341] usbhid: USB HID core driver
[    3.725453] bcm2835_vchiq 3f00b840.mailbox: failed to set channelbase
[    3.729018] vchiq: could not load vchiq
[    3.737335] Initializing XFRM netlink socket
[    3.742905] NET: Registered protocol family 17
[    3.747331] Key type dns_resolver registered
[    3.751725] Registering SWP/SWPB emulation handler
[    3.759223] registered taskstats version 1
[    3.763143] Loading compiled-in X.509 certificates
[    3.785191] Key type ._fscrypt registered
[    3.789080] Key type .fscrypt registered
[    3.791761] Key type fscrypt-provisioning registered
[    3.847462] uart-pl011 3f201000.serial: cts_event_workaround enabled
[    3.852774] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 114, base_baud = 0) is a PL011 rev2
[    3.879042] printk: console [ttyAMA0] enabled
[    3.895470] bcm2835_thermal 3f212000.thermal: Not able to read trip_temp: -33
[    4.000988] bcm2835-clk 3f101000.cprman: tsens: couldn't lock PLL
[    4.004662] bcm2835_thermal: probe of 3f212000.thermal failed with error -33
[    4.011584] sdhost: log_buf @ (ptrval) (f8053000)
[    4.074335] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    4.081314] of_cfs_init
[    4.087758] of_cfs_init: OK
[    4.111626] Waiting for root device /dev/mmcblk0p2...
[    4.135310] mmc0: host does not support reading read-only switch, assuming write-enable
[    4.141840] mmc0: new high speed SDHC card at address 4567
[    4.155999] mmcblk0: mmc0:4567 QEMU! 8.00 GiB
[    4.209556]  mmcblk0: p1 p2
[    4.387664] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    4.394605] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    4.478209] devtmpfs: mounted
[    4.611261] Freeing unused kernel memory: 1024K
[    4.755750] Run /sbin/init as init process
[    4.760220]   with arguments:
[    4.763826]     /sbin/init
[    4.767235]     earlyprintk
[    4.770599]   with environment:
[    4.773677]     HOME=/
[    4.785002]     TERM=linux
[    9.609291] systemd[1]: System time before build time, advancing clock.
[   10.137774] random: fast init done
[   10.812752] NET: Registered protocol family 10
[   10.837373] Segment Routing with IPv6
[   13.273402] systemd[1]: systemd 241 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid)
[   13.468965] systemd[1]: Detected architecture arm.
[   23.413875] systemd[1]: Set hostname to <raspberrypi>.
[   33.992479] uart-pl011 3f201000.serial: no DMA platform data
[   38.405627] random: systemd: uninitialized urandom read (16 bytes read)
[   38.503084] random: systemd: uninitialized urandom read (16 bytes read)
[   38.518598] systemd[1]: Listening on Journal Audit Socket.
[   38.536102] random: systemd: uninitialized urandom read (16 bytes read)
[   38.543297] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[   38.581454] systemd[1]: Created slice system-serial\x2dgetty.slice.
[   38.599794] systemd[1]: Created slice system-getty.slice.
[   38.614493] systemd[1]: Listening on Syslog Socket.
[   38.630966] systemd[1]: Listening on udev Kernel Socket.
[   38.648522] systemd[1]: Listening on Journal Socket (/dev/log).
[   38.663199] systemd[1]: Reached target Swap.
[   38.683516] systemd[1]: Created slice system-systemd\x2dfsck.slice.
[   38.710022] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[   43.829917] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[   45.234537] systemd-journald[112]: Received request to flush runtime journal from PID 1
[   88.764615] random: crng init done
[   88.765199] random: 7 urandom warning(s) missed due to ratelimiting
[   91.662780] 8021q: 802.1Q VLAN Support v1.8
[   95.587585] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[   99.904706] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[  108.729856] Adding 102396k swap on /var/swap.  Priority:-2 extents:1 across:102396k SSFS

Lots of stuff in here... including identification of the processor and board.

Benchmark

To see how well this compares to real hardware, we need some benchmarks for comparison...

BogoMips

The BogoMips pseudo-benchmark (Wikipedia), is used by the Linux kernel to calibrate a wait loop. On ARM processors an alternative timer-delay approach may be used, and a BogoMips figure may be derived from the system timer rather than the processor clock. The BogoMips line in the 'demsg' output reflects this:

Calibrating delay loop (skipped), value calculated using timer frequency.. 125.00 BogoMIPS (lpj=625000)

This value is also reported in '/proc/cpuinfo' and 'lscpu', and is used as the basis of the system BogoMips figure in 'dmesg':

SMP: Total of 4 processors activated (500.00 BogoMIPS).

So for this system BogoMips doesn't tell us about the processor, instead reflecting the system timer. So to get a feel for performance we're going to have to use something else.

OpenSSL

The OpenSSL cryptographic library provides a tool providing a command-line interface to the library methods and one aspect of this provides a speed test. Since I'm mostly interested in older systems I'm going to use the common RSA and MD5 methods.

$ openssl speed md5
Doing md5 for 3s on 16 size blocks: 1445194 md5's in 3.00s
Doing md5 for 3s on 64 size blocks: 1206383 md5's in 3.01s
Doing md5 for 3s on 256 size blocks: 782471 md5's in 3.00s
Doing md5 for 3s on 1024 size blocks: 331358 md5's in 3.00s
Doing md5 for 3s on 8192 size blocks: 52272 md5's in 3.00s
Doing md5 for 3s on 16384 size blocks: 26360 md5's in 3.00s
OpenSSL 1.1.1d  10 Sep 2019
built on: Thu Mar 25 16:22:23 2021 UTC
options:bn(64,32) rc4(char) des(long) aes(partial) blowfish(ptr) 
compiler: gcc -fPIC -pthread -Wa,--noexecstack -Wall -D__ARM_MAX_ARCH__=7 -Wa,--noexecstack -g -O2 -fdebug-prefix-map=/build/openssl-GRrFMG/openssl-1.1.1d=. -fstack-protector-strong -Wformat -Werror=format-security -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
md5               7707.70k    25650.67k    66770.86k   113103.53k   142737.41k   143960.75k
$ openssl speed rsa
Doing 512 bits private rsa's for 10s: 6375 512 bits private RSA's in 10.00s
Doing 512 bits public rsa's for 10s: 68512 512 bits public RSA's in 10.00s
Doing 1024 bits private rsa's for 10s: 1273 1024 bits private RSA's in 9.99s
Doing 1024 bits public rsa's for 10s: 32773 1024 bits public RSA's in 9.99s
Doing 2048 bits private rsa's for 10s: 249 2048 bits private RSA's in 10.02s
Doing 2048 bits public rsa's for 10s: 11806 2048 bits public RSA's in 9.99s
Doing 3072 bits private rsa's for 10s: 92 3072 bits private RSA's in 10.05s
Doing 3072 bits public rsa's for 10s: 5648 3072 bits public RSA's in 9.99s
Doing 4096 bits private rsa's for 10s: 43 4096 bits private RSA's in 10.02s
Doing 4096 bits public rsa's for 10s: 3421 4096 bits public RSA's in 9.98s
Doing 7680 bits private rsa's for 10s: 9 7680 bits private RSA's in 11.15s
Doing 7680 bits public rsa's for 10s: 1031 7680 bits public RSA's in 9.99s
Doing 15360 bits private rsa's for 10s: 2 15360 bits private RSA's in 18.10s
Doing 15360 bits public rsa's for 10s: 266 15360 bits public RSA's in 10.00s
OpenSSL 1.1.1d  10 Sep 2019
built on: Thu Mar 25 16:22:23 2021 UTC
options:bn(64,32) rc4(char) des(long) aes(partial) blowfish(ptr) 
compiler: gcc -fPIC -pthread -Wa,--noexecstack -Wall -D__ARM_MAX_ARCH__=7 -Wa,--noexecstack -g -O2 -fdebug-prefix-map=/build/openssl-GRrFMG/openssl-1.1.1d=. -fstack-protector-strong -Wformat -Werror=format-security -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2
                  sign    verify    sign/s verify/s
rsa  512 bits 0.001569s 0.000146s    637.5   6851.2
rsa 1024 bits 0.007848s 0.000305s    127.4   3280.6
rsa 2048 bits 0.040241s 0.000846s     24.9   1181.8
rsa 3072 bits 0.109239s 0.001769s      9.2    565.4
rsa 4096 bits 0.233023s 0.002917s      4.3    342.8
rsa 7680 bits 1.238889s 0.009690s      0.8    103.2
rsa 15360 bits 9.050000s 0.037594s      0.1     26.6

Extracting the relevant figures for comparisons (see OpenSSL Speed Results):

  • OpenSSL speed MD5 8,192 bytes: 142,737.41k
  • OpenSSL speed RSA 4,096 bytes sign/s: 4.3
  • OpenSSL speed RSA 4,096 bytes verify/s: 342.8

These will be roughly indicative of computational workload performance.

Thoughts

Raspberry Pi systems have been a bit under powered for computational or memory intensive tasks such as compiling large programs from source. QEMU provides a potential workaround for this by providing an emulated system running the same operating system and tool chain, where host capabilities can elevate performance. Although networking appears to be an issue here, host tools can be used to access the file systems and copy software builds over to an drive which can be used in a real Raspberry Pi system.

Further Sources


No comments: