Posts by cayoenrique

    Part1

    Not enough time to do all I want. Then the little time I had spent it searching for more info. So to start rolling the ball I will change tactics. Instead of a Full Tested Tutorial, lets start little at a time.


    Objective:

    First lets start by saying that the main objective is not show you how to do oscam in your PC. For that there hundred of thread in this forum. Instead we will focus in how to prepare our PC to emulate other CPU targets, like Mips, Mipsel, ARM, etc.


    Prerequisites:

    So I assume that you know, have available and working - source of encrypted ts stream ( Linux receiver like Dreambox or generics, USB/PCI PC SAT device, and a front-end tuner program like TVHeadend.), and you have VLC or similar. Final that you have a PC with Linux. Ubuntu/Debian derivatives for the most part is the standard. I use Lubuntu 18.4 for this test. And in general I strongly suggest you have oscam running on your Linux PC. So you all ready learn how to deal with it and have all the necessary con fig files in your hand ready.


    Notes:

    All web link will be shown as _http instead of http to prevent hot links.

    I will place a # in front of required Linux command. like

    • #ls

    It is assume that $HOME points to your user area in Ubuntu. And $USER show user. So test it to verify correctness

    • #echo $HOME
    • #echo $USER

    On every session/boot you will start your date with

    • #sudo apt update


    Text Editor - I always used Lubuntu text editor called “leafpad” you can any you like, nano, vi, visudo etc. Just adjust my cmd line every time you see leafpad.


    File manager. Lubuntu default file manager is “pcmanfm” but if you are in Ubuntu you may use nautilus. Again adjust as needed. To get access to root file manger I do, #sudo pcmanfm. You may try #sudo nautilus or maybe #sudogtk nautilus.


    make. make compilation speed can be do it faster using ccache. Also if you have a PC/CPU with multi core. STOP all other process, close all windows and allow the PC to use ALL core to compile. then you add option “-j#” to make. Where # is the number of cores +1. So if you have an 8 core machine you use 9. or do “#make -j9“ to compile. So you will see that I post “#make -j9“ you need to adjust to your needs.



    Requirements for development:

    • #sudo apt update


    wget - Easy cmd downloads

    • #sudo apt install wget


    Compiling Tools

    • #sudo apt install build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl mercurial bzr ecj cvs unzip
    • #sudo apt install subversion dialog make gcc nano


    ccache - this improves speed when using repetitive “make” as it should store a cache of compiled files to prevent recompilation.

    • #sudo apt install ccache

    lets test it with

    • #ccache -s
    • #ccache -V


    bridge-utils net-tools - we need this to create network bridge between Ubuntu and qemu running image. Yes to provide network to oscam inside qemu.

    • #sudo apt install bridge-utils net-tools


    $HOME/bin - this directory is not automatically created by Ubuntu. But it is all ready setup to pick up and use if it is in the path available. So lets create it for future use

    • #mkdir $HOME/bin


    $HOME/workspace - to prevent having all files around lets have a single workspace area.

    • #mkdir $HOME/workspace


    continue>>

    1) I did try but it did not work. here is the output


    root@LEDE:~# ls -la /root/oscam

    drwxr-xr-x 6 root root 1024 Aug 19 17:52 .

    drwxr-xr-x 5 root root 1024 Aug 19 17:51 ..

    drwxrwxrwx 2 root root 1024 Aug 19 07:15 config

    -rwxrwxr-x 1 root root 1348312 Aug 18 05:18 oscam


    root@LEDE:~# ls -la /root/oscam/oscam

    -rwxrwxr-x 1 root root 1348312 Aug 18 05:18 /root/oscam/oscam

    root@LEDE:~# /root/oscam/oscam --help

    /bin/ash: /root/oscam/oscam: not found



    2) If I analyze this issue, both mipsel seems to be build for identical machines MIPS R3000

    Code
    #readelf -h oscam | grep MachineMachine:                           MIPS R3000


    3) The fact is that your build ask for more dependencies


    it seems we have installed

    0x00000001 (NEEDED) Shared library: [libpthread.so.0] ==============> libpthread - 1.1.16-1

    0x00000001 (NEEDED) Shared library: [libc.so.6] ==============> libc - 1.1.16-1


    Missing

    0x00000001 (NEEDED) Shared library: [libm.so.6]

    0x00000001 (NEEDED) Shared library: [libdl.so.2]

    0x00000001 (NEEDED) Shared library: [librt.so.1]



    4) Now what I think is the main problem is that our LEDE/Openwrt build is base on different GCC & GLIBC


    In LEDE oscam build


    #readelf -V oscam

    Version needs section '.gnu.version_r' contains 1 entry:

    Addr: 0x0000000000402198 Offset: 0x002198 Link: 6 (.dynstr)

    000000: Version: 1 File: libgcc_s.so.1 Cnt: 4

    0x0010: Name: GCC_3.4 Flags: none Version: 5

    0x0020: Name: GLIBC_2.0 Flags: none Version: 4

    0x0030: Name: GCC_4.2.0 Flags: none Version: 3

    0x0040: Name: GCC_3.0 Flags: none Version: 2



    In Dreambox oscam build


    Version needs section '.gnu.version_r' contains 2 entries:

    Addr: 0x0000000000408cb8 Offset: 0x008cb8 Link: 5 (.dynstr)

    000000: Version: 1 File: libpthread.so.0 Cnt: 4

    0x0010: Name: GLIBC_2.3.3 Flags: none Version: 8

    0x0020: Name: GLIBC_2.2 Flags: none Version: 6

    0x0030: Name: GLIBC_2.3.2 Flags: none Version: 4

    0x0040: Name: GLIBC_2.0 Flags: none Version: 3

    0x0050: Version: 1 File: libc.so.6 Cnt: 3

    0x0060: Name: GLIBC_2.3 Flags: none Version: 7

    0x0070: Name: GLIBC_2.2 Flags: none Version: 5

    0x0080: Name: GLIBC_2.0 Flags: none Version: 2



    5) installing missing dependencies

    Code
    opkg update
    opkg install libm
    opkg install libdl
    opkg install librt


    produce errors


    root@LEDE:~# opkg install libm

    Unknown package 'libm'.

    Collected errors:

    * opkg_install_cmd: Cannot install package libm.

    root@LEDE:~# opkg install libdl

    Unknown package 'libdl'.

    Collected errors:

    * opkg_install_cmd: Cannot install package libdl.

    root@LEDE:~# opkg install librt

    Installing librt (1.1.16-1) to root...

    Downloading http://downloads.lede-project.…_1.1.16-1_mipsel_24kc.ipk

    root@LEDE:~# /root/oscam/oscam -h

    /bin/ash: /root/oscam/oscam: not found



    See best practice is to find toolchain version use to buid our OS, so that most dependecies get satisfyed. And if needed we then install mising ones that match original build versions. But it is a nice experimenting, getting experience on this.

    Let me correct my self for what I am going to say 1rst, just to make it clear. oscam.zip posted in post 23 may work for many using LEDE/OpenWrt. Problem is not if mcsshare's oscam buid for Dreambox may work or not in other mipsel routers. I will expect it will work for a few people. But this thread objective is if it can work for

    1. Router : D-Link DIR-860L B1
    2. CPU: MediaTek MT7621 ver:1 eco:3
    3. LEDE v17 firmware: LEDE Reboot 17.01.4 r3560-79f57e422d


    So I do not have a D-Link DIR-860L B1 that do not allow me to test in real thing. Instead I am testing it by emulating a Mipsel CPU under quemu. But running in a a x64 Ubuntu PC. Go it!


    The closed firmware image of LEDE/OpenWrt image is base on



    Code
    Linux version 4.9.58 (buildbot@builds) (gcc version 5.5.0 (LEDE GCC 5.5.0 r5217-098afa1) )
    BusyBox v1.27.2 () built-in shell (ash)  
    (SNAPSHOT, r5218-f90f94d)


    Notice there still difference as I could not find exact Malta image match. s3n0 said his is


    Code
    Linux LEDE 4.4.92 #0 SMP Tue Oct 17 17:46:20 2017 mips GNU/Linux


    But I hope to hear from s3n0 in the future that my assumptions are correct. I will post my test result in next post.

    To be honest most of the time I watch TV using a Win7 HTTP, yes no Linux for that to simplify for the family. But when I am sick or lazy I do start my Ubuntu Server and used oscam. In this way I can watch TV in any Phone or Tablet. So in general my oscam needs/experience are very limited


    I have limited hijack this tread to learn from mcsshare . But please notice we are providing solutions to the objective of this tread request. Please forgime a few more questions.


    mcsshare Can you suggest how to pick the minimum config for make. So I guess Newcamd, and the basic emus like Powervu, Tanberg, Biss, etc, I guess just config fie can help me. But if possible please suggest any other important hint. Or even sources for your redesign. I am very thankful to you. Keep the good job. Admins please notice that we keep withing objectives of threas as smallest oscam build can help to run in limited LEDE/Openwr routers.

    This is like a joke. WE are providing solutions and he may not have time to use it.


    Now I did it becouse I wanted to test oscam under qemu emulation. So why not use a target that is in need here. By the way see my new thread at

    Oscam CPU target emulation using qemu in Ubuntu.


    Now 1rst thing. mcsshare THANK YOU. That is a nice Tutorial. I even follow it and tested just to see diference.


    Well the truth is that I am lazy and do not like to patch. So instead of that svn I use


    _https://github.com/oscam-emu/oscam-patched


    May not have the latest but it is already patched.




    As for oscam TARGET files In my case I place all of them in: /root/oscam + /root/oscam/config. This is because the limitations I have under emulation.

    I did add a password to the file as I originally intended to upload to a server.


    password: oscam-patched


    Tested for mipsel in malta. Hope it works for you.


    PD: user/pass and IPs are fake or generic. To comply with forum rules of not showing my real ones. But they work as tested.

    Oscam CPU target emulation using qemu in Ubuntu.


    To admins, I am posting in this area as I could not find any other appropriate area. Who knows then, maybe we should not be talking about this here!. In any case, feel free to move or delete any that you may feel is wrong. But please notice that this tool could help many as people with oscam knowledge could try to emulate to guess problem/solution.


    1) Objective, Qemu emulation to test OS/programs in hardware we do not have. Like android boxes or routers with weird CPUs. Or may be any of those generic arduinos


    For example take a look in:

    looking for oscam binary to LEDE 17 - OpenWRT based FW on router MIPS (D-Link)


    In that thread our friend s3n0 ask for help for a target router that maybe no one else has! So how can he get help?


    We all could emulate it in qemu, do a little test and share our findings. Well that sound easy, but it may not always work as advertise. But worth trying.


    2) I had use qemu in the past but never got the Sharing/Bridge network between Ubuntu and qemu. So I had not tested oscam yet as it requires network. Very soon will do.


    3) Just today I got a workable Bridge network between Ubuntu 18.4/qemu. Soon I will be posting a tutorial on how to set it your self, Just let me test oscam to make sure I do not hit a wall at the end.


    4) My test setup, I will next try to use Ubuntu running TVHeadEnd connected to a USB/PCSAT, Normally it will request/connect to oscam running in same Linux Ubuntu. And a simple play list is use with VLC to change channels.


    To emulate we will disable normal AMD x64 oscam in Ubuntu. We will still use, VLC, TVHeadend, USB/PCSAT. But Instead we will open a qemu emulation of a MIPSEL CPU router running Lede/Openwrt. In the emulation, we will install the appropriate mipsel version of oscam and expect it to answer VLC.by returning decoded TS stream.


    This is not new, possibly some one here has do it hundred of time. But I have not seen it posted. So hopefully I can do some test and post my results in the next days. See you soon.

    HE HE HE HE, strong words. I do not have to protect him, but he in fact was clear. He said he has little time, and only interested in a clear easy tutorial. Yes the quick solution as many others. In the other hand he did mention he knows how to do oscam in x86 PC. So he has done some work, only having issues with running on a router.


    But people do not be afraid of Linux. This was, is and still the future on many free programing solutions.


    And yes you are correct, "file location is important" and the many settings in oscam that can change from target to target. So maybe the submitted programs do work, just need a little twick.


    Now Me, in the other hand have some issues at home and this is a good way to distract my mind. In the PAST, I had never got a virtual mips/mipsel image in qemu sharing the network with HOST Ubuntu. So his problem remind me to try again. And if I learn to do it right, I can clearly play then with a oscam runing in a Virtual target "ramips-mt7621". There is no problem in sharing latter any results with him or any of you.


    Yes I guess I am freely working for him but it is just a distraction an learning experience for me. I did spent a few more hours, but still having issues sharing network in Ubuntu 18.04+qemu 3.0.0+lede-malta-le-vmlinux-initramfs.elf. I have not done any oscam work yet. I guess I will latter open a new thread to prevent continue hijacking this one.

    I understood you may not have time to continue. To SAD...


    Well I guess I can use your oscam problem as an excuse to put my self up to date.

    Wao... LEDE vs Opwnwrt! What a mess in the forum and wikis. Their internal division the re-merge got most of the old stuff lost so Google often just get you to dead links.


    Listen I did spent a good few hours last night. Just to find my self relearning a lot of stuff.


    I know I should had read this thread for second Time. You did post good info of your self, sorry.

    wifi-router with installed LEDE v17 firmware:

    LEDE Reboot 17.01.4 r3560-79f57e422d / LuCI lede-17.01 branch (git-17.290.79498-d3f0685)

    machine: D-Link DIR-860L B1


    And you did ask:

    Is there a complete tutorial how can I download and compile new Oscam in LEDE firmware for my MIPS router (ar7xx) ?


    PLEASE notice router is not of target "ar7xx" NOPE. Instead it is: "ramips/mt7621/"

    LEDE v17 firmware: LEDE Reboot 17.01.4

    machine: D-Link DIR-860L B1

    system type: MediaTek MT7621 ver:1 eco:3

    cpu model: MIPS 1004Kc V2.15

    isa: mips1 mips2 mips32r1 mips32r2



    I guess the close build I can find is in : _https://downloads.openwrt.org/

    firmware

    _http://archive.openwrt.org/releases/17.01.4/targets/ramips/mt7621/lede-17.01.4-ramips-mt7621-dir-860l-b1-squashfs-factory.bin


    SDK

    _http://archive.openwrt.org/releases/17.01.4/targets/ramips/mt7621/lede-sdk-17.01.4-ramips-mt7621_gcc-5.4.0_musl-1.1.16.Linux-x86_64.tar.xz

    _http://archive.openwrt.org/releases/17.01.4/targets/ramips/mt7621/lede-imagebuilder-17.01.4-ramips-mt7621.Linux-x86_64.tar.xz



    Now I do not have your Router model. Best I can do to play is use qemu or vmware to simulate OS in PC.


    So we need "malta" image

    Do to changes in LEDE/OpenWrt best we can find are in

    _http://archive.openwrt.org/snapshots/trunk/malta/generic/

    _https://downloads.openwrt.org/snapshots/targets/malta/le/



    In current version there is no malta le ONLY Big Endian!!! Weird. _https://downloads.openwrt.org/releases/18.06.0/targets/malta/be/ but this will not work.


    For now I am trying to establish a Virtual Image base on

    1) _https://downloads.openwrt.org/snapshots/targets/malta/le/


    2) And I will try to see if I can execute a copy of the real dir-860l-b1-squashfs-factory.bin but exported to a ext4 image to be use in Virtual machine, some time openwrt can in fact boot ignoring the missing hardware errors.


    Listen I know yous said you do not need help any more. But I will try to test anyway. If I get somewhere, I will post code and tutorial. I am doing it to refresh my self in this LEDE stuff.


    I know you mention you will like to use a sub reader. I do not have one. I can only make sure oscam boots and for instance decode powervu or tanberg.


    And to others reading I am doing nothing new. I am sure, this stuff have been discussed here a few times. It is just that i have not done it myself.

    @s3no


    About oscam building procedure. I guess How to build oscam was nicely explained in previous post. I have limited experience in oscam.

    About LEDE/Opemwrt. I bet you can find may tutorials on how to build binaries for LEDE or Opemwrt. Building ipk packages is not either a science.

    Now the problem here I guess is that you are asking just the easy solution here. You looking for an magic ipk that will resolved your need without any effort.

    But please notice this. Oscam is build for linux, you are asking help in a linux forum, LEDE/Openwrt are just embedded Linux OS. Therefore if you want to play you need to start learning Linux. Clearly a little at a time.


    * I had experience building binaries in openwrt in the past using Openwrt own tools. Never build for LEDE. If you still interested In doing it your self I can try to help you. Beware It will take time to learn, ask, answer and test. I have not post so lets see if I can use this as an excuse to have some post on my record.


    Now if you like my help lets start for saying:

    * Yes I have the time and desired to learn, please continue.

    * Letting us know what is your router model.

    * What is you experience in Linux and /or Lede, Had you build/compiled before any binary yourself before?

    * Do you have access to Ubuntu or any other Linux PC OS?



    -------------------------------------------------


    In the other hand if you are in a hurry, you can help yours self if instead of saying "I've already tried - not working in my case (LEDE v17.01 firmware)."

    Instead, Tell us more about what you did? What was the complete response of the Linux environment while trying to execute oscam?


    Now I am not a streamboard.tv user but reading at the links provided before I found interesting:

    _http://www.streamboard.tv/oscam/wiki/crosscompiling


    in particular see

    _http://www.streamboard.tv/oscam/wiki/crosscompiling#mipsel_ddwrt


    I guess best think to do myself is to see if I have time tonight and try to play myself with those tools. I guess I can learn with your own question too.