Raspberrypi: Difference between revisions

From Objectif Client Inc
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 17: Line 17:
unzip -p 2017-02-16-raspbian-jessie.zip | sudo dd of=/dev/sdX bs=4096 status=progress
unzip -p 2017-02-16-raspbian-jessie.zip | sudo dd of=/dev/sdX bs=4096 status=progress
</syntaxhighlight>
</syntaxhighlight>
==Emulator==
===Install Qemu ===
* Install
<pre>
apt-get update && sudo apt-get install qemu-system-x86
</pre>
* Validate
<pre>
qemu-system-arm --version
</pre>
* Get Raspberry Image
<pre>
git clone https://github.com/dhruvvyas90/qemu-rpi-kernel.git
</pre>
===Config Raspberry Image===
* Create a script "config" and run it
<pre>
#!/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
</pre>
* Run the script
<pre>
./config
</pre>
* Comment with a # the unique line in ld.so.preload in Raspberry VM
<pre>
vi /etc/ld.so.preload
</pre>
* Create a device rule
<pre>
vi  /etc/udev/rules.d/90-qemu.rules
</pre>
* Add the following
<pre>
KERNEL=="sda", SYMLINK+="mmcblk0"
KERNEL=="sda?", SYMLINK+="mmcblk0p%n"
KERNEL=="sda2", SYMLINK+="root"
</pre>
=== Run the VM ===
* Create a script named runme
<pre>
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
</pre>
* Run the VM
<pre>
./runme
</pre>

Latest revision as of 23:02, 9 October 2017

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
  • 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