Raspberrypi

From Objectif Client Inc
Revision as of 23:00, 9 October 2017 by Nicolas (talk | contribs)
Jump to navigation Jump to search

Download

Raspberry site Raspberry

Prepare the SD Card

Link linux command line

  1. Check the device name of the card and umount it
df -h
umount /dev/sdX1
  1. Copy the image from the zip file on the card
unzip -p 2017-02-16-raspbian-jessie.zip | sudo dd of=/dev/sdX bs=4096 status=progress

Emulator

Install Qemu =

  • Install
apt-get update && sudo apt-get install qemu-system-x86
  • Validate
qemu-system-arm --version
  • Get Raspberry Image
git clone https://github.com/dhruvvyas90/qemu-rpi-kernel.git

Config Raspberry Image

  • Create a script "config" and run it
#!/bin/bash
# Starts raspberry pi image in configuration mode
 
qemu-system-arm -kernel ./qemu-rpi-kernel/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -hda rpi.img

with a #

  • Run the script
.config
  • Comment with a # the unique line in ld.so.preload in Raspberry VM
vi /etc/ld.so.preload
  • Create a device rule
vi  /etc/udev/rules.d/90-qemu.rules
  • Add the following
KERNEL=="sda", SYMLINK+="mmcblk0"
KERNEL=="sda?", SYMLINK+="mmcblk0p%n"
KERNEL=="sda2", SYMLINK+="root"

Run the VM

  • Create a script named runme
sh
# Start the Raspberry Pi in fully functional mode!
 
qemu-system-arm -kernel ./qemu-rpi-kernel/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda rpi.img
  • Run the VM
./runme