Posts by cayoenrique

    Even when I said I am gong step by step and not worrying if it do TV OK. Well lets make a change. I will like you send me your private config inside your box by PM. Well in this way if for any reazon you get TV then I guess you get luck and good for you.


    But most important then I place the oscam/tvheadend files in correct place as you have, use same user/pass and Network setup.

    This will result in less efort from your side as my emultion is 100% as your Real thing.


    What I need then:

    Your oscam config folder and its location.

    Your tvheadend location and a copy of your config. Go to webif by:

    Now at the top hit [About] tab

    olmost in the bottom you see the info mine a coy I build redas for example:

    Code
    Build: 0.0.0~unknown (2018-07-12T23:42:29-04:00) Toggle details


    Hit the last blue word where it say "Toggle Detais"

    C&P what it show and send it by PM mine for example reads



    In Ubuntu the folder config is at "$HOME/.hts" see it is hidden as it has a "." in front of the name.

    Now I have read around it may be at "/home/hts/.hts". In any case open a new normal terminal ( NO su).

    To find your user name

    • #echo $USER

    To find out your Home directory

    • #echo $HOME

    Now lest check a few possible locations

    • #ls -la $HOME/.hts
    • #ls -la $HOME/hts
    • #ls -la /home/hts/.hts
    • #ls -la /sdcard/.hts
    • #ls -la /sdcard/hts

    note adjust sdcard to you real sdcard location

    • cd /sdcard
    • su

    • service tvheadend stop
    • tar cvfp tvheadend.tar /home/hts/.hts

    You had created a tar file called tvheadend.tar in /sdcard

    Send me those by PM.

    Listen I am having trouble with this forum behavior. I guess I hate java script. So it keeps submitting my unfinished posts. I bet you did not read the whole edited post in post 21. I want to help you. But you need to stop trying to explained what YOU understand is the problem and what YOU understand is the Solution. No I am not upset. I need you to show me the fact not YOUR analysis.


    Here is what I am going to do I will kill wifi so that the forum scripts do not bather me. Lets see if that helps.

    I understood you just want to watch TV. So you just want your dbapi. hehehehe. But guess what! I am a week from that. Now tuneup or sync with me.

    So we need to do this step by step.

    • Need to know if my build ( any progam I make in simulation) do work inside your REAL box.
    • Need to know if your old oscam was removed and not creating any problem.
    • Need to know if you choose an appropriate area to work our linux kernel program running under Android. I sugested /sdcard/user
    • Need to know if my "NOT FINISHED static oscam build" execute and finds its configs. See we do not need dbapi. I do not care about that at the moment.

    So one more time tune with me, Need my help! Then ask what I need from you. I do not want to here about not been able to watch TV or DVBapi.


    Now if you want my help please do what is in post #21 part C.


    And one more time I am not upset nor I want you to be upset with me. So are we buddys or not.


    But I need answers to simple steps question so that I can understand where we are. I am sorry that I am ignoring your analysis. But Please keep with me an you will end up not only with a working oscam but with a valid toolchain to build your own oscam as you please, Now go an do your assignment.

    OK.
    Please get out of the easy people way of speak normally they ONLY say "...but it doe not work."


    I think I need more info to understand the problem. I need you to be more expressive in your answer. Treat me like a child. One thing is Logs reports. Another thing oscam build do not execute. Lets keep the issues apart.


    A)Lets start from explaining the original situation without any update.

    • My understanding is that you can watch tv. tvheadend webif works and oscam webif work. You can watch Tanberg and powerve encrypted.
    • But oscam build is old and I guess some of the new powervu channels do not work.

    b) What happen when you did use the oscams submited by other people.

    For exmaple you can say.

    oscam --help did not show anything ans top/ps program do not show it is working.

    or oscam do execute , i can see oscam webif, but logs reports some problems.


    C) Finally you try my solution.

    IMPORTANT:

    1. You have to remove original oscam. make sure webif does not workstion.
    2. "/sdcard" there are many posibilities, like /storage/sdcard/ etsc. But for my explanation I will use "/sdcard"


    Now you install my files. Clearly you do not install them in /home/user./ That is for the emulation in qemu. Instead for now you use your own sdcard. Lets say your Android Sdcard address is at: "/sdcard"

    1. create a folder call "user"
    2. Then you move files from home.tar.xz from /home/user to: /sdcard/user/ . See change home for sdcard.
    3. Now you need to edit oscam config and make sure adreses pointing to home now point to sdcard.
    4. edit /sdcard/user/oscam.sh do the same.

    make sure one more time oscam webif is not up and running as program may have a setup to reboot again if fail.

    Open a terminal

    • #su
    • #chmod +x /sdcard/user/oscam.sh
    • #chmod +x /sdcard/user/oscam/oscam
    • #cd /sdcard/user

    Now execute oscam help to check if it executes

    • #oscam/oscam --help

    Now you should see that the help shows. So lets test webif

    • #./oscam.sh or yuo can do #/sdcard/user/oscam.sh

    Now goto webif and check your config files one more time. You may need to ad one of a few keys for your sats.

    can you watch tv?

    How we doing?


    Now finally you go to logs and tell me the errors.


    See I spent f@$#% 15 minutes writing this,. You can spent more time writing the problem. By the way I am not upset I do like to help you. f@$#% is like a joke. Take your time. we have whole day or weeks ahead. Will wait for your response.

    Thanks for busybox. That was to have a REAL Statically build program that I can use to test my emulation. So we now my emulation works. But I do not need that any more, I am pretty sure I did a OSCAM that can run in your device.


    But that why have not you report the result!!! That is the main Objective of this thread. To have a recent oscam that can play in your device.


    Common download

    2 OSCAM 1 Set Top Box, how???

    from post 15 and tell me if it work!!!!!


    File: "home.tar.xz"


    I am waiting...... still waiting.... hehehehe I am joking.

    I will definitely will wait your response.

    If you are doing a test in wemu you need to mount your hdd like this


    • cd $HOME/bin/arm/versatile
    • 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

    Then you copy this files to mnt.


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

    restart qemu and play

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

    Ok this is the latest oscam patch from

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


    It is been compiled statically with minimun stuff. No card readers of ssl. But it is the debug on just in case you need to test.

    This one for sure will run. and you should have webif. If you have troble just go to config and change ports or iP addresses. So I guess even if you have multiple oscam running you should be able ti see this one running.


    But as I said before, I wonder if the TVHeadend and will required an upgrade due to extended-cw-functionality-powervu


    Tvheadend with extended_cw functionality (powervu)


    bone appetite

    I want this one. /bin/busybox


    So do

    #su


    copy the file to your internal sdcard. normally you can see it at /sdcard. Then do

    #cp /bin/busybox /sdcard/busybox


    if that does not work try doing

    #ls /storage


    to find out what is the sdcard. then do like

    #cp /bin/busybox /storage/sdcxard/busybox


    then copy that file and zip it an upload it.


    If it is to much difficult never mind. I already compiling a static oscam. I will post it for you to test.

    You said that the device was rooted. Normally when a device is rooted, the program used will install busybox. So If you are rooted it will be there.


    Now did you try


    whereis busybox


    In any case me find another static linked program.

    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.