Project

General

Profile

Support #933

Virtualize Arch Linux ARM on x86_64 Arch Linux

Added by Daniel Curtis over 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Operating Systems
Target version:
Start date:
04/17/2018
Due date:
% Done:

100%

Estimated time:
1.00 h
Spent time:

Description

This is a guide on virtualizing an ARM based operating system, in this case Arch Linux ARM, on an x86_64 Arch Linux system.

Prepare the environment

  • Make sure the system is up to date:
    pacman -Syu
    
  • Install a few dependencies:
    pacman -S git base-devel
    

Install Arch Linux ARM

  • Create a 4GB image and mount it to ~/alarm/root:
    mkdir -p ~/alarm/root && cd ~/alarm
    dd if=/dev/zero of=./alarm.img bs=8M count=512
    mkfs.ext4 alarm.img
    sudo mount alarm.img root
    
  • Download and install alarm into the image:
    wget http://archlinuxarm.org/os/ArchLinuxARM-armv7-latest.tar.gz
    sudo bsdtar -xpf ArchLinuxARM-armv7-latest.tar.gz -C ./root
    sync
    
  • Remove the getty systemd unit link to prevent the console from locking up:
    sudo rm root/etc/systemd/system/getty.target.wants/getty@tty1.service
    
  • Copy the kernel and device tree blob out of the image:
    cp ./root/boot/zImage ./zImage_alarm
    cp ./root/boot/dtbs/vexpress-v2p-ca9.dtb ./
    
  • Unmount the image so it can be booted from:
    sudo umount root
    
  • With the kernel and rootfs ready, start the VM:
    qemu-system-arm \
    -M vexpress-a9 \
    -smp 2 \
    -m 1G \
    -dtb vexpress-v2p-ca9.dtb \
    -kernel zImage_alarm \
    -append "root=/dev/mmcblk0 rw roottype=ext4 console=ttyAMA0" \
    -drive if=sd,driver=raw,cache=writeback,file=./alarm.img \
    -redir tcp:2222::22 \
    --nographic
    
  • Now log in as root with the password root.
  • The host system also redirects ssh requests on 2222 to the virtualized arch linux arm install.

Resources

Also available in: Atom PDF