OpenWrt Forum Archive

Topic: Raspberry Pi camera on OpenWRT

The content of this topic has been archived on 29 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I try to run the Raspberry Pi camera on OpenWRT.
The Camera have a ov5647 chip.

1. How does it work on Rasbian ?

When I am run lsmod under Rasbian i can not find some ov5647 module and i can not find any code in to the kernelsource.
(But it exist on the internet here: https://github.com/gokulnatha/GT-I9505/ … /video/msm)

On the other hand it seems to be that rasbian do not need this driver to run the camera.
But there is no /dev/video0 device on it.
2. For this reason can i am only run raspicam applications with the camera on raspbian ?

3. What would be the conditions for running the camera under OpenWRT ?

This HowTo are deprecated. I m moved to here


I wonder that no one had this problem before me.
But possible that i am posted in the wrong category, if yes please move me.

I have solved my problem.
For running the the Raspi-Cam, i need the start_x.elf, bcm2835-v4l2.ko and the raspicam applications.

I have build the packages but the building of bcm2835-v4l2 have one hook.
The source of bcm2835-v4l2 are include in https://github.com/raspberrypi/linux.git.
And i must download the complett linux.git via "PKG_SOURCE_PROTO:=git" this are ca 1,3GB.
But bcm2835-v4l2-source are a part of the openwrt buildroot (for brcm2708) after building.
This should be the preferred source, because it is possible that the source from https://github.com/raspberrypi/linux.git
are differ from the buildroot source.

Is It possible that the SDK download linux and patch it again so i can use the right source ?

My makefiles download at this time from here https://github.com/raspberrypi/linux.git.



here my instructions:
unless stated otherwise, run the commands from a Linux PC (I have used Porteus-KDE4-v3.1-x86_64)
I have only tested on Raspberry Pi 1 but it should wok on Pi 2.

1.) Build the bcm2835-v4l2.ko and the raspicam applications:
Download the SDK.
The openwrt-SDK-15.05-rc3 for Pi 1 are here.
The openwrt-SDK-15.05-rc3 for Pi 2 are here.
Download package1.tar.xz unpack them and put them into the SDK.
go to the SDK and run as root:

make V=s

2.) enable the start_x.elf:
Mount the bootparition of the SD-Card on your PC.
Go to there and run:

wget --no-check-certificate -O ./fixup_x.dat https://github.com/raspberrypi/firmware/blob/master/boot/fixup_x.dat?raw=true
wget --no-check-certificate -O ./start_x.elf https://github.com/raspberrypi/firmware/blob/master/boot/start_x.elf?raw=true

put this onto your config.txt file (create it, if it not exist):

start_x=1

3.) install the modules:
Switch on the Raspberry-Pi
192.168.1.1 are a example it is the IP of the Pi.

scp <SDKPATH>/bin/brcm2708/packages/base/kmod-bcm2835-v4l2_3.18.17+2015.06.17-1_brcm2708.ipk root@192.168.1.1://root
scp <SDKPATH>/bin/brcm2708/packages/base/raspicam_2015.08.09-1_brcm2708.ipk root@192.168.1.1://root

on the Pi

opkg update
opkg install kmod-bcm2835-v4l2_3.18.17+2015.06.17-1_brcm2708.ipk
opkg install raspicam_2015.08.09-1_brcm2708.ipk

4.) test it from Linux-PC with vlc:
simple test on Pi make a 10sek h264 Video on it
on the Pi

raspivid -o tvid.h264 

stream test from PI to your PC.

on the Pii:

opkg install ncat
raspivid -w 1920 -h 1080 -fps 20 -t 0 -o - | ncat -l 4711

on your PC:

mknod /tmp/vidpipe p
nc 192.168.1.1 4711 | ffmpeg -i - -f mpeg - >> /tmp/vidpipe
vlc /tmp/vidpipe

(Last edited by Plonk34 on 20 Sep 2015, 02:59)

Can you tell me the meaning of decontain?

Sorry, i know my english are terrible.
I mean pack/unpack instead of contain/decontain.
I have corrected this post.

Thank you so much !! but I have a question about step 1

I want to download openwrt-15.05 SDK.

in this url https://downloads.openwrt.org/chaos_cal … x/generic/

I downloaded OpenWrt-SDK-15.05-rc1-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64 (1).tar

the third one from the top.

is it right? If it isn't, can you tell me where can i get the openwrt-15.05 SDK ?

sorry.

And I have one more question.

I have raspberry PI board , and the board's operating system is OpenWRT

I am wondering whether I should do step 1~4 should be on the board shell script or not ?

thank you!!

I have two questions.

1. I down loaded the OpenWrt-SDK-15.05-rc3-brcm2708-bcm2709_gcc-4.8-linaro_uClibc-0.9.33.2_eabi.Linux-x86_64.tar
from the url which is for Raspberry PI 2
I unpacked it, but inside the unpacked SDK directory I founded the package directory and the name of it is same with the name of unpacked package1.tar.xz . and the package directory which is in the SDK directory was not empty there exist Makefile.
so I copied the contents of the unpacked package1.tar.xz to package directory in SDK.
is it right way ?

2. I got error message it says
CMake Error: your C compiler: "/home/son/usb/OpenWrt-SDK-15.05-rc3-brcm2708-bcm2709_gcc-4.8-linaro_uClibc-0.9.33.2_eabi.Linux-x86_64/staging_dir/host/bin/ccache" was not found.   Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Check for working C compiler: /home/son/usb/OpenWrt-SDK-15.05-rc3-brcm2708-bcm2709_gcc-4.8-linaro_uClibc-0.9.33.2_eabi.Linux-x86_64/staging_dir/host/bin/ccache -- broken
CMake Error at /home/son/usb/OpenWrt-SDK-15.05-rc3-brcm2708-bcm2709_gcc-4.8-linaro_uClibc-0.9.33.2_eabi.Linux-x86_64/staging_dir/host/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler
  "/home/son/usb/OpenWrt-SDK-15.05-rc3-brcm2708-bcm2709_gcc-4.8-linaro_uClibc-0.9.33.2_eabi.Linux-x86_64/staging_dir/host/bin/ccache"
  is not able to compile a simple test program.

  It fails with the following output:





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)


CMake Error: your C compiler: "/home/son/usb/OpenWrt-SDK-15.05-rc3-brcm2708-bcm2709_gcc-4.8-linaro_uClibc-0.9.33.2_eabi.Linux-x86_64/staging_dir/host/bin/ccache" was not found.   Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: your CXX compiler: "/home/son/usb/OpenWrt-SDK-15.05-rc3-brcm2708-bcm2709_gcc-4.8-linaro_uClibc-0.9.33.2_eabi.Linux-x86_64/staging_dir/host/bin/ccache" was not found.   Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
-- Configuring incomplete, errors occurred!


do you know why this happens?

so kernel and raspicam directory and Makefile should be in package directory in the he openwrt-SDK-15.05-rc3 right ?

sorry and thank you.

in step 2 I can't find the config.txt.

Can you tell me where it is?

(Last edited by tooson9010 on 21 Aug 2015, 07:42)

The right path of bcm2835-v4l2 kernelmodule Makefile are:
"OpenWrt-SDK-15.05-rc3-brcm2708-bcm2709_gcc-4.8-linaro_uClibc-0.9.33.2_eabi.Linux-x86_64/package/kernel/bcm2835-v4l2/Makefile"
And the raspicam:
"OpenWrt-SDK-15.05-rc3-brcm2708-bcm2709_gcc-4.8-linaro_uClibc-0.9.33.2_eabi.Linux-x86_64/package/raspicam/Makefile"

your errormessage means that ccache are missed on your system,
or least that the link
"/home/son/usb/OpenWrt-SDK-15.05-rc3-brcm2708-bcm2709_gcc-4.8-linaro_uClibc-0.9.33.2_eabi.Linux-x86_64/staging_dir/host/bin/ccache"
not work.

create the config.txt, if it not exist (i have editing again).

which host distrubition are you using ?

Thank you for the reply!! I really want to use raspi camera module on OpenWRT.

what is host distrubition? I using Ubuntu do you mean this?

and I did step I on the other linux but I got the same error.

You told me that I least the link so I need to compile SDK on the root?

sorry for the many question. I need to use camera module and thank you very much for the reply again.

and I search the way I can do step 1 without the error which means cache are missed or least the link?

and in the package that I downloaded on your post, I couldn't find any c file there was just Makefile in the bcm2835-v412 and

raspicam directory is it right?

Ok Ubuntu is you host system.
And i thing ccache are missed on Ubuntu.
Run in (Ubuntu) console:

which ccache

.
If nothing is found seach on your package manager (i can not help you here, because i have no ubuntu) for ccache and install it.

The next hook are: the make process on SDK download the missed sourcecode (the c files to the you ask) via git.
This are more then 1,3 GB and you need git on ubuntu.

I have describe this problem on the beginning of post 2.
If any expert here: I would be thankful to show me a solution.

But if you wait a hour i make you a package2 with code inside.

I rename the raspicam package to rpiuserland because it is the complett userland.
I modified the makefile for it, so the broadcom licence are inside.

1.) this step are optional.
download raspberrypi_userland-2015.08.09.tar.bz2
md5sum: 8513154ba20a6e0bebc1beac75341bbe
and put it in the SDK/dl directory

2.)
download packages2.tar.xz
md5sum: 381c7f98bbc6c75c69ab13fcc8a4ad03
and use it like packages1.tar.xz

The difference are, i have put the kernel source from bcm2835-v4l2 inside.
The big download eliminate.

I have build the packages for Pi2 against SDK-15.05-rc3 here:
kmod-bcm2835-v4l2_3.18.17+2015.06.17-1_brcm2708.ipk
md5sum f6c557b4bdd8d639fb4adb7489382996
rpiuserland_2015.08.09-1_brcm2708.ipk
md5sum fae5b2c0f8f1ccdc14d7de8227bc1b74

I have some questions.

1) I used packages2 that you mentioned
but the command
scp <SDKPATH>/packages/base/kmod-bcm2835-v4l2_3.18.17+2015.06.17-1_brcm2708.ipk root@192.168.1.1://root

on step 3 , in the packages directory , I can't find base directory there is just
Makefile , kernel , rpiuserland.

can you tell me what I should do?


2)I read your comment
raspberrypi_userland-2015.08.09.tar.bz2,  packages2.tar.xz
I unpacked them and I just put in the SDK but I can understand why md5sum is need. just put them in the SDK in not enough?


3) SD card mentioned in the step 2 means that the SD card installed openWRT right?





and I after installing ccache Iguess make is done well. thank you very much
sorry for the question .. thank you

(Last edited by tooson9010 on 23 Aug 2015, 07:44)

1.) sorry my fail, i have edit again.
the path are <SDKPATH>/bin/brcm2708/packages/base/kmod-bcm2835-v4l2_3.18.17+2015.06.17-1_brcm2708.ipk


2.) leave raspberrypi_userland-2015.08.09.tar.bz2 packet. Put it to <SDKPATH>/dl.
Use packages2 like packages1 (unpack and put to <SDKPATH>/package).

md5sum means the md5 hashsum of the file. It is are info only, and not compellingly required.
Do you know what are hashsum is ? if not read https://de.wikipedia.org/wiki/Pr%C3%BCfsumme.

here the some meaning of subdirectorys.
<SDKPATH>/bin = It contain the result of building. It will created if building was success.
<SDKPATH>/build_dir/<target/pack> = here are running the buildprocess. It will created if you run make.
<SDKPATH>/dl    = Download directory. The makefile store the downloaded sourcecode in it.
<SDKPATH>/package = contain the makefiles of packages, patches and if need sourcecode. the content of this directory will not change because the buildprocess copy the content first to <SDKPATH>/build_dir


3.) yes
It means that OpenWRT-15.05-rc3 installed on the SD-card

thank you for your reply !!

I am using package 2 instead of package 1 but in step 1

while I was doing this command
scp <SDKPATH>/bin/brcm2708/packages/base/raspicam_2015.08.09-1_brcm2708.ipk root@192.168.1.1://root
I found there is no raspicam file

I guess rpiuserland_2015.08.09-1_brcm2708.ipk or rpiuserland_inc_2015.08.09-1_brcm2708.ipk will be used instead of raspicam.

am I right? and which one is the right one ?

rpiuserland_2015.08.09-1_brcm2708.ipk are right
in rpiuserland_inc_2015.08.09-1_brcm2708.ipk are only the includes.
I would save the headerfiles, but it is normally not the right way on openwrt to store headerfiles on the System

normally when you make proffesionell builds of openwrt package
You should separate the whole build in small pieces.
I was too lazy to make it, and it have not much relvanz on a Pi because you have enought space.

have you install kmod-bcm2835-v4l2_3.18.17+2015.06.17-1_brcm2708.ipk first ?
reload the driver and reading in the system message:

rmmod bcm2835-v4l2
insmod bcm2835-v4l2
dmesg | tail

this means it was success:

...
bcm2835-v4l2: Broadcom 2835 MMAL video capture ver 0.0.2 loaded

Hope so much that it working, because i have no Pi2 for testing, but i will buy it in future.

I am trying to install the kmod-bcm2835-v4l2_3.18.17+2015.06.17-1_brcm2708.ipk

but when I did these command

opkg update
opkg install kmod-bcm2835-v4l2_3.18.17+2015.06.17-1_brcm2708.ipk

I got error like this

*satisfy_dependencies_for : Cannot satisfy the following dependencies for kmod-bcm2835-v412:
*      kernel (= 3.18.17-1-beebeea48e3792a20d2324a49f04b74d) *
*opkg_install_cmd : Cannot install packages kmod-bcm2835-v412

thank you for the reply!

I used different image file because the image file you posted I can't use network.

you need the equal SDK to your image and of course you need network support to update opkg.
Or you have stored the packages on SD-card and modified the /etc/opkg.conf

thank you very much !!!!
I completed!!!!

(Last edited by tooson9010 on 27 Aug 2015, 16:40)

Thank you!!

When can not connect internet,
Please check the following:

vim /etc/config/network
=========================
(...)
config interface 'lan'
        (...)
    option proto 'dhcp'
    option ipaddr '192.168.20.123'
(...)
=========================

The discussion might have continued from here.