---
# System prepended metadata

title: Run Linux Kernel on QEMU emulator
tags: [env-setup, linux, qemu, kernel]

---

Run Linux Kernel on QEMU emulator
===

###### tags: `linux` `kernel` `env-setup` `qemu`

## Prev Step

[step 3: Build Kernel](https://hackmd.io/VL0CysI4TXG_ahNq-SSRFg)

## Run qemu

在 linux-5.10.1 路徑下輸入以下指令使用 qemu 模擬一個 arm cpu 並在上面跑 Linux:

    qemu-system-arm -M vexpress-a9 -smp 4 -m 1024M -nographic \
    -kernel ./build/arch/arm/boot/zImage \
    -dtb ./build/arch/arm/boot/dts/vexpress-v2p-ca9.dtb \
    -append "rdinit=/linuxrc console=ttyAMA0 loglevel=8"


Now you are running linux-5.10.1 on arm v7 platform emulated by qemu:

![](https://i.imgur.com/OjeypJY.png)
(不知道為什麼會多個?p)

### close qemu

	ctrl + a + x
or

open another terminal:

    killall qemu-system-arm



## Trouble shooting

1./bin/sh: 1: flex: not found
    
    sudo apt install flex
    
2./bin/sh: 1: bison: not found

    sudo apt install bison

3.Command 'qemu-system-arm' not found

    sudo apt install qemu-system-arm

