【问题标题】:QEmu-ARM-Ubuntu: CPU1: failed to boot: -38QEmu-ARM-Ubuntu:CPU1:启动失败:-38
【发布时间】:2016-12-25 22:58:08
【问题描述】:

如何修复 QEmu 中的“CPU1: failed to boot: -38”问题?

我在 Windows 10 的 Virtual Box 上托管 Ubuntu 16.04。在 Ubuntu 16.04 内部,有 QEmu 模拟 ARM 处理器,运行 Ubuntu Trusty (14.04)。当 ARM-Ubuntu 启动时,它会多次打印到控制台“CPU1:启动失败:-38”和类似的东西。是一些命令行切换到 QEmu 还是配置文件的问题?还是另一个 VM 中的 QEmu ARM 仿真存在错误或缺乏支持?

实际上,ARM-Ubuntu 仅使用物理机和中间虚拟机中可用的 6 个内核中的 1 个。

为了在 QEmu 上设置 ARM-Linux,我主要关注 these steps。我必须做一些不同的事情,例如因为 Ubuntu Sauce 不再可用。具体我做的步骤是:

# 1) setup the rootfs

sudo apt-get install qemu-user-static qemu-system-arm

mkdir vexpress
cd vexpress
mkdir qemu-img

# Create 8-GB image
dd if=/dev/zero of=./vexpress-8G.img bs=8M count=1024
sudo losetup -f ./vexpress-8G.img
sudo mkfs.ext4 /dev/loop0
sudo mount /dev/loop0 qemu-img

# Bootstrap Ubuntu Trusty armhf rootfs in the qemu-img directory
# For Ubuntu versions later than Trusty some commands fail
# For Ubuntu versions before Saucy there is no port to ARM
# Ubuntu Saucy is not supported anymore
sudo qemu-debootstrap --arch=armhf trusty qemu-img
sudo cp `which qemu-arm-static` qemu-img/usr/bin/

# setup serial console, apt repositories and network
sudo chroot qemu-img
sed 's/tty1/ttyAMA0/g' /etc/init/tty1.conf > /etc/init/ttyAMA0.conf
echo "deb  http://ports.ubuntu.com trusty main restricted multiverse universe" > /etc/apt/sources.list
apt-get update
echo -e "\nauto eth0\niface eth0 inet dhcp" >> /etc/network/interfaces

# root password
passwd


# 2) pick and install a kernel

# Fix locale problems http://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue
locale
sudo locale-gen "be_BY.UTF-8"
sudo locale-gen "en_US"
sudo locale-gen "en_US.UTF-8"
sudo dpkg-reconfigure locales

apt-get install wget ca-certificates
wget https://launchpad.net/ubuntu/+archive/primary/+files/linux-image-3.13.0-24-generic-lpae_3.13.0-24.46_armhf.deb
dpkg -i linux-image-3.13.0-24-generic-lpae_3.13.0-24.46_armhf.deb

# So far I'm getting the following warnings:
#   Warning: cannot read table of mounted file systems: No such file or directory
#   warning: failed to read mtab

# !!! press CTRL+D to exit the chroot
^D


# 3) Boot it up


# copy kernel, initrd and dtb files
sudo cp qemu-img/boot/vmlinuz-3.13.0-24-generic-lpae .
sudo cp qemu-img/boot/initrd.img-3.13.0-24-generic-lpae .
sudo cp qemu-img/lib/firmware/3.13.0-24-generic-lpae/device-tree/vexpress-v2p-ca15-tc1.dtb .

# umount the rootfs img
sudo umount qemu-img

sudo chmod 777 vmlinuz-3.13.0-24-generic-lpae
sudo chmod 777 initrd.img-3.13.0-24-generic-lpae
sudo chmod 777 vexpress-v2p-ca15-tc1.dtb
sudo chmod 777 vexpress-8G.img

# http://unix.stackexchange.com/questions/167165/how-to-pass-ctrl-c-in-qemu
# Allow Ctrl+C and Ctrl+Z on guest, changing them on host to Ctrl+] and Ctrl+[
stty intr ^]
stty susp ^j

qemu-system-arm --drive format=raw,if=sd,file=vexpress-8G.img -kernel vmlinuz-3.13.0-24-generic-lpae -initrd initrd.img-3.13.0-24-generic-lpae -M vexpress-a15 -serial stdio -m 2048 -append 'root=/dev/mmcblk0 rw mem=2048M raid=noautodetect rootwait console=ttyAMA0,38400n8 devtmpfs.mount=0' -dtb ./vexpress-v2p-ca15-tc1.dtb
# Still getting error: "CPU1: failed to boot: -38"

【问题讨论】:

  • 根据提供的与问题相关的信息,我会说你需要用这件事做事。
  • @Notlikethat,我添加了创建和启动 ARM-Ubuntu QEmu 映像的步骤。中间 Ubuntu 的 Virtual Box 版本为 5.1.4 。我还要提供更多信息吗?

标签: arm ubuntu-14.04 virtual-machine virtualbox qemu


【解决方案1】:

您正在模拟的特定机器 (vexpress-v2p-ca15-tc1) 是双核机器,因此内核将尝试启动它在您传递的 DTB 中描述的辅助 CPU。但是由于 QEMU 只模拟单个 CPU,secondary 自然会因为不存在而无法上线。

消息本身是完全无害的,但如果您对错误消息过敏,只需在内核命令行中添加 maxcpus=1 即可防止 Linux 甚至尝试启动任何辅助内核。如果您真的想要模拟两个内核,请将-smp 2 选项传递给 QEMU,尽管这很可能会导致更多的模拟开销并且总体上更慢。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-14
    • 2016-01-26
    • 2012-07-10
    • 1970-01-01
    相关资源
    最近更新 更多