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

    Building from source for the first time

    Scheduled Pinned Locked Moved Support
    10 Posts 2 Posters 719 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.
      • E Offline
        enrolado
        last edited by

        I've been pretty much following the steps within the scripts found in https://github.com/ubports/device-builds, and after some code adjustments have been able to build ubp-5.1-allthefixings on my ubuntu 18.04 box.

        However, now that I have the device_hammerhead_devel.tar.xz file ready, I am not sure of the next steps... Unfortunately I do not have the ubuntu-device-flash as that package did not exist under 18.04.

        Can anyone explain the next steps? Do I fastboot into recovery, copy the xz files and install (similar to lineageOS)? Do I need to use some other tool to flash my nexus5?

        1 Reply Last reply Reply Quote 1
        • E Offline
          enrolado
          last edited by

          Since my phone is already running UT, could I just boot into recovery and...

          adb shell mkdir /a
          adb shell mount /data/system.img /a
          adb push out/target/product/hammerhead/system.img /a/var/lib/lxc/android/system.img
          adb reboot

          ?

          I guess I have not fully understood the difference in out/target/product/hammerhead/system.img and out/target/product/hammerhead/userdata.img, and whether I need to flash both to different mount points.

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

            maybe you can rebuild from here: https://github.com/ubports/goget-ubuntu-touch or simply install the old xenial build https://repo.ubports.com/pool/xenial/main/g/goget-ubuntu-touch/

            1 Reply Last reply Reply Quote 0
            • E Offline
              enrolado
              last edited by enrolado

              So a follow up to this, for others...

              After completing all the steps in https://github.com/ubports/device-builds, I then did the steps in https://docs.ubports.com/en/latest/porting/ubp-5.1.html

              That is, reboot into fastboot and

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

              Reboot to validate new kernel

              uname -a
              lsb_release -a
              cat /proc/version
              

              Then fastboot again and do

              ./replace-android-system system.img
              

              From https://github.com/janimo/phablet-porting-scripts/blob/68734ca07998b8e784397df77d9aca4b968b3815/build/replace-android-system

              In my Nexus5, I had to modify the script since I fastboot'ed already...

              read -t 10 -n 1 -p "Reboot to recovery (y/n)? " answer
              [ -z "$answer" ] && answer="Yes"  # if 'yes' have to be default choice
              case ${answer:0:1} in
                  y|Y )
                      adb reboot recovery;
                      wait_for_device;
                  ;;
                  * )
                      echo "Assuming device in recovery mode";
                  ;;
              esac
              

              Once you reboot into UT, you can validate the updated build properties...

              cat /android/system/build.prop
              

              which should match what you built on your machine! 🙂

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

                @enrolado would you be willing to make a short write up for the docs here http://docs.ubports.com/en/latest/systemdev/index.html ? Smt like: get the kernel sources, compile, mount, push.

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

                  @doniks Can do! However, I did all of this on my Linux Mint 19.1 box, so there were some required code changes in order to build everything. I am still working my way through the folders to match code-to-repo (since repo sync isn't your typical gitsubmodules (!)).

                  In the porting page, there is an explicit call out that ubp-5.1 ports must be built using Ubuntu 16.04. A container or virtual machine based on 16.04 is recommended for this purpose. So I'm unsure who to touch base with to see if guidance can officially transition to a newer compiler (including changes on all the respective repos). Would you have a name? Feel free to PM me.

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

                    @enrolado said in Building from source for the first time:

                    @doniks Can do!

                    Cool!

                    However, I did all of this on my Linux Mint 19.1 box, so there were some required code changes in order to build everything.

                    I am still working my way through the folders to match code-to-repo

                    don't understand

                    (since repo sync isn't your typical gitsubmodules (!)).

                    it certainly isn't 🙂 (Off topic: I can't decide which one I hate more though. They're both horrible, backstabbing solutions to a real problem)

                    In the porting page, there is an explicit call out that ubp-5.1 ports must be built using Ubuntu 16.04. A container or virtual machine based on 16.04 is recommended for this purpose. So I'm unsure who to touch base with to see if guidance can officially transition to a newer compiler (including changes on all the respective repos). Would you have a name? Feel free to PM me.

                    about newer compiler ... I am pretty sure that the actual compiler used is some old precompiled (forked?) gcc that has been stuck as a binary inside the android repo. And I am also very sure that noone wants to (should) invest time to officially transition to a newer compiler. That would be way too much effort wasted on old android forks.

                    could be that the 16.04 advise is there specifically for that ubuntu-device-flash problem that you ran into?! although you hint that there was more needed "some required code changes" ...

                    what we could do is write the page such that it instructs people to use 16.04 and gives them the steps that should work there. Even if you haven't tested it in exactly the same way, because you were on a newer version. Maybe add some hints for other versions, such as the adb pushing in absence of the u-d-f. Right now there is no doc at all, which makes it a frustrating uphill battle if people want to contribute to these kernels. If we can provide some building blocks to point people in the right direction it would be much better than the current void of information.

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

                      @enrolado know what? a little birdie just reminded me of this page: http://docs.ubports.com/en/latest/porting/ubp-5.1.html

                      it kinda says everything that needs to be said, no? had you seen this page? did you have to do something else? actually, which device are you working on?

                      I'm thinking of moving that page from porting (where frankly I had overlooked it) to system software development section....

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

                        about newer compiler ... I am pretty sure that the actual compiler used is some old precompiled (forked?) gcc that has been stuck as a binary inside the android repo. And I am also very sure that noone wants to (should) invest time to officially transition to a newer compiler. That would be way too much effort wasted on old android forks.

                        Yeah, I think I took a curve on the instructions, since I do not recall using any precompiled compiler.

                        I'm on:

                        gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
                        
                        arm-linux-gnueabihf-cpp (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
                        
                        arm-linux-androidebi-gcc (GCC) 4.8
                        

                        and I definitely had to update a bunch of files to get it to build. That said, I do use my Nexus 5 as a daily driver, and I don't think we have anything as feature-complete using newer code, is there?

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

                          know what? a little birdie just reminded me of this page: http://docs.ubports.com/en/latest/porting/ubp-5.1.html

                          it kinda says everything that needs to be said, no? had you seen this page? did you have to do something else? actually, which device are you working on?

                          I'm thinking of moving that page from porting (where frankly I had overlooked it) to system software development section....

                          I agree

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