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

Porting Halium to Nexus 7 deb

Scheduled Pinned Locked Moved Porting
41 Posts 9 Posters 20.6k Views 4 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.
    • D Offline
      doniks
      last edited by doniks 16 Jul 2017, 13:52

      I'm trying to get Halium running on the Nexus 7 2013 gsm variant "deb".

      I've made a few steps already. Most notably: Plasma Mobile starts!

      I'm keeping (and updating while I progress) the summary below, so that:

      • I don't forget what steps I took
      • Others can help to improve this
      • Others can use this as inspiration for their ports

      Setup sources

      • Follow the Porting Guide for halium-7.1 here https://docs.halium.org
      • lineageos kernel sources: https://github.com/LineageOS/android_kernel_google_msm
      • my local_manifest: https://gist.github.com/doniks/7ee302c7792450761332d8f8712f29f6
      • binaries : https://developers.google.com/android/nexus/drivers MOB30X
      • my repo with all kernel changes: https://github.com/doniks/android_kernel_google_msm

      Kernel image

      config

      source build/envsetup.sh 
      add_lunch_combo lineage_deb-userdebug
      lunch lineage_deb-userdebug
      
      • kernel config: kernel/google/msm/arch/arm/configs/lineageos_flo_defconfig
      • Primary source to check for wrong configs: https://github.com/lbt/mer-kernel-check
      • my kernel config: https://gist.github.com/doniks/7406a87e5f15e1eab5a64aa90ad8f633
      • other config checkers for reference:
        • CONFIG=out/target/product/deb/obj/KERNEL_OBJ/.config lxc-checkconfig
        • https://github.com/janimo/phablet-porting-scripts/blob/master/kernel/check-config

      patches

      • https://gist.github.com/doniks/75d16dda43d241feb79b721bab6c4940

      • https://gist.github.com/doniks/44faf86a23f7467b80744f033fb08100

      • add cgroup_disable=memory to the HYBRIS_BOOTIMG_COMMANDLINE in halium/hybris-boot/Android.mk (this fixes some problem with systemd/cgroups, can't remember what exactly πŸ˜› )

      common porting errors

      • Halium Porting Error Knowledge Base
        https://gist.github.com/doniks/2ac14a1bb6750165bf782f62139c8aab#file-gistfile1-txt-L61
      • Reference of older kernel versions http://elixir.free-electrons.com/linux/v2.6.39.4/source
      • [https://public.etherpad-mozilla.org/p/r.0aae797a3bd13b4cd923b82fe29a2f47](Sailfish HADK FAQ)

      test and debug

      • Follow steps here http://docs.halium.org/en/latest/porting/debug-build/
      • if you want to force init into telnet, add kernel parameter bootmode=debug:
      fastboot -c "$(abootimg -i hybris-boot.img | sed -ne '/cmdline/s/. cmdline . //p' ) bootmode=debug" boot hybris-boot.img
      

      Android image

      cd halium
      mka systemimage
      ls -l out/target/product/deb/system.img
      

      Rootfs

      Halium rootfs

      get it

      • https://docs.halium.org/en/latest/porting/install-build/reference-rootfs.html

      install it

      • to install the rootfs you need working adb. I use this twrp recovery: https://eu.dl.twrp.me/deb/twrp-3.0.2-0-deb.img.html (had some problems with 3.1.1-0)
      • boot into twrp recovery
      git clone https://github.com/Halium/halium-scripts
      ./halium-scripts/halium-install halium-rootfs-20170630-151006.tar.gz halium/out/target/product/deb/system.img 
      
      • The device should reboot and get to the point where it announces usb networking:
      lsusb -vd 0fce: | grep -i serial
        iSerial                 3 GNU/Linux Device on usb0 10.15.19.82
      
      • reboot into twrp recovery to set the root password
      adb shell
      cd /data
      mkdir mnt
      mount rootfs.img mnt/
      chroot mnt /bin/bash 
      export PATH=/sbin:/bin:/usr/sbin:/usr/bin:$PATH
      passwd
      

      connect to it

      • reboot the device and wait for usb networking to come up as above
      • configure usb network on your desktop in a similar way as above for telnet, but now for ssh
      sudo ip address add 10.15.19.1 dev enp0s20f0u7 
      sudo ip route add 10.15.19.82 dev enp0s20f0u7
      
      • login via ssh
      ssh root@10.15.19.82 
      
      • fix path variable
      echo $PATH
      /usr/bin:/bin
      export PATH=/usr/sbin:/sbin:$PATH
      echo 'export PATH=/usr/sbin:/sbin:$PATH' >> /root/.bashrc
      

      what works

      • test_lights makes the led breathe
      • EGL_PLATFORM=hwcomposer test_hwcomposer shows rotating spiral! I need echo 200 > /sys/class/leds/lcd-backlight/brightness to turn up the display brightness, so I can actually see the spiral πŸ™‚
      • wifi: http://docs.halium.org/en/latest/porting/debug-build/wifi.html
      nmcli d # no wlan0
      echo 1 > /dev/wcnss_wlan 
      echo sta > /sys/module/wlan/parameters/fwpath 
      nmcli d # shows wlan0
      nmcli dev wifi # list wifis 
      nmcli dev wifi connect <SOMEOPENWIFI>
      # or
      # sudo nmcli device wifi connect <SOMEENCRYPTEDWIFI> password <PASSWORD>
      ping -c 2 8.8.8.8
      ping -c 2 debian.org
      # install some missing packages
      apt update
      apt install openssh-client bash-completion command-not-found binutils nano
      
      • buttons: evtest /dev/input/event5
      • touchscreen: evtest /dev/input/event0
      • adb:
        • TWRP
        • chroot into rootfs
        • systemctl enable adb
      • test_egl_config : https://gist.github.com/doniks/4e9ea8a8f5aaf1968c2e42846b5a9158

      what doesn't work

      • test_audio nothing to hear
      ACDB init open file failed
      [ACDB Init]->File is not found on the system
      [ACDB Init]->ACDB init success!
      
      • test_camera
      library "libcamera_compat_layer.so" not found
      Segmentation fault
      
      • test_egl segfaults
      • test_glesv2 segfault
      • test_gps, honestly I don't know whether that output below constitutes success of failure ... since I can't recognise any coordinates, I think it failed. I've waited 5 minutes or so. There are more *** tracking lines but no coordinates
      *** setup signal handler
      *** get gps interface
      *** device info
       id = gps
       name = loc_api GPS Module
       author = Qualcomm USA, Inc.
      *** init gps interface
      *** set capabilities
      capability is 00000007
       ** Creating thread: 'Loc_hal_worker' (start=0xb69f23b5, arg=0x1d02080)
       ** After thread_create: 'Loc_hal_worker', error=0 (start=0xb69f23b5, arg=0x1d02080)
       **** Thread wrapper start (start=0xb69f23b5, arg=0x1d02080) ****
      *** setting positioning mode
      *** start gps track
      *** gps tracking started
      *** tracking.... 
      
      • test_input
      library "libis_compat_layer.so" not found
      Segmentation fault
      
      • test_media, get a video from http://bbb3d.renderfarming.net/download.html
      wget http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_surround-fix.avi
      wget http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_60fps_normal.mp4
      scp bbb_sunflower_1080p_60fps_normal.mp4 root@10.15.19.82:
      ssh root@10.15.19.82
      test_media bbb_sunflower_1080p_60fps_normal.mp4
      library "libmedia_compat_layer.so" not found
      Segmentation fault
      
      • test_nfc
      Starting test_nfc.
      Finding NFC hardware module.
      test_nfc: test_nfc.c:156: testNfc: Assertion `hwModule != NULL' failed.
      Aborted
      
      • test_recorder
      Test application for video recording using the camera
      Recording start with volume up button. And stops with volume down.
      The result is stored to /root/test_video.avi
      
      library "libcamera_compat_layer.so" not found
      Segmentation fault
      
      • test_sensors
      library "/system/lib/hw/sensors.oem.so" not found
      libsensor_add_waiting_client adding cb 0
      Hardware module ID: sensors
      Hardware module Name: Qualcomm Sensors Module
      Hardware module Author: Qualcomm Inc.
      Hardware module API version: 0x1
      Hardware HAL API version: 0x100
      Poll device version: 0x1000001
      API VERSION 0.1 (legacy): 0x1
      API VERSION 0.1: 0x65537
      API VERSION 1.0: 0x16777217
      API VERSION 1.1: 0x16842753
      API VERSION 1.2: 0x16908289
      API VERSION 1.3: 0x16973825
      API VERSION 1.4: 0x17039361
      libsensor_add_waiting_client adding cb 1
      Got 0 sensors
      
      • test_wifi 1 says :
      Cannot load driver (err -1)
      

      not supported

      • test_vibrator , segfaults, but anyway the N7 doesn't have a haptic motor to vibrate
      Segmentation fault
      

      UBports rootfs

      Tried the rootfs from here: http://cdimage.ubports.com/rootfs/ but it doesn't do too much for me:

      • screen stays on the Google logo
      • no usb iSerial messages
      • no usb network interface seems to come up
      • last_kmsg shows that systemd does take over http://paste.ubuntu.com/25419054/ however,
      • it complains that "systemd[1]: Failed to start LXC Android Config and Container Initialization."
      • no adb interface comes up, even though in TWRP/chroot I see that android-tools-adbd.service is enabled

      Plasma mobile rootfs

      git clone https://github.com/bhush9/rootfs-builder bhush9-rootfs-builder
      cd bhush9-rootfs-builder
      # follow the instructions in README to patch lb_chroot_live-packages
      sudo ./build.sh
      # waaaaait
      # install it
      

      The reboot takes about a minute. Then you'll hear an audible greeting and afterwards you are greeted by the plasma mobile login screen. You can login and play around a bit. Not much to do though. No network connection and it's not possible to ssh in.

      Reboot back into TWRP and chroot.

      1. To be able to use the ssh server, you need to generate ssh server keys: dpkg-reconfigure openssh-server
      2. Preferably enable password less login :
      adb shell mkdir /home/phablet/.ssh
      adb push ~/.ssh/id.pub /home/phablet/.ssh/authorized_keys
      // todo : some chmod/chown needed?
      
      1. reboot, setup usbnet and then reboot and login as ssh phablet@10.15.19.82
      2. Alternatively, you can set the passwords, but I don't do this because it seems to actually break the graphical login:
      passwd 
      passwd: Authentication token manipulation error
      passwd: password unchanged
      # fix passwd
      apt remove libnss-extrausers
      pam-auth-update 
      # select everything but extrausers
      passwd # set root password 
      passwd phablet # set user password
      

      Debian

      Haven't tried yet.
      https://archive.org/download/halium-debian-rootfs/
      https://github.com/JBBgameich/rootfs-builder/tree/debian

      Arch

      https://github.com/Halium/rootfs-builder/tree/archlinux
      https://github.com/mickybart/rootfs-builder/tree/archlinux
      Haven't tried yet. I'm not very familiar with arch.

      What's next?

      • Get ubports to run
      • Get PM to run on halium-boot
      • Check out LuneOS
      • Check out SailfishOS
      • Build a .zip file, only makes sense if some OS is remotely usable, PM is close but still not there
      • get lxc-attach to work
      • patch out the noise dmesg logging of the battery

      Any tips or feedback appreciated!

      D 2 Replies Last reply 28 Aug 2017, 18:25 Reply Quote 5
      • D Offline
        doniks
        last edited by 16 Jul 2017, 15:21

        update: got hwcomposer working with some help from bshah, updating first post

        1 Reply Last reply Reply Quote 0
        • T Offline
          Tonoxis
          last edited by 19 Jul 2017, 02:24

          Hey Doniks, nice to see you still working on Ubuntu Touch (It's ShadowEO from XDA). The Nexus 7 does actually have NFC, but you are correct, it does not have a haptic motor for vibration.

          Sad to see the Flo isn't supported, but you can bet I'll be trying your deb port on my flo the moment you have a working test release πŸ˜„

          D 1 Reply Last reply 19 Jul 2017, 05:46 Reply Quote 0
          • D Offline
            doniks @Tonoxis
            last edited by doniks 19 Jul 2017, 05:46

            @Tonoxis Well, hallo there! Pleasure to meet again πŸ™‚

            I was actually thinking the other day to ping you on xda whether you would be interested to help πŸ™‚

            As for "releasing", I hadn't actually intended to upload the kernel image itself anywhere ... you know it's not in any way in a consumer ready state. The screen is black you can talk to it with commandline stuff over a usb cable. It is exciting πŸ™‚ but only for a certain audience. People should be able to build it with the instructions above and then have all the sources and infrastructure such that they can also actually improve upon the current state. Or do you think it would make sense to upload the images?

            As for supporting flo - Well, it might "just work", right?! Similar with how we did it back in the day the other way around where your TonoKrnl "just worked" on my deb.

            PS: updated first post for NFC & vibration. thx!

            1 Reply Last reply Reply Quote -1
            • T Offline
              Tonoxis
              last edited by 23 Jul 2017, 19:22

              Unfortunately, I haven't had time for much of anything lately, if that were different I'd be happy to help with the project. For release, I'd recommend images and source tree, so anyone who wishes to contribute/debug can download your image as it currently is without needing to completely rebuild from source.

              And I hadn't thought of that, you're right, it's possible the Deb version may just work on the Flo. I think the only hardware difference is the cellular modem afaik.

              1 Reply Last reply Reply Quote 0
              • D Offline
                doniks
                last edited by 9 Aug 2017, 20:25

                Small update in the OP. Tried plasma mobile rootfs, but can't make it work. Ubports rootfs for Halium doesn't seem to exist.

                1 Reply Last reply Reply Quote 0
                • D Offline
                  doniks
                  last edited by 14 Aug 2017, 21:23

                  0_1502745560704_N7PMlogin.jpg

                  Behold! Plasma Mobile on the N7!

                  Courtesy of Mr @bshah, aka Da Man, who fixed some black magic code, so all I had to do was repo sync and reinstall πŸ™‚

                  1 Reply Last reply Reply Quote 3
                  • B Offline
                    bshah
                    last edited by 15 Aug 2017, 02:44

                    Great that you got it working, now we need to get UBports working here πŸ™‚

                    1 Reply Last reply Reply Quote 2
                    • D Offline
                      doniks @doniks
                      last edited by 28 Aug 2017, 18:25

                      Tried the rootfs from here: http://cdimage.ubports.com/rootfs/ but it doesn't do too much for me:

                      OP:

                      • screen stays on the Google logo
                      • no usb iSerial messages
                      • no usb network interface seems to come up
                      • last_kmsg shows that systemd does take over http://paste.ubuntu.com/25419054/ however,
                      • it complains that "systemd[1]: Failed to start LXC Android Config and Container Initialization."
                      • no adb interface comes up, even though in TWRP/chroot I see that android-tools-adbd.service is enabled
                      flohackF 1 Reply Last reply 9 Sept 2017, 08:21 Reply Quote 0
                      • B Offline
                        bshah
                        last edited by 8 Sept 2017, 09:32

                        @doniks said in Porting Halium to Nexus 7 deb:

                        Alternatively, you can set the passwords, but I don't do this because it seems to actually break the graphical login:

                        I actually figured this out... it seemed strange, but I gave wrong instructions it seems,

                        pam-auth-update 
                        # select everything but extrausers
                        

                        Here is the catch, last option of pam-auth-update is ... None of the above ... so it would disable standard login as well, instructions should've been select everything but extrausers and none of the above.

                        Anyway, I will be publishing newer images with this things fixed soon, so you won't also need to do "hacks" for ssh..

                        1 Reply Last reply Reply Quote 1
                        • flohackF Offline
                          flohack @doniks
                          last edited by 9 Sept 2017, 08:21

                          @doniks Well AFAIK there is currently no ubports image booting with Halium correctly. Plus even if the xenial image would boot, it is far from usable. Lots of permission problems, no apps start etc. Its Pre-Alpha πŸ˜‰

                          BR

                          My languages: πŸ‡¦πŸ‡Ή πŸ‡©πŸ‡ͺ πŸ‡¬πŸ‡§ πŸ‡ΊπŸ‡Έ

                          1 Reply Last reply Reply Quote 0
                          • D Offline
                            demokrit
                            last edited by 19 Sept 2017, 21:23

                            @doniks you could try the rootfs @ http://cdimage.ubuntu.com/ubuntu-touch/xenial/daily-preinstalled/current/ (I think xenial-preinstalled-touch-armhf.tar.gz or the -arm64.tar.gz if the nexus 7 is 64-bit should be the correct rootfs) and if this works our devs from ubports might reproduce their work step-by-step? I would be very interested whether this works if you could try πŸ™‚

                            T D 2 Replies Last reply 19 Sept 2017, 21:42 Reply Quote 0
                            • T Offline
                              Tonoxis @demokrit
                              last edited by 19 Sept 2017, 21:42

                              @demokrit said in Porting Halium to Nexus 7 deb:

                              @doniks you could try the rootfs @ http://cdimage.ubuntu.com/ubuntu-touch/xenial/daily-preinstalled/current/ (I think xenial-preinstalled-touch-armhf.tar.gz or the -arm64.tar.gz if the nexus 7 is 64-bit should be the correct rootfs) and if this works our devs from ubports might reproduce their work step-by-step? I would be very interested whether this works if you could try πŸ™‚

                              Unfortunately, the Nexus 7 is not ARM64, it's normal ARM. So the ARM64 rootfs wouldn't work here. Glad to see progress being made and would love to test it out at some point πŸ™‚

                              D 1 Reply Last reply 20 Sept 2017, 08:42 Reply Quote 0
                              • D Offline
                                demokrit @Tonoxis
                                last edited by 20 Sept 2017, 08:42

                                @Tonoxis Ah, I did not make myself clear xD i meant there are rootfs'ses for both armhf and amr64 but good to know it's armhf, thx πŸ™‚

                                1 Reply Last reply Reply Quote 0
                                • T Offline
                                  Tonoxis
                                  last edited by Tonoxis 10 Jan 2017, 07:10 1 Oct 2017, 01:45

                                  @doniks I've finally had a chance to play around with the steps you've produced, and I found the issue with the Ubuntu rootfs-builder is that it needs to run under sudo for chroot to run. Your OP was very informative and it definitely helped me get over a couple of places I was stuck building while reading the Halium documentation.

                                  I attempted to boot my kernel but the MSM watchdog keeps rebooting the device after a little bit, however I can see in /proc/last_kmsg that it seems to want a rootfs, so I'm waiting until everything is done building to fully test. Gonna see if I can't get GNOME Wayland to run on Halium/Hybris. πŸ˜„

                                  Edit: After waiting a little bit, my Ubuntu 16.04 boot appears to fail with a problem setting up LXC Networking, it then hangs. No USB connection, it doesn't seem to respond to Ubuntu's requests for device setup. So I'm going to try the rootfs you linked.

                                  D 1 Reply Last reply 1 Oct 2017, 21:47 Reply Quote 0
                                  • D Offline
                                    doniks @demokrit
                                    last edited by 1 Oct 2017, 21:41

                                    @demokrit said in Porting Halium to Nexus 7 deb:

                                    @doniks you could try the rootfs @ http://cdimage.ubuntu.com/ubuntu-touch/xenial/daily-preinstalled/current/ (I think xenial-preinstalled-touch-armhf.tar.gz

                                    Canonicals "touch" root filesystems look somewhat different. Everything is in a "/system/" subfolder. If that would be the only difference, then well, one could hack around that, but I'm not sure whether there are other things as well (upstart/systemd?). I didn't feel like investing the time, since I expected the ubports core team to release a halium rootfs any day now πŸ˜› But hey listening to the last community Q&A, it should really be any day now ...

                                    1 Reply Last reply Reply Quote 0
                                    • D Offline
                                      doniks @Tonoxis
                                      last edited by 1 Oct 2017, 21:47

                                      @Tonoxis
                                      Nice!

                                      I have done a repo sync and try to get back to where I was before. I'm using the halium rootfs and it does bring up the 10.15.19.82 network and I can ssh in, but after a few seconds it seems to tear that usb network down. I think I had that before, but I can't remember how I got past that. Something with the android lxc containers in the rootfs

                                      Any luck with the rootfs yet?

                                      T 1 Reply Last reply 2 Oct 2017, 03:39 Reply Quote 0
                                      • T Offline
                                        Tonoxis @doniks
                                        last edited by Tonoxis 10 Feb 2017, 18:04 2 Oct 2017, 03:39

                                        @doniks I managed to figure out a workaround, I had to pull the jessie version of libssl1.0.0 so I could force ADBd to run instead, for whatever reason, my debian rootfs never gets USB tethering up unless it's the debug bootmode option. I am actually working with a running debian root now, however I screwed up while building my system image and didn't have any vendor blobs for libhybris to work with πŸ˜• I'm rebuilding my system image now and then I'm going to reinstall the halium rootfs with the new system image.

                                        Before-posting Edit: Looks like I'm running into an issue where the build system isn't picking up my vendor tree πŸ˜• even after popping MOB30X's binaries down in there as laid out in the LineageOS guides for setting this folder up, every system image I build continues to not contain the proprietary blobs... I can't tell if I'm doing something wrong, or if it's something else that I'm not doing first.

                                        EDIT EDIT: WOO! Had to do some linking around libhybris-egl, but I was able to finally get test_hwcomposer to show the spiral! Working on getting wayland to start up (working on getting some VTs up so I can launch weston as a test)

                                        EDIT: Weston starts as long as I specify fbdev-backend and use msm_fb_refresher to get it up and running, but it runs and it's snappy. I just can't get anything else wayland to work (gnome-shell --display-server, kwin_wayland, etc)

                                        1 Reply Last reply Reply Quote 3
                                        • JBBgameichJ Offline
                                          JBBgameich
                                          last edited by 26 Oct 2017, 00:53

                                          Which debian rootfs are you using?
                                          I just wanted to inform you that my work on the debian buster rootfs is now nearly finished and it boots to ssh, the lxc container starts and libhybris also works.
                                          I have some pre-built one around here: https://archive.org/download/halium-debian-rootfs/halium-debian-rootfs_20171024.tar.gz and the source for the rootfs-builder has moved here: https://github.com/debian-pm/rootfs-builder.

                                          T 1 Reply Last reply 9 Nov 2017, 21:27 Reply Quote 1
                                          • D Offline
                                            doniks @doniks
                                            last edited by 7 Nov 2017, 20:24

                                            @doniks said in Porting Halium to Nexus 7 deb:

                                            patches

                                            • https://gist.github.com/doniks/75d16dda43d241feb79b721bab6c4940

                                            FWIW, it might be conceivable to fix this thing about pidns_operations in a better way. I was poking around in the upstream kernel

                                            git clone  --depth 1 --branch v4.13.11  https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
                                            grep --color=always  -nr -C 3 -Ee'CONFIG_PID_NS|pidns_operations' |less -R
                                            

                                            and I see some stuff that is not present in the kernel I use. But, well, that's for another day. Afterall, I don't even know whether it's an actual problem right now πŸ˜›

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