Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@wuhanstudio
Last active April 14, 2024 21:44
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save wuhanstudio/e9b37b07312a52ceb5973aacf580c453 to your computer and use it in GitHub Desktop.
Save wuhanstudio/e9b37b07312a52ceb5973aacf580c453 to your computer and use it in GitHub Desktop.
Armbian on QEMU
# Install QEMU-6.1.0
wget https://download.qemu.org/qemu-6.1.0.tar.xz
tar xvJf qemu-6.1.0.tar.xz
cd qemu-6.1.0
./configure
make
sudo make install
# Download Armbian (Ubuntu Focal 20.04) for OrangePi PC
wget https://mirrors.netix.net/armbian/dl/orangepipc/archive/Armbian_21.08.1_Orangepipc_focal_current_5.10.60.img.xz
sudo apt-get install xz-utils
unxz Armbian_21.08.1_Orangepipc_focal_current_5.10.60.img.xz
# Create SD Image for QEMU
fallocate -l 16G armbian.img
dd conv=notrunc if=Armbian_21.08.1_Orangepipc_focal_current_5.10.60.img of=armbian.img bs=2G
fdisk -lu armbian.img
# sudo mount -o loop,offset=Boot*512 armbian.img /mnt/
sudo mount -o loop,offset=4194304 armbian.img /mnt/
# Copy vmlinuz dtb initrd
sudo cp /mnt/boot/vmlinuz-5.10.60-sunxi ./
sudo cp /mnt/boot/dtb-5.10.60-sunxi/sun8i-h3-orangepi-pc.dtb ./
sudo cp /mnt/boot/initrd.img-5.10.60-sunxi ./
# Resize the img partition size
sudo apt install gparted
sudo umount /mnt
sudo modprobe loop
LOOP_DEVICE=`sudo losetup -f`
sudo losetup $LOOP_DEVICE armbian.img
sudo parted $LOOP_DEVICE
# print
# resizepart 1 16GB
# Fix potential errors in the filesystem
# sudo partprobe $LOOP_DEVICE
# LOOP_DEVICE_P1="${LOOP_DEVICE}p1"
# sudo e2fsck -f $LOOP_DEVICE_P1
# sudo resize2fs $LOOP_DEVICE_P1 16G
sudo losetup -d $LOOP_DEVICE
# Start QEMU
qemu-system-arm -M orangepi-pc -m 1G -smp 4\
-kernel vmlinuz-5.10.60-sunxi \
-dtb sun8i-h3-orangepi-pc.dtb \
-initrd initrd.img-5.10.60-sunxi \
-sd armbian.img \
-append 'console=ttyS0,115200 root=/dev/mmcblk0p1' \
-nic user,hostfwd=tcp::2022-:22,model=allwinner-sun8i-emac \
-no-reboot -serial stdio -nographic -monitor none
# Resize filesystem in Orange Pi
sudo resize2fs /dev/mmcblk0p1
@wuhanstudio
Copy link
Author

  ___  ____  _   ____   ____
 / _ \|  _ \(_) |  _ \ / ___|
| | | | |_) | | | |_) | |
| |_| |  __/| | |  __/| |___
 \___/|_|   |_| |_|    \____|

Welcome to Armbian 21.08.1 Focal with Linux 5.10.60-sunxi

System load:   208%             Up time:       5 min
Memory usage:  8% of 998M       IP:            10.0.2.15
Usage of /:    91% of 1.2G

[ 6 security updates available, 16 updates total: apt upgrade ]
Last check: 2021-10-05 11:04

[ General system configuration (beta): armbian-config ]

No directory, logging in with HOME=/
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

wuhanstudio@orangepipc:/$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment