Building Kodi on Pi 2 - some thoughts
#1
:edit
----
This is my WIP which will be updated.

:edit2 building our own ffmpeg was a bad idea Smile so now using some patch files, let's see how this goes

:edit3: I think its in an early use stage now, needs more polishing but does the job. If you plan to use your raspberry pi 2 mainly with kodi, use Openelec/Raspbmc/Osmc/xbian!
----

Now that we have the power to build directly on pi 2, I would like to share a few things and make some suggestions for the configure files.
I guess there may be more people who would like to build on pi 2 itself.

I went for 15 instead of 14.1 because texturepacker and it's pathfinding of sdl didn't work out for me, but is fixed in master branch.

So compilation with make -j4 does 'only take' about 1:30h (not including previously bootstraping and building of ffmpeg and configure stuff, which takes about another ~30 minutes).
Goal was to get raspbian+desktop+kodi cortex-a7 and neon optimized (yeah I know it won't be as feature rich as maybe OpenElec).

So far it 'runs' without cec (probably wrong compiled) and produces a blank screen on exit (still able to switch to another console) and I am sure there are more things that don't work...
Maybe someone could take a look at my config.log and give me some hints.

Code:
CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" CXXFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" LDFLAGS="-L/opt/vc/lib" ./configure --disable-gl --enable-gles  --with-platform=raspberry-pi --disable-x11  --disable-vaapi --disable-vdpau --enable-player=omxplayer --disable-avahi --enable-libcec

But to get started, it would be nice to get something like --with-platform=raspberry-pi2 which would set correct defined egl and uses neon=yes, cpu=cortex-a7 etc.
Here is a patch file from helix to give you the idea, I just used the changes for kodi 15, but I am nowhere near sure if the second part is perfect (in /tools/depends/configure.in - very few cpu args?).

Ideally that option would also include the right folders for compiler flags, eg CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads [...]"
See configure command above for the whole library folders.

If someone wants to try, here is a step-by-step guide of what I did so far.
Reply
#2
Excellent work man!
This is right what I intend to do. Keep this howto updated!

Btw, do you think it is easier to install Kodi on standard Raspbian or install OSMC or OpenElec and than make SAMBA shares, share printer, make it AirPrint compatible, get Transmission etc?
Reply
#3
FYI Arch Linux ARM supports the rpi2:

http://archlinuxarm.org/platforms/armv7/...berry-pi-2

Their PKGBUILD might give you some hints on what CFLAGS to use for cpu optimization:

https://github.com/archlinuxarm/PKGBUILD...p/PKGBUILD
Reply
#4
(2015-02-20, 20:56)DrQb Wrote: Excellent work man!
This is right what I intend to do. Keep this howto updated!

Btw, do you think it is easier to install Kodi on standard Raspbian or install OSMC or OpenElec and than make SAMBA shares, share printer, make it AirPrint compatible, get Transmission etc?

OSMC offers Samba shares, a CUPS server for print sharing and a torrent client (Deluge)
Reply
#5
I am learning many things atm with compiler flags, that build was crap :-) I learned I need to set up new gcc and g++ and use something like

FLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard" CXXFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard" LDFLAGS="-L/opt/vc/lib" ./configure --disable-gl --enable-gles --with-platform=raspberry-pi --disable-x11 --disable-vaapi --disable-vdpau --disable-avahi --enable-libcec

I will update that post when I think it really produced neon build and not such nonsense :-)

(2015-02-20, 20:56)DrQb Wrote: Excellent work man!
This is right what I intend to do. Keep this howto updated!

Btw, do you think it is easier to install Kodi on standard Raspbian or install OSMC or OpenElec and than make SAMBA shares, share printer, make it AirPrint compatible, get Transmission etc?
Much easier to take OSMC/Openelec I think. This here is more a learning project for me, as I wanted to have standard raspbian + neon/cortex-a7/hardfloat kodi, which I couldn't find.
But I believe end of the weekend it should be finished, most things work now, just have to check a few things and try also building kodi on UbuntuHF image posted over at raspberry forum.

offtopic:
debian can be so annoying with outdated libs, I hate you libpostproc.
Reply
#6
(2015-02-20, 22:44)naloj Wrote: FYI Arch Linux ARM supports the rpi2:

http://archlinuxarm.org/platforms/armv7/...berry-pi-2

Their PKGBUILD might give you some hints on what CFLAGS to use for cpu optimization:

https://github.com/archlinuxarm/PKGBUILD...p/PKGBUILD

This is helpful, indeed, only problem what I see that this way forced installation/building of ffmpeg uses wrong flags
Code:
libavfilter/bbox.c:1:0: warning: switch -mcpu=cortex-a7 conflicts with -march=armv7-a switch [enabled by default]
I think they missed FFMPEG_CFLAGS

I can build ffmpeg myself with correct flags, but kodi's configure doesn't find them due old libpostproc. Let's see how we get this sorted...

:edit
ok, solved, kodi is building right now. but i get the feelling it was maybe not a good idea to use master (beta/alpha?) branch of ffmpeg instead stable/release....

That configure for ffmpeg....quite big, includes everything kodi would use + all the flags from the arch pkgbuild + libpostproc
Code:
./configure --disable-devices --disable-ffplay --disable-ffmpeg --disable-sdl --disable-ffprobe --disable-ffserver --disable-doc --enable-gpl --enable-runtime-cpudetect --enable-postproc --enable-vaapi --enable-vdpau --enable-bzlib --enable-gnutls --enable-muxer=spdif --enable-muxer=adts --enable-muxer=asf --enable-muxer=ipod --enable-encoder=ac3 --enable-encoder=aac --enable-encoder=wmav2 --enable-protocol=http --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis --enable-nonfree --enable-pthreads --enable-zlib --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-postproc --enable-shared --arch=arm --cpu=cortex-a7 --extra-cxxflags="-Ofast -fexcess-precision=fast -mfloat-abi=hard -mabi=aapcs-linux -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=1  -mcpu=cortex-a7 -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad" --extra-cflags="-Ofast -fexcess-precision=fast -mfloat-abi=hard -mabi=aapcs-linux -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=1  -mcpu=cortex-a7 -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad"
Reply
#7
thanks for posting fraz0815, its all Jargon to me but still i'm excited LOL keep up the good work with your project, as a laymen can I ask what is the objective? to increase speed/performance?
Reply
#8
(2015-02-21, 13:11)MediaPi Wrote: thanks for posting fraz0815, its all Jargon to me but still i'm excited LOL keep up the good work with your project, as a laymen can I ask what is the objective? to increase speed/performance?
Well optimized Kodi + fully functional desktop.
I don't know if it makes a difference in the end, but bothers me to know, that I would be using something 'not optimal'.
Also it gets about time that there will be a new "How-to build Kodi on pi 2" that works and is not heavily outdated as the existing ones.

Don't get me wrong, Openelec/Raspbmc/xbian do a great job, but I personally prefer just to compile and install on top of a linux distro instead of having to use a specific distro to get ONE program (kodi) running.

edit:
Full WIP can be found here: https://drive.google.com/file/d/0B8nSlx6...sp=sharing
Reply
#9
great thanks! good luck and would love to see a video when your project has matured Smile
Reply
#10
So, build guide is more or less ready. I tried to comment much and make things clear.
It also has infos about different branches of kodi (version 14/15, fork by popcornmix) and uses the new cpu stuff aka '-mcpu=cortex-a7 -mfpu=neon-vfpv4'.

Problem which all versions have, is that exiting kodi fails after video player was used (no difference between sw, omx or mmal).
Don't know if it is kodi or firmware related problem (log)
This also affects the deb from http://michael.gorven.za.net/raspberrypi/xbmc ,see http://www.raspberrypi.org/forums/viewto...3&t=100811
Reply
#11
feel free to submit a PR for --with-platform=raspberrypi2
This needs to be done for depends as well, which will solve the ffmpeg woes.
Reply
#12
@fraz0815
See: https://github.com/xbmc/xbmc/pull/6577

(also on newclock4).
Reply
#13
Thanks for the fix, will check later and post log if there remains any problem.

About the PR, after messing about with configure.in files I came to the conclusion its easier to not do this, because a couple of reasons.
a) library stuff is eventually located somewhere else on new pi 2 images, like jessie or ubuntu. just set them manually and not hardcode them in
b) to really get rid of ffmpeg and its warnings, we need to use gcc 4.9 and -march=armv7ve, so no point here, that would involve another check for gcc 4.9 which is not in wheezy repo...
Reply
#14
configure is all about not hardcoding stuff, but detecting what is available and making use of it or printing an error in case stuff is missing.
Reply

Logout Mark Read Team Forum Stats Members Help
Building Kodi on Pi 2 - some thoughts0