oscam
Contents
About
- OSCam
- Open Source Conditional Access Module
OSCam is based on the Streamboard mp-cardserver 0.9d by dukat and has been extended and worked on by many more since then.
Toolchain
Get target architecture
I guess the "l" is for "little endian (by default)".
It's a Broadcom BCM 7444S.
Install toolchain
1 aptitude install crossbuild-essential-armel
OScam source
1 sudo apt install subversion subversion-tools git
Dependencies
- PCSC
- Middleware to access a smart card using SCard API (PC/SC).
- SH4 STAPI support
- SH4 STAPI5 support
- Coolapi support
- AZBOX support
Compile libusb
1 aptitude install libudev-dev
When compiling from git, remember that you may have to run ./autogen.sh, ./bootstrap.sh or run the autotools creation utilities, in order to have configure and Makefile created for you. The difference between autogen.sh and bootstrap.sh is that the former will invoke configure with a set of default options, whereas the latter will not.
1 cd ~/workspace/software/vuplus
2 git clone https://github.com/libusb/libusb.git
3 cd ~/workspace/software/vuplus/libusb
4 ./autogen.sh ### WITH DEFAULTS
5 #./bootstrap.sh ### NO DEFAULTS
6 ./configure --help
7 ./configure \
8 --host="arm-linux-gnueabi" \
9 --prefix="$PWD/../install" \
10 --disable-udev
11 make -j$(nproc)
12 make install
13 export PKG_CONFIG_PATH="$PWD/install/lib/pkgconfig" && \
14 pkg-config --debug --cflags libusb-1.0
Compile libpcsc
Satisfy dependencies
1 aptitude install autoconf-archive flex
1 cd ~/workspace/software/vuplus
2 git clone https://salsa.debian.org/rousseau/PCSC.git
3 cd PCSC
4 ./bootstrap
5 ./configure --help
6
7 ### COMPILES
8 ### WITH LIBUSB SUPPORT WITH PATH
9 ./configure \
10 --host="arm-linux-gnueabi" \
11 --prefix="$PWD/install" \
12 --disable-libudev \
13 --disable-libsystemd \
14 --enable-libusb \
15 --enable-static \
16 LIBUSB_LIBS="-L../libusb/install/lib -lusb-1.0" \
17 LIBUSB_CFLAGS="-I../libusb/install/include/libusb-1.0"
18 make -j$(nproc)
19 make install
20
21 ### COMPILES
22 ### WITH LIBUSB SUPPORT WITH PKG_CONFIG
23 export PKG_CONFIG_PATH="$PWD/../install/lib/pkgconfig"
24 ./configure \
25 --host="arm-linux-gnueabi" \
26 --prefix="$PWD/../install" \
27 --disable-libudev \
28 --disable-libsystemd \
29 --enable-libusb \
30 --enable-static \
31 LIBUSB_LIBS="$(pkg-config --libs libusb-1.0)" \
32 LIBUSB_CFLAGS="$(pkg-config --cflags libusb-1.0)"
33 make -j$(nproc)
34 make install
35
36 ### COMPILES
37 ### WITHOUT LIBUSB SUPPORT
38 ./configure \
39 --host="arm-linux-gnueabi" \
40 --prefix="/usr/local" \
41 --disable-libudev \
42 --disable-libsystemd \
43 --disable-libusb \
44 --enable-static
45 make -j$(nproc)
When you are receiving an error like this one:
Adjust src/pcsc-wirecheck-main.c
Compile libssl/libcrypto
1 cd ~/workspace/software/vuplus
2 git clone https://github.com/openssl/openssl.git
3
4 cd ~/workspace/software/vuplus/openssl
5 ./Configure --help
6
7 ./Configure linux-armv4 \
8 --cross-compile-prefix="/usr/bin/arm-linux-gnueabi-" \
9 --prefix="$PWD/install"
10 make -j$(nproc)
11 make install
12
13
14 cd ~/workspace/software/vuplus/openssl
15 export PKG_CONFIG_PATH="$PWD/../install/lib/pkgconfig"
16 ./Configure --help
17 ./Configure linux-armv4 \
18 --cross-compile-prefix="/usr/bin/arm-linux-gnueabi-" \
19 --prefix="$PWD/../install"
20 make -j$(nproc)
21 make install
Compile OScam
1 apt-get install dialog
1 cd ~/workspace/software/vuplus
2 svn checkout https://svn.streamboard.tv/oscam/trunk oscam-svn
3 cd ~/workspace/software/vuplus/oscam-svn
4
5 ### LINK AGAINST OPENSSL, LIBPCSC AND LIBUSB-1.0
6 ### WITH PKG-CONFIG
7 export PKG_CONFIG_PATH="$PWD/../install/lib/pkgconfig"
8 ./config.sh --enable IPV6SUPPORT WITH_SSL
9 make static \
10 V=1 \
11 -j$(nproc) \
12 CONF_DIR=/etc \
13 USE_LIBUSB=1 \
14 LIBUSB_FLAGS="$(pkg-config --cflags libusb-1.0)" \
15 LIBUSB_LIB="$(pkg-config --libs libusb-1.0)" \
16 USE_PCSC=1 \
17 PCSC_FLAGS="$(pkg-config --cflags libpcsclite)" \
18 PCSC_LIB="$(pkg-config --libs libpcsclite)" \
19 USE_LIBCRYPTO=1 \
20 LIBCRYPTO_FLAGS="$(pkg-config --cflags libcrypto)" \
21 LIBCRYPTO_LIB="$(pkg-config --libs libcrypto)" \
22 USE_SSL=1 \
23 SSL_CFLAGS="$(pkg-config --cflags libssl)" \
24 SSL_LIB="$(pkg-config --libs libssl)" \
25 CROSS="arm-linux-gnueabi-" \
26 EXTRA_CFLAGS="-I$PWD../install/include" \
27 EXTRA_LIBS="-latomic"
This was a full compilation run with all dependencies, but it may also be possible to install the corresponding libs and headers on the target device and copy them to the machine and use them for (in this case even dynamic) linking. But these libs are like to be somewhat older.
Create a ipk package
Works with some embedded systems like vuplus, openwrt or ddwrt.
Dissecting a package
Show contents of package
Extract package
File types
1 package-name.ipk: Debian binary package (format 2.0), with data.tar.gz/ , data compression gz/
2 recon/control.tar.gz: gzip compressed data, last modified: Mon May 1 17:36:45 2017, from Unix, original size modulo 2^32 10240
3 recon/data.tar.gz: gzip compressed data, last modified: Mon May 1 17:36:45 2017, from Unix, original size modulo 2^32 1064960
4 recon/debian-binary: ASCII text
tar tzf control.tar.gz
tar tzf data.tar.gz
Unpack tar-files
debian-binary
1 2.0
Prepare the archive contents
Prepare directory structure
package/control/conffiles
package/control/control
1 Package: oscam-custom
2 Version: 1.20-svn11581
3 Description: Custom OScam
4 Architecture: vuultimo4k
5 Section: extra
6 Priority: optional
7 Maintainer: Tobias Stein <grand.ouvert@googlemail.com>
8 Homepage: http://www.streamboard.tv/
9 Depends: libc6(>=2.24-r0), libcrypto1.0.0(>=1.0.2j-r0.6), libssl1.0.0(>=1.0.2j-r0.6), openssl(>=1.0.2j-r0.6), pcsc-lite-lib(>=1.8.8-r4)
10 Source: http://www.streamboard.tv/svn/oscam/trunk
package/data/etc/oscam/oscam.conf
1 [global]
2 usrfile = /var/log/oscamuser.log
3 logfile = /var/log/oscam.log
4 maxlogsize = 20
5 nice = -1
6 #emmlogdir =
7
8 [cccam]
9 port = 12000
10 reshare = 0
11 version = 2.3.0
12
13 [dvbapi]
14 enabled = 1
15 au = 1
16 boxtype = dreambox
17 user = dvbapiau
18
19 [webif]
20 ###Default
21 #httpport = 8888
22 httpport = 83
23 httpallowed = 127.0.0.1,192.168.182.0-192.168.182.255
24 httpuser = oscam
25 httppwd = oscam
26 httphelplang = de
27 httprefresh = 10
28 httppollrefresh = 10
29 httphideidleclients = 0
30 httpreadonly = 0
31 httpsavefullcfg = 0
32
33 #[cs357x]
34 #port = 44357
35 ###und/oder
36
37 #[newcamd]
38 #Port = 34000@09C4:000000;34001@1830:003411
39 #key = 0102030405060708091011121314
40
package/data/etc/oscam/oscam.dvbapi
1 # dvbapi configuration
2 #
3 # types:
4 # P - Priority
5 # format:
6 # P: <caid>:[<provider>]:[<srvid>]:[<ecmpid>]
7 # I - Ignore
8 # format:
9 # I: <caid>:[<provider>]:[<srvid>]:[<ecmpid>]
10 # M - Map
11 # format:
12 # M: <caid>:[<provider>]:[<srvid>]:[<ecmpid>] <target caid>:[<target provider>]
13 # D - Delay
14 # format:
15 # D: <caid>:[<provider>]:[<srvid>]:[<ecmpid>] <delay (ms)>
16 #
17 #
18 #
19 #P: 0500:023800 # SRG 2.6
20 #P: 0D05 # ORF CW / EMU
21 #P: 0D95 # ORF ICE
22 #P: 1830:003411 # HD01
23 #P: 1843:003411 # HD02
24 #P: 1702 # S02
25 #P: 1833 # S02HD ohne Betatunnel
26 #P: 094C # V13
27 #P: 098C # V14
28
package/data/etc/oscam/oscam.server
1 # oscam.server generated automatically by Streamboard OSCAM 1.20-EMU-NFR SVN r8986
2 # Read more: http://www.streamboard.tv/svn/oscam/trunk/Distribution/doc/txt/oscam.server.txt
3
4 [reader]
5 label = reader0_sky_s02
6 enable = 0
7 protocol = internal
8 device = /dev/sci0
9 caid = 1702,1833
10 boxkey = 1122334455667788
11 detect = cd
12 mhz = 600
13 cardmhz = 600
14 group = 1
15 emmcache = 1,3,2
16
17 [reader]
18 label = reader0_sky_v13
19 enable = 0
20 protocol = internal
21 device = /dev/sci0
22 caid = 09C4
23 boxid = 596C3056
24 detect = cd
25 group = 1
26 emmcache = 1,3,2
27
28 [reader]
29 label = reader0_sky_v14
30 enable = 0
31 protocol = internal
32 device = /dev/sci0
33 caid = 098C
34 boxid = 12345678
35 detect = cd
36 group = 1
37 emmcache = 1,3,2
38
39 [reader]
40 label = reader0_hd+_hd01
41 enable = 0
42 protocol = internal
43 device = /dev/sci0
44 caid = 1830
45 boxkey = A7642F57BC96D37C
46 rsakey = BF358B5461863130686FC933FB541FFCED682F3680F09DBC1A23829FB3B2F766B9DD1BF3B3ECC9AD6661B753DCC3A9624156F9EB64E8168EF09E4D9C5CCA4DD5
47 detect = cd
48 mhz = 368
49 cardmhz = 368
50 group = 1
51 emmcache = 1,3,2
52
53 [reader]
54 label = reader0_hd+_hd02
55 enable = 0
56 protocol = internal
57 device = /dev/sci0
58 caid = 1843
59 boxkey = A7642F57BC96D37C
60 rsakey = BF358B5461863130686FC933FB541FFCED682F3680F09DBC1A23829FB3B2F766B9DD1BF3B3ECC9AD6661B753DCC3A9624156F9EB64E8168EF09E4D9C5CCA4DD5
61 detect = cd
62 mhz = 368
63 cardmhz = 368
64 group = 1
65 emmcache = 1,3,2
66
67 [reader]
68 label = reader0_srg_via
69 enable = 0
70 protocol = internal
71 device = /dev/sci0
72 caid = 0500
73 detect = cd
74 group = 1
75 emmcache = 1,3,2
76
77 [reader]
78 label = reader0_orf_0d95
79 enable = 0
80 protocol = internal
81 device = /dev/sci0
82 caid = 0D95
83 detect = cd
84 group = 1
85 emmcache = 1,3,2
86
87 [reader]
88 label = reader0_orf_0d05
89 enable = 0
90 protocol = internal
91 device = /dev/sci0
92 caid = 0D05
93 detect = cd
94 group = 1
95 emmcache = 1,3,2
96
97 [reader]
98 label = reader0_smarthd
99 enable = 0
100 protocol = internal
101 device = /dev/sci0
102 caid = 0B01
103 detect = cd
104 mhz = 500
105 cardmhz = 357
106 ident = 0B01:000000
107 group = 1
108 emmcache = 1,3,-1
109
110 [reader]
111 label = reader1_sky_s02
112 enable = 0
113 protocol = internal
114 device = /dev/sci1
115 caid = 1702,1833
116 boxkey = 1122334455667788
117 detect = cd
118 mhz = 600
119 cardmhz = 600
120 group = 2
121 emmcache = 1,3,2
122
123 [reader]
124 label = reader1_sky_v13
125 enable = 0
126 protocol = internal
127 device = /dev/sci1
128 caid = 09C4
129 boxid = 596C3056
130 detect = cd
131 group = 2
132 emmcache = 1,3,2
133
134 [reader]
135 label = reader1_sky_v14
136 enable = 0
137 protocol = internal
138 device = /dev/sci1
139 caid = 098C
140 boxid = 12345678
141 detect = cd
142 group = 2
143 emmcache = 1,3,2
144
145 [reader]
146 label = reader1_hd+_hd01
147 enable = 0
148 protocol = internal
149 device = /dev/sci1
150 caid = 1830
151 boxkey = A7642F57BC96D37C
152 rsakey = BF358B5461863130686FC933FB541FFCED682F3680F09DBC1A23829FB3B2F766B9DD1BF3B3ECC9AD6661B753DCC3A9624156F9EB64E8168EF09E4D9C5CCA4DD5
153 detect = cd
154 mhz = 368
155 cardmhz = 368
156 group = 2
157 emmcache = 1,3,2
158
159 [reader]
160 label = reader1_hd+_hd02
161 enable = 0
162 protocol = internal
163 device = /dev/sci1
164 caid = 1843
165 boxkey = A7642F57BC96D37C
166 rsakey = BF358B5461863130686FC933FB541FFCED682F3680F09DBC1A23829FB3B2F766B9DD1BF3B3ECC9AD6661B753DCC3A9624156F9EB64E8168EF09E4D9C5CCA4DD5
167 detect = cd
168 mhz = 368
169 cardmhz = 368
170 group = 2
171 emmcache = 1,3,2
172
173 [reader]
174 label = reader1_srg_via
175 enable = 0
176 protocol = internal
177 device = /dev/sci1
178 caid = 0500
179 detect = cd
180 group = 2
181 emmcache = 1,3,2
182
183 [reader]
184 label = reader1_orf_0d95
185 enable = 0
186 protocol = internal
187 device = /dev/sci1
188 caid = 0D95
189 detect = cd
190 group = 2
191 emmcache = 1,3,2
192
193 [reader]
194 label = reader1_orf_0d05
195 enable = 0
196 protocol = internal
197 device = /dev/sci1
198 caid = 0D05
199 detect = cd
200 group = 2
201 emmcache = 1,3,2
202
203 [reader]
204 label = reader1_smarthd
205 enable = 0
206 protocol = internal
207 device = /dev/sci1
208 caid = 0B01
209 detect = cd
210 mhz = 500
211 cardmhz = 357
212 ident = 0B01:000000
213 group = 2
214 emmcache = 1,3,-1
215
216
217 [reader]
218 label = line_cccam
219 enable = 0
220 protocol = cccam
221 device = 192.168.0.11,12000
222 user = user
223 password = pass
224 inactivitytimeout = 30
225 fallback = 1
226 group = 3
227 cccversion = 2.3.0
228 ccckeepalive = 1
229
230 [reader]
231 label = line_newcamd
232 enable = 0
233 protocol = newcamd
234 device = 192.168.0.11,35000
235 key = 0102030405060708091011121314
236 user = user
237 password = password
238 fallback = 1
239 group = 4
240
241 #[reader]
242 #label = D09
243 #protocol = internal
244 #device = /dev/sci0
245 #rsakey = 8A..ohne umbruch & ohne leerzeichen..11
246 #boxkey = 66..ohne umbruch & ohne leerzeichen..7B
247 #autospeed = 1
248 #### bis SVN 9099 diese Einstellungen benutzen
249 ##mhz = 368
250 ##cardmhz = 368
251 #group = 1
252 #emmcache = 1,1,2
253
package/data/etc/oscam/oscam.user
package/data/etc/init.d/oscam-custom.sh
1 #!/bin/bash
2
3 EMUNAME="oscam_svn11581 1.20 11581"
4 BINARY="/usr/bin/oscam-1.20-svn11581"
5 BASENAME="$(basename "$BINARY")"
6
7 if [ "$1" == "start" ]; then
8 "$BINARY" -b -r 2 -c /etc/oscam
9 elif [ "$1" == "stop" ]; then
10 killall "$BASENAME"
11 elif [ "$1" == "kill" ]; then
12 killall -9 "$BASENAME"
13 elif [ "$1" == "status" ]; then
14 ps faux |grep oscam |grep -v grep
15 fi
package/data/etc/oscam_11581.emu
Set executable
1 chmod a+x package/data/etc/init.d/oscam-custom.sh
Build the package with ipk.sh
A small script to create a ipk archive
ipk.sh
1 #!/bin/bash
2
3 SELF="$(basename "$0")"
4
5 # Note that we use "$@" to let each command-line parameter expand to a
6 # separate word. The quotes around "$@" are essential!
7 # We need TEMP as the 'eval set --' would nuke the return value of getopt.
8 TEMP=$(getopt \
9 -o 'kpo:s:u' \
10 --long 'keep,out:,pack,src:,unpack' \
11 -n "$SELF" -- "$@")
12
13 if [ $? -ne 0 ]; then
14 echo 'Error parsing options. Exiting…' >&2
15 exit 1
16 fi
17
18 # Note the quotes around "$TEMP": they are essential!
19 eval set -- "$TEMP"
20 unset TEMP
21
22 while true; do
23 case "$1" in
24 '-k'|'--keep')
25 KEEP=true
26 shift
27 continue
28 ;;
29 '-o'|'--out')
30 OUT="$2"
31 shift 2
32 continue
33 ;;
34 '-p'|'--pack')
35 MODE="PACK"
36 shift
37 continue
38 ;;
39 '-s'|'--src')
40 SRC="$2"
41 shift 2
42 continue
43 ;;
44 '-u'|'--unpack')
45 MODE="UNPACK"
46 shift
47 continue
48 ;;
49 '--')
50 shift
51 break
52 ;;
53 *)
54 echo "Error: Unknown option '$1'" >&2
55 exit 1
56 ;;
57 esac
58 done
59
60 if [ "$MODE" = "PACK" ]; then
61 echo "MODE: pack"
62 fi
63
64 ### SANITY
65 if [ -d "$SRC" ]; then
66 cd "$SRC/.." || exit 1
67 elif [ -z "$SRC" ]; then
68 echo "Please specify a source directory. Exiting…"
69 exit 1
70 else
71 echo "Source directory '$SRC' does not exist. Exiting…"
72 exit 1
73 fi
74
75 if [ -z "$OUT" ]; then
76 echo "Please specify a output file. Exiting…"
77 exit 1
78 fi
79
80 declare -a STRUCTURE
81 STRUCTURE=( "debian-binary" "data.tar.gz" "control.tar.gz" )
82
83 echo "2.0" > "$SRC/debian-binary"
84 tar czf "$SRC/control.tar.gz" -C "$SRC/control" ./
85 tar czf "$SRC/data.tar.gz" -C "$SRC/data" ./
86 ar rDvs "$OUT" "${STRUCTURE[@]/#/$SRC/}"
87 if [ ! $KEEP ]; then
88 rm "${STRUCTURE[@]/#/$SRC/}"
89 #rm "data.tar.gz" "control.tar.gz"
90 fi
Set skript executable
Install the generated ipk
1 scp oscam-custom_1.20-svn11581_vuultimo4k.ipk vuplus:
2
3 opkg info oscam-custom_1.20-svn11581_vuultimo4k.ipk
4 Package: oscam-custom
5 Version: 1.20-svn11581
6 Depends: libc6 (>= 2.24-r0), libcrypto1.0.0 (>= 1.0.2j-r0.6), libssl1.0.0 (>= 1.0.2j-r0.6), openssl (>= 1.0.2j-r0.6), pcsc-lite-lib (>= 1.8.8-r4)
7 Status: unknown ok not-installed
8 Section: extra
9 Architecture: vuultimo4k
10 Maintainer: Tobias Stein <grand.ouvert@googlemail.com>
11 Source: http://www.streamboard.tv/svn/oscam/trunk
12 Description: Custom OScam
13
14 opkg install oscam-custom_1.20-svn11581_vuultimo4k.ipk
15 Installing oscam-custom (1.20) on root.
16 Existing conffile /etc/oscam/oscam.conf is different from the conffile in the new package.
17 The new conffile will be placed at /etc/oscam/oscam.conf-opkg.
18 Existing conffile /etc/oscam/oscam.server is different from the conffile in the new package.
19 The new conffile will be placed at /etc/oscam/oscam.server-opkg.
20 Configuring oscam-custom.
21
22 /etc/init.d/oscam-custom.sh start
23 /etc/init.d/oscam-custom.sh status
Enjoy.