QEmu-ARM-Ubuntu:CPU1:无法启动:-38

时间:2016-08-18 21:36:48

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

如何修复" CPU1:无法启动:-38"问题在QEmu?

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

实际上,ARM-Ubuntu在物理机和中间虚拟机中只使用了6个核心。

要在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"

1 个答案:

答案 0 :(得分:1)

您正在仿真的特定计算机(vexpress-v2p-ca15-tc1)是双核计算机,因此内核将尝试启动它在DTB中描述的辅助CPU通过。但是,由于QEMU仅模拟单个CPU,因此不存在,辅助服务器自然无法联机。

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