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

    building for Nexus 7 deb

    Scheduled Pinned Locked Moved Porting
    32 Posts 3 Posters 10.9k 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.
      • D Offline
        doniks
        last edited by doniks

        Hi! I understand that the Nexus 7 isn't supported by ubports at the moment. However with all the new energy around here I thought I give it a shot (again https://forums.ubports.com/topic/44/installing-ubuntu-on-nexus-7-2013-deb-lte). I think it shouldn't be too hard to build it, seeing that this device has been supported by UT at some point. Maybe someone around here can help me along.

        I am stuck at the lunch command - it doesn't include any option to build for deb.

        What I did so far, following the steps here
        https://wiki.ubports.com/wiki/Setting-up-Your-Tree-for-CM12.1-Devices
        is

        mkdir phablet
        cd phablet
        repo init -u https://github.com/ubports/android -b ubp-5.1
        mkdir .repo/local_manifests

        create .repo/local_manifests/asus_deb.xml :

        <?xml version="1.0" encoding="UTF-8"?>
        <manifest>
        <remote name="cm"
        fetch="http://github.com/CyanogenMod"
        revision="refs/heads/cm-12.1" />

        <project
        path="device/asus/deb"
        name="android_device_asus_deb"
        remote="cm" revision="cm-12.1" />

        <project
        path="device/asus/flo"
        name="android_device_asus_flo"
        remote="cm" revision="cm-12.1" />

        <project
        path="kernel/google/msm"
        name="android_kernel_google_msm"
        remote="cm" revision="cm-12.1" />
        </manifest>

        repo sync -c

        download Nexus7 (Mobile) binaries for Android 5.1.0 (LMY47O) from
        https://developers.google.com/android/nexus/drivers
        extract them

        source build/envsetup.sh
        lunch

        You're building on Linux

        Lunch menu... pick a combo:

        1. aosp_arm64-eng 2. aosp_arm-eng 3. aosp_mips64-eng 4. aosp_mips-eng 5. aosp_x86_64-eng 6. aosp_x86-eng

        So, lunch is not offering anything with "deb". Looking at this https://docs.ubuntu.com/phone/en/devices/porting-new-device#anchor3 I would expect that there should be an option "aosp_deb-userdebug"

        Can someone help me here?

        1 Reply Last reply Reply Quote 0
        • D Offline
          doniks
          last edited by

          Ok, so reading through

          less build/envsetup.sh

          especially the functions lunch and breakfast, I come to believe that the file vendor/cm/vendorsetup.sh is involved in this, which in turn seems to point to

          https://raw.githubusercontent.com/CyanogenMod/hudson/master/cm-build-targets

          which is basically empty. That rings a bell for me about CyanogenMod being dead and having been reborn as LineageOS. Checking the corresponding

          https://github.com/LineageOS/android_vendor_cm/blob/cm-12.1/vendorsetup.sh

          I see it referring to

          https://raw.githubusercontent.com/LineageOS/hudson/master/lineage-build-targets

          The good news is that this one is not empty. The bad news is that this file is being grepped for 12.1 which again produces no hits.

          Either way, it looks like all the script does is call

          add_lunch_combo deb userdebug

          However when I execute this line directly and afterwards lunch, I see the following error.

          add_lunch_combo deb-userdebug
          lunch deb-userdebug

          build/core/product_config.mk:234: *** Can not locate config makefile for product "deb". Stop.
          Device deb not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod).
          Found repository: android_device_asus_deb
          Traceback (most recent call last):
          File "build/tools/roomservice.py", line 251, in <module>
          default_revision = get_default_revision()
          File "build/tools/roomservice.py", line 115, in get_default_revision
          return r.replace('refs/heads/', '').replace('refs/tags/', '')
          AttributeError: 'NoneType' object has no attribute 'replace'
          build/core/product_config.mk:234: *** Can not locate config makefile for product "deb". Stop.

          ** Don't have a product spec for: 'deb'
          ** Do you have the right repo manifest?

          So, that doesn't solve it either.

          1 Reply Last reply Reply Quote 0
          • D Offline
            doniks
            last edited by

            Ah, no, I guess it should be

            add_lunch_combo cm_deb-userdebug
            lunch cm_deb-userdebug
            make

            that is progressing now, let's see where it goes.

            1 Reply Last reply Reply Quote 0
            • D Offline
              doniks
              last edited by doniks

              ok that ran through until

              #### make completed successfully (01:04:37 (hh:mm:ss)) ####

              and I see

              cd out/target/product/deb/
              ls *.img
              boot.img cache.img ramdisk-android.img ramdisk-recovery.img ramdisk-ubuntu.img recovery.img system.img userdata.img

              however when I put my device into bootloader mode and then try

              fastboot boot recovery.img

              it boots and reboots and ends up in the TWRP recovery which is what is installed currently

              fastboot boot boot.img

              simply keeps on rebooting forever and ever. same happens when I do either of

              fastboot flash boot boot.img
              fastboot flash recovery recovery.img

              and then reboot into either system or recovery.

              so, what now?

              flohackF 1 Reply Last reply Reply Quote 0
              • flohackF Offline
                flohack @doniks
                last edited by

                @doniks Maybe you need to unlock smth? some devices protect everything from being overwritten? NOt sure about that

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

                1 Reply Last reply Reply Quote 0
                • D Offline
                  doniks
                  last edited by

                  Mhm, no I don't think that's it. I did that oem unlock thingy a long time ago and had since had multiple android versions, multiple different recoveries, also UT for a lengthy period. So I don't think a lock is keeping me.

                  flohackF 1 Reply Last reply Reply Quote 0
                  • flohackF Offline
                    flohack @doniks
                    last edited by

                    @doniks There is no logical reason why fastboot flash recovery recovery.img should not work, sorry then...

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

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      doniks
                      last edited by

                      I tried the following:

                      fastboot flash recovery twrp.img
                      fastboot boot recovery.img

                      observe that it boots the ubuntu recovery and then reboots into twrp recovery

                      adb shell cat /proc/last_kmsg > last_kmsg

                      When reading that logfile I spot the following towards the end:

                      SELinux: Could not open sepolicy: No such file or directory
                      init: SELinux: Failed to load policy; rebooting into recovery mode

                      Sounds like I have a problem with SELinux!? But what to do?

                      flohackF 1 Reply Last reply Reply Quote 0
                      • flohackF Offline
                        flohack @doniks
                        last edited by

                        @doniks SELinux is a kernel extension for security and policies. can you check the output of the kernel settings script for Ubuntu: https://github.com/janimo/phablet-porting-scripts/tree/master/kernel => it will tell you what needs to be changed in the kernel config file, and it can also apply those changes. Then a rebuild of the kernel should get you going.

                        BR

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

                        1 Reply Last reply Reply Quote 0
                        • D Offline
                          doniks
                          last edited by

                          Ah thanks! I'll check that.

                          But it makes me wonder ... I have a recovery that has trouble booting. But, stupid question: Is it a "cyanogenmod recovery" or is it an "ubports recovery"? I guess, I'm somewhere in between, right? The "repo init" brought the ubports side and the "local_manifest" brought in the cm side. If it were straight "cm only", then the resulting recovery would probably just boot. But then, I don't want cm, so, I'm venturing into ubp territory and those config options you linked are probably the next step deeper into ubp land.

                          I'm rambling ... I'm just trying to understand what I'm actually doing, while copy pasting instructions.

                          I see in the script there is a CONFIGS_OFF : CONFIG_DEFAULT_SECURITY_SELINUX

                          that does indeed sound like it might resolve the problem. Let's see.

                          1 Reply Last reply Reply Quote 0
                          • D Offline
                            doniks
                            last edited by doniks

                            Alrighty! Welcome to the Ubports Recovery πŸ™‚

                            I applied most of what sounded like "turn off SELinux". I didn't apply all the check-config changes yet, because I was concerned about changing too many things at once and breaking more than fixing. (diff below)

                            Recovery seems to be working fine now: Shows menu, I can navigate it with volup/voldown/power and with touch gestures, all actions I tried seemed to work. On to image building πŸ™‚

                            git diff
                            

                            arrrghhh .... forum software! why can I copy/paste a diff as plain text, which of course screws up the layouting of the post because it's misinterpreted as markdown, but I am NOT allowed to copy/paste into a

                            code block
                            

                            because "Error

                            Post content was flagged as spam by Akismet.com"

                            Whatever, I adjusted the following:
                            CONFIG_SECURITY_SELINUX_BOOTPARAM=y
                            CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0
                            CONFIG_SECURITY_SELINUX_DISABLE=y
                            CONFIG_DEFAULT_SECURITY_SELINUX=n

                            flohackF 1 Reply Last reply Reply Quote 1
                            • flohackF Offline
                              flohack @doniks
                              last edited by

                              @doniks You can safely apply all changes of this script - in fact they are all necessary, so dont bother with trying one by one πŸ˜‰

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

                              D 1 Reply Last reply Reply Quote 0
                              • D Offline
                                doniks @flohack
                                last edited by doniks

                                @Flohack said in building for Nexus 7 deb:

                                @doniks You can safely apply all changes of this script - in fact they are all necessary, so dont bother with trying one by one πŸ˜‰

                                Ok, let me try. I saw some apparmor stuff and thought .... uh, probably I need to hunt for kernel patches to make this work, let me postpone THAT headache ....

                                D flohackF 2 Replies Last reply Reply Quote 1
                                • D Offline
                                  doniks @doniks
                                  last edited by

                                  @doniks said in building for Nexus 7 deb:

                                  @Flohack said in building for Nexus 7 deb:

                                  @doniks You can safely apply all changes of this script - in fact they are all necessary, so dont bother with trying one by one πŸ˜‰

                                  Ok, let me try.

                                  Yup, that was easy enough. Applied all changes. Rebuilt. Flashed recovery. Rebooted. Works just as well until here!

                                  1 Reply Last reply Reply Quote 2
                                  • flohackF Offline
                                    flohack @doniks
                                    last edited by

                                    @doniks In general if you got a working CM kernel no real kernel patches are needed except apparmor3 => But you can try stealing that as a whole subdir from a kernel that has these patches applied. Should be more like copy/paste.

                                    BR

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

                                    1 Reply Last reply Reply Quote 0
                                    • D Offline
                                      doniks
                                      last edited by

                                      one step further. next road block. I've cloned the rootstock-ng thingy, downloaded the vivid....tar.gz, ran the rootstock thingy. It did it's thing, the tablet rebooted but is stuck at the Google logo screen. adb is not working. nothing seems to be happening. Not sure how to proceed, don't have any ideas 😞

                                      D 1 Reply Last reply Reply Quote 0
                                      • D Offline
                                        doniks @doniks
                                        last edited by

                                        I realize that there is a deb image in the rc channel

                                        ubuntu-device-flash --verbose --server=https://system-image.ubports.com/ touch --device=deb --channel=ubuntu-touch/rc-proposed

                                        that installs and starts just fine. Poking around in that image, it seems to me as if the initrd is basically the same as my self built one, but the kernel config and the android system.img look quite different. Though, I still don't know what exactly to do ...

                                        1 Reply Last reply Reply Quote 0
                                        • A Offline
                                          Andreas Pokorny
                                          last edited by

                                          @doniks You might want to try the google_msm kernel in ubports. It already contains the apparmor and other backports:
                                          https://github.com/ubports/android_kernel_google_msm/tree/ubp-5.1

                                          but it does not contain a reasonable kernel config for flo.

                                          You could also verify that the user space binaries and firmware files are being picked up get copied into the out/target/product/...../system directory.

                                          If none of that gets you any further - use adb while in recovery and go to /data/system-data and examine the var/log files for clues..

                                          A D 3 Replies Last reply Reply Quote 1
                                          • A Offline
                                            Andreas Pokorny @Andreas Pokorny
                                            last edited by

                                            I meant deb .. not flo

                                            flohackF 1 Reply Last reply Reply Quote 0
                                            • flohackF Offline
                                              flohack @Andreas Pokorny
                                              last edited by

                                              @Andreas-Pokorny You can edit posts here xD

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

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