Skip to content

Setup Development Environment

Meliurwen edited this page Apr 11, 2018 · 27 revisions

In this tutorial you'll be guided step by step in the building and setup of CoderBot, from ground up to the fully working eviroment, directly from source.

It is composed in four "macro-steps": Preparation of the Machine, Preparation of the Enviroment, Installation of the Core and Configuration. The first macro-step is composed in two mutually exclusive options: Preparation of the Virtual Machine (qemu) and Preparation of the Physical Machine (Raspberry Pi).

Note: The VM option is for testing and development purposes only.

Preparation of the Machine

Preparation of the Virtual Machine (qemu)

Requirements:

  • qemu-system-arm (>= 2.11)

Recommended distros:

  • Ubuntu 18.04 or higher

On Debian and Debian-based distros:

apt install qemu-system-arm

Create the directories that will host our virtual machine's files:

mkdir ~/rasp-qemu && mkdir ~/rasp-qemu/qemu-rpi-kernel

Move into qemu-rpi-kernel folder and download the patched kernel and its .dtb:

cd ~/rasp-qemu/qemu-rpi-kernel
wget https://github.com/dhruvvyas90/qemu-rpi-kernel/raw/master/kernel-qemu-4.9.59-stretch
wget https://github.com/dhruvvyas90/qemu-rpi-kernel/raw/master/versatile-pb.dtb

Move to the parent folder, download and unzip Raspbian's image:

cd ..
wget https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2018-03-14/2018-03-13-raspbian-stretch-lite.zip
unzip 2018-03-13-raspbian-stretch-lite.zip && rm 2018-03-13-raspbian-stretch-lite.zip

Create an executable file and give execution permission:

echo "qemu-system-arm -kernel ./qemu-rpi-kernel/kernel-qemu-4.9.59-stretch \
                   -append 'root=/dev/sda2 panic=1 rootfstype=ext4 rw' \
                   -hda 2018-03-13-raspbian-stretch-lite.img \
                   -cpu arm1176 \
                   -m 256 \
                   -machine versatilepb \
                   -no-reboot \
                   -serial stdio \
                   -dtb ./qemu-rpi-kernel/versatile-pb.dtb \
                   -net nic -net user,hostfwd=tcp::3333-:33" > coderbot.sh && chmod +x coderbot.sh

Execute the .sh file, et voilà!

./coderbot.sh

Preparation of the Physical Machine (Raspberry Pi)

Stuff...

Preparation of the Enviroment

ssh-keygen -t rsa -b 2048 -q -f rasp-qemu/rpi_key -P ""
ssh-copy-id pi@localhost -i rpi_key.pub -p 3333
ssh pi@localhost -p 3333 -i rasp-qemu/rpi_key
Clone this wiki locally