public inbox for gentoo-vdr@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-vdr] shell script to compile tt-s2-6400 driver from andreas regel source tree
@ 2012-03-01 23:14 Martin Dummer
  0 siblings, 0 replies; only message in thread
From: Martin Dummer @ 2012-03-01 23:14 UTC (permalink / raw
  To: gentoo-vdr

[-- Attachment #1: Type: text/plain, Size: 176 bytes --]

use this script to compile drivers for technotrend s2-6400

use the script with a not-root-user, if compile is successful then the
modules will be installed with a "sudo" call

[-- Attachment #2: build_saa716x_only.sh_v4 --]
[-- Type: text/plain, Size: 4905 bytes --]

#!/bin/bash

HG_REP="http://powarman.dyndns.org/hgwebdir.cgi/v4l-dvb-saa716x/"

#Jun 03 18:21:32 2011
#REV_OPTS="-r 1d34d58f281c"

#Sun Aug 21 17:18:00 2011 +0200 (6 weeks ago)
#REV_OPTS="-r fbcf17e360ee"

#Sun, 06 Nov 2011 19:04:22 +0100 	Andreas Regel 	saa716x_ff: support correct TS mux setting for FPGA 1.10.
#REV_OPTS="-r 956dbeac0169"

#Mon, 24 Oct 2011 19:55:09 +0200 	Andreas Regel 	saa716x_ff: Allow to have osd device opened twice.
#REV_OPTS="-r d35cb1db5bb2"

#Mon, 24 Oct 2011 19:42:05 +0200 	Andreas Regel 	saa716x_ff: move firmware command interface code to separate file.
#REV_OPTS="-r 491683c27d90"

#11 Oct 2011
#saa716x_ff: Fix possible crash in IRQ handler.
#
#During loading or unloading the saa716x_ff module it could happen that
#saa716x->priv was accessed in the IRQ handler before being initialized
#or after the pointer was freed already.
#REV_OPTS="-r 159875070cab"


check_if_command_is_available() {
	type $1 >/dev/null 2>&1
	if [ $? -ne 0 ]; then
		echo "the necessary program \"$1\" was not found, stopping script now."
		exit 1
	fi
}

apply_OSD_RAW_CMD_patch_1() {
patch << EOF
--- saa716x_ff_main.c.orig      2011-06-02 13:44:47.663001005 +0200
+++ saa716x_ff_main.c   2011-06-02 13:50:16.608001176 +0200
@@ -49,6 +49,24 @@
 #include "stv090x.h"
 #include "isl6423.h"
 
+#if !defined OSD_RAW_CMD
+typedef struct osd_raw_cmd_s {
+    const void *cmd_data;
+    int cmd_len;
+    void *result_data;
+    int result_len;
+} osd_raw_cmd_t;
+
+typedef struct osd_raw_data_s {
+    const void *data_buffer;
+    int data_length;
+    int data_handle;
+} osd_raw_data_t;
+
+#define OSD_RAW_CMD            _IOWR('o', 162, osd_raw_cmd_t)
+#define OSD_RAW_DATA           _IOWR('o', 163, osd_raw_data_t)
+#endif
+
 unsigned int verbose;
 module_param(verbose, int, 0644);
 MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)");
EOF
}
apply_OSD_RAW_CMD_patch_2() {
patch << EOF
--- saa716x_ff_cmd.h.orig	2011-11-12 14:46:51.175700236 +0100
+++ saa716x_ff_cmd.h	2011-11-12 14:45:10.103702959 +0100
@@ -1,6 +1,24 @@
 #ifndef __SAA716x_FF_CMD_H
 #define __SAA716x_FF_CMD_H
 
+#if !defined OSD_RAW_CMD
+typedef struct osd_raw_cmd_s {
+    const void *cmd_data;
+    int cmd_len;
+    void *result_data;
+    int result_len;
+} osd_raw_cmd_t;
+
+typedef struct osd_raw_data_s {
+    const void *data_buffer;
+    int data_length;
+    int data_handle;
+} osd_raw_data_t;
+
+#define OSD_RAW_CMD            _IOWR('o', 162, osd_raw_cmd_t)
+#define OSD_RAW_DATA           _IOWR('o', 163, osd_raw_data_t)
+#endif
+
 extern int sti7109_cmd_init(struct sti7109_dev *sti7109);
 extern int sti7109_raw_cmd(struct sti7109_dev * sti7109,
 			   osd_raw_cmd_t * cmd);
EOF
}

pause() {
	echo "$*"
	echo "pause, press Enter to continue"
	read Anything
}



###
# MAIN
###




WORKDIR="$(dirname $0)/"

cd "$WORKDIR"
WORKDIR="$(pwd)/v4l-dvb-saa716x/"

echo "working dir: $WORKDIR"

SUBDIR="drivers/media/common/saa716x"

check_if_command_is_available sed
check_if_command_is_available patch
check_if_command_is_available hg
check_if_command_is_available make

if [ -n "$1" ]
then
	# use parameter $1 as kernel version
	KVERSION="$1"
else
	KVERSION=$(uname -r)
fi
KERNEL=/lib/modules/$KVERSION/
if [ ! -d "$KERNEL" ]
then
	echo "Kernel Version $KVERSION does not exist or has no proper directory $KERNEL"
	exit 1
fi

# check user id
if [ $(id -u) = 0 ]
then
	SUDO=""
	echo "Problems come up when root modifies the hg repo, regular users can't use it any more."
	echo "Better use a regular user account to compile this kernel module...."
	echo -n "Do you really want to continue? "
	read Answer
	if [ "$Answer" != "y" ]; then
		exit
	fi
else
	SUDO="sudo"
	echo "Use sudo to copy compiled modules to directory $KERNEL"
fi

echo "compile for kernel $KVERSION"
pause

echo "Download or update driver from hg repository"
set -e
set -x
if [ -d "$WORKDIR" ]; then
  cd "$WORKDIR"
  hg revert --all
  hg pull
  hg update $REV_OPTS
else
  hg clone $HG_REP "$WORKDIR"
  cd "$WORKDIR"
  hg update $REV_OPTS
fi

#Do you want to add patches? Do this here
cd "$WORKDIR"
#patch -p1 -i FILENAME
#patch -p1 -i FILENAME


#We have to add some special includes here
set -x
cd "$WORKDIR/linux/$SUBDIR"

echo "EXTRA_CFLAGS += -Idrivers/media/dvb/frontends/" >> Makefile
sed -i '1 i\#include <linux/version.h>' saa716x_ff_main.c \
saa716x_ff_ir.c

if [ ! -e saa716x_ff_cmd.h ] 
then
	apply_OSD_RAW_CMD_patch_1
else
	apply_OSD_RAW_CMD_patch_2
fi

#Clean driver, build driver

cd $KERNEL/source
make SUBDIRS="$WORKDIR/linux/$SUBDIR" clean
make SUBDIRS="$WORKDIR/linux/$SUBDIR" CONFIG_SAA716X_CORE=m CONFIG_DVB_SAA716X_FF=m

set +x

echo ""
echo "compile was successful, next is installing it..."
pause

set -x
[ -d $KERNEL/kernel/$SUBDIR ] || $SUDO mkdir -p $KERNEL/kernel/$SUBDIR
$SUDO rm -f $KERNEL/kernel/$SUBDIR/*.ko
$SUDO mv $WORKDIR/linux/$SUBDIR/*.ko $KERNEL/kernel/$SUBDIR/

$SUDO depmod -a $KVERSION


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-03-02  0:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-01 23:14 [gentoo-vdr] shell script to compile tt-s2-6400 driver from andreas regel source tree Martin Dummer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox