From aee6e1eac1c566e9fbb3d5408e9dfac23fd33385 Mon Sep 17 00:00:00 2001 From: cvh Date: Thu, 5 Jan 2017 12:40:01 +0100 Subject: [PATCH 1/6] media_build: initial package --- packages/linux-drivers/media_build/package.mk | 49 ++++++++++ .../media_build-01-remove-rmmod.pl.patch | 13 +++ .../media_build-02-add-to-backports.patch | 15 +++ tools/mkpkg/mkpkg_media_build | 97 +++++++++++++++---- 4 files changed, 154 insertions(+), 20 deletions(-) create mode 100644 packages/linux-drivers/media_build/package.mk create mode 100644 packages/linux-drivers/media_build/patches/media_build-01-remove-rmmod.pl.patch create mode 100644 packages/linux-drivers/media_build/patches/media_build-02-add-to-backports.patch diff --git a/packages/linux-drivers/media_build/package.mk b/packages/linux-drivers/media_build/package.mk new file mode 100644 index 0000000000..7dc31f7bad --- /dev/null +++ b/packages/linux-drivers/media_build/package.mk @@ -0,0 +1,49 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="media_build" +PKG_VERSION="2016-12-28" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/crazycat69/linux_media" +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain linux" +PKG_BUILD_DEPENDS_TARGET="toolchain linux" +PKG_SECTION="driver" +PKG_SHORTDESC="DVB drivers that replace the version shipped with the kernel" +PKG_LONGDESC="DVB drivers that replace the version shipped with the kernel" +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +pre_make_target() { + export KERNEL_VER=$(get_module_dir) + export LDFLAGS="" +} + +make_target() { + cd media_build + make dir DIR=../media + make VER=$KERNEL_VER SRCDIR=$(kernel_path) allyesconfig + make VER=$KERNEL_VER SRCDIR=$(kernel_path) +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/lib/modules/$KERNEL_VER/updates + find $ROOT/$PKG_BUILD/media_build/v4l/ -name \*.ko -exec cp {} $INSTALL/usr/lib/modules/$KERNEL_VER/updates \; +} diff --git a/packages/linux-drivers/media_build/patches/media_build-01-remove-rmmod.pl.patch b/packages/linux-drivers/media_build/patches/media_build-01-remove-rmmod.pl.patch new file mode 100644 index 0000000000..fbe5f6f064 --- /dev/null +++ b/packages/linux-drivers/media_build/patches/media_build-01-remove-rmmod.pl.patch @@ -0,0 +1,13 @@ +[Patch] without this patch you need to install libproc-processtable-perl at host system + +--- a/media_build/v4l/Makefile ++++ b/media_build/v4l/Makefile +@@ -51,7 +51,7 @@ + @echo Kernel build directory is $(OUTDIR) + $(MAKE) -C ../linux apply_patches + $(MAKE) -C $(OUTDIR) SUBDIRS=$(PWD) $(MYCFLAGS) modules +- ./scripts/rmmod.pl check ++# ./scripts/rmmod.pl check + # $(MAKE) checkpatch + + mismatch:: prepare firmware diff --git a/packages/linux-drivers/media_build/patches/media_build-02-add-to-backports.patch b/packages/linux-drivers/media_build/patches/media_build-02-add-to-backports.patch new file mode 100644 index 0000000000..87e0524391 --- /dev/null +++ b/packages/linux-drivers/media_build/patches/media_build-02-add-to-backports.patch @@ -0,0 +1,15 @@ +diff --git a/media_build/backports/backports.txt b/media_build/backports/backports.txt +index 2a6006b..8c7c3de 100644 +--- a/media_build/backports/backports.txt ++++ b/media_build/backports/backports.txt +@@ -25,6 +25,10 @@ + add pr_fmt.patch + add debug.patch + add drx39xxj.patch ++add linux-203-stb0899_enable_low_symbol_rate.patch ++add linux-212-mantis_stb0899_faster_lock.patch ++add linux-222-stb0899_signal_quality.patch ++add linux-227-ds3000-invalid-symbol-rate.patch + + [4.8.255] + add v4.8_user_pages_flag.patch diff --git a/tools/mkpkg/mkpkg_media_build b/tools/mkpkg/mkpkg_media_build index 0509358bce..719750bc31 100755 --- a/tools/mkpkg/mkpkg_media_build +++ b/tools/mkpkg/mkpkg_media_build @@ -1,41 +1,98 @@ #!/bin/sh ################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC # -# OpenELEC is free software: you can redistribute it and/or modify +# LibreELEC is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # -# OpenELEC is distributed in the hope that it will be useful, +# LibreELEC is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . +# along with LibreELEC. If not, see . ################################################################################ -echo "getting sources..." +# name of the package +DVB_MKPKG_NAME="media_build" +DVB_MKPKG_FOLDER="$(pwd)" + +# remove old files +echo "removing old sources ..." +rm -rf ${DVB_MKPKG_NAME} +rm -rf ${DVB_MKPKG_NAME}-* + +################################################################################ + +# media_build dl +echo "getting media_build sources ..." if [ ! -d media_build.git ]; then - git clone git://linuxtv.org/media_build.git media_build.git + git clone --depth=1 https://bitbucket.org/CrazyCat/media_build.git ${DVB_MKPKG_NAME}/media_build fi - cd media_build.git - git pull - GIT_REV=`git log -n1 --format=%h` - cd .. +echo "cleaning media_build sources ..." + rm -rf ${DVB_MKPKG_NAME}/media_build/.git -echo "copying sources..." - rm -rf media_build-$GIT_REV - cp -R media_build.git media_build-$GIT_REV +# media_tree dl +echo "getting sources ..." + if [ ! -d linux_media.git ]; then + git clone --depth=1 https://github.com/crazycat69/linux_media.git -b latest ${DVB_MKPKG_NAME}/media_tree + fi -echo "cleaning sources..." - rm -rf media_build-$GIT_REV/.git +cd ${DVB_MKPKG_NAME}/media_tree + git pull + GIT_REV=`git log -n1 --pretty=format:"%ad" --date=short` -echo "packing sources..." - tar cvJf media_build-$GIT_REV.tar.xz media_build-$GIT_REV +cd $DVB_MKPKG_FOLDER/ -echo "remove temporary sourcedir..." - rm -rf media_build-$GIT_REV +# final folder +mkdir ${DVB_MKPKG_NAME}/media/ + +################################################################################ + +# modify the media_build buildscript +cd ${DVB_MKPKG_NAME}/media_build/linux/ + +# backup Makefile +cp Makefile Makefile.org + +# workaround for crazycat media_build to create a proper named file +sed -i -E "s/TODAY_TAR\ \:\=\ linux\-media\-LATEST\.tar/TODAY_TAR\ \:\=\ linux\-media.tar/g" Makefile + +# normal media build +sed -i -E 's/TODAY_TAR\ \:\=\ linux\-media\-\$\{DATE\}\.tar/TODAY_TAR\ \:\=\ linux\-media.tar/g' Makefile + +# remove the creation of the archive +sed -i -E 's/bzip2\ \$\(PWD\)\/\$\(TODAY_TAR\)/ /g' Makefile + +# collecting files from media_tree +echo "collect source files ..." +make todaytar DIR="../../media_tree/" + +# extract resulting tar into media folder +tar xf linux-media.tar -C "../../media/" + +# cleanup +rm linux-media.tar +rm Makefile && mv Makefile.org Makefile + +cd $DVB_MKPKG_FOLDER +rm -rf ${DVB_MKPKG_NAME}/media_tree/ +rm -rf ${DVB_MKPKG_NAME}/media_build/.git/ + +# rename buildfolder +mv ${DVB_MKPKG_NAME}/ ${DVB_MKPKG_NAME}-$GIT_REV/ + +################################################################################ + +# pack sources +echo "packing sources ..." +tar cvJf ${DVB_MKPKG_NAME}-$GIT_REV.tar.xz ${DVB_MKPKG_NAME}-$GIT_REV + +echo "remove temporary sourcedir ..." +rm -rf ${DVB_MKPKG_NAME}-$GIT_REV +rm -rf ${DVB_MKPKG_NAME} From e174626c6960d8717314d95bd7236498a4228c13 Mon Sep 17 00:00:00 2001 From: cvh Date: Thu, 5 Jan 2017 12:40:31 +0100 Subject: [PATCH 2/6] media_build: move dvb patches out of linux --- .../backports}/linux-203-stb0899_enable_low_symbol_rate.patch | 0 .../backports}/linux-212-mantis_stb0899_faster_lock.patch | 0 .../media_build/backports}/linux-222-stb0899_signal_quality.patch | 0 .../backports}/linux-227-ds3000-invalid-symbol-rate.patch | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename packages/{linux/patches/default => linux-drivers/media_build/sources/media_build/backports}/linux-203-stb0899_enable_low_symbol_rate.patch (100%) rename packages/{linux/patches/default => linux-drivers/media_build/sources/media_build/backports}/linux-212-mantis_stb0899_faster_lock.patch (100%) rename packages/{linux/patches/default => linux-drivers/media_build/sources/media_build/backports}/linux-222-stb0899_signal_quality.patch (100%) rename packages/{linux/patches/default => linux-drivers/media_build/sources/media_build/backports}/linux-227-ds3000-invalid-symbol-rate.patch (100%) diff --git a/packages/linux/patches/default/linux-203-stb0899_enable_low_symbol_rate.patch b/packages/linux-drivers/media_build/sources/media_build/backports/linux-203-stb0899_enable_low_symbol_rate.patch similarity index 100% rename from packages/linux/patches/default/linux-203-stb0899_enable_low_symbol_rate.patch rename to packages/linux-drivers/media_build/sources/media_build/backports/linux-203-stb0899_enable_low_symbol_rate.patch diff --git a/packages/linux/patches/default/linux-212-mantis_stb0899_faster_lock.patch b/packages/linux-drivers/media_build/sources/media_build/backports/linux-212-mantis_stb0899_faster_lock.patch similarity index 100% rename from packages/linux/patches/default/linux-212-mantis_stb0899_faster_lock.patch rename to packages/linux-drivers/media_build/sources/media_build/backports/linux-212-mantis_stb0899_faster_lock.patch diff --git a/packages/linux/patches/default/linux-222-stb0899_signal_quality.patch b/packages/linux-drivers/media_build/sources/media_build/backports/linux-222-stb0899_signal_quality.patch similarity index 100% rename from packages/linux/patches/default/linux-222-stb0899_signal_quality.patch rename to packages/linux-drivers/media_build/sources/media_build/backports/linux-222-stb0899_signal_quality.patch diff --git a/packages/linux/patches/default/linux-227-ds3000-invalid-symbol-rate.patch b/packages/linux-drivers/media_build/sources/media_build/backports/linux-227-ds3000-invalid-symbol-rate.patch similarity index 100% rename from packages/linux/patches/default/linux-227-ds3000-invalid-symbol-rate.patch rename to packages/linux-drivers/media_build/sources/media_build/backports/linux-227-ds3000-invalid-symbol-rate.patch From 9574e2492ae3ddeb6ac3b3d2434675e0c9d01488 Mon Sep 17 00:00:00 2001 From: cvh Date: Thu, 5 Jan 2017 12:41:27 +0100 Subject: [PATCH 3/6] projects/Virtual/options: add media_build --- projects/Virtual/options | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/Virtual/options b/projects/Virtual/options index ae5acf25b8..8b70855217 100644 --- a/projects/Virtual/options +++ b/projects/Virtual/options @@ -85,7 +85,7 @@ # for a list of additinoal drivers see packages/linux-drivers # Space separated list is supported, # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" - ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS bcm_sta" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS bcm_sta media_build" # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia,nouveau,vmware,virtualbox) # Space separated list is supported, From 4fecb9b327a055323f0cd434f5ff04f07a265419 Mon Sep 17 00:00:00 2001 From: cvh Date: Thu, 5 Jan 2017 12:41:34 +0100 Subject: [PATCH 4/6] projects/RPi2/options: add media_build --- projects/RPi2/options | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/RPi2/options b/projects/RPi2/options index 42220046c7..873ccef8f5 100644 --- a/projects/RPi2/options +++ b/projects/RPi2/options @@ -136,4 +136,4 @@ # for a list of additinoal drivers see packages/linux-drivers # Space separated list is supported, # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" - ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS media_build" From 6f18e53ce7ff92966835a9578df0dc68929bdf2a Mon Sep 17 00:00:00 2001 From: cvh Date: Thu, 5 Jan 2017 12:41:41 +0100 Subject: [PATCH 5/6] projects/RPi/options: add media_build --- projects/RPi/options | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/RPi/options b/projects/RPi/options index 6570a08f17..97b38d543d 100644 --- a/projects/RPi/options +++ b/projects/RPi/options @@ -140,4 +140,4 @@ # for a list of additinoal drivers see packages/linux-drivers # Space separated list is supported, # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" - ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS media_build" From 6e20418ed5dd4dda1e1f68807e570c203588d62f Mon Sep 17 00:00:00 2001 From: cvh Date: Thu, 5 Jan 2017 12:41:49 +0100 Subject: [PATCH 6/6] projects/Generic/options: add media_build --- projects/Generic/options | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/Generic/options b/projects/Generic/options index 3618bc2fba..82dc2622ce 100644 --- a/projects/Generic/options +++ b/projects/Generic/options @@ -85,4 +85,4 @@ # for a list of additinoal drivers see packages/linux-drivers # Space separated list is supported, # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" - ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS bcm_sta" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS bcm_sta media_build"