Motion on ArchLinux ARM using MMAL mode

2 minute read Published:

How to revive Raspberry Cam on ArchLinux ARM

Some Background

My favorite Linux distribution for my Raspberry Pi 1 ArchLinux ARM recently got a kernel update to version 4.9.11, which was big jump, given that it was running with the 4.4.x kernel tree before.

PANIC

But since I had some issues with the Raspberry Pi Cam v4l kernel module before I was already wary if this update would work and what should I say? It didn’t.

Kernel was upgraded fine but the box didn’t come back after reboot. And since I am using it as a low cost security cam I only could login via ssh.

After taking the box from the place where I hid it and plugin in some HDMI-cable so I could at least see what was the problem I was greeted by some nice PANIC. 😞

Why it failed

Some people form the ArchLinux ARM forum already found out it was the dreaded Cam Module again and the following kernel update disabled it completely.

My idea

But since I wanted to use my Cam actually I remembered that motion recently gained the possibility to use MMAL cams.

The options for that where in the motion.conf file but they just seemed to be ignored. I had to read the actual source code for motion to find out that it will check at compiletime for the presence of /opt/vc/include/interface/mmal and on that condition will enable compilation of the MMAL mode.

How to use MMAL

After downloading the latest release of motion from their page on github and installing some devel packages (automake and autoconf) I could successfully build, and install MMAL enabled motion on my Raspberry Pi:

    ./configure --prefix=/usr \
                --without-pgsql \
                --without-mysql \
                --sysconfdir=/etc \
                --with-ffmpeg
    make
    make install

Then I could change the options in motion.conf:

    mmalcam_name vc.ril.camera
    mmalcam_control_params --vflip --hflip -ex night -drc medium

And voila: camera works again :)

PS: don’t use --hflip/--vflip and motion rotate option together 😳