Run Linux for ARMv8 on qemu

Run Linux for ARMv8 on qemu

对于很多热爱ARM Linux的Geeker来说,如果随时随地打开电脑就能快速搭建一个ARM Linux开发环境,并进行各种hack,将是一件大快人心的事情。但是现实总是不那么尽如人意:你的ARM开发板总不能随时都处于你身边唾手可得的位置 ,它可能躺在你办公室的工位上,也有可能你手边刚好缺一个能够给你的开发板供电的适配器。幸运的是,我们有Qemu,借助这个完善的开源模拟器,我们就有了一块随时随地能hack的开发板。只要你不是为了调试那些需要严格依赖硬件的外设,比如某一颗HDMI转换芯片,或者某个基于I2C接口的Audio codec,而是用它来研究一些软件框架相关的模块,比如Linux kernel的内存管理,比如ARM的启动代码,比如Linux 内核的进程调度,这些对具体硬件依赖程度不高的模块,它都能胜任。

下面我会做一个简单的例子,描述我是如何利用upstream linux kernel + buildroot 制作根文件系统,构建一个可以在qemu上运行的ARM64 最小的Linux系统的。

如果以位数(32/64)区分,目前的ARM处理器有两类:ARMv7及其以下的版本为32位处理器,ARMv8及其以上的版本为64位处理器。针对这两类ARM CPU,Qemu对应的模拟器可执行程序分别是: qemu-system-arm和qemu-system-aarch64.

在Hack的过程中,我发现Ubuntu 16.04自带的qemu-system-aarch64(版本比较低)在运行Linux 4.5及其以上版本的内核的时候,一启动就会报错,然后我尝试自己编译了最新版本的qemu-system-aarch64(v2.10.1),能够正常运行,然后我就直接用自己编译的版本把Ubuntu系统自带的版本给覆盖了 。暂时还没有去研究为什么低版本的Qemu启动新版本的内核会出错的原因,也许是低版本的qemu不支持某些ARMv8的新特性,哈哈,这个以后再说,暂时现在先聚焦主题,来boot一个ARMv8 Linux最小系统。

一般要启动一个Linux最小系统,需要两个部分: Linux kernel + 根文件系统。最近发现buildroot用来构建根文件系统非常方便:

buildroot源码下载:

git clone git://git.buildroot.net/buildroot

编译: 一个最小的根文件系统只需要通过make menuconfig打开如下配置即可

BR2_aarch64=y
BR2_cortex_a57=y
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y               /* 使用buildroot编译的toolchain */
BR2_KERNEL_HEADERS_4_4=y                      /* kernel 头文件 */
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"       /* ARM virt 平台的串口名称 */
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
BR2_TARGET_ROOTFS_CPIO=y                      /* 这里编译成压缩的文件系统,做initramfs */

该配置参考了一位Linaro工程师的博文: Running Linux in QEMU’s aarch64 system emulation mode

执行make 命令进行编译,最终得到的根文件镜像为:output/images/rootfs.cpio

Linux kernel直接使用upstream的最新代码:

下载:

git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git

编译:

make ARCH=arm64 defconfig
make ARCH=arm64 menuconfig 指定上面buildroot编译的rootfs做为initramfs
CONFIG_INITRAMFS_SOURCE="../opensource/buildroot/output/images/rootfs.cpio "
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-

编译完成后,生成内核镜像:arch/arm64/boot/Image

然后就可以利用qemu启动该镜像进入Linux最小系统了:

qemu-system-aarch64 -machine virt -cpu cortex-a53 -machine type=virt -nographic -smp 4 -m 512 -kernel arch/arm64/boot/Image  --append "earlycon console=ttyAMA0"

启动log:

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 4.16.0-00002-ga378398 (andy@Xeon) (gcc version 6.3.1 20170404 (Linaro GCC 6.3-2017.05)) #46 SMP PREEMPT Sun Apr 22 11:32:47 CST 2018
[    0.000000] Machine model: linux,dummy-virt
[    0.000000] earlycon: pl11 at MMIO 0x0000000009000000 (options '')
[    0.000000] bootconsole [pl11] enabled
[    0.000000] efi: Getting EFI parameters from FDT:
[    0.000000] efi: UEFI not found.
[    0.000000] NUMA: No NUMA configuration found
[    0.000000] NUMA: Faking a node at [mem 0x0000000000000000-0x000000005fffffff]
[    0.000000] NUMA: NODE_DATA [mem 0x5ffeab00-0x5ffec2ff]
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000040000000-0x000000005fffffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x000000005fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000005fffffff]
[    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] random: get_random_bytes called from start_kernel+0xa4/0x3fc with crng_init=0
[    0.000000] percpu: Embedded 21 pages/cpu @        (ptrval) s54936 r0 d31080 u86016
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: enabling workaround for ARM erratum 845719
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 129024
[    0.000000] Policy zone: DMA32
[    0.000000] Kernel command line: earlycon console=ttyAMA0
[    0.000000] Memory: 496772K/524288K available (5308K kernel code, 430K rwdata, 1296K rodata, 3200K init, 313K bss, 27516K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000]  Tasks RCU enabled.
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv2m: range[mem 0x08020000-0x08020fff], SPI[80:143]
[    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.000296] sched_clock: 56 bits at 62MHz, resolution 16ns, wraps every 4398046511096ns
[    0.012764] Console: colour dummy device 80x25
[    0.014503] Calibrating delay loop (skipped), value calculated using timer frequency.. 125.00 BogoMIPS (lpj=250000)
[    0.015136] pid_max: default: 32768 minimum: 301
[    0.018630] Dentry cache hash table entries: 65536 (order: 7, 524288 bytes)
[    0.019588] Inode-cache hash table entries: 32768 (order: 6, 262144 bytes)
[    0.020227] Mount-cache hash table entries: 1024 (order: 1, 8192 bytes)
[    0.020598] Mountpoint-cache hash table entries: 1024 (order: 1, 8192 bytes)
[    0.081167] ASID allocator initialised with 32768 entries
[    0.088726] Hierarchical SRCU implementation.
[    0.103012] EFI services will not be available.
[    0.111318] smp: Bringing up secondary CPUs ...
[    0.145152] Detected VIPT I-cache on CPU1
[    0.146719] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.180304] Detected VIPT I-cache on CPU2
[    0.180646] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[    0.210690] Detected VIPT I-cache on CPU3
[    0.211055] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[    0.212162] smp: Brought up 1 node, 4 CPUs
[    0.215012] SMP: Total of 4 processors activated.
[    0.215551] CPU features: detected feature: 32-bit EL0 Support
[    0.216023] CPU features: detected feature: Kernel page table isolation (KPTI)
[    0.293793] CPU: All CPU(s) started at EL1
[    0.294664] alternatives: patching kernel code
[    0.324397] devtmpfs: initialized
[    0.350758] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.351812] futex hash table entries: 1024 (order: 5, 131072 bytes)
[    0.357964] pinctrl core: initialized pinctrl subsystem
[    0.380976] random: fast init done
[    0.395311] DMI not present or invalid.
[    0.403080] NET: Registered protocol family 16
[    0.408010] audit: initializing netlink subsys (disabled)
[    0.412454] audit: type=2000 audit(0.372:1): state=initialized audit_enabled=0 res=1
[    0.421406] cpuidle: using governor menu
[    0.422241] vdso: 2 pages (1 code @         (ptrval), 1 data @         (ptrval))
[    0.423053] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.425936] DMA: preallocated 256 KiB pool for atomic allocations
[    0.428492] Serial: AMBA PL011 UART driver
[    0.472014] 9000000.pl011: ttyAMA0 at MMIO 0x9000000 (irq = 39, base_baud = 0) is a PL011 rev1
[    0.474227] console [ttyAMA0] enabled
[    0.474227] console [ttyAMA0] enabled
[    0.474996] bootconsole [pl11] disabled
[    0.474996] bootconsole [pl11] disabled
[    0.541652] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.546979] cryptd: max_cpu_qlen set to 1000
[    0.555611] vgaarb: loaded
[    0.558169] SCSI subsystem initialized
[    0.560435] pps_core: LinuxPPS API ver. 1 registered
[    0.560798] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.561537] PTP clock support registered
[    0.577997] clocksource: Switched to clocksource arch_sys_counter
[    0.585547] VFS: Disk quotas dquot_6.6.0
[    0.586966] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.667685] NET: Registered protocol family 2
[    0.679278] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes)
[    0.680122] TCP established hash table entries: 4096 (order: 3, 32768 bytes)
[    0.681037] TCP bind hash table entries: 4096 (order: 4, 65536 bytes)
[    0.682116] TCP: Hash tables configured (established 4096 bind 4096)
[    0.692515] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.693391] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.697140] NET: Registered protocol family 1
[    1.091659] hw perfevents: enabled with armv8_pmuv3 PMU driver, 1 counters available
[    1.158568] workingset: timestamp_bits=44 max_order=17 bucket_order=0
[    1.196143] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    1.238625] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 248)
[    1.239695] io scheduler noop registered (default)
[    1.249668] pl061_gpio 9030000.pl061: PL061 GPIO chip @0x0000000009030000 registered
[    1.254717] PCI: OF: host bridge /pcie@10000000 ranges:
[    1.255990] PCI: OF:    IO 0x3eff0000..0x3effffff -> 0x00000000
[    1.256914] PCI: OF:   MEM 0x10000000..0x3efeffff -> 0x10000000
[    1.257382] PCI: OF:   MEM 0x8000000000..0xffffffffff -> 0x8000000000
[    1.259121] pci-host-generic 3f000000.pcie: ECAM at [mem 0x3f000000-0x3fffffff] for [bus 00-0f]
[    1.261471] pci-host-generic 3f000000.pcie: PCI host bridge to bus 0000:00
[    1.262833] pci_bus 0000:00: root bus resource [bus 00-0f]
[    1.263400] pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
[    1.263807] pci_bus 0000:00: root bus resource [mem 0x10000000-0x3efeffff]
[    1.264227] pci_bus 0000:00: root bus resource [mem 0x8000000000-0xffffffffff]
[    1.278742] pci 0000:00:01.0: BAR 6: assigned [mem 0x10000000-0x1003ffff pref]
[    1.279628] pci 0000:00:01.0: BAR 4: assigned [mem 0x8000000000-0x8000003fff 64bit pref]
[    1.280333] pci 0000:00:01.0: BAR 1: assigned [mem 0x10040000-0x10040fff]
[    1.280726] pci 0000:00:01.0: BAR 0: assigned [io  0x1000-0x101f]
[    1.300393] virtio-pci 0000:00:01.0: enabling device (0000 -> 0003)
[    1.342393] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    1.376846] loop: module loaded
[    1.452650] rtc-pl031 9010000.pl031: rtc core: registered pl031 as rtc0
[    1.454729] i2c /dev entries driver
[    1.480609] NET: Registered protocol family 17
[    1.482712] Bridge firewalling registered
[    1.483086] 8021q: 802.1Q VLAN Support v1.8
[    1.488440] registered taskstats version 1
[    1.503669] input: gpio-keys as /devices/platform/gpio-keys/input/input0
[    1.509552] rtc-pl031 9010000.pl031: setting system clock to 2018-04-22 09:53:06 UTC (1524390786)
[    1.517606] uart-pl011 9000000.pl011: no DMA platform data
[    1.619787] Freeing unused kernel memory: 3200K
Starting logging: OK
Initializing random number generator... done.
Starting network: OK

Welcome to Buildroot
buildroot login: root
# cd /
# ls
bin      init     linuxrc  opt      run      tmp
dev      lib      media    proc     sbin     usr
etc      lib64    mnt      root     sys      var
# mount
rootfs on / type rootfs (rw,size=248384k,nr_inodes=62096)
devtmpfs on /dev type devtmpfs (rw,relatime,size=248384k,nr_inodes=62096,mode=755)
proc on /proc type proc (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=666)
tmpfs on /dev/shm type tmpfs (rw,relatime,mode=777)
tmpfs on /tmp type tmpfs (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
sysfs on /sys type sysfs (rw,relatime)
# 

按Ctrl-a x组合键可以退出qemu。

本文为博主原创,转载请著名出处。欢迎关注博主的公众号:HackforFun

在这里插入图片描述

<think>首先,用户的问题是关于在使用QEMU构建ARM环境时遇到内核panic错误:"Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b"。我需要基于提供的引用和系统指令来回答。 系统指令: - 所有行内数学表达式使用$...$格式。 - 独立公式使用$$...$$格式并单独成段。 - LaTeX语法正确。 - 使用中文回答。 - 生成相关问题。 - 回答中引用的段落末尾自然地添加引用标识。 - 回答结构清晰,帮助用户逐步解决问题。 - 引用站内内容:[^1], [^2], [^3], [^4]。 用户提供的引用: - [^1]: Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004。在移植Linux系统到arm上时遇到问题。 - [^2]: Kernel panic - not syncing: Attempted to kill init(linux内核启动错误-arm)。建议选择Kernel Features中的选项。 - [^3]: JZ2440移植根文件系统及Kernel panic问题。涉及制作根文件系统的步骤。 - [^4]: 基于ARM平台分析Linux系统调用过程。关于寄存器和frame的定义。 用户的具体问题是:QEMU ARM kernel panic not syncing attempted to kill init exitcode 0x0000000b。exitcode是0x0000000b,而引用中是0x00000004,但问题类似,都是"Attempted to kill init"。 我需要构建一个结构清晰的回答: 1. **理解问题**:解释错误含义。 2. **可能原因**:基于引用和常见原因分析。 3. **解决方案**:提供逐步解决步骤。 4. **预防措施**:如何避免类似问题。 5. **相关问题**:生成相关的问题列表。 错误分析: - "Kernel panic - not syncing: Attempted to kill init" 表示内核在启动过程中尝试杀死init进程失败,导致系统崩溃。 - exitcode 0x0000000b 可能表示特定的错误代码。在Linux中,exit code 11通常与段错误(SIGSEGV)相关,因为SIGSEGV是信号11。 基于引用: - [^2]提到,在ARM移植中,问题可能与内核配置有关,特别是启用ARM EABI和允许旧ABI二进制文件运行。 - [^3]涉及根文件系统的制作,包括静态编译BusyBox、设置inittab、fstab等。 - [^1]和[^4]提供了一般上下文,但exitcode不同。 可能的解决方案: 1. **内核配置**:确保在内核配置中启用ARM EABI和支持旧ABI。 2. **根文件系统**:检查根文件系统是否正确构建,包括必要的目录、文件和库。 3. **QEMU设置**:验证QEMU命令行参数是否正确,如内核镜像、设备树、根文件系统路径。 4. **调试工具**:使用QEMU的调试功能或打印内核日志来诊断。 步骤式回答: - 步骤1: 检查内核配置。 - 步骤2: 验证根文件系统。 - 步骤3: 确保QEMU参数正确。 - 步骤4: 调试错误。 生成相关问题: - 基于主题,如ARM移植、QEMU使用、内核panic解决。 确保使用中文。</think>### QEMU ARM 内核 Panic 错误 "Attempted to kill init" 解决方案 在使用 QEMU 构建 ARM 环境时,遇到 "Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b" 错误,通常表示内核在启动过程中尝试终止 `init` 进程失败,导致系统崩溃。exitcode `0x0000000b` 在 Linux 中对应信号 11 (`SIGSEGV`),即段错误(Segmentation Fault),常见于内存访问违规或二进制兼容性问题[^1][^2]。以下我将基于常见原因和解决方案,逐步指导您排查和修复问题。整个过程基于 ARM 架构的 Linux 内核移植和 QEMU 仿真环境。 #### 步骤 1: 理解错误原因和诊断 - **错误含义**:`Attempted to kill init` 表示内核无法正确启动用户空间的第一个进程 (`init`),通常由根文件系统问题、内核配置错误或二进制兼容性导致。 - **exitcode 0x0000000b**:对应 `SIGSEGV`(信号 11),表示段错误,常见原因包括: - 内核与用户空间程序(如 `init`)的 ABI(应用二进制接口)不兼容。 - 根文件系统缺少关键文件(如库文件、配置文件)或权限错误。 - 内存访问问题,如 MMU 配置错误或设备树未正确加载。 - **诊断工具**: - 使用 QEMU 的 `-d` 参数输出内核日志:`qemu-system-arm -d in_asm,cpu,exec,int -kernel zImage ...`。 - 检查内核启动日志,确认 `init` 进程失败点,例如是否卡在挂载根文件系统或加载库文件[^3][^4]。 #### 步骤 2: 检查并修复内核配置 内核配置错误是常见原因,尤其涉及 ARM EABI(Embedded Application Binary Interface)设置。参考引用[^2],需确保内核支持旧 ABI 二进制文件: 1. **修改内核配置**: - 进入 Linux 内核源码目录:`cd linux-arch/arm/configs`。 - 运行 `make menuconfig`,导航到 **Kernel Features** 子菜单。 - 启用以下选项: - `[*] Use the ARM EABI to compile the kernel`(使用 ARM EABI 编译内核)。 - `[*] Allow old ABI binaries to run with this kernel (EXPERIMENTAL)`(允许旧 ABI 二进制文件运行)。 - 保存配置并重新编译内核:`make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-`。 - 编译后生成新内核镜像(如 `zImage`),在 QEMU 中使用它[^2]。 2. **验证设备树支持**: - 确保 QEMU 命令行包含正确的设备树文件(`.dtb`),例如: ```bash qemu-system-arm -M vexpress-a9 -kernel zImage -dtb vexpress-v2p-ca9.dtb -append "root=/dev/mmcblk0 console=ttyAMA0" -drive file=rootfs.img,format=raw,if=sd ``` - 如果设备树缺失,内核可能无法初始化硬件,导致内存访问错误。使用 `dtc -I dtb -O dts vexpress-v2p-ca9.dtb > dump.dts` 检查设备树内容。 #### 步骤 3: 验证和修复根文件系统 根文件系统问题(如缺少库文件或配置错误)是另一个常见原因。参考引用[^3],确保根文件系统完整: 1. **构建静态编译的 BusyBox**: - 下载 BusyBox 源码,运行 `make menuconfig`,选择 **Settings → Build Options → Build BusyBox as a static binary (no shared libs)**,编译为静态库以避免依赖问题。 - 安装到根文件系统目录: ```bash make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- CONFIG_PREFIX=/path/to/rootfs install ``` 2. **创建必要目录和文件**: - 在根文件系统中创建基础目录:`mkdir -p etc lib proc tmp dev home mnt root sys usr/lib`。 - 关键配置文件: - `etc/inittab`:确保内容包含 `init` 启动脚本: ```plaintext ::sysinit:/etc/init.d/rcS console::askfirst:-/bin/sh ::ctrlaltdel:/sbin/reboot ::shutdown:/bin/umount -a -r ``` - `etc/fstab`:正确挂载点: ```plaintext proc /proc proc defaults 0 0 tmpfs /tmp tmpfs defaults 0 0 sysfs /sys sysfs defaults 0 0 tmpfs /dev tmpfs defaults 0 0 ``` - `etc/init.d/rcS`:设置环境变量和挂载: ```bash #!/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin runlevel=S prevlevel=N umask 022 export PATH runlevel prevlevel mount -a echo /sbin/mdev > /proc/sys/kernel/hotplug mdev -s ``` - 设置执行权限:`chmod +x etc/init.d/rcS`。 3. **添加 C 库文件**: - ARM 工具链的库文件必须拷贝到根文件系统: ```bash cp /path/to/toolchain/arm-linux-gnueabihf/libc/lib/*.so /path/to/rootfs/lib -d cp /path/to/toolchain/arm-linux-gnueabihf/libc/usr/lib/*.so /path/to/rootfs/usr/lib -d ``` - 使用 `file` 命令检查库文件架构:`file lib/libc.so.6` 应显示 ARM 格式。 4. **生成根文件系统镜像**: - 使用 `genext2fs` 创建镜像: ```bash genext2fs -b 1024 -d /path/to/rootfs rootfs.img ``` - 在 QEMU 中挂载:`-drive file=rootfs.img,format=raw,if=sd`。 #### 步骤 4: 调整 QEMU 启动参数 QEMU 命令行错误可能导致内存或设备初始化失败: - **标准 QEMU ARM 命令**: ```bash qemu-system-arm -M vexpress-a9 -m 512M -kernel zImage -dtb vexpress-v2p-ca9.dtb \ -append "root=/dev/mmcblk0 rw console=ttyAMA0" -drive file=rootfs.img,format=raw,if=sd \ -serial stdio -no-reboot ``` - **关键参数说明**: - `-append "root=..."`:指定根文件系统设备(如 `/dev/mmcblk0` 对应 SD 卡)。 - `-serial stdio`:将内核日志输出到终端,便于调试。 - 如果问题依旧,添加 `-s -S` 参数启动 GDB 调试:`qemu-system-arm ... -s -S`,然后在另一个终端运行 `gdb-multiarch -ex "target remote localhost:1234"`。 #### 步骤 5: 测试和验证 - 启动 QEMU,观察日志: - 如果错误消失,系统应进入 shell 提示符。 - 如果仍有 panic,检查日志中的具体错误(如 `Failed to execute /init`),确认是否库文件缺失或权限问题(使用 `chmod 4755 /path/to/init` 修复)。 - **常见陷阱**: - 工具链不匹配:确保 QEMU、内核和根文件系统使用相同 ARM 架构(如 `armv7-a`)。 - 内存不足:增加 QEMU 内存(`-m 1G`)。 - 参考引用[^4],ARM 系统调用涉及寄存器帧(如 `S_FRAME_SIZE`),确保内核配置支持正确的 ABI[^4]。 #### 预防措施 - **内核配置**:始终启用 `ARM EABI` 和旧 ABI 支持,尤其使用旧工具链时[^2]。 - **静态编译**:优先静态编译 BusyBox 以减少依赖。 - **版本兼容**:使用匹配的 QEMU、内核和工具链版本(如 QEMU 6.x + Linux 5.x + GCC 10.x)。 通过以上步骤,90% 的类似问题可解决。如果问题持续,提供 QEMU 命令、内核版本和日志片段,以便进一步分析[^1][^3]。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值