Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

ebuild for avermedia-a828 usb adapter kernel driver

  • Loading branch information...
commit c8c8999fc9db6ac3d7590eb50f83479528499ee0 1 parent ca72929
Alex Alexander authored April 05, 2011
73  licenses/AVerMediaLinuxDriver
... ...
@@ -0,0 +1,73 @@
  1
+
  2
+AVerMedia TECHNOLOGIES, Inc.
  3
+AVerMedia Linux Driver License Agreement
  4
+
  5
+ 
  6
+
  7
+IMPORTANT: This AVerMeida Linux Driver is supplied to you by
  8
+AVerMedia TECHNOLOGIES, Inc. ("AVerMedia") in consideration 
  9
+of your agreement to the following terms, and your use, installation, 
  10
+modification or redistribution of this AVerMedia Linux Driver 
  11
+constitutes acceptance of these terms. If you do not agree with 
  12
+these terms, please do not use, install, modify or redistribute 
  13
+this AVerMedia Linux Driver.
  14
+
  15
+1. License. Any driver sources, binaries, utilities, documentation 
  16
+and other materials accompanying this License, whether on disk, 
  17
+print or electronic documentation, in read only memory, or any 
  18
+other media, (collectively, the "AVerMedia Linux Driver") are 
  19
+licensed, not sold, to you by AVerMedia for use only under the terms
  20
+of this License, and AVerMedia reserves all rights not expressly
  21
+granted to you. The rights granted herein are limited to AVerMedia's
  22
+intellectual property rights in the AVerMedia Linux Driver and do not
  23
+include any other patents or intellectual property rights. You own
  24
+the media on which the AVerMedia Linux Driver is recorded but AVerMedia
  25
+retains ownership of the AVerMedia Linux Driver itself and its
  26
+derivative works. The AVerMedia Linux Driver in this package and
  27
+any copies, modifications and derivative works which this License
  28
+authorizes you to make are subject to this License. The binaries
  29
+part of AVerMedia Linux Driver is ported from Windows driver and
  30
+is under some other NDA, so the original source code will not be
  31
+released.
  32
+
  33
+2. Permitted Uses and Restrictions. You may use, copy, redistribute
  34
+or install the original AVerMedia Linux Driver to test or demonstrate
  35
+the AVerMedia Linux Driver with AVerMedia's products. You may also
  36
+modify the released source code in order to improve the compatibilities,
  37
+operability and functionalities with AVerMedia's products as long as
  38
+this License in whole are remained and subsequently use, copy,
  39
+redistribute or install the derivative works. You have no right to
  40
+reverse engineer, decompile, disassemble the accompanying object files
  41
+through the released source code, nor to modify, incorporate into or
  42
+compile in combination with your own programs to operate with any
  43
+product other than from AVerMedia. Your rights under this License
  44
+will terminate automatically without notice from AVerMedia if you
  45
+fail to comply with any term(s) of this License.
  46
+
  47
+3. Disclaimer of Warranty. The AVerMedia Linux Driver may be "alpha",
  48
+"beta", "development", pre-release, untested, and/or not fully tested
  49
+and may contain errors that could cause failures or loss of data, be
  50
+incomplete or contain inaccuracies. YOU EXPRESSLY ACKNOWLEDGE AND AGREE
  51
+THAT USE OF THE AVERMEDIA LINUX DRIVER IS AT YOUR SOLE RISK AND THAT THE
  52
+ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY AND EFFORT
  53
+IS WITH YOU. THE AVERMEDIA LINUX DRIVER IS PROVIDED "AS IS" WITH ALL
  54
+FAULTS. THE USER ASSUMES TOTAL RESPONSIBILITY AND ALL RISKS ASSOCIATED
  55
+WITH USE OF THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, RISKS OF ANY
  56
+DEFECTS, INACCURACIES, PROGRAM ERRORS, DAMAGE TO OR LOSS OF DATA,
  57
+PROGRAMS OR EQUIPMENT, UNAVAILABILITY OR INTERRUPTION OF OPERATIONS.
  58
+AVERMEDIA DOES NOT MAKE, AND EXPRESSLY DISCLAIM, ANY EXPRESS OR IMPLIED
  59
+WARRANTIES OF ANY KIND WHATSOEVER, INCLUDING, WITHOUT LIMITATION,
  60
+ANY WARRANTIES OR FITNESS FOR A PARTICULAR PURPOSE, AND ANY WARRANTIES
  61
+OF TITLE OR NON-INFRINGEMENT. AVERMEDIA DOES NOT WARRANT THAT THE USE
  62
+OR OPERATION OF THE SOFTWARE WILL BE UNITERRUPTED OR ERROR FREE.
  63
+
  64
+4. Complete Agreement. This License constitutes the entire agreement
  65
+between the parties with respect to the use of the AVerMedia Linux
  66
+Driver licensed hereunder and supersedes all prior or contemporaneous
  67
+understandings regarding such subject matter. No amendment to or
  68
+modification of this License will be binding unless in writing and
  69
+signed by AVerMedia. Any translation of this License is done for
  70
+local requirements and in the event of a dispute between the English
  71
+and any non-English versions, the English version of this License
  72
+shall govern.
  73
+
5  media-video/avermedia-a828/Manifest
... ...
@@ -0,0 +1,5 @@
  1
+AUX avermedia-a828-2.6.37.patch 1900 RMD160 f920b0c8e46222b16eebb04a94f8837506f999eb SHA1 a2440fb11ff8fb096cc3317f719f4aa3b52cec54 SHA256 fe9a1c1e0245d34fcddec5b545b04209ba4d6d808843f36646352c13cfcc6861
  2
+AUX avermedia-a828.installer.patch 1305 RMD160 ff72693396d5f40d187acc84165edacd94c58d5d SHA1 6466404695b4ae99903d20031895c9f1d1957d8c SHA256 7fda60f68e210f7c7ebefc68c110408b33c01f3b339a6272856513c742977652
  3
+AUX install_prebuilt.sh 4276 RMD160 3aec631e52a7baf3a4e48933a9d116688d12a887 SHA1 07cb0c46d386b6785464ca7e25300a878b1df833 SHA256 e695882775d4ae1ffb43f49285ea8d0a38072165c1bc3c222ec56f3bf2bd5e74
  4
+DIST A828_Installer_x64_0.28-Beta_091125.zip 1617723 RMD160 12953528fdb9739a5e0a4c58b564ac88b36f0ff8 SHA1 8ab6b7fb37f549147ac060a19d591dff7d346430 SHA256 0c51f73347451c6a12c5973a7f76df496e79ce21a1daacd676ca5f117581a856
  5
+EBUILD avermedia-a828-0.28_beta.ebuild 1227 RMD160 d52a6adfe94a3e6b78f3325cde26b614aaaf21bf SHA1 2431c444381b27764a9314978659f001bbcf529d SHA256 24b2eb921276731cfef36f90406364217146d9ac8e0588de29f4da8f7ae96610
54  media-video/avermedia-a828/avermedia-a828-0.28_beta.ebuild
... ...
@@ -0,0 +1,54 @@
  1
+# Copyright 1999-2011 Gentoo Foundation
  2
+# Distributed under the terms of the GNU General Public License v2
  3
+# $Header: $
  4
+
  5
+EAPI=4
  6
+
  7
+inherit linux-mod
  8
+
  9
+DESCRIPTION="Kernel module for the Avermedia A828 USB Adapter"
  10
+HOMEPAGE="http://www.avermedia.com/"
  11
+SRC_URI="
  12
+	amd64? (
  13
+		http://www.avermedia.com/avertv/Support/DownloadCount.aspx?FDFId=3204 ->
  14
+			A828_Installer_x64_0.28-Beta_091125.zip
  15
+		)
  16
+	"
  17
+
  18
+LICENSE="AVerMediaLinuxDriver"
  19
+SLOT="0"
  20
+KEYWORDS="~amd64"
  21
+IUSE=""
  22
+
  23
+RESTRICT="mirror strip"
  24
+
  25
+DEPEND=""
  26
+RDEPEND="${DEPEND}"
  27
+
  28
+S="${WORKDIR}"/"A828_Installer_x64_0.28-Beta"
  29
+
  30
+pkg_setup() {
  31
+	MODULE_NAMES="
  32
+		averusba828(video:${S}/drv/installer/src:${S}/drv/installer/src)
  33
+		a828(video:${S}/drv/installer/src:${S}/drv/installer/src) 
  34
+	"
  35
+	BUILD_TARGETS="default"
  36
+	linux-mod_pkg_setup
  37
+}
  38
+
  39
+src_prepare() {
  40
+	# fix the installer
  41
+	epatch "${FILESDIR}"/"${PN}".installer.patch
  42
+
  43
+	# extract the thing
  44
+	./AVERMEDIA-Linux-x64-A828-0.28-beta.sh "${S}"/drv
  45
+
  46
+	cd drv/installer
  47
+	# fix driver
  48
+	# http://www.linuxtv.org/wiki/index.php/AVerMedia_A828
  49
+	kernel_is ge 2 6 37 && epatch "${FILESDIR}"/"${PN}"-2.6.37.patch
  50
+
  51
+	cp "${FILESDIR}"/install_prebuilt.sh .
  52
+	# moving prebuilt stuff to place
  53
+	./install_prebuilt.sh "${S}"/drv/installer $KV_DIR $KV_OUT_DIR
  54
+}
75  media-video/avermedia-a828/files/avermedia-a828-2.6.37.patch
... ...
@@ -0,0 +1,75 @@
  1
+diff -u -ur src-orig//aver/osdep.c src/aver/osdep.c
  2
+--- src-orig//aver/osdep.c	2011-04-05 12:25:38.705956015 +0300
  3
++++ src/aver/osdep.c	2011-04-05 12:28:14.779956016 +0300
  4
+@@ -432,11 +432,11 @@
  5
+ 	if( !tmp ) return -ENOMEM;
  6
+ 	
  7
+ 	if(st_Mutex == type) {
  8
+-		init_MUTEX(tmp);
  9
++		sema_init(tmp, 1);
  10
+ 		*sem = (pSemaphore) tmp;
  11
+ 	}
  12
+ 	else if(st_MutexLocked == type) {
  13
+-		init_MUTEX_LOCKED(tmp);
  14
++		sema_init(tmp, 0);
  15
+ 		*sem = (pSemaphore) tmp;
  16
+ 	}
  17
+ 	else {
  18
+@@ -1067,14 +1067,15 @@
  19
+ 	kfree(kref);
  20
+ }
  21
+ 
  22
++static DEFINE_MUTEX(dvbdev_mutex);
  23
+ void SysLockKernel()
  24
+ {
  25
+-	lock_kernel();
  26
++	mutex_lock(&dvbdev_mutex);
  27
+ }
  28
+ 
  29
+ void SysUnlockKernel()
  30
+ {
  31
+-	unlock_kernel();
  32
++	mutex_unlock(&dvbdev_mutex);
  33
+ }
  34
+ 
  35
+ unsigned long SysCopyToUser(void *to, const void *from, unsigned long n)
  36
+diff -u -ur src-orig//aver/osdep_th2.c src/aver/osdep_th2.c
  37
+--- src-orig//aver/osdep_th2.c	2011-04-05 12:25:38.705956015 +0300
  38
++++ src/aver/osdep_th2.c	2011-04-05 12:28:14.785956016 +0300
  39
+@@ -78,6 +78,7 @@
  40
+ #include <linux/smp_lock.h>
  41
+ #include <linux/sched.h> 
  42
+ #include "osdep_th2.h"
  43
++#include "osdep.h"
  44
+ 
  45
+ 
  46
+ int SysKernelThread(void (*func)(void *),void *thObj)
  47
+@@ -87,7 +88,7 @@
  48
+ 
  49
+ int SysSetThreadName(const char *name) 
  50
+ {
  51
+-        lock_kernel();
  52
++	SysLockKernel();
  53
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61)
  54
+         daemonize();
  55
+         sigfillset(&current->blocked);
  56
+@@ -97,7 +98,7 @@
  57
+         allow_signal(SIGTERM);
  58
+ #endif
  59
+         siginitsetinv(&current->blocked, sigmask(SIGKILL)|sigmask(SIGINT)|                        sigmask(SIGTERM));
  60
+-        unlock_kernel();
  61
++	SysUnlockKernel();
  62
+ 
  63
+ 	return 0;
  64
+ }
  65
+diff -u -ur src-orig//aver/osdep_v4l2.c src/aver/osdep_v4l2.c
  66
+--- src-orig//aver/osdep_v4l2.c	2011-04-05 12:25:38.705956015 +0300
  67
++++ src/aver/osdep_v4l2.c	2011-04-05 12:28:14.790956016 +0300
  68
+@@ -98,6 +98,7 @@
  69
+ #include "osdep_v4l2.h"
  70
+ 
  71
+ #include "debug.h"
  72
++#define VFL_TYPE_VTX    3
  73
+ 
  74
+ struct videodev_context
  75
+ {
53  media-video/avermedia-a828/files/avermedia-a828.installer.patch
... ...
@@ -0,0 +1,53 @@
  1
+--- AVERMEDIA-Linux-x64-A828-0.28-beta.sh.old	2011-04-05 12:19:38.794956016 +0300
  2
++++ AVERMEDIA-Linux-x64-A828-0.28-beta.sh	2011-04-05 12:24:07.952956016 +0300
  3
+@@ -2,8 +2,8 @@
  4
+ BASE=`(cd \`dirname $0\`; pwd)`
  5
+ THIS=`basename $0`
  6
+ END_OF_SCRIPT=115
  7
+-MD5SUM=17ef6d18d6dae4332807c192b25c9589
  8
+ TMPDIR=/tmp/avm-install
  9
++[[ -n $1 ]] && TMPDIR=$1
  10
+ 
  11
+ install_package()
  12
+ {
  13
+@@ -84,12 +84,12 @@
  14
+ cd $TMPDIR
  15
+ 
  16
+ # verify MD5 checksum
  17
+-CHECKSUM=`tail -n +${END_OF_SCRIPT} $BASE/$THIS | md5sum /dev/stdin | awk '{print $1}'`
  18
+-echo "Verifying archive integrity..."
  19
+-if [[ "$CHECKSUM" != "$MD5SUM" ]]; then
  20
+-	echo "Archive integrity check failed. This installer is corrupted."
  21
+-	exit
  22
+-fi
  23
++#CHECKSUM=`tail -n +${END_OF_SCRIPT} $BASE/$THIS | md5sum /dev/stdin | awk '{print $1}'`
  24
++#echo "Verifying archive integrity..."
  25
++#if [[ "$CHECKSUM" != "$MD5SUM" ]]; then
  26
++#	echo "Archive integrity check failed. This installer is corrupted."
  27
++#	exit
  28
++#fi
  29
+ 
  30
+ # extract archive and invoke installer
  31
+ echo "Extracting archive..."
  32
+@@ -100,15 +100,15 @@
  33
+ 	exit
  34
+ fi
  35
+ 
  36
+-echo "Running installer..."
  37
+-cd installer
  38
+-bash -i ./installer.sh
  39
++#echo "Running installer..."
  40
++#cd installer
  41
++#bash -i ./installer.sh
  42
+ 
  43
+ # clean up
  44
+-cd $BASE
  45
+-rm -rf $TMPDIR
  46
++#cd $BASE
  47
++#rm -rf $TMPDIR
  48
++echo "installed dir: $(pwd)"
  49
+ 
  50
+-clear
  51
+ exit
  52
+ 
  53
+ ==END_OF_SCRIPT==
146  media-video/avermedia-a828/files/install_prebuilt.sh
... ...
@@ -0,0 +1,146 @@
  1
+#!/bin/bash
  2
+#
  3
+# FUNCTION: generate postfix string for use in kernel-dependent object path
  4
+# IN: Arg1: path to kernel source
  5
+#     Arg2: path to kernel objects outputs (as in make O=/.../objdir)
  6
+# OUT: KVSTR KVVER
  7
+BASE=$1
  8
+cd $BASE
  9
+
  10
+log()
  11
+{
  12
+	echo -e $1;
  13
+}
  14
+
  15
+generate_kdep_string()
  16
+{
  17
+	local ksrc="$1"
  18
+	local kobj="$2"
  19
+
  20
+	# extract kernel versions from makefile in $ksrc
  21
+	local kversion=`grep -e '^VERSION' $ksrc/Makefile 2>/dev/null | awk '{print $3}'`
  22
+	local kpatchlevel=`grep -e '^PATCHLEVEL' $ksrc/Makefile 2>/dev/null | awk '{print $3}'`
  23
+	local ksublevel=`grep -e '^SUBLEVEL' $ksrc/Makefile 2>/dev/null | awk '{print $3}'`
  24
+
  25
+	KVVER="${kversion}.${kpatchlevel}.${ksublevel}"
  26
+
  27
+    #s016+s
  28
+    # retry extraction from makefile in $kobj
  29
+	if [[ "$kversion" != "2" || "$kpatchlevel" != "6" ]]; then
  30
+	    kversion=`grep -e '^VERSION' $kobj/Makefile 2>/dev/null | awk '{print $3}'`
  31
+	    kpatchlevel=`grep -e '^PATCHLEVEL' $kobj/Makefile 2>/dev/null | awk '{print $3}'`
  32
+	    ksublevel=`grep -e '^SUBLEVEL' $kobj/Makefile 2>/dev/null | awk '{print $3}'`
  33
+
  34
+	    KVVER="${kversion}.${kpatchlevel}.${ksublevel}"
  35
+    fi
  36
+    #s016+e
  37
+
  38
+	local regstr=""
  39
+	local memstr=""
  40
+
  41
+	# on x86_64 kernels, register parameter and high memory is no longer supported and we do not
  42
+	# need it in the version string.
  43
+	if grep -e '^CONFIG_X86_64=y' $kobj/.config >/dev/null 2>&1; then
  44
+		KVSTR="x64"
  45
+	else
  46
+	# on x86 kernels, register parameter and high memory support are deciding factors
  47
+	# in the version string.
  48
+
  49
+		# kernel 2.6.20 and later all use register parameter
  50
+		if [[ "$ksublevel" -ge "20" ]]; then
  51
+			regstr="REG"
  52
+		elif grep -e '^CONFIG_REGPARM=y' $kobj/.config >/dev/null 2>&1; then
  53
+			regstr="REG"
  54
+		else
  55
+			regstr=""
  56
+		fi
  57
+
  58
+		if grep -e '^CONFIG_HIGHMEM4G=y' $kobj/.config >/dev/null 2>&1; then
  59
+			memstr="4G"
  60
+		elif grep -e '^CONFIG_HIGHMEM64G=y' $kobj/.config >/dev/null 2>&1; then
  61
+			memstr="64G"
  62
+		#s005, if high memory support is disabled, use 4G prebuilt objects
  63
+		elif grep -e '^CONFIG_NOHIGHMEM=y' $kobj/.config >/dev/null 2>&1; then
  64
+			memstr="4G"
  65
+		else
  66
+			log "generate_kdep_string: unknown highmem setting"
  67
+		fi
  68
+
  69
+		KVSTR="${memstr}${regstr}"
  70
+	fi
  71
+
  72
+	log "generate_kdep_string: KVSTR=$KVSTR"
  73
+	log "generate_kdep_string: KVVER=$KVVER"
  74
+	export KVSTR KVVER
  75
+}
  76
+
  77
+select_kernel_best_match()
  78
+{
  79
+	local kver=`echo $KVVER | awk 'BEGIN{FS="."}{print $3}'`
  80
+	rm -f .kerns 
  81
+	# construct a list of kernel subversion
  82
+	#s001 for d in `find $BASE/src/kdep -type d -name '2.6.*' 2>/dev/null`; do
  83
+	for d in `find $BASE/kdep -type d -name '2.6.*' 2>/dev/null`; do
  84
+		echo `basename $d | awk 'BEGIN{FS="."}{print $3}'` >>.kerns 2>/dev/null
  85
+	done
  86
+
  87
+	local largest=`sort -g .kerns | tail -n 1 2>/dev/null`
  88
+	local smallest=`sort -g .kerns | head -n 1 2>/dev/null`
  89
+
  90
+	# find a best matching version to the running kernel
  91
+	if [ $kver -lt $smallest ]; then
  92
+		kver=$smallest
  93
+	elif [ $kver -gt $largest ]; then
  94
+		kver=$largest
  95
+	else 
  96
+		kver=$largest
  97
+		for k in `sort -g .kerns`; do
  98
+			if [ $kver -le $k ]; then
  99
+				kver=$k
  100
+				break
  101
+			fi
  102
+		done
  103
+	fi
  104
+	export KVVER="2.6.$kver"
  105
+}
  106
+
  107
+# Select the most appropriate pre-built objects to use on target system
  108
+# and copy them into src directory to proceed to build ko.
  109
+select_module()
  110
+{
  111
+	kernelsrc=$1
  112
+	kernelobj=$2
  113
+	# retrieve KVSTR and KVVER
  114
+	generate_kdep_string $kernelsrc $kernelobj
  115
+
  116
+	# copy prebuild files
  117
+	# s003, only copy if this directory exists
  118
+	if [ -e $BASE/prebuild/OBJ-$KVSTR ]; then
  119
+		\cp -rf $BASE/prebuild/OBJ-$KVSTR/* src/ >/dev/null 2>.err
  120
+        	if [[ "$?" != "0" ]]; then
  121
+                	dialog --backtitle "$BACKTITLE" --title \
  122
+			"ERROR: Failed to copy files" --textbox .err  20 $WIDTH
  123
+        	        clear
  124
+                	exit
  125
+	        fi									fi
  126
+
  127
+	# if we do not have binary for this kernel, try the best match
  128
+	if [ ! -e $BASE/kdep/$KVVER ]; then
  129
+		# return best match kernel in KVVER
  130
+		select_kernel_best_match
  131
+	fi
  132
+
  133
+	# copy kernel dependent prebuild files
  134
+	# s003, only copy if this directory exists
  135
+	if [ -e $BASE/kdep/$KVVER/OBJ-$KVSTR ]; then
  136
+		\cp -rf $BASE/kdep/$KVVER/OBJ-$KVSTR/* src/ >/dev/null 2>.err
  137
+        	if [[ "$?" != "0" ]]; then
  138
+                	dialog --backtitle "$BACKTITLE" --title \
  139
+			"ERROR: Failed to copy files" --textbox .err  20 $WIDTH
  140
+        	        clear
  141
+                	exit
  142
+	        fi
  143
+	fi
  144
+}
  145
+
  146
+select_module $2 $3
2  profiles/license_groups
@@ -2,4 +2,4 @@
2 2
 # Distributed under the terms of the GNU General Public License v2
3 3
 # $Header: /var/cvsroot/gentoo-x86/profiles/license_groups,v 1.53 2010/10/27 10:23:34 hanno Exp $
4 4
 
5  
-EULA TeamViewer
  5
+EULA TeamViewer AVerMediaLinuxDriver

0 notes on commit c8c8999

Please sign in to comment.
Something went wrong with that request. Please try again.