Making the Raspberry Pi Camera work on Slackware ARM (14.1)

I simply wanted to create a (more) comprehensive guide for the Raspberry Pi Camera on Slackware ARM, because even though most of the necessary information is available throughout the web, the necessary information was spread out through multiple blog entries, and guides.

  1. I assume that we are starting off with working Slackware ARM (14.1) instance on a Raspberry Pi or Pi 2 with an attached camera module.
    If needed, the Slackware ARM installation gudes are avaliable at:
  2. As a first step, one has to download, compile and install the Raspberry Pi userland, in order to generate the binaries needed to access the camera. (raspistill, etc.)
    cd /usr/src
    git clone "https://github.com/raspberrypi/userland.git"
    mkdir userland/build
    cd userland/build
    cmake ..
    make
    make install
  3. Secondly, the access rights for the
    /dev/vchiq

    device need to be set up. We can create an udev rule to carry out this task from the next boot onward.

    usermod -a -G video <username>
    chmod 0660 /dev/vchiq
    chgrp video /dev/vchiq
    echo 'SUBSYSTEM=="vchiq",GROUP="video",MODE="0660"' > /etc/udev/rules.d/10-vchiq-permissions.rules
    
  4. After this, we have to add the Raspberry Pi userland's binaries, and libraries to the system path, and library load paths:
    [code]
    echo "/opt/vc/lib" >> /etc/ld.so.conf
    ldconfig

cat > /etc/profile.d/videocore-paths.sh <<EOF
#!/bin/sh

# For root users, ensure that /opt/vc/sbin is in the $PATH.
if [ "`id -u`" = "0" ]; then
echo $PATH | grep /opt/vc/sbin 1> /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
PATH="$PATH:/opt/vc/sbin"
fi
fi

# Add videocore utilities to system $PATH:
PATH="$PATH:/opt/vc/bin"
<<EOF
chmod a+x /etc/profile.d/videocore-paths.sh
[/code]

[*] And finally we have to edit

/boot/config.txt

to increase GPU memory to 128 MB, and set the start_file and fixup_file variables. (And optionally disable_camera_led config entry as well.)


if grep -q "^gpu_mem=" /boot/config.txt; then
  sed -ie 's:gpu_mem=.*$:gpu_mem=128:g' /boot/config.txt
else
  echo "gpu_mem=128" >> /boot/config.txt
fi

if grep -q "^start_file=" /boot/config.txt; then
  sed -ie 's:start_file=.*$:start_file=start_x.elf:g' /boot/config.txt
else
  echo "start_file=start_x.elf" >> /boot/config.txt
fi

if grep -q "^fixup_file=" /boot/config.txt; then
  sed -ie 's:fixup_file=.*$:fixup_file=fixup_x.dat:g' /boot/config.txt
else
  echo "fixup_file=fixup_x.dat" >> /boot/config.txt
fi

if grep -q "^disable_camera_led=" /boot/config.txt; then
  sed -ie 's:disable_camera_led=.*$:disable_camera_led=1:g' /boot/config.txt
else
  echo "disable_camera_led=1" >> /boot/config.txt
fi

[/list]

Once we are done with the above steps, we should be ready to give it a try:

raspistill -o cam.jpg

Hozzászólások