前面几节启动运行qemu都添加了"-nographic"参数,表示禁用图形界面,所有输出通过终端显示。这节我们使用图形话的命令启动qemu。并介绍几个linux frambuffer测试命令。
1、图形化启动
qemu-system-arm \
-M vexpress-a9 \
-m 512M \
-smp 4 \
-kernel /data/tftp/zImage \
-dtb /data/tftp/vexpress-v2p-ca9.dtb \
-append "console=ttyAMA0 root=/dev/mmcblk0 rw init=linuxrc ip=192.168.2.101" \
-sd /data/tftp/rootfs.ext4 \
-net nic -net tap,ifname=tap0,script=no,downscript=no \
-serial stdio
如上所示命令,去掉了"-nographic"参数,添加了"-serial stdio",表示以qemu以图形的方式启动,并且将将串口设备重定向到标准输入输出(终端)。
如图启动成功,并以独立的窗口显示界面。启动日志
[~]$qemu-system-arm \
> -M vexpress-a9 \
> -m 512M \
> -smp 4 \
> -kernel /data/tftp/zImage \
> -dtb /data/tftp/vexpress-v2p-ca9.dtb \
> -append "console=ttyAMA0 root=/dev/mmcblk0 rw init=linuxrc ip=192.168.2.101" \
> -sd /data/tftp/rootfs.ext4 \
> -net nic -net tap,ifname=tap0,script=no,downscript=no \
> -serial stdio
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.14.1 (xxxxxx@qrs) (gcc version 6.5.0 (Buildroot 2019.05.2)) #3 SMP Fri Mar 21 17:55:31 CST 2025
[ 0.000000] CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[ 0.000000] OF: fdt: Machine model: V2P-CA9
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] random: fast init done
[ 0.000000] percpu: Embedded 16 pages/cpu @dfbae000 s36428 r8192 d20916 u65536
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 130048
[ 0.000000] Kernel command line: console=ttyAMA0 root=/dev/mmcblk0 rw init=linuxrc ip=192.168.2.101
[ 0.000000] log_buf_len individual max cpu contribution: 4096 bytes
[ 0.000000] log_buf_len total cpu_extra contributions: 12288 bytes
[ 0.000000] log_buf_len min size: 16384 bytes
[ 0.000000] log_buf_len: 32768 bytes
[ 0.000000] early log buf free: 15012(91%)
[ 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: 509436K/524288K available (6144K kernel code, 523K rwdata, 1552K rodata, 1024K init, 171K bss, 14852K reserved, 0K cma-reserved)
[ 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] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
[ 0.000000] .text : 0xc0008000 - 0xc0700000 (7136 kB)
[ 0.000000] .init : 0xc0900000 - 0xc0a00000 (1024 kB)
[ 0.000000] .data : 0xc0a00000 - 0xc0a82e30 ( 524 kB)
[ 0.000000] .bss : 0xc0a8a048 - 0xc0ab4d94 ( 172 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU event tracing is enabled.
[ 0.000000] RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] L2C: platform modifies aux control register: 0x02020000 -> 0x02420000
[ 0.000000] L2C: DT/platform modifies aux control register: 0x02020000 -> 0x02420000
[ 0.000000] L2C-310 enabling early BRESP for Cortex-A9
[ 0.000000] L2C-310 full line of zeros enabled for Cortex-A9
[ 0.000000] L2C-310 dynamic clock gating disabled, standby mode disabled
[ 0.000000] L2C-310 cache controller enabled, 8 ways, 128 kB
[ 0.000000] L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x46420001
[ 0.000000] smp_twd: clock not found -2
[ 0.000187] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.002362] clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
[ 0.003024] Failed to initialize '/smb@4000000/motherboard/iofpga@7,00000000/timer@12000': -22
[ 0.005909] Console: colour dummy device 80x30
[ 0.006247] Calibrating local timer... 94.64MHz.
[ 0.062635] Calibrating delay loop... 1030.55 BogoMIPS (lpj=5152768)
[ 0.147837] pid_max: default: 32768 minimum: 301
[ 0.148703] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.148736] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.156673] CPU: Testing write buffer coherency: ok
[ 0.163396] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.167146] Setting up static identity map for 0x60100000 - 0x60100060
[ 0.168138] Hierarchical SRCU implementation.
[ 0.171333] smp: Bringing up secondary CPUs ...
[ 0.242362] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[ 0.280217] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[ 0.318065] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[ 0.318561] smp: Brought up 1 node, 4 CPUs
[ 0.318648] SMP: Total of 4 processors activated (4053.40 BogoMIPS).
[ 0.318727] CPU: All CPU(s) started in SVC mode.
[ 0.340945] devtmpfs: initialized
[ 0.349362] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 0
[ 0.359732] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.360298] futex hash table entries: 1024 (order: 4, 65536 bytes)
[ 0.381081] NET: Registered protocol family 16
[ 0.383991] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.525108] cpuidle: using governor ladder
[ 0.527213] hw-breakpoint: debug architecture 0x4 unsupported.
[ 0.529130] Serial: AMBA PL011 UART driver
[ 0.544610] OF: amba_device_add() failed (-19) for /memory-controller@100e0000
[ 0.545757] OF: amba_device_add() failed (-19) for /memory-controller@100e1000
[ 0.546178] OF: amba_device_add() failed (-19) for /watchdog@100e5000
[ 0.547680] irq: type mismatch, failed to map hwirq-75 for /interrupt-controller@1e001000!
[ 0.556881] 10009000.uart: ttyAMA0 at MMIO 0x10009000 (irq = 38, base_baud = 0) is a PL011 rev1
[ 0.574902] console [ttyAMA0] enabled
[ 0.576617] 1000a000.uart: ttyAMA1 at MMIO 0x1000a000 (irq = 39, base_baud = 0) is a PL011 rev1
[ 0.578056] 1000b000.uart: ttyAMA2 at MMIO 0x1000b000 (irq = 40, base_baud = 0) is a PL011 rev1
[ 0.579236] 1000c000.uart: ttyAMA3 at MMIO 0x1000c000 (irq = 41, base_baud = 0) is a PL011 rev1
[ 0.580243] OF: amba_device_add() failed (-19) for /smb@4000000/motherboard/iofpga@7,00000000/wdt@f000
[ 0.601756] SCSI subsystem initialized
[ 0.603917] usbcore: registered new interface driver usbfs
[ 0.604396] usbcore: registered new interface driver hub
[ 0.604922] usbcore: registered new device driver usb
[ 0.609692] Advanced Linux Sound Architecture Driver Initialized.
[ 0.616307] clocksource: Switched to clocksource arm,sp804
[ 0.690647] NET: Registered protocol family 2
[ 0.694600] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.694960] TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.695283] TCP: Hash tables configured (established 4096 bind 4096)
[ 0.697048] UDP hash table entries: 256 (order: 1, 8192 bytes)
[ 0.697320] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[ 0.698362] NET: Registered protocol family 1
[ 0.700799] RPC: Registered named UNIX socket transport module.
[ 0.700976] RPC: Registered udp transport module.
[ 0.701088] RPC: Registered tcp transport module.
[ 0.701280] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.708184] hw perfevents: enabled with armv7_cortex_a9 PMU driver, 5 counters available
[ 0.711265] workingset: timestamp_bits=30 max_order=17 bucket_order=0
[ 0.718959] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.720743] NFS: Registering the id_resolver key type
[ 0.721691] Key type id_resolver registered
[ 0.721848] Key type id_legacy registered
[ 0.722072] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 0.722702] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[ 0.723567] 9p: Installing v9fs 9p2000 file system support
[ 0.727775] io scheduler noop registered (default)
[ 0.727936] io scheduler mq-deadline registered
[ 0.728076] io scheduler kyber registered
[ 0.731443] clcd-pl11x 10020000.clcd: PL111 designer 41 rev2 at 0x10020000
[ 0.739876] clcd-pl11x 10020000.clcd: /clcd@10020000 hardware, 1024x768@59 display
[ 0.892384] Console: switching to colour frame buffer device 128x48
[ 1.019097] clcd-pl11x 1001f000.clcd: PL111 designer 41 rev2 at 0x1001f000
[ 1.023512] clcd-pl11x 1001f000.clcd: /smb@4000000/motherboard/iofpga@7,00000000/clcd@1f000 hardware, 640x480@59 display
[ 1.448696] 40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
[ 1.449844] Intel/Sharp Extended Query Table at 0x0031
[ 1.450994] Using buffer write method
[ 1.453593] 40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
[ 1.454227] Intel/Sharp Extended Query Table at 0x0031
[ 1.455094] Using buffer write method
[ 1.455769] Concatenating MTD devices:
[ 1.455941] (0): "40000000.flash"
[ 1.456080] (1): "40000000.flash"
[ 1.456204] into device "40000000.flash"
[ 1.468562] libphy: Fixed MDIO Bus: probed
[ 1.531290] libphy: smsc911x-mdio: probed
[ 1.539207] smsc911x 4e000000.ethernet eth0: MAC Address: 52:54:00:12:34:56
[ 1.653937] isp1760 4f000000.usb: bus width: 32, oc: digital
[ 1.656347] isp1760 4f000000.usb: NXP ISP1760 USB Host Controller
[ 1.657638] isp1760 4f000000.usb: new USB bus registered, assigned bus number 1
[ 1.660763] isp1760 4f000000.usb: Scratch test failed.
[ 1.661659] isp1760 4f000000.usb: can't setup: -19
[ 1.663805] isp1760 4f000000.usb: USB bus 1 deregistered
[ 1.670535] usbcore: registered new interface driver usb-storage
[ 1.689246] rtc-pl031 10017000.rtc: rtc core: registered pl031 as rtc0
[ 1.692061] IR NEC protocol handler initialized
[ 1.692382] IR RC5(x/sz) protocol handler initialized
[ 1.692712] IR RC6 protocol handler initialized
[ 1.693005] IR JVC protocol handler initialized
[ 1.693301] IR Sony protocol handler initialized
[ 1.693615] IR SANYO protocol handler initialized
[ 1.694072] IR Sharp protocol handler initialized
[ 1.694527] IR MCE Keyboard/mouse protocol handler initialized
[ 1.694894] IR XMP protocol handler initialized
[ 1.705761] mmci-pl18x 10005000.mmci: Got CD GPIO
[ 1.706366] mmci-pl18x 10005000.mmci: Got WP GPIO
[ 1.709785] mmci-pl18x 10005000.mmci: mmc0: PL181 manf 41 rev0 at 0x10005000 irq 34,35 (pio)
[ 1.816839] input: AT Raw Set 2 keyboard as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:iofpga@7,00000000/10006000.kmi/serio0/input/input0
[ 1.835317] ledtrig-cpu: registered to indicate activity on CPUs
[ 1.842558] usbcore: registered new interface driver usbhid
[ 1.843447] usbhid: USB HID core driver
[ 1.857551] mmc0: new SD card at address 4567
[ 1.860454] mmcblk0: mmc0:4567 QEMU! 60.0 MiB
[ 1.869997] aaci-pl041 10004000.aaci: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 33
[ 1.870438] aaci-pl041 10004000.aaci: FIFO 512 entries
[ 1.871370] oprofile: using arm/armv7-ca9
[ 1.872279] NET: Registered protocol family 17
[ 1.873114] 9pnet: Installing 9P2000 support
[ 1.873497] Key type dns_resolver registered
[ 1.873808] Registering SWP/SWPB emulation handler
[ 1.879975] rtc-pl031 10017000.rtc: setting system clock to 2025-03-29 07:55:54 UTC (1743234954)
[ 1.887001] Generic PHY 4e000000.ethernet-ffffffff:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=4e000000.ethernet-ffffffff:01, irq=POLL)
[ 1.909959] smsc911x 4e000000.ethernet eth0: SMSC911x/921x identified at 0xe1290000, IRQ: 31
[ 2.457799] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:iofpga@7,00000000/10007000.kmi/serio1/input/input2
[ 2.990484] IP-Config: Guessing netmask 255.255.255.0
[ 2.991604] IP-Config: Complete:
[ 2.992801] device=eth0, hwaddr=52:54:00:12:34:56, ipaddr=192.168.2.101, mask=255.255.255.0, gw=255.255.255.255
[ 2.994166] host=192.168.2.101, domain=, nis-domain=(none)
[ 2.995345] bootserver=255.255.255.255, rootserver=255.255.255.255, rootpath=
[ 3.003265] ALSA device list:
[ 3.004048] #0: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 33
[ 3.036991] EXT4-fs (mmcblk0): couldn't mount as ext3 due to feature incompatibilities
[ 3.066319] EXT4-fs (mmcblk0): mounted filesystem with ordered data mode. Opts: (null)
[ 3.067428] VFS: Mounted root (ext4 filesystem) on device 179:0.
[ 3.113961] Freeing unused kernel memory: 1024K
[ 3.366574] random: crng init done
[ 3.736373] EXT4-fs (mmcblk0): re-mounted. Opts: data=ordered
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Starting network: ip: RTNETLINK answers: File exists
FAIL
Welcome to Buildroot
buildroot login:
2、linux fb测试指令
buildroot里面有自带的linux frambuffer测试指令,我们需要选择添加一下。
Target packages --->
Graphic libraries and applications (graphic/text) --->
[*] fb-test-app
重新编译后添加了如下指令
# cd /usr/bin/
# ls fb-test*
fb-test fb-test-perf fb-test-string
fb-test-offset fb-test-rect
# fb-test
fb-test 1.1.1 (rosetta)
fb res 1024x768 virtual 1024x768, line_len 2048, bpp 16
# fb-test -h
fb-test 1.1.1 (rosetta)
Usage: fb-test -f fbnum -r -g -b -w -p pattern
Where -f fbnum = framebuffer device number
-r = fill framebuffer with red
-g = fill framebuffer with green
-b = fill framebuffer with blue
-w = fill framebuffer with white
-p pattern = fill framebuffer with pattern number
这个测试指令在屏幕驱动调试的时候非常有用。
# fb-test-rect
rect 1.1.1 (rosetta)
这个命令在屏幕上画方格,可以测试一下屏幕的刷新率。