qemu
platform: deepin-v23
configure
there are some problems when we config qemu
# sphinx not found
sudo apt install python3-sphinx
# spinx_rtd_theme not found
sudo apt install python3-sphinx-rtd-theme
# ERROR: Cannot find Ninja
sudo apt-get install ninja-build
# ../meson.build:926:10: ERROR: Dependency "glib-2.0" not found, tried pkgconfig
sudo apt-get install libglib2.0-dev
# ../target/hexagon/meson.build:292:8: ERROR: Program 'flex' not found or not executable
sudo apt install flex
# ../target/hexagon/meson.build:298:8: ERROR: Program 'bison' not found or not executable
sudo apt install bison
tips: linux install python-package, don't use pip
make
# After making, such as./build/qemu-system-arm exists.
qemu-system-arm -machine help
execute
bare machine
arm-none-linux-gnueabihf-gcc -o main.out main.c -static
qemu-arm main.out
其中main.c示例代码
#include <stdio.h>
int main()
{
printf("hello world!\n");
return 0;
}
kernel
#!/usr/bin/bash
KERN_DIR="/home/orig/open/linux/linux-6.6.51/"
KERNEL=${KERN_DIR}arch/x86/boot/bzImage
QEMU_DIR="/home/orig/open/qemu/qemu-9.1.0/"
BIOS_DIR=${QEMU_DIR}"pc-bios/"
echo $KERNEL
echo $BIOS_DIR
qemu-system-x86_64 \
-smp 2 \
-m 1024M \
-L ${BIOS_DIR} \
-kernel ${KERNEL} \
-nographic \
-append "root=/dev/ram0 rw console=ttyS0 init=/linuxrc" \
problem
# qemu: could not load PC BIOS 'bios-256k.bin'
#
# [solution] find and config the path of 'bios-256k.bin'
cd qemu-9.1.0
find . -name bios-256k.bin