Project

General

Profile

Support #929

Updated by Daniel Curtis about 6 years ago

This is a guide on virtualizing an ARM based operating system, in this case Raspbian for the Raspberry Pi 3, Raspbian, on an x86_64 Arch Linux system. 

 h2. Prepare the environment 

 * Make sure the system is up to date: 
 <pre> 
 pacman -Syu 
 </pre> 

 * Install a few dependencies: 
 <pre> 
 pacman -S git base-devel 
 </pre> 

 h3. Install ARM toolchain: 

 * Clone the toolchain repo (using @--depth 1@ will decrease the overall download size by 400MB): 
 <pre> 
 mkdir ~/git && cd ~/git 
 git clone --depth 1 https://github.com/raspberrypi/tools.git 
 </pre> 

 * Add the tools to your path: 
 <pre> 
 echo 'export PATH=$PATH:~/git/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin' >> ~/.bash_profile 
 </pre> 

 * Source the @.bash_profile@: 
 <pre> 
 source ~/.bash_profile 
 </pre> 

 h2. Install Qemu 

 * Install qemu and the extra architectures: 
 <pre> 
 pacman -S git qemu qemu-arch-extra wget 
 </pre> 

 h3. Compile Latest Kernel 

 * Download the qemu-rpi-kernel repo: 
 <pre> 
 cd ~/git 
 git clone https://github.com/dhruvvyas90/qemu-rpi-kernel.git 
 </pre> 

 h3. Prepare Raspbian 

  

 * Change into the qemu-rpi-kernel/tools directory: 
 <pre> 
 cd ~/git/qemu-rpi-kernel/tools 
 </pre> 

 * Modify the kernel compile script to use Arch commands: 
 <pre> 
 sed -i.bak -e's/sudo\ apt-get\ update/sudo\ pacman\ -Syu/g' -e's/sudo\ apt-get\ install\ git\ libncurses5-dev\ gcc-arm-linux-gnueabihf/sudo\ pacman\ -S\ git/g' build-kernel-qemu 
 </pre> 

 * Edit the build-kernel-qemu script: 
 <pre> 
 vi build-kernel-qemu 
 </pre> 
 #* And comment out all COMMIT versions except for the desired commit, and turn USE_GIT off also remove the exit command before the makes: 
 <pre> 
 #COMMIT=6820d0cbec64cfee481b961833feffec8880111e 
 #COMMIT=raspberrypi-kernel_1.20171029-1 
 #COMMIT="" 
 COMMIT=raspberrypi-kernel_1.20180313-1 
 #USE_GIT=1 

 #exit 
 </pre> 

 * Run the build script: 
 <pre> 
 ./build-kernel-qemu 
 </pre> 

 * Download the latest raspbian image (1.7G): 
 <pre> 
 mkdir ~/raspbian && cd ~/raspbian 
 wget http://downloads.raspberrypi.org/raspbian/images/raspbian-2018-03-14/2018-03-13-raspbian-stretch.zip 
 </pre> 

 h2. Resources 

 * https://azeria-labs.com/emulate-raspberry-pi-with-qemu/ 
 * http://downloads.raspberrypi.org/raspbian/images/raspbian-2018-03-14/ 
 * https://github.com/raspberrypi/linux/releases 
 * https://github.com/dhruvvyas90/qemu-rpi-kernel

Back