# Raspberry Pi: Pi Camera Board not working

## AchilleTalon

I am trying to make working the Raspberry Pi Camera board without success.

My Gentoo/Linux kernel is 3.12.26, my version of media-libs/raspberrypi-userland is pre20140117. I have the following in my /boot/config.txt:

```

gpu_mem=128

start_file=start_x.elf

fixup_file=fixup_x.dat

```

My firmware files in /boot are recently extracted from Github (last Friday if I remember correctly).

Here is the message I am getting while trying the following:

```
localhost ~ # raspistill -o file.jpg

mmal: mmal_component_create_core: could not find component 'vc.ril.camera'

mmal: Failed to create camera component

mmal: main: Failed to create camera component

mmal: Failed to run camera app. Please check for firmware updates

```

Obviously there isn't any firmware updates unless the Github stuff is outdated. How can I get more information on what is going on? Any hints?

TIA.

----------

## chithanh

I think the raspberrypi-userland is too old. Unfortunately, my Pi started to run very unstable this summer, so I cannot create a properly tested update to the package.

----------

## AchilleTalon

I compiled the code from Github and it is working now. So, yes, the problem is the raspberry-userland code is outdated. Will take a look at the ebuild file and see if I can package a new version.

----------

## AchilleTalon

So, the solution is only to make a new tarball from the Github, copy the ebuild with another name, ebuild ... manifest, put the tarball on the distribution servers and that's it.

----------

## chithanh

I made a new snapshot, raspberrypi-userland-0_pre20140830 which you can test.

It is in package.mask for now because I cannot test it myself.

----------

## AchilleTalon

Wait, I found something. When building using the script buildme provided with the source code, everything works fine. When building with the ebuild script I get the original error.

There is then something with the ebuild steps that makes it fail. I am using cross compilation for speed. I will try to rebuild locally and let you know the outcome.

NOTE: I did build with the ebuild script locally and it doesn't work neither. So, my conclusion is there is something with the steps in the ebuild script which cause the problem. I haven't gone further in the investigation. If time permit tomorrow I will look at it.

----------

## AchilleTalon

What I discovered so far. Doing everything in the ebuild script doesn't work. Replacing the cmake-util commands by the plain cmake commands doesn't work neither. Using the ebuild to up to the prepare phase and then running the buildme script works. I then decided to modify the ebuild script to separate steps in order to identify where it fails exactly.

Here is my script:

```
(...)

src_configure() {

    # toolchain file not needed, but build fails if it is not specified

    #local mycmakeargs="-DCMAKE_BUILD_TYPE=Release ./"

    #cmake-utils_src_configure

    mkdir -p build/raspberry/release

    cd build/raspberry/release

    cmake -DCMAKE_BUILD_TYPE=Release ../../..

}

src_compile() {

    cd build/raspberry/release

    emake

}

src_install() {

    #local mycmakeargs="DESTDIR=/var/tmp/mycamera"

    #cmake-utils_src_install

    cd build/raspberry/release

    emake install DESTDIR=/var/tmp/mycamera

    doenvd "${FILESDIR}"/04${PN}

    # enable dynamic switching of the GL implementation

    dodir /usr/lib/opengl

    dosym ../../../opt/vc /usr/lib/opengl/${PN}

    # tell eselect opengl that we do not have libGL

    touch "${ED}"/opt/vc/.gles-only

}

```

If I use ebuild up to the prepare step, then run in the $S directory the following steps from the buildme script:

```
mkdir -p build/raspberry/release

chown -R portage:portage build

cd build/raspberry/release

cmake -DCMAKE_BUILD_TYPE=Release ../../..

```

Then create the file .configured in /var/tmp/portage/media-libs/raspberrypi-userland-0_pre20140903 to prevent the next step to run the configure part of the ebuild.

```
ebuild raspberrypi-userland-0_pre20140903.ebuild install

export PATH=$PATH:/var/tmp/mycamera/opt/vc/bin

export LD_LIBRARY_PATH=/var/tmp/mycamera/opt/vc/lib

```

Then, raspistill works correctly.

So, obviously something is not done properly in the configure phase. I tried with:

```
local mycmakeargs="DESTDIR=/var/tmp/mycamera"

cmake-utils_src_install

```

In the ebuild script and it doesn't work. The configure phase completes without errors. However the installed executable doesn't work and produce the error reported originally.

My knowledge of cmake is almost inexistent, so, if anyone can provide some kind of guidance it will be appreciated.

----------

## chithanh

So I managed to get my Raspberry Pi to work more or less stable again, by downclocking and upvolting a bit.

I investigated the issue and though I have no camera, I get the same error:

```
# /opt/vc/bin/raspistill -o file.jpg

mmal: mmal_component_create_core: could not find component 'vc.ril.camera'

mmal: Failed to create camera component

mmal: main: Failed to create camera component

mmal: Camera is not enabled in this build. Try running "sudo raspi-config" and ensure that "camera" has been enabled

```

Googling a bit turned up this issue in a different camera application for the Raspberry Pi and it contained the right pointer. Namely, the executable needs to link to libmmal_vc_client.so in order to use the camera.

When forcing the library to be loaded, there is still an error but that appears to be normal if you run it without a camera attached.

```
# LD_PRELOAD=/opt/vc/lib/libmmal_vc_client.so /opt/vc/bin/raspistill -o file.jpg

mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM)

mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1)

mmal: Failed to create camera component

mmal: main: Failed to create camera component

mmal: Camera is not enabled in this build. Try running "sudo raspi-config" and ensure that "camera" has been enabled

```

This means it is either an --as-needed issue, or the build scripts need to be modified in order to link to libmmal_vc_client explicitly.

----------

