搭建QEMU + ARM64 Linux Kernel 开发环境

准备好Vmware 的Ubuntu OS, 在虚拟机的Ubuntu上搭建Qemu + ARM64的开发和调试环境
VMware® Workstation 16 Player, 本人虚拟机上的Ubuntu版本信息如下

guojia@ubuntu:~/.vim/bundle/YouCompleteMe$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.3 LTS
Release:	20.04
Codename:	focal

  1. 下载qemu
    https://www.qemu.org/download/搭建QEMU + ARM64 Linux Kernel 开发环境_第1张图片
    选择最新的发布版本6.2.0

  2. 编译qemu
    参考资料: https://wiki.qemu.org/Hosts/Linux
    step1:

tar -xvf qemu-6.2.0.tar.xz
cd qemu-6.2.0/
./configure

错误提示1:

Using './build' as the directory for build output

ERROR: Cannot find Ninja

解决方法:

sudo apt-get install ninja-build

step2:

make

qemu build 完成之后生成的可执行文件在 “qemu-6.2.0/build”, 我们需要的aarch64的qemu可执行文件已经生成

guojia@ubuntu:~/jiaguo/qemu/qemu-6.2.0/build/aarch64-softmmu$ ls -al
total 28
drwxrwxr-x   2 guojia guojia  4096 Mar 12 03:38 .
drwxrwxr-x 262 guojia guojia 24576 Mar 12 04:27 ..
lrwxrwxrwx   1 guojia guojia    22 Mar 12 03:38 qemu-system-aarch64 -> ../qemu-system-aarch64
guojia@ubuntu:~/jiaguo/qemu/qemu-6.2.0/build/aarch64-softmmu$ 

  1. buildroot 制作跟文件系统
    https://buildroot.org/download.html
    搭建QEMU + ARM64 Linux Kernel 开发环境_第2张图片
    下载最新的buildroot release: buildroot-2022.02.tar.gz
    step1:
tar -xvf buildroot-2022.02.tar.gz

step2:

cd buildroot-2022.02
make menuconfig

错误提示1:

 *** Unable to find the ncurses libraries or the
 *** required header files.
 *** 'make menuconfig' requires the ncurses libraries.
 *** 
 *** Install ncurses (ncurses-devel or libncurses-dev 
 *** depending on your distribution) and try again.

解决方法:

sudo apt install libncurses-dev

配置Target options
搭建QEMU + ARM64 Linux Kernel 开发环境_第3张图片
选择Aarch64 (little endian)
搭建QEMU + ARM64 Linux Kernel 开发环境_第4张图片
配置Toolchain
搭建QEMU + ARM64 Linux Kernel 开发环境_第5张图片
选择External toolchain
搭建QEMU + ARM64 Linux Kernel 开发环境_第6张图片
配置System configuration
搭建QEMU + ARM64 Linux Kernel 开发环境_第7张图片
设置Root password
搭建QEMU + ARM64 Linux Kernel 开发环境_第8张图片
配置tty
搭建QEMU + ARM64 Linux Kernel 开发环境_第9张图片
设置TTY port: ttyAMA0
搭建QEMU + ARM64 Linux Kernel 开发环境_第10张图片
配置Target packages
搭建QEMU + ARM64 Linux Kernel 开发环境_第11张图片
选择Show packages that are also provided by busybox
搭建QEMU + ARM64 Linux Kernel 开发环境_第12张图片
设置Debugging, profiling and benchmark
选择自己需要的工具,我们选择strace
搭建QEMU + ARM64 Linux Kernel 开发环境_第13张图片
设置 Text editors and viewers
我们选择vim
搭建QEMU + ARM64 Linux Kernel 开发环境_第14张图片
配置Filesystem images
搭建QEMU + ARM64 Linux Kernel 开发环境_第15张图片
选择cpio the root filesystem (for use as an initial RAM filesystem)
搭建QEMU + ARM64 Linux Kernel 开发环境_第16张图片
编译好的rootfs在下面的路径

guojia@ubuntu:~/jiaguo/tools/buildroot-2022.02/output/images$ ls -al
total 53180
drwxr-xr-x 2 guojia guojia     4096 Mar 12 18:26 .
drwxrwxr-x 6 guojia guojia     4096 Mar 12 18:26 ..
-rw-r--r-- 1 guojia guojia 25804288 Mar 12 18:26 rootfs.cpio
-rw-r--r-- 1 guojia guojia 28641280 Mar 12 18:26 rootfs.tar
  1. 编译Linux kernel (arm64)

step1:
下载aarch64 交叉编译工具链
https://releases.linaro.org/components/toolchain/binaries/
搭建QEMU + ARM64 Linux Kernel 开发环境_第17张图片
搭建QEMU + ARM64 Linux Kernel 开发环境_第18张图片
搭建QEMU + ARM64 Linux Kernel 开发环境_第19张图片
这里我们选择gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz

step2:
下载Linux kernel 源代码: https://www.kernel.org/
搭建QEMU + ARM64 Linux Kernel 开发环境_第20张图片
本人是事先下载好的linux-5.16.9
step3:
编译Linux kernel, arm64默认的配置文件在arch/arm64/config下面

guojia@ubuntu:~/jiaguo/opensrc/linux-5.16.9/arch/arm64/configs$ ls -al
total 40
drwxrwxr-x  2 guojia guojia  4096 Mar 12 18:38 .
drwxrwxr-x 14 guojia guojia  4096 Feb 11 00:26 ..
-rw-rw-r--  1 guojia guojia 29192 Feb 11 00:26 defconfig

step4:
写一个配置环境变量和make menuconfig的脚本config_kernel.sh

#! /bin/bash

BUILD_DIR=/home/guojia/jiaguo/opensrc/linux-5.16.9

if [ ! -z $1 ]
then
	BUILD_DIR=$1
fi

export ARCH=arm64
export CROSS_COMPILE=/home/guojia/jiaguo/tools/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
cd $BUILD_DIR
make menuconfig

执行config_kernel.sh, 遇到flex的错误提示

guojia@ubuntu:~/jiaguo/tools/scripts$ sh setup_buildenv.sh /home/guojia/jiaguo/opensrc/linux-5.16.9
  LEX     scripts/kconfig/lexer.lex.c
/bin/sh: 1: flex: not found
make[1]: *** [scripts/Makefile.host:9: scripts/kconfig/lexer.lex.c] Error 127
make: *** [Makefile:619: defconfig] Error 2

解决方法:

sudo apt install flex

再次执行setup_buildenv.sh, 遇到bison的错误提示

guojia@ubuntu:~/jiaguo/tools/scripts$ sh setup_buildenv.sh /home/guojia/jiaguo/opensrc/linux-5.16.9
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
/bin/sh: 1: bison: not found
make[1]: *** [scripts/Makefile.host:17: scripts/kconfig/parser.tab.h] Error 127
make: *** [Makefile:619: defconfig] Error 2

解决方法:

sudo apt install bison -y

step5:
问题解决之后继续配置Boot options
搭建QEMU + ARM64 Linux Kernel 开发环境_第21张图片
设置Default kernel command string
搭建QEMU + ARM64 Linux Kernel 开发环境_第22张图片
配置Initramfs source file
搭建QEMU + ARM64 Linux Kernel 开发环境_第23张图片
找到buildroot时生成的rootfs.cpio把,路径设置到这里
搭建QEMU + ARM64 Linux Kernel 开发环境_第24张图片
编译Linux kernel
写一个编译linux kernel的脚本,build_kernel.sh

#! /bin/bash

BUILD_DIR=/home/guojia/jiaguo/opensrc/linux-5.16.9

if [ ! -z $1 ]
then
	BUILD_DIR=$1
fi

export ARCH=arm64
export CROSS_COMPILE=/home/guojia/jiaguo/tools/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
cd $BUILD_DIR
make -j4

执行脚本

sh build_kernel.sh /home/guojia/jiaguo/opensrc/linux-5.16.9

编译时遇到错误信息

scripts/extract-cert.c:21:10: fatal error: openssl/bio.h: No such file or directory
   21 | #include 
      |          ^~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.host:95: scripts/extract-cert] Error 1
make: *** [Makefile:1181: scripts] Error 2

解决方法:

sudo apt install libssl-dev

linux kernel 编译完成之后,kernel的根目录可以找到vmlinux文件

guojia@ubuntu:~/jiaguo/opensrc/linux-5.16.9$ file vmlinux
vmlinux: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), statically linked, BuildID[sha1]=d22e4517e2555f991a40c9087991c873be2d5a92, with debug_info, not stripped

kernel的Image文件在arch/arm64/boot目录下

uojia@ubuntu:~/jiaguo/opensrc/linux-5.16.9/arch/arm64/boot$ file Image
Image: MS-DOS executable PE32+ executable (EFI application) Aarch64 (stripped to external PDB), for MS Windows

  1. QEMU 启动ARM64 Linux kernel 5.16.9
#! /bin/bash

/home/guojia/jiaguo/qemu/qemu-6.2.0/build/aarch64-softmmu/qemu-system-aarch64 \
	-machine virt \
	-cpu cortex-a57 \
	-machine type=virt \
	-nographic -smp 1 \
	-m 2048 \
	-kernel /home/guojia/jiaguo/opensrc/linux-5.16.9/arch/arm64/boot/Image \
	--append "console=ttyAMA0" \
	$1 $2

启动日志

guojia@ubuntu:~/jiaguo/tools/scripts/qemu$ sh start_qemu.sh 
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x411fd070]
[    0.000000] Linux version 5.16.9-gcd4cbffd8f8b (guojia@ubuntu) (aarch64-linux-gnu-gcc (Linaro GCC 7.5-2019.12) 7.5.0, GNU ld (Linaro_Binutils-2019.12) 2.28.2.20170706) #3 SMP PREEMPT Sun Mar 13 05:53:15 PDT 2022
[    0.000000] Machine model: linux,dummy-virt
[    0.000000] efi: UEFI not found.
[    0.000000] NUMA: No NUMA configuration found
[    0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x00000000bfffffff]
[    0.000000] NUMA: NODE_DATA [mem 0xbfbf2b40-0xbfbf4fff]
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000040000000-0x00000000bfffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x00000000bfffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x00000000bfffffff]
[    0.000000] cma: Reserved 32 MiB at 0x00000000bb800000
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv0.2 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: Trusted OS migration not required
[    0.000000] percpu: Embedded 20 pages/cpu s41240 r8192 d32488 u81920
[    0.000000] Detected PIPT I-cache on CPU0
[    0.000000] CPU features: detected: Spectre-v2
[    0.000000] CPU features: detected: Spectre-v3a
[    0.000000] CPU features: detected: Spectre-v4
[    0.000000] CPU features: kernel page table isolation forced ON by KASLR
[    0.000000] CPU features: detected: Kernel page table isolation (KPTI)
[    0.000000] CPU features: detected: ARM erratum 834220
[    0.000000] CPU features: detected: ARM erratum 832075
[    0.000000] CPU features: detected: ARM errata 1165522, 1319367, or 1530923
[    0.000000] Fallback order for Node 0: 0 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 516096
[    0.000000] Policy zone: DMA
[    0.000000] Kernel command line: console=ttyAMA0
[    0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 1980928K/2097152K available (15232K kernel code, 3194K rwdata, 8500K rodata, 14720K init, 510K bss, 83456K reserved, 32768K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu: 	RCU event tracing is enabled.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=1.
[    0.000000] 	Trampoline variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] Root IRQ handler: gic_handle_irq
[    0.000000] GICv2m: range[mem 0x08020000-0x08020fff], SPI[80:143]
[    0.000000] random: get_random_bytes called from start_kernel+0x484/0x674 with crng_init=0
[    0.000000] arch_timer: cp15 timer(s) running at 62.50MHz (virt).
[    0.000000] clocksource: arch_sys_counter: mask: 0x1ffffffffffffff max_cycles: 0x1cd42e208c, max_idle_ns: 881590405314 ns
[    0.000058] sched_clock: 57 bits at 62MHz, resolution 16ns, wraps every 4398046511096ns
[    0.002882] Console: colour dummy device 80x25
[    0.006210] Calibrating delay loop (skipped), value calculated using timer frequency.. 125.00 BogoMIPS (lpj=250000)
[    0.006302] pid_max: default: 32768 minimum: 301
[    0.006802] LSM: Security Framework initializing
[    0.007750] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.007785] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.028122] /cpus/cpu-map: empty cluster
[    0.033620] rcu: Hierarchical SRCU implementation.
[    0.036698] EFI services will not be available.
[    0.037054] smp: Bringing up secondary CPUs ...
[    0.037118] smp: Brought up 1 node, 1 CPU
[    0.037137] SMP: Total of 1 processors activated.
[    0.037208] CPU features: detected: 32-bit EL0 Support
[    0.037226] CPU features: detected: 32-bit EL1 Support
[    0.037278] CPU features: detected: CRC32 instructions
[    0.051634] CPU: All CPU(s) started at EL1
[    0.051949] alternatives: patching kernel code
[    0.064454] devtmpfs: initialized
[    0.070743] KASLR enabled
[    0.071469] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.071572] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[    0.074553] pinctrl core: initialized pinctrl subsystem
[    0.082449] DMI not present or invalid.
[    0.087817] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.095968] DMA: preallocated 256 KiB GFP_KERNEL pool for atomic allocations
[    0.096354] DMA: preallocated 256 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.096561] DMA: preallocated 256 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.096733] audit: initializing netlink subsys (disabled)
[    0.100248] audit: type=2000 audit(0.076:1): state=initialized audit_enabled=0 res=1
[    0.101571] thermal_sys: Registered thermal governor 'step_wise'
[    0.101610] thermal_sys: Registered thermal governor 'power_allocator'
[    0.102758] cpuidle: using governor menu
[    0.103398] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.103701] ASID allocator initialised with 32768 entries
[    0.106564] Serial: AMBA PL011 UART driver
[    0.130344] 9000000.pl011: ttyAMA0 at MMIO 0x9000000 (irq = 47, base_baud = 0) is a PL011 rev1
[    0.147390] printk: console [ttyAMA0] enabled
[    0.172649] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[    0.172807] HugeTLB registered 32.0 MiB page size, pre-allocated 0 pages
[    0.172901] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.173075] HugeTLB registered 64.0 KiB page size, pre-allocated 0 pages
[    0.179018] ACPI: Interpreter disabled.
[    0.182364] iommu: Default domain type: Translated 
[    0.182697] iommu: DMA domain TLB invalidation policy: strict mode 
[    0.183433] vgaarb: loaded
[    0.184314] SCSI subsystem initialized
[    0.186131] usbcore: registered new interface driver usbfs
[    0.186389] usbcore: registered new interface driver hub
[    0.186604] usbcore: registered new device driver usb
[    0.187717] pps_core: LinuxPPS API ver. 1 registered
[    0.187792] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti 
[    0.188017] PTP clock support registered
[    0.188386] EDAC MC: Ver: 3.0.0
[    0.191260] FPGA manager framework
[    0.191850] Advanced Linux Sound Architecture Driver Initialized.
[    0.202768] clocksource: Switched to clocksource arch_sys_counter
[    0.203584] VFS: Disk quotas dquot_6.6.0
[    0.204537] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.205652] pnp: PnP ACPI: disabled
[    0.217411] NET: Registered PF_INET protocol family
[    0.218913] IP idents hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.222891] tcp_listen_portaddr_hash hash table entries: 1024 (order: 2, 16384 bytes, linear)
[    0.223218] TCP established hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.223535] TCP bind hash table entries: 16384 (order: 6, 262144 bytes, linear)
[    0.223842] TCP: Hash tables configured (established 16384 bind 16384)
[    0.225616] UDP hash table entries: 1024 (order: 3, 32768 bytes, linear)
[    0.225924] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes, linear)
[    0.226892] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.228904] RPC: Registered named UNIX socket transport module.
[    0.229043] RPC: Registered udp transport module.
[    0.229122] RPC: Registered tcp transport module.
[    0.229252] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.229517] PCI: CLS 0 bytes, default 64
[    0.237604] hw perfevents: enabled with armv8_pmuv3 PMU driver, 5 counters available
[    0.238136] kvm [1]: HYP mode not available
[    0.245188] Initialise system trusted keyrings
[    0.247705] workingset: timestamp_bits=42 max_order=19 bucket_order=0
[    0.266363] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.272157] NFS: Registering the id_resolver key type
[    0.272520] Key type id_resolver registered
[    0.272602] Key type id_legacy registered
[    0.272956] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.273129] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.273796] 9p: Installing v9fs 9p2000 file system support
[    0.305643] Key type asymmetric registered
[    0.305794] Asymmetric key parser 'x509' registered
[    0.306283] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 245)
[    0.306504] io scheduler mq-deadline registered
[    0.311126] io scheduler kyber registered
[    0.347713] pl061_gpio 9030000.pl061: PL061 GPIO chip registered
[    0.356474] pci-host-generic 4010000000.pcie: host bridge /pcie@10000000 ranges:
[    0.357112] pci-host-generic 4010000000.pcie:       IO 0x003eff0000..0x003effffff -> 0x0000000000
[    0.357607] pci-host-generic 4010000000.pcie:      MEM 0x0010000000..0x003efeffff -> 0x0010000000
[    0.357875] pci-host-generic 4010000000.pcie:      MEM 0x8000000000..0xffffffffff -> 0x8000000000
[    0.358372] pci-host-generic 4010000000.pcie: Memory resource size exceeds max for 32 bits
[    0.358856] pci-host-generic 4010000000.pcie: ECAM at [mem 0x4010000000-0x401fffffff] for [bus 00-ff]
[    0.364079] pci-host-generic 4010000000.pcie: PCI host bridge to bus 0000:00
[    0.364472] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.364645] pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
[    0.364757] pci_bus 0000:00: root bus resource [mem 0x10000000-0x3efeffff]
[    0.364878] pci_bus 0000:00: root bus resource [mem 0x8000000000-0xffffffffff]
[    0.366476] pci 0000:00:00.0: [1b36:0008] type 00 class 0x060000
[    0.373387] pci 0000:00:01.0: [1af4:1000] type 00 class 0x020000
[    0.373687] pci 0000:00:01.0: reg 0x10: [io  0x0000-0x001f]
[    0.373836] pci 0000:00:01.0: reg 0x14: [mem 0x00000000-0x00000fff]
[    0.373990] pci 0000:00:01.0: reg 0x20: [mem 0x00000000-0x00003fff 64bit pref]
[    0.374169] pci 0000:00:01.0: reg 0x30: [mem 0x00000000-0x0003ffff pref]
[    0.380888] pci 0000:00:01.0: BAR 6: assigned [mem 0x10000000-0x1003ffff pref]
[    0.381401] pci 0000:00:01.0: BAR 4: assigned [mem 0x8000000000-0x8000003fff 64bit pref]
[    0.381650] pci 0000:00:01.0: BAR 1: assigned [mem 0x10040000-0x10040fff]
[    0.381837] pci 0000:00:01.0: BAR 0: assigned [io  0x1000-0x101f]
[    0.391923] EINJ: ACPI disabled.
[    0.436111] virtio-pci 0000:00:01.0: enabling device (0000 -> 0003)
[    0.453457] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.461493] SuperH (H)SCI(F) driver initialized
[    0.462264] msm_serial: driver initialized
[    0.464890] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    0.492635] loop: module loaded
[    0.494180] megasas: 07.719.03.00-rc1
[    0.502798] physmap-flash 0.flash: physmap platform flash device: [mem 0x00000000-0x03ffffff]
[    0.508368] 0.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
[    0.508893] Intel/Sharp Extended Query Table at 0x0031
[    0.509534] Using buffer write method
[    0.510012] physmap-flash 0.flash: physmap platform flash device: [mem 0x04000000-0x07ffffff]
[    0.510485] 0.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
[    0.515326] Intel/Sharp Extended Query Table at 0x0031
[    0.515808] Using buffer write method
[    0.516012] Concatenating MTD devices:
[    0.516088] (0): "0.flash"
[    0.516164] (1): "0.flash"
[    0.516270] into device "0.flash"
[    0.842062] tun: Universal TUN/TAP device driver, 1.6
[    0.851764] thunder_xcv, ver 1.0
[    0.851927] thunder_bgx, ver 1.0
[    0.852081] nicpf, ver 1.0
[    0.853820] hclge is initializing
[    0.853995] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
[    0.854141] hns3: Copyright (c) 2017 Huawei Corporation.
[    0.854409] e1000: Intel(R) PRO/1000 Network Driver
[    0.854485] e1000: Copyright (c) 1999-2006 Intel Corporation.
[    0.854718] e1000e: Intel(R) PRO/1000 Network Driver
[    0.854790] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    0.855061] igb: Intel(R) Gigabit Ethernet Network Driver
[    0.855158] igb: Copyright (c) 2007-2014 Intel Corporation.
[    0.855289] igbvf: Intel(R) Gigabit Virtual Function Network Driver
[    0.855488] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[    0.855975] sky2: driver version 1.30
[    0.857592] VFIO - User Level meta-driver version: 0.3
[    0.861472] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.861785] ehci-pci: EHCI PCI platform driver
[    0.862094] ehci-platform: EHCI generic platform driver
[    0.862351] ehci-orion: EHCI orion driver
[    0.862577] ehci-exynos: EHCI Exynos driver
[    0.863112] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.863320] ohci-pci: OHCI PCI platform driver
[    0.863691] ohci-platform: OHCI generic platform driver
[    0.863958] ohci-exynos: OHCI Exynos driver
[    0.865062] usbcore: registered new interface driver usb-storage
[    0.870518] rtc-pl031 9010000.pl031: registered as rtc0
[    0.871078] rtc-pl031 9010000.pl031: setting system clock to 2022-03-13T13:02:12 UTC (1647176532)
[    0.872374] i2c_dev: i2c /dev entries driver
[    0.881854] sdhci: Secure Digital Host Controller Interface driver
[    0.882058] sdhci: Copyright(c) Pierre Ossman
[    0.883413] Synopsys Designware Multimedia Card Interface Driver
[    0.884535] sdhci-pltfm: SDHCI platform and OF driver helper
[    0.886553] ledtrig-cpu: registered to indicate activity on CPUs
[    0.889273] usbcore: registered new interface driver usbhid
[    0.889408] usbhid: USB HID core driver
[    0.897666] NET: Registered PF_PACKET protocol family
[    0.898736] 9pnet: Installing 9P2000 support
[    0.899135] Key type dns_resolver registered
[    0.899734] Loading compiled-in X.509 certificates
[    0.914890] input: gpio-keys as /devices/platform/gpio-keys/input/input0
[    0.920703] ALSA device list:
[    0.920820]   No soundcards found.
[    0.923270] uart-pl011 9000000.pl011: no DMA platform data
[    0.952866] Freeing unused kernel memory: 14720K
[    0.953596] Run /init as init process
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Saving random seed: [    1.795942] random: dd: uninitialized urandom read (512 bytes read)
OK
Starting network: OK

Welcome to Buildroot
buildroot login: root
Password: 

# cd /
# ls 
bin      init     linuxrc  opt      run      tmp
dev      lib      media    proc     sbin     usr
etc      lib64    mnt      root     sys      var

# strace ls
execve("/bin/ls", ["ls"], 0xfffffd6b8560 /* 11 vars */) = 0
brk(NULL)                               = 0xaaaaeff26000
faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib64/tls/aarch64/libresolv.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/lib64/tls/aarch64", 0xfffff38abec0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib64/tls/libresolv.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/lib64/tls", 0xfffff38abec0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib64/aarch64/libresolv.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/lib64/aarch64", 0xfffff38abec0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib64/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0@8\0\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=80400, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffa3e22000
mmap(NULL, 154088, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xffffa3dcc000
mprotect(0xffffa3ddf000, 61440, PROT_NONE) = 0
mmap(0xffffa3dee000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12000) = 0xffffa3dee000
mmap(0xffffa3df0000, 6632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffffa3df0000
close(3)                                = 0
openat(AT_FDCWD, "/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0`\26\2\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=1429520, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 1523104, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xffffa3c58000
mprotect(0xffffa3dae000, 65536, PROT_NONE) = 0
mmap(0xffffa3dbe000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x156000) = 0xffffa3dbe000
mmap(0xffffa3dc4000, 32160, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffffa3dc4000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffa3e20000
mprotect(0xffffa3dbe000, 16384, PROT_READ) = 0
mprotect(0xffffa3dee000, 4096, PROT_READ) = 0
mprotect(0xaaaacf6f6000, 12288, PROT_READ) = 0
mprotect(0xffffa3e27000, 8192, PROT_READ) = 0
getuid()                                = 0
ioctl(0, TIOCGWINSZ, {ws_row=0, ws_col=0, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
brk(NULL)                               = 0xaaaaeff26000
brk(0xaaaaeff47000)                     = 0xaaaaeff47000
newfstatat(AT_FDCWD, ".", {st_mode=S_IFDIR|0755, st_size=400, ...}, 0) = 0
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
newfstatat(3, "", {st_mode=S_IFDIR|0755, st_size=400, ...}, AT_EMPTY_PATH) = 0
getdents64(3, 0xaaaaeff26380 /* 20 entries */, 32768) = 504
newfstatat(AT_FDCWD, "./var", {st_mode=S_IFDIR|0755, st_size=200, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./usr", {st_mode=S_IFDIR|0755, st_size=140, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=60, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./sys", {st_mode=S_IFDIR|0555, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./sbin", {st_mode=S_IFDIR|0755, st_size=1120, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./run", {st_mode=S_IFDIR|0755, st_size=160, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./root", {st_mode=S_IFDIR|0700, st_size=60, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./proc", {st_mode=S_IFDIR|0555, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./opt", {st_mode=S_IFDIR|0755, st_size=40, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./mnt", {st_mode=S_IFDIR|0755, st_size=40, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./media", {st_mode=S_IFDIR|0755, st_size=40, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./linuxrc", {st_mode=S_IFLNK|0777, st_size=11, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./lib64", {st_mode=S_IFLNK|0777, st_size=3, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./lib", {st_mode=S_IFDIR|0755, st_size=740, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./init", {st_mode=S_IFREG|0755, st_size=462, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./etc", {st_mode=S_IFDIR|0755, st_size=420, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./dev", {st_mode=S_IFDIR|0755, st_size=2980, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "./bin", {st_mode=S_IFDIR|0755, st_size=1540, ...}, AT_SYMLINK_NOFOLLOW) = 0
getdents64(3, 0xaaaaeff26380 /* 0 entries */, 32768) = 0
close(3)                                = 0
newfstatat(1, "", {st_mode=S_IFCHR|0600, st_rdev=makedev(0xcc, 0x40), ...}, AT_EMPTY_PATH) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(1, "\33[1;34mbin\33[m      \33[1;32minit\33["..., 109bin      init     linuxrc  opt      run      tmp
) = 109
write(1, "\33[1;34mdev\33[m      \33[1;34mlib\33[m"..., 109dev      lib      media    proc     sbin     usr
) = 109
write(1, "\33[1;34metc\33[m      \33[1;36mlib64\33"..., 109etc      lib64    mnt      root     sys      var
) = 109
exit_group(0)                           = ?
+++ exited with 0 +++

你可能感兴趣的:(qemu,arm,linux)