diff mbox

[1/1] kodi: Enable raspberry-pi2 build support

Message ID 1461702074-14376-1-git-send-email-bmauduit@beneth.fr
State Rejected
Headers show

Commit Message

Benoît Mauduit April 26, 2016, 8:21 p.m. UTC
The previous commit [ef37472b20894c99cad758397f3cd6b90f933df1] was
based on a newer version of Kodi :
"with-platform=raspberry-pi2" is not yet supported in Kodi "Jarvis" branch.

Backport 2 patches from Kodi master branch into this one.

Signed-off-by: Benoît Mauduit <bmauduit@beneth.fr>
---
 ...0007-configure-Add-raspberry-pi2-platform.patch | 205 +++++++++++++++++++++
 1 file changed, 205 insertions(+)
 create mode 100644 package/kodi/0007-configure-Add-raspberry-pi2-platform.patch

Comments

Thomas Petazzoni April 26, 2016, 8:32 p.m. UTC | #1
Hello,

On Tue, 26 Apr 2016 22:21:14 +0200, Benoît Mauduit wrote:
> The previous commit [ef37472b20894c99cad758397f3cd6b90f933df1] was
> based on a newer version of Kodi :
> "with-platform=raspberry-pi2" is not yet supported in Kodi "Jarvis" branch.
> 
> Backport 2 patches from Kodi master branch into this one.
> 
> Signed-off-by: Benoît Mauduit <bmauduit@beneth.fr>

Thanks. I do remember seeing a report (on IRC ?) that commit
ef37472b20894c99cad758397f3cd6b90f933df1 was indeed causing some
problems.

Yann, Bernd, can you review/ack this patch from Benoît?

Thanks!

Thomas
Bernd Kuhls April 26, 2016, 8:54 p.m. UTC | #2
Am Tue, 26 Apr 2016 22:32:56 +0200 schrieb Thomas Petazzoni:

> Hello,
> 
> On Tue, 26 Apr 2016 22:21:14 +0200, Benoît Mauduit wrote:
>> The previous commit [ef37472b20894c99cad758397f3cd6b90f933df1] was
>> based on a newer version of Kodi :
>> "with-platform=raspberry-pi2" is not yet supported in Kodi "Jarvis" 
branch.
>> 
>> Backport 2 patches from Kodi master branch into this one.
>> 
>> Signed-off-by: Benoît Mauduit <bmauduit@beneth.fr>
> 
> Thanks. I do remember seeing a report (on IRC ?) that commit
> ef37472b20894c99cad758397f3cd6b90f933df1 was indeed causing some
> problems.
> 
> Yann, Bernd, can you review/ack this patch from Benoît?

Hi Thomas,

reviewing it will be difficult for me because I can not do a runtime test 
because I do not have access to RPI hardware.

Currently I am preparing a patch series for the 17.0-Krypton version 
bump, I think I will send the first part of it to my github account in 
the coming days after some of my PR for the Kodi project are completed.

Backporting feature patches is, afair, something you do not really like ;)
As always, as a normal Kodi user, I do not know any release dates but 
17.0-Krypton did not even reach alpha1 yet so expect several months until 
the next version is released. Maybe we should wait for it nonetheless?

Regards, Bernd
Yann E. MORIN April 26, 2016, 9 p.m. UTC | #3
Benoit, All,

On 2016-04-26 22:21 +0200, Benoît Mauduit spake thusly:
> The previous commit [ef37472b20894c99cad758397f3cd6b90f933df1] was
> based on a newer version of Kodi :
> "with-platform=raspberry-pi2" is not yet supported in Kodi "Jarvis" branch.

Arg. My bad. I indeed looked at the master of Kodi when doing that
patch.

Until there is a new release of Kodi (Krypton?), we should revert my
patch, rather than backport upstream changes...

Regards,
Yann E. MORIN.

> Backport 2 patches from Kodi master branch into this one.
> 
> Signed-off-by: Benoît Mauduit <bmauduit@beneth.fr>
> ---
>  ...0007-configure-Add-raspberry-pi2-platform.patch | 205 +++++++++++++++++++++
>  1 file changed, 205 insertions(+)
>  create mode 100644 package/kodi/0007-configure-Add-raspberry-pi2-platform.patch
> 
> diff --git a/package/kodi/0007-configure-Add-raspberry-pi2-platform.patch b/package/kodi/0007-configure-Add-raspberry-pi2-platform.patch
> new file mode 100644
> index 0000000..7542b91
> --- /dev/null
> +++ b/package/kodi/0007-configure-Add-raspberry-pi2-platform.patch
> @@ -0,0 +1,205 @@
> +From 968c4a0f412c80bf0afecf934b71044d297cad51 Mon Sep 17 00:00:00 2001
> +From: =?UTF-8?q?Beno=C3=AEt=20Mauduit?= <bmauduit@beneth.fr>
> +Date: Tue, 26 Apr 2016 15:30:42 +0200
> +Subject: [PATCH 1/1] configure: Add raspberry-pi2 platform
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +Original commit from "popcornmix" [0], and fixed by "wsnipex" [1] on Kodi branch master.
> +Commit-id in xbmc/kodi upstream git :
> +[0] Commit-id : 253ec417519afe9415612add80ff5a1753208b75
> +[1] Commit-id : 1da2f07be715865bf7cf9731d7147dc4f43459be
> +
> +Addition to original patches :
> + * Add optimization flag for rpi2 in main xbmc build
> + * Add -mtune & -mvectorize-with-neon-quad flag in "tools/depends" build
> +
> +Signed-off-by: Benoît Mauduit <bmauduit@beneth.fr>
> +---
> + configure.ac                                      | 21 +++++++++++--
> + m4/xbmc_arch.m4                                   |  8 ++---
> + tools/depends/Makefile.include.in                 |  2 +-
> + tools/depends/configure.ac                        | 37 ++++++++++++++++-------
> + tools/depends/target/Toolchain.cmake.in           |  2 +-
> + tools/depends/target/Toolchain_binaddons.cmake.in |  2 +-
> + 6 files changed, 50 insertions(+), 22 deletions(-)
> +
> +diff --git a/configure.ac b/configure.ac
> +index 5d47a4a..2eb0e20 100644
> +--- a/configure.ac
> ++++ b/configure.ac
> +@@ -698,8 +698,17 @@ case $use_platform in
> +   raspberry-pi)
> +      target_platform=target_raspberry_pi
> +      use_neon=no
> +-     use_arch="arm"
> +      use_cpu=arm1176jzf-s
> ++     ;;
> ++  raspberry-pi2)
> ++     target_platform=target_raspberry_pi
> ++     use_neon=yes
> ++     use_cpu=cortex-a7
> ++     ;;
> ++esac
> ++
> ++if test "$target_platform" = "target_raspberry_pi" ; then
> ++     use_arch="arm"
> +      use_hardcoded_tables="yes"
> +      use_openmax=no
> +      ARCH="arm"
> +@@ -708,8 +717,7 @@ case $use_platform in
> +      USE_MMAL=1; AC_DEFINE([HAS_MMAL],[1],["Define to 1 if MMAL libs is enabled"])
> +      CFLAGS="$CFLAGS"
> +      CXXFLAGS="$CXXFLAGS"
> +-     ;;
> +-esac
> ++fi
> + 
> + if test "$host_vendor" = "apple"; then
> +   use_avahi=no
> +@@ -807,6 +815,13 @@ if test "$host_vendor" = "apple" ; then
> + elif test "$target_platform" = "target_raspberry_pi"; then
> +   ARCH="arm"
> +   use_arch="arm"
> ++
> ++  # Add specific flags for rpi2
> ++  if test "$use_platform" = "raspberry-pi2"; then
> ++    CFLAGS="$CFLAGS -mcpu=cortex-a7 -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad"
> ++    CXXFLAGS="$CXXFLAGS -mcpu=cortex-a7 -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad"
> ++  fi
> ++
> + elif test "$use_arch" = "arm"; then
> +   CFLAGS="$CFLAGS -mno-apcs-stack-check"
> +   CXXFLAGS="$CXXFLAGS -mno-apcs-stack-check"
> +diff --git a/m4/xbmc_arch.m4 b/m4/xbmc_arch.m4
> +index 0b66a82..adb8e97 100644
> +--- a/m4/xbmc_arch.m4
> ++++ b/m4/xbmc_arch.m4
> +@@ -77,9 +77,7 @@ if test "$target_platform" = "target_android" ; then
> +   AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -DTARGET_ANDROID")
> + fi
> + 
> +-case $use_platform in
> +-  raspberry-pi)
> +-     AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_ARMEL -DTARGET_RASPBERRY_PI")
> +-     ;;
> +-esac
> ++if test "$target_platform" = "target_raspberry_pi" ; then
> ++  AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_ARMEL -DTARGET_RASPBERRY_PI")
> ++fi
> + ])
> +diff --git a/tools/depends/Makefile.include.in b/tools/depends/Makefile.include.in
> +index 6e37022..326e7b8 100644
> +--- a/tools/depends/Makefile.include.in
> ++++ b/tools/depends/Makefile.include.in
> +@@ -20,7 +20,7 @@ NATIVE_OS=@build_os@
> + CROSS_COMPILING=@cross_compiling@
> + ARCH_DEFINES=@ARCH_DEFINES@
> + NATIVE_ARCH_DEFINES=@NATIVE_ARCH_DEFINES@
> +-TARGET_PLATFORM=@use_platform@
> ++TARGET_PLATFORM=@target_platform@
> + XCODE_VERSION=@use_xcode@
> + AAPT=@AAPT@
> + DX=@DX@
> +diff --git a/tools/depends/configure.ac b/tools/depends/configure.ac
> +index 12935e3..05644b8 100644
> +--- a/tools/depends/configure.ac
> ++++ b/tools/depends/configure.ac
> +@@ -302,34 +302,49 @@ case $host in
> +     AC_MSG_ERROR(unsupported host ($use_host))
> + esac
> + 
> +-if test "$use_platform" = "raspberry-pi"; then
> ++case $use_platform in
> ++  raspberry-pi)
> ++     target_platform=raspberry-pi
> ++     use_neon=no
> ++     use_cpu=arm1176jzf-s
> ++     platform_cflags="-mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp"
> ++     platform_cxxflags="-mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp"
> ++     platform_ldflags=""
> ++     ;;
> ++  raspberry-pi2)
> ++     target_platform=raspberry-pi
> ++     use_neon=yes
> ++     use_cpu=cortex-a7
> ++     platform_cflags="-fPIC -mcpu=cortex-a7 -mtune=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 -mvectorize-with-neon-quad"
> ++     platform_cxxflags="-fPIC -mcpu=cortex-a7 -mtune=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 -mvectorize-with-neon-quad"
> ++     platform_ldflags="-lpthread"
> ++     ;;
> ++esac
> ++
> ++if test "$target_platform" = "raspberry-pi" ; then
> +   if test -d "${use_firmware}/opt/vc/include"; then
> +     :
> +   else
> +     AC_MSG_ERROR([Raspberry Pi firmware not found])
> +   fi
> +-  use_neon=no
> +   use_arch="arm"
> +-  use_cpu="arm1176jzf-s"
> +   use_hardcoded_tables="yes"
> +-  use_alsa="no"
> +   ARCH="arm"
> +   platform_os="linux"
> +   cross_compiling="yes"
> +   use_host="arm-linux-gnueabihf"
> +   deps_dir="$use_host"
> +-  platform_cflags="-pipe -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfloat-abi=hard \
> +-   -mfpu=vfp -mabi=aapcs-linux -Wno-psabi -Wa,-mno-warn-deprecated \
> +-   -Wno-deprecated-declarations -isystem${use_firmware}/opt/vc/include \
> ++  platform_cflags+=" -pipe -mabi=aapcs-linux -Wno-psabi \
> ++   -Wa,-mno-warn-deprecated -Wno-deprecated-declarations \
> ++   -isystem${use_firmware}/opt/vc/include \
> +    -isystem${use_firmware}/opt/vc/include/interface/vcos/pthreads \
> +    -isystem${use_firmware}/opt/vc/include/interface/vmcs_host/linux"
> +-  platform_cxxflags="-pipe -mcpu=arm1176jzf-s -mtune=arm1176jzf-s \
> +-   -mfloat-abi=hard -mfpu=vfp -mabi=aapcs-linux -Wno-psabi \
> ++  platform_cxxflags+=" -pipe -mabi=aapcs-linux -Wno-psabi \
> +    -Wa,-mno-warn-deprecated -Wno-deprecated-declarations \
> +    -isystem${use_firmware}/opt/vc/include \
> +    -isystem${use_firmware}/opt/vc/include/interface/vcos/pthreads \
> +    -isystem${use_firmware}/opt/vc/include/interface/vmcs_host/linux"
> +-  platform_ldflags="-L${use_firmware}/opt/vc/lib -lEGL -lGLESv2 -lbcm_host -lvcos \
> ++  platform_ldflags+=" -L${use_firmware}/opt/vc/lib -lEGL -lGLESv2 -lbcm_host -lvcos \
> +    -lvchiq_arm"
> + fi
> + 
> +@@ -491,7 +506,7 @@ AC_SUBST(use_cpu)
> + AC_SUBST(use_toolchain)
> + AC_SUBST(use_build_toolchain)
> + AC_SUBST(use_tarballs)
> +-AC_SUBST(use_platform)
> ++AC_SUBST(target_platform)
> + AC_SUBST(use_firmware)
> + AC_SUBST(cross_compiling)
> + AC_SUBST(platform_cflags)
> +diff --git a/tools/depends/target/Toolchain.cmake.in b/tools/depends/target/Toolchain.cmake.in
> +index 943be73..59385e8 100644
> +--- a/tools/depends/target/Toolchain.cmake.in
> ++++ b/tools/depends/target/Toolchain.cmake.in
> +@@ -1,6 +1,6 @@
> + SET(OS "@platform_os@")
> + SET(CPU "@use_cpu@")
> +-SET(PLATFORM "@use_platform@")
> ++SET(PLATFORM "@target_platform@")
> + IF("${OS}" STREQUAL "linux" OR "${OS}" STREQUAL "android")
> + SET(CMAKE_SYSTEM_NAME Linux)
> + ENDIF()
> +diff --git a/tools/depends/target/Toolchain_binaddons.cmake.in b/tools/depends/target/Toolchain_binaddons.cmake.in
> +index dc6d565..98494b4 100644
> +--- a/tools/depends/target/Toolchain_binaddons.cmake.in
> ++++ b/tools/depends/target/Toolchain_binaddons.cmake.in
> +@@ -1,7 +1,7 @@
> + set(CMAKE_SYSTEM_VERSION 1)
> + set(OS "@platform_os@")
> + set(CPU "@use_cpu@")
> +-set(PLATFORM "@use_platform@")
> ++set(PLATFORM "@target_platform@")
> + if("${OS}" STREQUAL "linux" OR "${OS}" STREQUAL "android")
> +   set(CMAKE_SYSTEM_NAME Linux)
> + endif()
> +-- 
> +2.8.1
> +
> -- 
> 2.8.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Benoît Mauduit April 27, 2016, 9:08 a.m. UTC | #4
Hi all,

On 04/26/2016 10:54 PM, Bernd Kuhls wrote:
> Am Tue, 26 Apr 2016 22:32:56 +0200 schrieb Thomas Petazzoni:
> 
>> Hello,
>>
>> On Tue, 26 Apr 2016 22:21:14 +0200, Benoît Mauduit wrote:
>>> The previous commit [ef37472b20894c99cad758397f3cd6b90f933df1] was
>>> based on a newer version of Kodi :
>>> "with-platform=raspberry-pi2" is not yet supported in Kodi "Jarvis" 
> branch.
>>>
>>> Backport 2 patches from Kodi master branch into this one.
>>>
>>> Signed-off-by: Benoît Mauduit <bmauduit@beneth.fr>
>>
>> Thanks. I do remember seeing a report (on IRC ?) that commit
>> ef37472b20894c99cad758397f3cd6b90f933df1 was indeed causing some
>> problems.
>>
>> Yann, Bernd, can you review/ack this patch from Benoît?
> 
> Hi Thomas,
> 
> reviewing it will be difficult for me because I can not do a runtime test 
> because I do not have access to RPI hardware.
> 
> Currently I am preparing a patch series for the 17.0-Krypton version 
> bump, I think I will send the first part of it to my github account in 
> the coming days after some of my PR for the Kodi project are completed.
> 
> Backporting feature patches is, afair, something you do not really like ;)
> As always, as a normal Kodi user, I do not know any release dates but 
> 17.0-Krypton did not even reach alpha1 yet so expect several months until 
> the next version is released. Maybe we should wait for it nonetheless?

Sorry to ask this, but do you have an explanation about not taking
upstream patches ? It is not obvious for me.

Also, I began to implement this fix on my own, and after seeing that
master branch have implemented this, I thought that it would better to
backport it. (Plus some addition from my side, that I will try to report
upstream).

From my point of view, we can integrate this patch (affecting only
raspberry-pi2 build) and remove it when the newer version of Kodi will
integrate it ?

Anyway, thanks for your feedbacks !
Regards,

Ps: I have tested Kodi on my raspberry-pi2. It works like a charm :)
Thomas Petazzoni May 7, 2016, 8:50 p.m. UTC | #5
Hello,

On Tue, 26 Apr 2016 22:21:14 +0200, Benoît Mauduit wrote:

> +Original commit from "popcornmix" [0], and fixed by "wsnipex" [1] on Kodi branch master.
> +Commit-id in xbmc/kodi upstream git :
> +[0] Commit-id : 253ec417519afe9415612add80ff5a1753208b75
> +[1] Commit-id : 1da2f07be715865bf7cf9731d7147dc4f43459be

In these are two patches upstream, then it should be two patches in
Buildroot as well.

> +
> +Addition to original patches :
> + * Add optimization flag for rpi2 in main xbmc build
> + * Add -mtune & -mvectorize-with-neon-quad flag in "tools/depends" build

Why are you doing those additional changes compared to upstream?

Like Yann said, we prefer to not backport too much stuff, except when
it's actually fixing a problem (which is not the case here).

Yann, will you send a patch that reverts your commit adding explicit RPi
2 support in the Kodi package ? This way we can have this for 2016.05,
and when a new Kodi release is done with built-in support for RPi2, we
can revisit this.

Thomas
Yann E. MORIN May 8, 2016, 7:38 a.m. UTC | #6
Benoît, All,

On 2016-04-27 11:08 +0200, Benoît Mauduit spake thusly:
> On 04/26/2016 10:54 PM, Bernd Kuhls wrote:
> > Am Tue, 26 Apr 2016 22:32:56 +0200 schrieb Thomas Petazzoni:
> > 
> >> Hello,
> >>
> >> On Tue, 26 Apr 2016 22:21:14 +0200, Benoît Mauduit wrote:
> >>> The previous commit [ef37472b20894c99cad758397f3cd6b90f933df1] was
> >>> based on a newer version of Kodi :
> >>> "with-platform=raspberry-pi2" is not yet supported in Kodi "Jarvis" 
> > branch.
> >>>
> >>> Backport 2 patches from Kodi master branch into this one.
> >>>
> >>> Signed-off-by: Benoît Mauduit <bmauduit@beneth.fr>
> >>
> >> Thanks. I do remember seeing a report (on IRC ?) that commit
> >> ef37472b20894c99cad758397f3cd6b90f933df1 was indeed causing some
> >> problems.
> >>
> >> Yann, Bernd, can you review/ack this patch from Benoît?
> > 
> > Hi Thomas,
> > 
> > reviewing it will be difficult for me because I can not do a runtime test 
> > because I do not have access to RPI hardware.
> > 
> > Currently I am preparing a patch series for the 17.0-Krypton version 
> > bump, I think I will send the first part of it to my github account in 
> > the coming days after some of my PR for the Kodi project are completed.
> > 
> > Backporting feature patches is, afair, something you do not really like ;)
> > As always, as a normal Kodi user, I do not know any release dates but 
> > 17.0-Krypton did not even reach alpha1 yet so expect several months until 
> > the next version is released. Maybe we should wait for it nonetheless?
> 
> Sorry to ask this, but do you have an explanation about not taking
> upstream patches ? It is not obvious for me.

It's not upstream patch we do not like. What we do not like are feature
patches. We try to limit the number of patches we have against packages,
so we limit ourselves to bug-fix patches.

> Also, I began to implement this fix on my own, and after seeing that
> master branch have implemented this, I thought that it would better to
> backport it. (Plus some addition from my side, that I will try to report
> upstream).

Yes, backporting upstream changes is preferred instead of rolling your
own (unless the backport is not technically possible, of course).

Also, your 'additions' no longer make those patches simple upstream
backports. If they are really needed, then the upstream backports should
be in their own patches, with your additions in separate patches (note
that this might be the case, I haven't looked at the patches).

But since those are feature patches, this discussion is moot anyway...

Regards,
Yann E. MORIN.
Yann E. MORIN May 8, 2016, 7:38 a.m. UTC | #7
Thomas, All,

On 2016-05-07 22:50 +0200, Thomas Petazzoni spake thusly:
> On Tue, 26 Apr 2016 22:21:14 +0200, Benoît Mauduit wrote:
> 
> > +Original commit from "popcornmix" [0], and fixed by "wsnipex" [1] on Kodi branch master.
> > +Commit-id in xbmc/kodi upstream git :
> > +[0] Commit-id : 253ec417519afe9415612add80ff5a1753208b75
> > +[1] Commit-id : 1da2f07be715865bf7cf9731d7147dc4f43459be
> 
> In these are two patches upstream, then it should be two patches in
> Buildroot as well.
> 
> > +
> > +Addition to original patches :
> > + * Add optimization flag for rpi2 in main xbmc build
> > + * Add -mtune & -mvectorize-with-neon-quad flag in "tools/depends" build
> 
> Why are you doing those additional changes compared to upstream?
> 
> Like Yann said, we prefer to not backport too much stuff, except when
> it's actually fixing a problem (which is not the case here).
> 
> Yann, will you send a patch that reverts your commit adding explicit RPi
> 2 support in the Kodi package ? This way we can have this for 2016.05,
> and when a new Kodi release is done with built-in support for RPi2, we
> can revisit this.

Yes, I'll send it soonish...

Regards,
Yann E. MORIN.
Benoît Mauduit May 12, 2016, 1:06 p.m. UTC | #8
Hi,


On 05/07/2016 10:50 PM, Thomas Petazzoni wrote:
> Hello,
> 
> On Tue, 26 Apr 2016 22:21:14 +0200, Benoît Mauduit wrote:
> 
>> +Original commit from "popcornmix" [0], and fixed by "wsnipex" [1] on Kodi branch master.
>> +Commit-id in xbmc/kodi upstream git :
>> +[0] Commit-id : 253ec417519afe9415612add80ff5a1753208b75
>> +[1] Commit-id : 1da2f07be715865bf7cf9731d7147dc4f43459be
> 
> In these are two patches upstream, then it should be two patches in
> Buildroot as well.
> 

Ok. I hesitate to do that. Because the second patch revert and improve
some change done by the first, I thought it was easier to understand
from Buildroot to integrate only one patch. (Following the philosophy,
one commit, one feature).

>> +
>> +Addition to original patches :
>> + * Add optimization flag for rpi2 in main xbmc build
>> + * Add -mtune & -mvectorize-with-neon-quad flag in "tools/depends" build
> 
> Why are you doing those additional changes compared to upstream?

I tried different optimization flags before coming to theses. It is
inspired by what Archlinux are doing for their kodi-rbp package. [1]

> 
> Like Yann said, we prefer to not backport too much stuff, except when
> it's actually fixing a problem (which is not the case here).

I see things a little differently when we talk about fixing/improving
build system and not adding a Kodi feature.

> 
> Yann, will you send a patch that reverts your commit adding explicit RPi
> 2 support in the Kodi package ? This way we can have this for 2016.05,
> and when a new Kodi release is done with built-in support for RPi2, we
> can revisit this.
> 
> Thomas
> 

Anyway, I had some strange behavior with this optimizations. When
compiling in -Os I have no issue, and kodi run very fine (RPI2 & RPI3).
But trying in -O3 result in various segfault. (I do not dig further
about this, and don't know if this is related to this change...)

I think it is better to wait for the next kodi version.

Thanks for the feedbacks !

Ps: I just see that archlinux is providing a patch[2] for building kodi
with gcc 6. Are we interested ? or are we waiting the next kodi ?

[1] : https://archlinuxarm.org/packages/armv6h/kodi-rbp/files/PKGBUILD
[2] : https://archlinuxarm.org/packages/armv6h/kodi-rbp/files/gcc6_fix.patch
Bernd Kuhls May 12, 2016, 5:26 p.m. UTC | #9
Am Thu, 12 May 2016 15:06:02 +0200 schrieb Benoît Mauduit:

> Ps: I just see that archlinux is providing a patch[2] for building kodi
> with gcc 6. Are we interested ? or are we waiting the next kodi ?
> 
> [1] : https://archlinuxarm.org/packages/armv6h/kodi-rbp/files/PKGBUILD
> [2] :
> https://archlinuxarm.org/packages/armv6h/kodi-rbp/files/gcc6_fix.patch

Hi Benoît,

I created that patch and send it to already here:
http://patchwork.ozlabs.org/patch/616330/

Please review the patch to help its integration in buildroot. Upstream 
(https://github.com/xbmc/xbmc/pull/9703) had no technical complaints 
about the patch but will not commit it because they won't do another 
release for the Jarvis-16 branch. The next version Krypton-17 will not 
need the patch.

You can also test my kodi17 branch for buildroot:
https://github.com/bkuhls/buildroot/tree/kodi17

Regards, Bernd
diff mbox

Patch

diff --git a/package/kodi/0007-configure-Add-raspberry-pi2-platform.patch b/package/kodi/0007-configure-Add-raspberry-pi2-platform.patch
new file mode 100644
index 0000000..7542b91
--- /dev/null
+++ b/package/kodi/0007-configure-Add-raspberry-pi2-platform.patch
@@ -0,0 +1,205 @@ 
+From 968c4a0f412c80bf0afecf934b71044d297cad51 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Beno=C3=AEt=20Mauduit?= <bmauduit@beneth.fr>
+Date: Tue, 26 Apr 2016 15:30:42 +0200
+Subject: [PATCH 1/1] configure: Add raspberry-pi2 platform
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Original commit from "popcornmix" [0], and fixed by "wsnipex" [1] on Kodi branch master.
+Commit-id in xbmc/kodi upstream git :
+[0] Commit-id : 253ec417519afe9415612add80ff5a1753208b75
+[1] Commit-id : 1da2f07be715865bf7cf9731d7147dc4f43459be
+
+Addition to original patches :
+ * Add optimization flag for rpi2 in main xbmc build
+ * Add -mtune & -mvectorize-with-neon-quad flag in "tools/depends" build
+
+Signed-off-by: Benoît Mauduit <bmauduit@beneth.fr>
+---
+ configure.ac                                      | 21 +++++++++++--
+ m4/xbmc_arch.m4                                   |  8 ++---
+ tools/depends/Makefile.include.in                 |  2 +-
+ tools/depends/configure.ac                        | 37 ++++++++++++++++-------
+ tools/depends/target/Toolchain.cmake.in           |  2 +-
+ tools/depends/target/Toolchain_binaddons.cmake.in |  2 +-
+ 6 files changed, 50 insertions(+), 22 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 5d47a4a..2eb0e20 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -698,8 +698,17 @@ case $use_platform in
+   raspberry-pi)
+      target_platform=target_raspberry_pi
+      use_neon=no
+-     use_arch="arm"
+      use_cpu=arm1176jzf-s
++     ;;
++  raspberry-pi2)
++     target_platform=target_raspberry_pi
++     use_neon=yes
++     use_cpu=cortex-a7
++     ;;
++esac
++
++if test "$target_platform" = "target_raspberry_pi" ; then
++     use_arch="arm"
+      use_hardcoded_tables="yes"
+      use_openmax=no
+      ARCH="arm"
+@@ -708,8 +717,7 @@ case $use_platform in
+      USE_MMAL=1; AC_DEFINE([HAS_MMAL],[1],["Define to 1 if MMAL libs is enabled"])
+      CFLAGS="$CFLAGS"
+      CXXFLAGS="$CXXFLAGS"
+-     ;;
+-esac
++fi
+ 
+ if test "$host_vendor" = "apple"; then
+   use_avahi=no
+@@ -807,6 +815,13 @@ if test "$host_vendor" = "apple" ; then
+ elif test "$target_platform" = "target_raspberry_pi"; then
+   ARCH="arm"
+   use_arch="arm"
++
++  # Add specific flags for rpi2
++  if test "$use_platform" = "raspberry-pi2"; then
++    CFLAGS="$CFLAGS -mcpu=cortex-a7 -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad"
++    CXXFLAGS="$CXXFLAGS -mcpu=cortex-a7 -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad"
++  fi
++
+ elif test "$use_arch" = "arm"; then
+   CFLAGS="$CFLAGS -mno-apcs-stack-check"
+   CXXFLAGS="$CXXFLAGS -mno-apcs-stack-check"
+diff --git a/m4/xbmc_arch.m4 b/m4/xbmc_arch.m4
+index 0b66a82..adb8e97 100644
+--- a/m4/xbmc_arch.m4
++++ b/m4/xbmc_arch.m4
+@@ -77,9 +77,7 @@ if test "$target_platform" = "target_android" ; then
+   AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -DTARGET_ANDROID")
+ fi
+ 
+-case $use_platform in
+-  raspberry-pi)
+-     AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_ARMEL -DTARGET_RASPBERRY_PI")
+-     ;;
+-esac
++if test "$target_platform" = "target_raspberry_pi" ; then
++  AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_ARMEL -DTARGET_RASPBERRY_PI")
++fi
+ ])
+diff --git a/tools/depends/Makefile.include.in b/tools/depends/Makefile.include.in
+index 6e37022..326e7b8 100644
+--- a/tools/depends/Makefile.include.in
++++ b/tools/depends/Makefile.include.in
+@@ -20,7 +20,7 @@ NATIVE_OS=@build_os@
+ CROSS_COMPILING=@cross_compiling@
+ ARCH_DEFINES=@ARCH_DEFINES@
+ NATIVE_ARCH_DEFINES=@NATIVE_ARCH_DEFINES@
+-TARGET_PLATFORM=@use_platform@
++TARGET_PLATFORM=@target_platform@
+ XCODE_VERSION=@use_xcode@
+ AAPT=@AAPT@
+ DX=@DX@
+diff --git a/tools/depends/configure.ac b/tools/depends/configure.ac
+index 12935e3..05644b8 100644
+--- a/tools/depends/configure.ac
++++ b/tools/depends/configure.ac
+@@ -302,34 +302,49 @@ case $host in
+     AC_MSG_ERROR(unsupported host ($use_host))
+ esac
+ 
+-if test "$use_platform" = "raspberry-pi"; then
++case $use_platform in
++  raspberry-pi)
++     target_platform=raspberry-pi
++     use_neon=no
++     use_cpu=arm1176jzf-s
++     platform_cflags="-mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp"
++     platform_cxxflags="-mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp"
++     platform_ldflags=""
++     ;;
++  raspberry-pi2)
++     target_platform=raspberry-pi
++     use_neon=yes
++     use_cpu=cortex-a7
++     platform_cflags="-fPIC -mcpu=cortex-a7 -mtune=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 -mvectorize-with-neon-quad"
++     platform_cxxflags="-fPIC -mcpu=cortex-a7 -mtune=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 -mvectorize-with-neon-quad"
++     platform_ldflags="-lpthread"
++     ;;
++esac
++
++if test "$target_platform" = "raspberry-pi" ; then
+   if test -d "${use_firmware}/opt/vc/include"; then
+     :
+   else
+     AC_MSG_ERROR([Raspberry Pi firmware not found])
+   fi
+-  use_neon=no
+   use_arch="arm"
+-  use_cpu="arm1176jzf-s"
+   use_hardcoded_tables="yes"
+-  use_alsa="no"
+   ARCH="arm"
+   platform_os="linux"
+   cross_compiling="yes"
+   use_host="arm-linux-gnueabihf"
+   deps_dir="$use_host"
+-  platform_cflags="-pipe -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfloat-abi=hard \
+-   -mfpu=vfp -mabi=aapcs-linux -Wno-psabi -Wa,-mno-warn-deprecated \
+-   -Wno-deprecated-declarations -isystem${use_firmware}/opt/vc/include \
++  platform_cflags+=" -pipe -mabi=aapcs-linux -Wno-psabi \
++   -Wa,-mno-warn-deprecated -Wno-deprecated-declarations \
++   -isystem${use_firmware}/opt/vc/include \
+    -isystem${use_firmware}/opt/vc/include/interface/vcos/pthreads \
+    -isystem${use_firmware}/opt/vc/include/interface/vmcs_host/linux"
+-  platform_cxxflags="-pipe -mcpu=arm1176jzf-s -mtune=arm1176jzf-s \
+-   -mfloat-abi=hard -mfpu=vfp -mabi=aapcs-linux -Wno-psabi \
++  platform_cxxflags+=" -pipe -mabi=aapcs-linux -Wno-psabi \
+    -Wa,-mno-warn-deprecated -Wno-deprecated-declarations \
+    -isystem${use_firmware}/opt/vc/include \
+    -isystem${use_firmware}/opt/vc/include/interface/vcos/pthreads \
+    -isystem${use_firmware}/opt/vc/include/interface/vmcs_host/linux"
+-  platform_ldflags="-L${use_firmware}/opt/vc/lib -lEGL -lGLESv2 -lbcm_host -lvcos \
++  platform_ldflags+=" -L${use_firmware}/opt/vc/lib -lEGL -lGLESv2 -lbcm_host -lvcos \
+    -lvchiq_arm"
+ fi
+ 
+@@ -491,7 +506,7 @@ AC_SUBST(use_cpu)
+ AC_SUBST(use_toolchain)
+ AC_SUBST(use_build_toolchain)
+ AC_SUBST(use_tarballs)
+-AC_SUBST(use_platform)
++AC_SUBST(target_platform)
+ AC_SUBST(use_firmware)
+ AC_SUBST(cross_compiling)
+ AC_SUBST(platform_cflags)
+diff --git a/tools/depends/target/Toolchain.cmake.in b/tools/depends/target/Toolchain.cmake.in
+index 943be73..59385e8 100644
+--- a/tools/depends/target/Toolchain.cmake.in
++++ b/tools/depends/target/Toolchain.cmake.in
+@@ -1,6 +1,6 @@
+ SET(OS "@platform_os@")
+ SET(CPU "@use_cpu@")
+-SET(PLATFORM "@use_platform@")
++SET(PLATFORM "@target_platform@")
+ IF("${OS}" STREQUAL "linux" OR "${OS}" STREQUAL "android")
+ SET(CMAKE_SYSTEM_NAME Linux)
+ ENDIF()
+diff --git a/tools/depends/target/Toolchain_binaddons.cmake.in b/tools/depends/target/Toolchain_binaddons.cmake.in
+index dc6d565..98494b4 100644
+--- a/tools/depends/target/Toolchain_binaddons.cmake.in
++++ b/tools/depends/target/Toolchain_binaddons.cmake.in
+@@ -1,7 +1,7 @@
+ set(CMAKE_SYSTEM_VERSION 1)
+ set(OS "@platform_os@")
+ set(CPU "@use_cpu@")
+-set(PLATFORM "@use_platform@")
++set(PLATFORM "@target_platform@")
+ if("${OS}" STREQUAL "linux" OR "${OS}" STREQUAL "android")
+   set(CMAKE_SYSTEM_NAME Linux)
+ endif()
+-- 
+2.8.1
+