In this thread I will publish my makefiles and mini-howtos for the Raspberry-Pi.
note:
Raspberry-Pi will abbreviated here as RPI.
The RPI version before 2 are called here 1.
I have only tested for RPI-1 on OpenWRT-15.05.
unless stated otherwise, run the commands from a Linux PC (I have used Porteus-KDE4-v3.1-x86_64).
The IP 192.168.1.1 is an example, it means the IP of the RPI.
Index:
1. Raspberry Pi Camera (ov5647) support
2. newer version of ffmpeg
3. Easycap videograpper (with usbtv or stk1160 chipset) support
4. bcm2835 library support
5. OpenWrt Raspberry Pi hardfloat build
1.) Raspberry Pi Camera (ov5647) support
-------------------------------------------------------------------
It will need:
- the start_x.elf and fixup_x.dat in the bootpartition. Enabeling with "start_x=1" in config.txt
- the bcm2835-v4l2 kernelmodule the source are include in the RPI-kernelsource.
- the userprogramms raspivid and raspistill that can find here https://github.com/raspberrypi/userland
I have write makefiles and a build-and-download-script that are easy to use.
for RPI 1 & 2 OpenWRT-15.05 use this: owrt-rpicam-tools-15.05-1.tar.xz.
for RPI 1 (the SDK for 2 does not exist) on trunk use this: owrt-rpicam-tools-trunk-1.tar.xz. (I used a SDK snappshot from 20.09.2015).
The Script in my archiv download and extrackt the SDK, link my package directorys and run make.
instructions:
1.1) enable the start_x.elf:
Mount the bootparition of the SD-Card on your PC.
Go to there and run as root:
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
gpu_mem=128
the gpu_mem=128 is not necessary but it should set (default is 64).
1.2) build the required packages:
download and unpack my archiv.
Change directory to it.
You can take a look into the mkPkgWithSDK-15.05.sh file to see the usage.
Or run it interativ.
for 15.05 run as root:
./mkPkgWithSDK-15.05.sh
for trunk run as root:
./mkPkgWithSDK-trunk.sh
1.3) Install the packages:
The ready modules are in <build-dir>/owrtSDK<1|2>/bin/brcm2708/packages/base
the modules are:
- kmod-bcm2835-v4l2_3.18.20+2015.06.17-1_brcm2708.ipk = the kernelmodule
- raspicam_2015.09.09-2_brcm2708.ipk = contain the following applications and there librarys: raspistill, raspivid,
raspiyuv and raspividyuv
- rpiuserland-rest_2015.09.09-2_brcm2708.ipk = contain all other applicatons and librarys of the raspberrypi/userland.
Copy to your RPI run:
scp -r <build-dir>/owrtSDK<1|2>/bin/brcm2708/packages/base root@192.168.1.1://root
via ssh on the RPI
cd ~/base
opkg update
opkg install kmod-bcm2835-v4l2_3.18.20+2015.06.17-1_brcm2708.ipk
opkg install raspicam_2015.09.09-2_brcm2708.ipk
1.4) test it from Linux-PC with vlc:
simple test on RPI make a 5sek h264 Video on it
raspivid -o tvid.h264
stream test from RPI to your PC.
On RPI:
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
It is realy hard to get get a fast (small delay), cheap (small cpu and ram load) and low bandwidth (h264) stream.
Here an another example that work at me but only in this constallation and only on Friday.
On PC:
nc -l -p 1234 | mplayer -cache 1000 -
On RPI:
raspivid -md 2 -ex night -ih -fl -fps 5 -t 0 -o tcp://<IP-OF-THE-PC>:1234
when everybody have an example that work with ffmpeg and ffserver or another example i am realy thankfull.
2.) newer version of ffmpeg
-----------------------------------------------------------------------
I have littlebit modifie the orginal makefile.
I add a newer version and enable vpx support.
Makefiles and a build-and-download-script,
for RPI 1 & 2 OpenWRT-15.05 and RPI 1 trunk, use this:owrt-ffmpeg-1.tar.xz. (md5 = 576dcc581fa7e5e7cf6150ffc5724fb5)
2.1) build the required packages:
download and unpack my archiv.
Change directory to it.
You can take a look into the mkPkgWithSDK.sh file to see the usage.
Or run it interativ.
The ready modules are in <build-dir>/owrtSDK<1|2|1t>/bin/brcm2708/packages/base
3.) Easycap videograpper (with usbtv or stk1160 chipset) support
-----------------------------------------------------------------------
note:
I have only test the usbtv chipset.
More information about Easycap videograppers can find at http://linuxtv.org/wiki/index.php/Easycap.
It will need:
- the usbtv or stk1160 kernelmodule. The source are include in the RPI-kernelsource.
Makefiles and a build-and-download-script,
for RPI 1 & 2 OpenWRT-15.05 use this: owrt-easycap-15.05-1.tar.xz (md5 = eea300a82c9267074545ee59e29b1c9e).
instructions:
3.1) build the required packages:
download and unpack my archiv.
Change directory to it.
You can take a look into the mkPkgWithSDK-15.05.sh file to see the usage.
Or run it interativ.
The ready modules are in <build-dir>/owrtSDK<1|2|1t>/bin/brcm2708/packages/base
3.2) test it:
grab video:
(/dev/video0 are an example replace by the right videodevice)
ffmpeg -i /dev/video0 -vcodec copy -an -f avi tvid0.avi
note there is a error message in ffmpeg (2.7.2 and 2.8.1 )like this:
"frame= 17 fps=0.0 q=-1.0 size= 4731kB time=00:00:00.65 bitrate=59563.7kbits[video4linux2,v4l2 @ 0xc24200] Dequeued v4l2 buffer contains corrupted data (691200 bytes)."
No idea what it mean.
grab sound:
(default are an example rplace by the right PCM device name. Find out with "arecord -L")
arecord -D default out.wav
4.) bcm2835 library support
-----------------------------------------------------------------------
This is a C library for Raspberry Pi (RPi). It provides access to GPIO and other IO functions on the Broadcom BCM 2835 chip,
allowing access to the GPIO pins on the 26 pin IDE plug on the RPi board so you can control and interface with various external devices.
It is from here: http://www.airspayce.com/mikem/bcm2835/
for RPI 2 read this part:
For this library to work correctly on RPI2, you MUST have the device tree support enabled in the kernel. You should also ensure you are using the latest version of Linux. The library has been tested on RPI2 with 2015-02-16-raspbian-wheezy and ArchLinuxARM-rpi-2 as of 2015-03-29.
When device tree suport is enabled, the file /proc/device-tree/soc/ranges will appear in the file system, and the bcm2835 module relies on its presence to correctly run on RPI2 (it is optional for RPI1). Without device tree support enabled and the presence of this file, it will not work on RPI2.
I have done Makefiles and a build-and-download-script here: owrt-bcm2835-library-1.tar.xz (md5 = 61e45446c8b612897f92530987dc5192).
In the package/bcm2835 is the makefile for building and adding the header and static-library files to the SDK.
In the package/bcm2835_examples is the "blink" and "event" example that is included in the bcm2835 library source.
blink switsch the the pin-11 (gpio-17) permanent on/off.
event wait for a low event on pin-15 (gpio-22).
instructions:
4.1) adding bcm2835 to the SDK:
download and unpack my archiv.
Change directory to it.
You can take a look into the mkPkgWithSDK.sh file to see the usage.
Or run it interativ.
example:
./mkPkgWithSDK.sh
choice 1 for RPI-1 sdkversion=15.05, 2 for RPI-2 sdkversion=15.05 or 1t for RPI-1 sdkversion=trunk
If your choice 1 and the other values are the default values (build directory = /tmp/build and $MV_DN = owrtSDK1)
Then is your modified SDK in /tmp/build/owrtSDK1
4.2) compile the blink and event examples:
Take a look in ./mkYourPkg.sh file.
If your new SDK in /tmp/build/owrtSDK1
run:
SDK_D=/tmp/build/owrtSDK1 ./mkYourPkg.sh
4.3) Install the packages:
The ready modules are in /tmp/build/owrtSDK1/bin/brcm2708/packages/base
the module is: bcm2835_examples_1.46-1_brcm2708.ipk
Copy to your RPI run:
scp /tmp/build/owrtSDK1/bin/brcm2708/packages/base/bcm2835_examples_1.46-1_brcm2708.ipk root@192.168.1.1://root
via ssh on the RPI
opkg install bcm2835_examples_1.46-1_brcm2708.ipk
Now you can test by typing via ssh on the RPI "event" or "blink"
5.) OpenWrt Raspberry Pi hardfloat build
----------------------------------------------
OpenWrt is in many cases the best choice for the Raspberry-Pi but OpenWrt is softfloat:
here is a got howto for build Openwrt hardfloat.
I have build Openwrt-15.05 for RPI-1 complete(md5: 27637371c0db5d7cddb8307d4d206893),
Openwrt-trunk (ca 2015.11.03) for RPI-1 base(md5: 7c37007411a1e5355c18cec14b62d0d0),
and build scripts for simple using (md5: 969bf11747a1248b71aa54a237bd1a5e).
note: the builds are not strong tested
5.1) Instructions fo my scripts:
you need:
25GB free space on /tmp/build (the build directory names should be short)
Full write rights for unprivileged user on /tmp/build
Diverse developing packages like ccache or zlib
A fast and stable internet connection.
a lot of time:
For Openwrt-15.05 RPI-1|2 use ./owrtb-rpi-15.05.sh RPI-1|2
For Openwrt-trunk RPI-1 use ./owrtb-rpi-trunk.sh (i have no configuration for RPI-2 yet)
Take a look at the head of the script and run it for help without any commands.
It is self explanatory
as root:
unpack buildscr.tar.gz and go to buildscr
make full write rights to ./dl and ./result
chmod -R 0777 ./dl ./result
as unprivileged user:
(it is possible to run ./owrtb-rpi-15.05.sh as root, but not ./owrtb-rpi-trunk.sh)
for this example we build Openwrt-15.05 for RPI-2 hardfloat:
run:
./owrtb-rpi-15.05.sh cfg-base -2
This command download, unpack and configure the source.
At menuconfig you may a change but should not.
./owrtb-rpi-15.05.sh build-base -2
this is the build command (make V=s).
On a Pentium D i need 5h
./owrtb-rpi-15.05.sh cfg-pkg -2
It use the created SDK for package building.
Unpacking and configuration.
./owrtb-rpi-15.05.sh rebuild-pkg -2
On a Pentium D i need 24h
It build the packages with IGNORE_ERRORS=1 you should use the command mutiple times.
When no new packages will be build you are ready.
./owrtb-rpi-15.05.sh mkindex -2
It creates a make log from the packages that will not be build.
And it make the package index.
Your result is in ./result/owrtbuild-15.05-rpi2hf-${BUILDNAME_SFX}
in bcm2708 (RPI-1) or bcm2709 (RPI-2) are images, packages etc.
in the last error_*.log file you can see which build was wrong.
in the errorpkg.tar.xz is a copy of following directorys from the SDK:
./feeds and ./package contain now only the fail packages.
./ready_feeds are the pass packages.
./log the make log of the fail packages.
last modified on 17.11.2015
(Last edited by Plonk34 on 17 Nov 2015, 06:15)