Posts by cayoenrique

    Wao I did put many hours on this. Still swimming against current. Getting not where yet.

    I have run the Debian Arm emulation. Have not set top network yet. To setup please use

    Oscam CPU target emulation using qemu in Ubuntu. as reference. Almost all is the same . Create your $HOME/bin. Place

    • $HOME/bin/host-network-setup.sh

    But now we do not use the malta script instead we will use a new one for ARM. It is attached.

    • $HOME/bin/start-versatile-instance.sh
    • create a new dir
    • mkdir $HOME/bin/arm
    • mkdir $HOME/bin/arm/versatile

    Save your Arm Debian files

    • $HOME/bin/arm/versatile/initrd.img-3.2.0-4-versatile
    • $HOME/bin/arm/versatile/vmlinuz-3.2.0-4-versatile
    • $HOME/bin/arm/versatile/debian_wheezy_armel_standard.qcow2

    You need to open your drive: debian_wheezy_armel_standard.qcow2 and save the oscam binaries

    • mkdir $HOME/bin/arm/versatile/mnt
    • sudo modprobe nbd max_part=8
    • sudo qemu-nbd -c /dev/nbd0 $HOME/bin/arm/versatile/debian_wheezy_armel_standard.qcow2
    • sudo mount /dev/nbd0p1 mnt

    Note this file system do open as "/" in Debian. So $HOME/bin/arm/versatile/mnt = / in Debian.

    Now get the files needed from the attachment home.tar.xz. And copy them to /home/user/oscam ...

    • sudo umount mnt
    • sudo qemu-nbd -d /dev/nbd0p1

    Press special attention. This one create the necesary devices in /dev/nd0-8

    • sudo modprobe nbd max_part=8

    This one translate qcow2 image format to Ubuntu system

    • sudo qemu-nbd -c /dev/nbd0 $HOME/bin/arm/versatile/debian_wheezy_armel_standard.qcow2


    ***See now how we do the mount and umount with the handler nbdp1 instead of the qcow2. As the handler take to job to translate qcow2.


    After the umount, the qcow2 image still attached to the handler. So we need to delete that

    • sudo qemu-nbd -d /dev/nbd0p1

    Now our qcow2 image is free for us to use. And files where saved.

    Now we only need to call quemu with

    • $HOME/bin/start-versatile-instance.sh

    After about 1.5 minute you will get:

    Yes user = user

    user password = user

    root = root

    root password = root.


    Enjoy



    A none working oscam is at /home/user/oscam/oscam

    Quote
    Linux version 3.18.24_hi3798cv2x (hychoi@hychoi-desktop) (gcc version 4.9.2 20140904 (prerelease) (gcc-4.9.2 + glibc-2.22 (Build by czyong) Tue Oct 27 16:32:03 CST 2015) ) #7 SMP Mon Jul 10 16:07:01 KST 2017Nice.

    I had spent a lot of time today. I did saw the Linux images that where base on Debian. I was expecting Debian will be the kernel use in android. Now you confirm and gave the kernel Linux version 3.18.24.


    And after ours searching for an image I think we can use the following tutorial to get images working. So here is next steps to do. Read tutorial, download next 3 files.

    Debian on an emulated ARM machine

    _https://www.aurel32.net/info/debian_arm_qemu.php



    In particular I am downloading

    _https://people.debian.org/~aurel32/qemu/armel/initrd.img-3.2.0-4-versatile 2.5M

    _https://people.debian.org/~aurel32/qemu/armel/vmlinuz-3.2.0-4-versatile 1.3M

    _https://people.debian.org/~aurel32/qemu/armel/debian_wheezy_armel_standard.qcow2 218M


    Later if I can I will try download

    _https://people.debian.org/~aurel32/qemu/armel/debian_wheezy_armel_desktop.qcow2 1.7G


    I hope to be able to have a workable Debian using

    Code
    qemu-system-arm -M versatilepb -kernel vmlinuz-3.2.0-4-versatile -initrd initrd.img-3.2.0-4-versatile -hda debian_wheezy_armel_standard.qcow2 -append "root=/dev/sda1 console=ttyAMA0" -m 256

    and I need to add the bridges to have network working.


    Will download

    _https://github.com/dizzdizzy/HiOSCAM/tree/master/u5sdk

    and try to compile the oscam image to test qemu. I know that is an old oscam. Will build from there.



    PD: Also this two links seems very interesting:

    _https://github.com/96boards-poplar/Documentation/blob/master/debian/debian_build_instructions.md#flash-images-onto-the-poplar-board-emmc

    _http://snapshots.linaro.org/96boards/poplar/linaro/aosp/


    See you latter.

    What I been gather so far:


    I did received some off forum/manufactuer info by PM. In general it claim sources for building are at:

    _https://github.com/dizzdizzy/HiOSCAM


    This is very interesting product as they seems to post openly the sources. I do not know if they are good and complete but still an intersting product to me. I wonder how good/sensitive/modes the tuners are and the cost of this device.


    Going back to objective, in general posted info of a guy who try to patch github sources said:

    Quote

    I've been able to add tandberg to the oscam Android. But due to the old source from the github link, I can't patch for the powervu.


    I then use the latest svn source from oscam development server (r11425), but still manage to get the dvbapi work as on the Enigma2. There's still error on decoding the audio and video even the ecm has been found by the emu.


    Anyway, thank you for the link.

    Bud sadly that guy did not said what vesrion of android 7.1 he did use.


    DANNYPS4 said he has install android 7.1 and Enigma 2 OpenATV. I asume in dual boot. And that even when he can have Enigma 2 OpenATV, he do have a preference for Android. That is why we are here.


    1rst problem in github I do not see sources for android 7.1. In git hub we nan find sources for

    android9-gcc4.7-toolchain

    android9-gcc4.8-toolchain

    But the make-u5.sh point to

    Code
    HISILICON_TOOLCHAIN=$OSCAM_PATH/arm-histbv310-linux/bin
    ANDROID_TOOLCHAIN=$OSCAM_PATH/android9-gcc4.8-toolchain/bin

    And as a few had said this old oscam compile my guess is that the toolchain is good any way for android 7.1. We still need toverify this our self.



    DANNYPS4 provided me with this Hardware info:

    Code
    CPU: Hisilicon Hi3798C V200 quad core Cortex A53 processor + multi-core ARM Mali-T720 processor
    Android 7.1
    sdk: https://github.com/dizzdizzy/HiOSCAM/tree/master/u5sdk


    What you need to know.

    Old oscam / tvheadend used to share single key / all encrpted pids. Our friend joeuser some time ago created patches to allow the used of multple keys for various audio pids in pvu. Now this days all had adopted this new thing in their code. But I bet you this receiver never got this patch. if you create a new oscam and do not patch and recompile tvheadend you get audio problems at least. My best guess is that this had been the problem in the past with the people that tryied. So keep this in mind, we may need to reconpile a new version of tvheadend.


    Now what next?


    About me.

    1rst lets start saying that I am no expert. But like to play. Sadly I have no harware to try it. I the need to try to see if I can find or build an image to run under qemu to emulate under Ubuntu. So if any can sugest where I can find a Cortex A53 processor image to be used in qemu please let me know.


    Lets start asking for more info. Some of this commads may not work. Just C&P to a File.txt what you get. Please open ssh terminal and do


    uname -a


    lscpu

    /proc/cpuinfo

    cat /proc/cpuinfo | grep 'core id'



    df -h

    mount



    cat /proc/version

    dmesg | grep Linux


    lsblk

    lsusb

    lspci

    lshw

    lshw -short



    ldd --version

    ldd /usr/bin/touch


    whereis libc.so

    this will produce a address ( ex /lib/libc.so), the use the addres with next like in


    objdump -p /lib/libc.so

    /lib/libc.so --version

    When asking for help better to give all info.


    Lets leave this tread as a general tutorial. Lets use one of the few post I found on this. Guess lets use:


    So that was I guess february 2018. Please update me there on your findings.

    2 OSCAM 1 Set Top Box, how???


    I am no expert but willing to help you. Now I need more info.

    Who own that github _https://github.com/dizzdizzy/HiOSCAM. What makes you think it is official

    If that is official and there is problem with oscam why there is no post about it?

    From what I see the github explained how to build!!


    Please send me a PM with out of this forum info like:

    • main forum of receiver
    • any other intent to make oscam for this taht is not on this forum.


    Please post about your skills.

    Do own PC with Ubuntu?

    How are your skill in: Linux, Android, C, Programming, compiling.

    Do you know how to access ssh Linux kernel in a Android?

    Is your device rooted?

    Is your device boot unlock?

    What image do you run now.?

    What other images you now can be used?


    Now I really need to know about CPU/Kernel/os version and in particular C Libs installed. So that we can identify the best tool-chain matching you hardware/software.


    Any other info you think will help.


    PLEASE again do not post about this here. Use you own Thread.

    2 OSCAM 1 Set Top Box, how???

    I will be waiting your response.


    To others, same suggestion. You can post a request like this here. But lets move on quickly to your own request/need on personal thread. This way we keep all nice and clean Thanks

    You can do all this none sense handwork to run a oscam mipsel server and it will work. BUT this is to hard. Why do it if you can just run and oscam x86 version natively in Ubuntu.


    Your answer is in 1rst post.


    So what is all this thread about?. You can use this method to test any variety of oscam version you build for other CPU/OS. All test done not with actual hardware but simulating the hardware in your own Ubuntu PC. Hope this explain a little more.



    See ansample where it may help:

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


    Our friend s3n0 ask for help. But I guess no one has his own router so he did not got his expected simple easy answer. Or at least some one that can offer him a working oscam version for his "MediaTek MT7621" mipsel CPU runing "Linux LEDE 4.4.92" OS. All the offered oscam bin did not work for him as they where not compatible with his CPU/OS version.


    Now Let me clarify what I said on that thread. That thread was answered as we could do best. And in fact mcsshare did a wonderful explanation on how to build oscam our self. Thanks again.

    Part#6


    Last time we had a working malta image running in qemu. Lets start again. Open a terminal:

    • #start-malta-instance.sh

    But wait until you see

    "[ 19.907046] pcnet32 0000:00:0b.0 eth0: link up”

    Now you can pres [ENTER] and you will see the LEDE Banner.


    Lets see what is in /root

    • #ls /root

    Nothing, Lets check our unfinished Network

    • #ifconfig

    You will see ONLY etho & lo. You have missing bridges so no REAL network access. But a fake one.

    • #ip route

    root@LEDE:/# ip route

    default via 10.0.2.2 dev eth0 src 10.0.2.15

    10.0.2.0/24 dev eth0 scope link src 10.0.2.15

    10.0.2.2 dev eth0 scope link src 10.0.2.15


    Lets ping google dns and it will not show

    • #ping 8.8.8.8 -c 2

    Now Lets bring up the network. First we need to mount our hardisk. I have not been able to do it automatically.

    • #mount /dev/sda -t ext4 /root

    Lets see if we see our files now

    • #ls /root

    There we go now we see our files

    root@LEDE:/# ls /root

    lost+found openwrt-wan-setup.sh oscam


    Now lets bring up the bridges and the network.

    • #/root/openwrt-wan-setup.sh

    root@LEDE:/# /root/openwrt-wan-setup.sh

    'radio0' is disabled

    'radio1' is disabled

    'radio0' is disabled

    'radio1' is disabled


    The warning errors on radios, is telling you that wireless have not been setup. But never mind as it is an emulation and in fact it does not have a wireless!!!


    Now lest see again our new network.

    • #ifconfig

    You will see something like this

    OpenWrt router Lan address still as 192.168.1.1. But beware on your host Ubuntu it will be at 192.168.7.1

    OpenWrt router Wan address is at 192.168.7.2. But beware on your host Ubuntu it will be at 192.168.1.1


    lets see if we got network, lets ping google DNS

    • #ping 8.8.8.8 -c 2

    This time we have access to network. We can ping our Host Ubuntu.

    • #ping 192.168.7.1 -c 2

    Now Open another terminal in Ubuntu. Lets ping from Ubuntu to router WAN side.

    • #ping 192.168.7.1 -c 2

    Lets ping from Ubuntu to router LAN side.

    • #ping 192.168.1.1 -c 2

    Now let ssh from Ubuntu to the router as if we where a client of the LAN router. To do shh we need first to change the password in the router. Go back to the qemu screen and do

    • #passwd[Enter]

    Change the password, I will use “admin” as password.

    Now go back to Ubuntu terminal and do

    • #ssh root@192.168.1.1

    And there you go no you can access your router direct from Ubuntu



    OSCAM:

    Lets make sure our x86 oscam is disabled

    • #systemctl status oscam
    • #systemctl stop oscam

    verify webif do not answer

    Now lets fire up oscam in router. Go back to qemu or do it from shh Ubuntu. lets see 1rst oscan help:

    • #/root/oscam/oscam --help

    Now that we know it runs, you can go to the config and adjust to your needs. If you feel more conftable you can quit qemu and mount the hdd image in ubuntu as we did. Make changes to /$HOME/bin/malta/mnt/oscam/config directory. Unmount and restart qemu. Then do

    • #/root/oscam/oscam

    Now go back to ubuntu explore and test if it has webif. It should not answer

    Now lets try instead with router address

    Yes this time respond from router. You may need to adjust your call to oscam as you have an oscam with new address.

    In the future, after installation and test: you will only have to do this to test oscam

    Open a terminal

    • #host-network-setup.sh
    • #start-malta-instance.sh
    • #mount /dev/sda -t ext4 /root
    • #/root/openwrt-wan-setup.sh
    • #/root/oscam/oscam

    And play the TV. Enjoy.

    This is it. I know Long to try. Now imaging the effort I put to write all this.

    Since nobody answered and thread is finish, I guess a moderator can move this thread to the tutorial section. Thanks.

    Part #5

    Ok lets continue.

    • #mkdir $HOME/bin/malta
    • #cd $HOME/bin/malta
    • #echo WAN_GATEWAY=\"$(ip route | awk '/default/ { print $3 }')\"
    • #echo WAN_IPADDRESS=\"$(ip route get 8.8.8.8 | awk ' { print $7 }')\"

    keep those handy in my case it shows:

    WAN_GATEWAY="192.168.3.1"

    WAN_IPADDRESS="192.168.3.52"


    • #leafpad openwrt-wan-setup.sh


    C&P the following

    Save and Exit.


    Now lest download the malta image:


    Please download also the files for oscam

    • #unzip -P oscam-patched root.zip


    rootfs:

    I do not know how to do this correctly so that we can have a permanent root files and any opkg upgrade we make!. Sorry. But we can set up mount to have disk point to our \root area. Now lets create our own sda disk, to store our files.


    creating a 516 mg unformatted disk image

    • #dd if=/dev/zero of=malta-le-root.ext4 bs=1M count=516

    Formatting the image to ext4

    • #mkfs.ext4 malta-le-root.ext4

    mounting the empty image

    • #sudo mount -o loop malta-le-root.ext4 mnt


    Now we can copy/setup all the files we need to have on /root. Please notice that when in LEDE/Openwrt user files are normally store at /root. But our Hardisk will be mounted like this “mount /dev/sda /root”. This means that even when in OpenWrt we use /root. In fact files in malta-le-root.ext4 are store at /. One more time all the files we store in $HOME/bin/malta/mnt/ will show later in Openwrt /root. I hope you go it.


    Lets copy the files:

    • #sudo cp openwrt-wan-setup.sh mnt
    • #sudo cp -R root/oscam mnt
    • #sudo chmod +x mnt/openwrt-wan-setup.sh
    • #sudo chmod +x mnt/oscam/oscam

    Lets unmount our disk image.

    • #sudo umount mnt


    Now Lets test it all. Reboot your PC. Then make sure you have network by using explore and navigating to google. Lets move to bin folder

    • #cd $HOME/bin

    Lets see how our Network Looks first.

    • #ifconfig

    Lets try to set up our bridges. NOTE: if you choose not to do PART#3 then You are required to do #sudo host-network-setup.sh

    • #host-network-setup.sh
    • #ifconfig

    You should see the new 2 interfaces “br-wan" & “br-lan".



    IMPORTAT: after you execute qemu without guy you feel you bcan not quit. To bring up qemu menu you need to do

    • #[CTRL]+[ALT]+a then c

    To get help write HELP [ENTER]

    Now to exit do

    • #q [Enter]


    Now lets start quemu with malta image

    • #start-malta-instance.sh

    Your router should start booting. You will see the console info from the kernel posted to the screen:

    "[ 0.000000] Linux version 4.9.58 (buildbot@builds) (gcc version 5.5.0 (LEDE GCC 5.5.0 r5217-098afa1) ) #0 SMP Tue Oct 31 02:43:10 2017“

    ***

    “Please press Enter to activate this console”


    But wait until you see

    "[ 19.907046] pcnet32 0000:00:0b.0 eth0: link up”

    Now you can pres [ENTER] and you will see the LEDE Banner.


    continue>>


    Part #4


    If you are here we assume you got your /etc/sudoers.d/qemu working or decided to postpone and then use sudo with the qemu script temporally. Now lets continue.


    • #sudo chown root:qemu /usr/local/etc/qemu/bridge.conf
    • #sudo chmod 0640 /usr/local/etc/qemu/bridge.conf



    Let me start by saying all this is not new nor created by me. I am only adding all pieces together to make it easy for you. Just search for “CCreate Linux bridge $BR_WAN $BR_LAN”


    Lets now create our scripts.


    WE will need 3 scripts. 1rst one set the bridges in Ubuntu. WE will need some info from our network. Make sure your network is up and working. So go to Explorer and open google to test it. Then just close it not needed anymore. if you get error latter you can always do ifconfig to get the manual info:

    • #ifconfig

    If you recalled from my example it show that my network is at

    See my example:

    enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

    • inet 192.168.3.02 netmask 255.255.255.0 broadcast 192.168.3.255
    • inet6 FFFF::FFFF:FFFF:FFFF:FFFF prefixlen 64 scopeid 0x20<link>
    • ether 00:00:00:00:00:01 txqueuelen 1000 (Ethernet)
    • RX packets 77458 bytes 109465919 (109.4 MB)
    • RX errors 0 dropped 0 overruns 0 frame 0
    • TX packets 52941 bytes 4531156 (4.5 MB)
    • TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
    • device interrupt 19 memory 0xf0500000-f0520000

    But more simple, keep this handy you will need to:

    • #echo WAN_GATEWAY=\"$(ip route | awk '/default/ { print $3 }')\"
    • #echo WAN_IPADDRESS=\"$(ip route get 8.8.8.8 | awk ' { print $7 }')\"
    • #echo IF_INET=\"$(ip route | awk '/default/ { print $5 }')\"


    • #cd $HOME\bin
    • #leafpad host-network-setup.sh


    C&P the following


    • #leafpad start-malta-instance.sh


    C&P the following

    Save and Exit.


    continue>>


    Part #3


    To prevent confusion, I am trying to take small explanation breaks from time to time. I know this is hard stuff. Last time we spoke about the router image and how it need a LAN and WAN network port. To day I will explain a qemu start cmd a little so you know what is needed and why we do things.


    Lets explained qemu cmd.


    qemu-system-mipsel

    • -M malta
    • -kernel $HOME/bin/malta/lede-malta-le-vmlinux-initramfs.elf
    • -append "root=/dev/sda”
    • -nographic
    • -m 128
    • -hda $HOME/bin/malta/malta-le-root.ext4
    • -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device pcnet,netdev=wan,mac="$MAC_WAN" \
    • -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device pcnet,netdev=lan,mac="$MAC_LAN"


    qemu-system-mipsel = main emulator for mipsel

    -M malta = tell it uses a malta image, I am not sure as why it is needed

    -kernel [file] = point to the file containing the kernel

    -append "root=/dev/sda” = a way for qemu to allow us to pass boot cmds to the kernel at boot time.

    -nographic = clearly we do not have a dedicated monitor hook to the emulation. nographic will forward then all stdio output to the qemu monitor screen.

    -m # = this tell how much ram memory we will emulate


    DISK’s: -hda [file] or -Disk etc.

    • = point to the file containing the disks to be added to /dev/*


    Network

    • -netdev bridge - in our case we use netdev bridge. We need to used twice because one is for “br-lan” & “br-wan”

    other usefull

    rootfs

    -initrd [file] - normally for linux bootloaders this is required. I may used it in the future.



    Why I tell you this? Well most of the time in Ubuntu we run programs as users. But there are stuff that setup the Linux environment that requires root access or “sudo”. In our example “sudo” is required to establish the bridge. But we do not want to give qemu root privileges!! As we quickly will think and worry that the images been tested will have root acces!!!! Wao what a dilemma!!!


    Many Ubuntu users uses virtio for this. I never had used it. More stuff to learn, but you can try. qemu suggest to use the “helper” it is in HELPER="/usr/local/libexec/qemu-bridge-helper". Then we give root access only to HELPER that is only uses to set network, and no other program or image have root access.


    IMPORTANT PLEASE DO NOT DO THIS IF YOU FEEL UNCONFORTABLE, I AM ONLY EXPLAINING HOW IS DONE. IF YOU BREAK /etc/sudoers.d/ YOU MAY NOT GET SUDO ACCES AGAIN!!! WILL REQUIRE SYSTEM REPAIR. SO WHEN DOING MODS TO THIS SYSTEM FILES WE NEED TO BE CAREFUL AND HAVE LINUX LIVE CD AROUND JUST IN CASE WE NEED TO REPAIR THIS. YOU BEEN WARNED PLEASE READ FOR MORE INFO

    _https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos

    _https://help.ubuntu.com/community/Sudoers


    So You can then ignore for now the following steps in this Part 3, until you feel confortable or others posted they done it. It is not that important. As you can overcome the problem by addinf sudo when you call the script. I will then proceed to explain anyway how to give "/usr/local/libexec/qemu-bridge-helper". For this we use /etc/sudoers.


    Setting up /etc/sudoers:

    IMPORTANT

    This is what I do prevent looking me out of sudo PLEASE use careful at your own risk. I will be leaving a Filmanager Opened and ready just in case sudo does not work again. I open a separate cmd and do:

    • #sudo pcmanfm

    A new File Manager opens but with root privileges. Please leave this open and untouched. Is here just in case we need it. After using visudo and exiting we my find “sudo" broken leaving us out. This will allow us to test we have not broken sudo and return to this elevated File manager all ready open and ready to do any repairs. So to test sudo, go an open a new terminal and run any program in sudo like “#sudo leafpad test.txt”. If sudo is broken it will complain. But as we have leave the previews File Manager we can still use it to delete old /etc/sudoers.d/qemu. Got it.


    1rst make sure you had read:

    _https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos

    • #sudo addgroup qemu
    • #sudo adduser $USER qemu
    • #sudo visudo -f /etc/sudoers.d/qemu


    It should have opened nano. Be careful. C & P the following 2 lines:

    Code
    Cmnd_Alias QEMU = /sbin/brctl, /sbin/ifconfig
    %qemu ALL=NOPASSWD: QEMU


    Now let exit and save: [ctrl]+X, y, [enter] *** I know you saw .tmp but it does not matters it does save the correct file .


    Now open a new terminal test sudo, for example

    • #sudo date


    if sudo is broken please delete /etc/sudoers.d/qemu

    And test that sudo works again. Then retry to edit sudo visudo -f /etc/sudoers.d/qemu


    continue >>


    Part2

    Qemu:

    Please read wiki to inform you what is qemu.


    For the emulation we use qemu. Most people just do “apt install qemu”. But that is trouble. As some of new images available will not execute correctly as the version install is old 2.11!! Instead we need to compile the latest 3.0. You can get info:

    • _https://en.wikipedia.org/wiki/QEMU
    • _https://wiki.qemu.org/
    • _https://www.qemu.org/



    • #mkdir $HOME/workspace/qemu
    • #cd $HOME/workspace/qemu
    • #sudo apt-get install libpixman-1-dev libfdt-dev zlib1g-dev libglib2.0-dev libsdl-dev
    • #wget https://download.qemu.org/qemu-3.0.0.tar.xz
    • #tar xvJf qemu-3.0.0.tar.xz
    • #cd qemu-3.0.0
    • #./configure --target-list=mipsel-softmmu
    • #make -j3
    • #sudo make install


    note: I suggest you do

    • #./configure --target-list=mipsel-softmmu

    this is the fastest build ONLY for mipsel. But if you what it all then do

    • #./configure



    Now Trial and error corrections. After many hours of test I found we need to create some more manual setup.

    • #echo "allow br-lan" > $HOME/workspace/qemu/bridge.conf
    • #echo "allow br-wan" >> $HOME/workspace/qemu/bridge.conf
    • #sudo mkdir /usr/local/etc/qemu
    • #sudo cp $HOME/workspace/qemu/bridge.conf /usr/local/etc/qemu/bridge.conf
    • #sudo chown $USER:$USER -R /usr/local/etc/qemu
    • #sudo chmod u+s /usr/local/libexec/qemu-bridge-helper



    Now let me make a small explanation on br-lan & br-wan. And why we need to config qemu to allow this two.


    Please do

    • #ifconfig


    See my example:

    enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

    inet 192.168.3.02 netmask 255.255.255.0 broadcast 192.168.3.255

    inet6 FFFF::FFFF:FFFF:FFFF:FFFF prefixlen 64 scopeid 0x20<link>

    ether 00:00:00:00:00:01 txqueuelen 1000 (Ethernet)

    RX packets 77458 bytes 109465919 (109.4 MB)

    RX errors 0 dropped 0 overruns 0 frame 0

    TX packets 52941 bytes 4531156 (4.5 MB)

    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    device interrupt 19 memory 0xf0500000-f0520000


    lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536

    inet 127.0.0.1 netmask 255.0.0.0

    inet6 ::1 prefixlen 128 scopeid 0x10<host>

    loop txqueuelen 1000 (Local Loopback)

    RX packets 2387 bytes 149460 (149.4 KB)

    RX errors 0 dropped 0 overruns 0 frame 0

    TX packets 2387 bytes 149460 (149.4 KB)

    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


    I have two REAL Network Devices that have a nickname, in my example “lo” the loop and "enp0s25“ an Ethernet Port. If you have Wifi then it may be a third.


    Now normally one of them have Internet access. We will need to share this access with the image running inside qemu. So that the mipsel oscam can communicate with your VLC and tuni8g front-end. I am sure you understand this. Now we are emulating/visualizing a Router. A router have at least two side or Ports. Normally Called WAN and LAN. Its is tru WAN that the Router Talk to the WEB. It is tru the LAN that the Router share that connection with the PC/phone/printers or Users. But we want to bridge our Internet Access in the Ubuntu PC. To do that we create to new Virtual Network Devices and bridge them that we are going to call “br-lan” & “br-wan”. In the future when we do ifconfig we will see this two new virtual devices. But ONLY when we Manually add them. To add/activate them we will use a script the we will call “host-network-setup.sh”



    continue>> we need to allow sudo access to the helper( I have this broken need to fix),

    we need to set up scripts to set bridges,call qemu

    and enable rootfs/hda, set network and finally call oscam inside emu emulation.

    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.