UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Anbox development

    Scheduled Pinned Locked Moved OS
    12 Posts 3 Posters 2.1k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • J Offline
        jld3103
        last edited by jld3103

        If watched the UT development for a year now and the Anbox development for about one and a half year now.

        I want to add new features to Anbox (especially notification support, which is really important for UT), but I wasn't able to find a guide on how to develop Anbox for UT.

        In the installation guide we have flash an image to the boot partition of the device.
        What image is that and how can I build it?
        Do I have to modify the anbox-tool debian package?

        Thanks, Jan-Luca

        advocatuxA 1 Reply Last reply Reply Quote 0
        • advocatuxA Offline
          advocatux @jld3103
          last edited by

          @jld3103 we are waiting for new the Unity8 and Mir to be in place before doing any Anbox development, so that project is on stand-by mode now.

          You have the images for testing here https://forums.ubports.com/topic/1676/development-testers-for-anbox

          1 Reply Last reply Reply Quote 0
          • J Offline
            jld3103
            last edited by jld3103

            @advocatux So I don't have to build the image?
            But then how do I modify my Anbox installation on UT?

            advocatuxA 1 Reply Last reply Reply Quote 0
            • advocatuxA Offline
              advocatux @jld3103
              last edited by

              @jld3103 I don't know the answer for that, sorry. Maybe you can ask in that main Anbox thread I've linked.

              Anyway, if you want to take a look at the code, the repo is https://github.com/ubports/anbox/

              1 Reply Last reply Reply Quote 0
              • mariogripM Offline
                mariogrip Administrators
                last edited by mariogrip

                So the easiest way to get started is using our crossbuilder tool, https://github.com/ubports/crossbuilder this will setup an lxc container that you can with all the tools to do the cross compiling of the binaries.

                To start with, install anbox on you device and make sure it's working before starting, this way we know that it works before you start 🙂

                First clone https://github.com/ubports/anbox and cd into it.

                Then to setup container i do:

                crossbuilder dependencies
                

                Then i just do

                crossbuilder shell
                cd anbox
                mkdir build-armhf
                cd build-armhf
                cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_WAYLAND=OFF -DENABLE_MIR=ON -DENABLE_TOUCH_INPUT=ON
                make -j10
                

                crossbuilder will bind mount to you current working folder

                Then with another shell (thats outside of crossbuilder) i push the binaries from the folder to the phone using adb.

                Now you have two options, use upstart or start the binaries manually,

                For upstart do:

                Then adb shell into you device and replace it with the binary you just make

                sudo mount -o rw,remount /
                sudo mv anbox /usr/bin
                stop anbox-session
                sudo stop anbox-container
                sudo start anbox-container
                start anbox-session
                

                For raw binary start:

                First stop the upstart session

                stop anbox-session
                sudo stop anbox-container
                

                Then to start anbox you need two services: container (root) and session (user)

                So you need to open two adb shells since there are blocking

                sudo ./anbox container-manager --data-path=/home/phablet/anbox-data --privileged
                

                and

                export ANBOX_NO_SDL_WINDOW_HIT_TEST=1
                export ANBOX_NO_DESKTOP_SUBDIR=1
                ./anbox session-manager --desktop_file_hint=/usr/share/applications/anbox.desktop --mir-rootless
                

                Please not these where mostly written from memory, so might be a bit rusty 🙂

                1 Reply Last reply Reply Quote 3
                • J Offline
                  jld3103
                  last edited by

                  @mariogrip Thanks for that short tutorial. This should definitely be part of the documentation.

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    jld3103
                    last edited by

                    @mariogrip Is there a team for Anbox development in the team or the community? Anbox is the thing that I'm most interested in from the whole UT project.

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      jld3103
                      last edited by

                      And are Anbox apps freezed like all other apps? That would be really bad for notifications. But I know, that I was able to play music from an Anbox app. So Android services are not freezed, right?

                      1 Reply Last reply Reply Quote 0
                      • J Offline
                        jld3103
                        last edited by jld3103

                        @mariogrip I got this:

                        jld3103@pippin:~/Desktop/anbox$ crossbuilder dependencies
                        Creating LXD container anbox-usdk-16-04-amd64-armhf-dev using ubports-sdk:ubuntu-sdk-16.04-amd64-armhf-dev.
                        Creating anbox-usdk-16-04-amd64-armhf-dev
                        Error: Failed to run: /snap/lxd/current/bin/lxd forkstart anbox-usdk-16-04-amd64-armhf-dev /var/snap/lxd/common/lxd/containers /var/snap/lxd/common/lxd/logs/anbox-usdk-16-04-amd64-armhf-dev/lxc.conf: 
                        Try `lxc info --show-log anbox-usdk-16-04-amd64-armhf-dev` for more info
                        jld3103@pippin:~/Desktop/anbox$ lxc info --show-log anbox-usdk-16-04-amd64-armhf-dev
                        Name: anbox-usdk-16-04-amd64-armhf-dev
                        Remote: unix://
                        Architecture: x86_64
                        Created: 2019/07/07 06:48 UTC
                        Status: Stopped
                        Type: persistent
                        Profiles: default
                        
                        Log:
                        
                        lxc anbox-usdk-16-04-amd64-armhf-dev 20190707064911.343 ERROR    start - start.c:proc_pidfd_open:1607 - Function not implemented - Failed to send signal through pidfd
                        lxc anbox-usdk-16-04-amd64-armhf-dev 20190707064911.344 ERROR    conf - conf.c:write_id_mapping:2763 - Invalid argument - Failed to write uid mapping to "/proc/8412/uid_map"
                        lxc anbox-usdk-16-04-amd64-armhf-dev 20190707064911.344 ERROR    conf - conf.c:lxc_map_ids:2962 - Failed to write mapping: 0 1000000 1000000000
                        150000 1000 1
                        
                        lxc anbox-usdk-16-04-amd64-armhf-dev 20190707064911.344 ERROR    start - start.c:lxc_spawn:1770 - Failed to set up id mapping.
                        lxc anbox-usdk-16-04-amd64-armhf-dev 20190707064911.387 WARN     network - network.c:lxc_delete_network_priv:2743 - Failed to remove interface "veth046PJF" from "lxdbr0"
                        lxc anbox-usdk-16-04-amd64-armhf-dev 20190707064911.387 ERROR    lxccontainer - lxccontainer.c:wait_on_daemonized_start:851 - Received container state "ABORTING" instead of "RUNNING"
                        lxc anbox-usdk-16-04-amd64-armhf-dev 20190707064911.387 ERROR    start - start.c:__lxc_start:2019 - Failed to spawn container "anbox-usdk-16-04-amd64-armhf-dev"
                        lxc 20190707064911.413 WARN     commands - commands.c:lxc_cmd_rsp_recv:135 - Connection reset by peer - Failed to receive response for command "get_state"
                        
                        1 Reply Last reply Reply Quote 0
                        • J Offline
                          jld3103
                          last edited by

                          OK. Works when using --privileged

                          1 Reply Last reply Reply Quote 0
                          • J Offline
                            jld3103
                            last edited by

                            I had to use my fixed version of crossbuilder:
                            https://github.com/jld3103/crossbuilder (There are two branches one for the permission fix and one for my inst-foreign fix)

                            Additional steps I had to do:

                            sudo dpkg --add-architecture armhf
                            sudo echo "deb [arch=armhf] http://ports.ubuntu.com/ trusty main universe" >> /etc/apt/sources.list
                            sudo apt update
                            crossbuilder inst-foreign cmake-data
                            crossbuilder --privileged dependencies
                            

                            Currently I'm struggeling with some other dependencies 😞

                            1 Reply Last reply Reply Quote 0
                            • J Offline
                              jld3103
                              last edited by jld3103

                              Today I setup my machine with a new SSD and Ubuntu 18.04 and the depenencies worked flawlessly.
                              But I still get the error with the "get_state" thing 😞

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post