alarm/kodi-rpi-git to 19.0b2.56808.0f75c91014-4

Properly set cortex-a72 optimizations for this package, see comment
in 0000-use-mcpu-avoiding-march-and-mtune.patch for more details.

Should be totally fine in doing so since this only RPi 4 can actually
make use of the HW decoding intended for v19 once it goes final and the
patchset is gets merged into ffmpeg (at some point).

In addition to that, fix a small bug in kodi.service, for details see:
909f274d6e
This commit is contained in:
graysky 2020-12-14 09:20:06 -05:00
parent d52dd2c007
commit 0926d17669
4 changed files with 133 additions and 32 deletions

View file

@ -0,0 +1,40 @@
From 2e2417894ac5d35bc3d93b86c18f4df299f4d933 Mon Sep 17 00:00:00 2001
From: graysky <graysky@archlinux.us>
Date: Sat, 12 Dec 2020 09:10:28 -0500
Subject: [PATCH] use -mcpu= avoiding -march and -mtune for armv7h
From what I understand, when building on ARM, it's best to avoid the -march=
flag and rather use -mcpu= flag due to differences in meaning on ARM vs x86[1].
Additionally, this patch avoids thousands of warns like the following when
building for armv7h:
cc1: warning: switch '-mcpu=cortex-a72' conflicts with '-march=armv8-a'
This is due to the way ffmpeg's configure script defines -march=armv8-a when it
encounters any cortex-a* passed to it.
for reference and to experiment:
untar ffmpeg, run ./configure, then inspect the output of ffbuild/config.mak and adjust:
kodi-build/build/ffmpeg/src/ffmpeg-build/ffmpeg-prefix/src/ffmpeg-build/ffbuild/config.mak
1. https://community.arm.com/developer/tools-software/tools/b/tools-software-ides-blog/posts/compiler-flags-across-architectures-march-mtune-and-mcpu
---
configure | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure b/configure
index 8569a60..0d3aafb 100755
--- a/configure
+++ b/configure
@@ -4948,7 +4948,7 @@ elif enabled arm; then
case $cpu in
armv*)
- cpuflags="-march=$cpu"
+ cpuflags="-mcpu=cortex-a72"
subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
;;
*)
--
2.29.2

View file

@ -0,0 +1,26 @@
From 666fd7f69f684d7dd23b1ee665b0902e29953b76 Mon Sep 17 00:00:00 2001
From: graysky <graysky@archlinux.us>
Date: Sat, 12 Dec 2020 09:29:51 -0500
Subject: [PATCH] mcpu=cortex-a72 for RPi4 application to ffmpeg
Get build system to patch ffmpeg source removing the -march= flag
---
cmake/modules/FindFFMPEG.cmake | 1 +
1 file changed, 1 insertion(+)
diff --git a/cmake/modules/FindFFMPEG.cmake b/cmake/modules/FindFFMPEG.cmake
index 9ce807c..a18b21c 100644
--- a/cmake/modules/FindFFMPEG.cmake
+++ b/cmake/modules/FindFFMPEG.cmake
@@ -279,6 +279,7 @@ if(NOT FFMPEG_FOUND)
${CMAKE_SOURCE_DIR}/tools/depends/target/ffmpeg/FindGnuTls.cmake
<SOURCE_DIR> &&
patch -p1 < ${CMAKE_SOURCE_DIR}/tools/depends/target/ffmpeg/0001-rpi-Add-hevc-acceleration.patch &&
+ patch -p1 < ${CMAKE_SOURCE_DIR}/tools/depends/target/ffmpeg/0002-use-mcpu-avoiding-march-and-mtune.patch &&
echo "########################################## patched ffmpeg ##############################"
)
--
2.29.2

View file

@ -17,9 +17,9 @@ _commitnumber=56808
_commit=0f75c910145f31dcb48219bc6174b0a15156ceaa
pkgver="19.0b2.$_commitnumber.${_commit:0:10}"
pkgrel=3
pkgrel=4
arch=('armv7h')
url="http://kodi.tv"
url="https://github.com/popcornmix/xbmc/tree/gbm"
license=('GPL2')
makedepends=(
'afpfs-ng' 'bluez-libs' 'cmake' 'curl' 'dav1d' 'doxygen' 'glew'
@ -72,6 +72,8 @@ source=(
"http://mirrors.kodi.tv/build-deps/sources/spdlog-$_spdlog_version.tar.gz"
sysusers.conf
tmpfiles.conf
0000-use-mcpu-avoiding-march-and-mtune.patch
0001-mcpu-cortex-a72-for-RPi4-application-to-ffmpeg.patch
)
backup=(boot/kodi.config.txt)
noextract=(
@ -86,7 +88,7 @@ noextract=(
"spdlog-$_spdlog_version.tar.gz"
)
sha256sums=('561a6d316fffa6d6559f7172d96f19e7c9159e5a14f139b86014140b306e7adb'
'91dd278d46eed0cb05ba733647c99379330f197daa87d33bf2b18032e5af5055'
'c37fe409b348e13eafad2745a5044dee5ea96c3a297921411b57953a8db966b2'
'61a0648d4a5086f560ceb4e020f82472d00b99398f2cacba94fad3e96c4c362a'
'5d38a895ee7b93689fab79124a3aad23a5e3e643abd08878d778d04066c8d26f'
'2a36ee05a8e023d2ba4bbe36f66768e5a9f3982582e0266103f95e117c1d684a'
@ -101,17 +103,25 @@ sha256sums=('561a6d316fffa6d6559f7172d96f19e7c9159e5a14f139b86014140b306e7adb'
'1789b97e790da8f2cb5ff827d15580878c8629fd889f5f038d7524dca43eacc9'
'b38e0bbef7faac2b82fed550a0c19b0d4e7f6737d5321d4fd8f216b80f8aee8a'
'f521b98232e5035b7cada46cf03975b8d753e93d0802bf22913fceed769f9d96'
'9c5e79ed8719cd032a3b17dac585aeff28a198e37af1da9af68ef1b86bab4d18')
'9c5e79ed8719cd032a3b17dac585aeff28a198e37af1da9af68ef1b86bab4d18'
'39a54a2d9c429c27ed2a369568043a1e3c86e2fe6bf931932984a0ce7aee7391'
'05a140fa6da5ba0576611e31f2ed2e5d56255c480e58be4854db154d611b29da')
prepare() {
cd "xbmc-$_commit"
[[ -d kodi-build ]] && rm -rf kodi-build
mkdir "$srcdir"/kodi-build
# put patch in source tree so kodi build system can pick it up
cp ../0000-use-mcpu-avoiding-march-and-mtune.patch \
tools/depends/target/ffmpeg/0002-use-mcpu-avoiding-march-and-mtune.patch
# patch kodi build system to apply the patch we just copied over
patch -Np1 -i ../0001-mcpu-cortex-a72-for-RPi4-application-to-ffmpeg.patch
}
build() {
cd kodi-build
# the build system expects to find /usr/include/drm/drm_fourcc.h however we provide this
# in /usr/lib/modules/x.y.z-1-ARCH/build/include/uapi/drm/drm_fourcc.h
#
@ -119,33 +129,59 @@ build() {
_kernel_release="$(pacman -Q linux-raspberrypi4-headers | grep -Eo "[^\ ]+$")-ARCH"
mkdir -p "$srcdir/uapi/drm"
ln -s /usr/lib/modules/$_kernel_release/build/include/uapi/drm/drm_fourcc.h "$srcdir/uapi/drm"
ln -s /usr/lib/modules/${_kernel_release/.rc/-rc}/build/include/uapi/drm/drm_fourcc.h "$srcdir/uapi/drm"
export CPPFLAGS+=" -I$srcdir/uapi"
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=/usr/lib \
-DCMAKE_EXE_LINKER_FLAGS_INIT="-L/opt/vc/lib -lvcsm" \
-DCMAKE_EXE_LINKER_FLAGS="-L/opt/vc/lib -lvcsm" \
-DCMAKE_CXX_FLAGS="-Wl,-L/opt/vc/lib -Wl,-lvcsm" \
-DENABLE_EVENTCLIENTS=ON \
-DENABLE_INTERNAL_FFMPEG=ON \
-DENABLE_INTERNAL_FMT=ON \
-DENABLE_INTERNAL_CROSSGUID=ON \
-DENABLE_INTERNAL_FSTRCMP=ON \
-DENABLE_INTERNAL_FLATBUFFERS=ON \
-DENABLE_INTERNAL_SPDLOG=ON \
-DCORE_PLATFORM_NAME=gbm \
-DAPP_RENDER_SYSTEM=gles \
-Dlibdvdcss_URL="$srcdir/libdvdcss-$_libdvdcss_version.tar.gz" \
-Dlibdvdnav_URL="$srcdir/libdvdnav-$_libdvdnav_version.tar.gz" \
-Dlibdvdread_URL="$srcdir/libdvdread-$_libdvdread_version.tar.gz" \
-DFFMPEG_URL="$srcdir/ffmpeg-$_ffmpeg_version.tar.gz" \
-DFMT_URL="$srcdir/fmt-$_fmt_version.tar.gz" \
-DCROSSGUID_URL="$srcdir/crossguid-$_crossguid_version.tar.gz" \
-DFSTRCMP_URL="$srcdir/fstrcmp-$_fstrcmp_version.tar.gz" \
-DFLATBUFFERS_URL="$srcdir/flatbuffers-$_flatbuffers_version.tar.gz" \
-DSPDLOG_URL="$srcdir/spdlog-$_spdlog_version.tar.gz" \
../"xbmc-$_commit"
# -march= defined in /etc/makepkg.conf will override the value for -mcpu we
# uses here so unset them and redefine below
unset CFLAGS CXXFLAGS
CFLAGS="-O2 -pipe -fstack-protector-strong -fno-plt -mtune=cortex-a72"
CXXFLAGS="${CFLAGS}"
if [[ $CARCH = "armv7h" ]]; then
export CFLAGS+=" -mcpu=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard"
export CXXFLAGS="${CFLAGS}"
elif [[ $CARCH = "aarch64" ]]; then
export CFLAGS+=" -mcpu=cortex-a72+crc"
export CXXFLAGS="${CFLAGS}"
fi
_args=(
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_INSTALL_LIBDIR=/usr/lib
-DVERBOSE=ON
-DENABLE_EVENTCLIENTS=ON
-DENABLE_INTERNAL_FFMPEG=ON
-DENABLE_INTERNAL_FMT=ON
-DENABLE_INTERNAL_CROSSGUID=ON
-DENABLE_INTERNAL_FSTRCMP=ON
-DENABLE_INTERNAL_FLATBUFFERS=ON
-DENABLE_INTERNAL_SPDLOG=ON
-DCORE_PLATFORM_NAME=gbm
-DAPP_RENDER_SYSTEM=gles
-Dlibdvdcss_URL="$srcdir/libdvdcss-$_libdvdcss_version.tar.gz"
-Dlibdvdnav_URL="$srcdir/libdvdnav-$_libdvdnav_version.tar.gz"
-Dlibdvdread_URL="$srcdir/libdvdread-$_libdvdread_version.tar.gz"
-DFFMPEG_URL="$srcdir/ffmpeg-$_ffmpeg_version.tar.gz"
-DFMT_URL="$srcdir/fmt-$_fmt_version.tar.gz"
-DCROSSGUID_URL="$srcdir/crossguid-$_crossguid_version.tar.gz"
-DFSTRCMP_URL="$srcdir/fstrcmp-$_fstrcmp_version.tar.gz"
-DFLATBUFFERS_URL="$srcdir/flatbuffers-$_flatbuffers_version.tar.gz"
-DSPDLOG_URL="$srcdir/spdlog-$_spdlog_version.tar.gz"
)
if [[ $CARCH = "armv7h" ]]; then
# this is only needed if the kernel version is <5.10.0
# can be removed once 5.10.y goes gold
_args+=(
-DCMAKE_EXE_LINKER_FLAGS_INIT="-L/opt/vc/lib -lvcsm"
-DCMAKE_EXE_LINKER_FLAGS="-L/opt/vc/lib -lvcsm"
-DCMAKE_CXX_FLAGS="-Wl,-L/opt/vc/lib -Wl,-lvcsm"
)
fi
cmake "${_args[@]}" ../"xbmc-$_commit"
make
make preinstall
}

View file

@ -1,13 +1,12 @@
[Unit]
Description=Kodi standalone (GBM)
After=remote-fs.target systemd-user-sessions.service network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service
After=remote-fs.target network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service
Wants=network-online.target polkit.service upower.service
Conflicts=getty@tty1.service
[Service]
User=kodi
Group=kodi
PAMName=login
TTYPath=/dev/tty1
Environment=WINDOWING=gbm
ExecStart=/usr/bin/kodi-standalone