Skip to content

Projects

MarcusJones edited this page Jun 8, 2018 · 2 revisions

Camera

  • Motion

https://github.com/Motion-Project sudo apt install motion

  • For MMAL camera

sudo modprobe bcm2835-v4l2

Raspberry Pi cameras can be set up two different ways. If Motion is installed by using the apt packages (e.g. apt-get install motion), then the camera must be set up using the bcm2835-v4l2 module which creates a v4l2 device for the camera. Users will need to install this module using the command sudo modprobe bcm2835-v4l2. This will set up the camera as a normal v4l2 device and it can be accessed via a standard /dev/videoX device. If Motion is built from source or installed via the deb packages on the project release page, then an additional option is to set up the camera using the mmalcam_name parameter or using the bcm2835-v4l2 module. When Motion is installed via apt, the mmalcam option is not available.

  • Outdated? To work with the Pi Camera you need a special version of Motion that supports MMAL cameras. The easiest way to install this is by downloading and installing a deb file as follows
wget github.com/Motion-Project/motion/releases/download/release-4.0.1/pi_jessie_motion_4.0.1-1_armhf.deb
wget https://github.com/ccrisan/motioneyeos/releases/download/20180401/motioneyeos-raspberrypi3-20180401.img.xz
  • Or OpenCV?

[INACTIVE] Virtualize linux host

VM created with with Linux Mint Cinnamon

Donkey r00 user: jetmule pass:

Base mem 8192 MB

Processors 4

[INACTIVE] Virtualize RPi

(No success yet)

  • Install QEMU

  • Download image file https://www.raspberrypi.org/downloads/raspbian/ RASPBIAN STRETCH WITH DESKTOP Image with desktop based on Debian Stretch Version:April 2018 Release date:2018-04-18 Kernel version:4.14 Release notes:Link

Unzipped into:

~/qemu/2018-04-18-raspbian-stretch.img
  • Expand the image file This step is optional, but recommended When you download the Raspbian image it will be in the raw format, a plain disk image (generally with an .img extension). A more efficient option is to convert this to a qcow2 image first. Use the qemu-img command to do this:
qemu-img convert -f raw -O qcow2 2018-04-18-raspbian-stretch.img raspbian-stretch.qcow

Now we can also easily expand the image:

qemu-img resize raspbian-stretch-lite.qcow +6G

You can check on your image using the qemu-img info command

Into:

~/qemu/kernel-qemu-4.9.59-stretch
  • Start
sudo qemu-system-arm \
-kernel ./kernel-qemu-4.9.59-stretch \
-append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" \
-hda raspbian-stretch.qcow \
-cpu arm1176 -m 256 \
-machine versatilepb \
-no-reboot \
-serial stdio \
-net nic -net user \
-net tap,ifname=vnet0,script=no,downscript=no
  • Explanation

    • sudo qemu-system-arm: you need to run QEMU as root
    • -kernel: this is the path to the QEMU kernel we downloaded in the previous step
    • -append: here we are providing the boot args direct to the kernel, telling it where to find it's root filesytem and what type it is
    • -hda: here we're attaching the disk image itself
    • -cpu/-m: this sets the CPU type and RAM limit to match a Raspberry Pi
    • -M: this sets the machine we are emulating. versatilepb is the 'ARM Versatile/PB' machine
    • -no-reboot: just tells QEMU to exit rather than rebooting the machine
    • -serial: redirects the machine's virtual serial port to our host's stdio
    • -net: this configures the machine's network stack to attach a NIC, use the user-mode stack, connect the host's vnet0 TAP device to the new NIC and don't use config scripts.
  • Attempt 1:

Error: unrecognized/unsupported machine ID (r1 = 0x00000183). Available machine support: ID (hex) NAME ffffffff Generic DT based system ffffffff ARM-Versatile (Device Tree Support)

  • Attempt 2:

Change image to raspbian-stretch-lite.qcow sudo qemu-system-arm
-kernel ./kernel-qemu-4.9.59-stretch
-append "root=/dev/sda2 panic=1 rootfstype=ext4 rw"
-hda raspbian-stretch-lite.qcow
-cpu arm1176 -m 256
-machine versatilepb
-no-reboot
-serial stdio
-net nic -net user
-net tap,ifname=vnet0,script=no,downscript=no

  • Attempt 3:

Change image to 2017-11-29-raspbian-stretch.zip qemu-img convert -f raw -O qcow2 2017-11-29-raspbian-stretch.img raspbian-stretch.qcow sudo qemu-system-arm
-kernel ./kernel-qemu-4.9.59-stretch
-append "root=/dev/sda2 panic=1 rootfstype=ext4 rw"
-hda raspbian-stretch.qcow
-cpu arm1176 -m 256
-machine versatilepb
-no-reboot
-serial stdio
-net nic -net user
-net tap,ifname=vnet0,script=no,downscript=no

Clone this wiki locally