Project

General

Profile

Actions

DeprecatedPortingToAndroid9 » History » Revision 3

« Previous | Revision 3/4 (diff) | Next »
dl lud, 06/29/2020 11:04 AM
Move cleanups to Replicant 10 page.


Porting Replicant to Android 9

This page contains old build instructions for Replicant 9. The source code is kept to do regression testing. Active development has moved into Replicant 10.

LineageOS 16 (Android 9)

Repositories and changes for LineageOS 16

Building LineageOS 16 version

Source code

$ repo init -u https://git.replicant.us/contrib/replicant-9/manifest.git -b replicant-9
$ repo sync

Alternatively a shallow copy of the source tree can be fetched in order to save on disk space:

$ repo init -u https://git.replicant.us/replicant-9/manifest.git -b replicant-9 --depth=1
$ repo sync -c

To `unshallow` a specific module:

$ cd path/to/module
$ git fetch --unshallow <remote>

For Trisquel 8

sudo apt-get install bc bison build-essential bsdmainutils ccache curl flex g++-multilib gcc-multilib gettext git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop python-mako pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev
sudo apt-get install gcc-5-arm-linux-gnueabi

Launching the build

Follow the i9300 manifest instructions:

$ subject='/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com'
$ mkdir .android-certs
$ for x in releasekey platform shared media testkey; do \
  ./development/tools/make_key .android-certs/$x "$subject"; \
  done
$ parallel_tasks=$(echo "$(grep 'processor' /proc/cpuinfo | wc -l ) + 1" | bc)
$ source build/envsetup.sh
$ lunch lineage_i9305-eng
$ make -j${parallel_tasks} bacon

The images can then be flashed with heimdall. They are then in:

  out/target/product/i9305/obj/PACKAGING/target_files_intermediates/lineage_i9305-target_files-eng.replicant/IMAGES/

Getting lastest changes

  • The repositories are being constantly modified with git push --force as we are trying things out, and don't want to make the commits history look too dirty, so be sure to backup your local changes.
  • Sometimes the manifest repository is also modified with git push --force. In that case the following commands will loose all the work you did locally but will make the repository consistent with upstream repositories again:
    $ rm -rf .repo/manifests/ # This enables me to force push and rebase the manifest repository as well
    $ repo init -u https://git.replicant.us/replicant-9/manifest.git -b replicant-9
    $ repo sync --force-sync
    
  • The following command might also be necessary to make the state consistent with upstream repositories again, when the manifest history wasn't rewritten, but it will also loose all the work you did locally:
    $ repo sync --force-sync
    

Install the images

$ sudo heimdall flash --BOOT out/target/product/i9305/obj/PACKAGING/target_files_intermediates/lineage_i9305-target_files-eng.replicant/IMAGES/boot.img --USERDATA out/target/product/i9305/obj/PACKAGING/target_files_intermediates/lineage_i9305-target_files-eng.replicant/IMAGES/userdata.img --SYSTEM out/target/product/i9305/obj/PACKAGING/target_files_intermediates/lineage_i9305-target_files-eng.replicant/IMAGES/system.img 

Get adb

As the device IDs are the ones given by the Linux kernel, they are not in the adb udev rules, so for now it requires to run adb as root:

$ sudo adb shell
* daemon not running; starting now at tcp:5037
* daemon started successfully
i9305:/ #                                 
$ sudo adb kill-server
$ adb shell
* daemon not running; starting now at tcp:5037
* daemon started successfully
error: no devices/emulators found

So make sure to kill the adb-server and run it as root:
$ adb kill-server
$ sudo adb shell
* daemon not running; starting now at tcp:5037
* daemon started successfully
i9305:/ # 

Booting

At some point during boot, the device goes into suspend, so you will need to press some buttons like the power or volume button to make the boot continue until the graphical interface.

You can also follow the boot progress with adb:

adb logcat
adb logcat -b main

Note that the device can go into suspend at any time, so adb might be interrupted. That looks like that:
First you get a shell

$ sudo adb shell
i9305:/ #

Then the connection is interrupted:

$ adb shell
i9305:/ # [randomdev@fullyfreelaptop ]$                                                                                                     

The effect with adb logcat is similar.

Using SwiftShader instead of Mesa3D llvmpipe for software rendering

To use SwifShader you need a kernel that supports UDIV/SDIV emulation, you can checkout the branch GNUtoo/udiv-emulation for kernel/replicant/linux. After doing that that run the following commands to use SwiftShader:

$ adb remount
$ adb shell
i9305:/ # rm vendor/lib/egl/libGLES_mesa.so # or move it somewhere safe meanwhile you test SwiftShader
i9305:/ # nano system/build.prop # set ro.hardware.hwcomposer=ranchu and ro.hardware.gralloc=default
$ adb reboot

AOSP 9

Status with AOSP 9

  • The Galaxy SIII 4G (i9305) boots (with graphics hacks) under AOSP9, without having to import nonfree libraries:
    • The device boots until the lock screen
    • The graphics work but are really slow as they have not been optimized
    • Sometime the display content is corrupted
    • The touchscreen works
  • The kernel used is based on Linux 5.0-rc6 and has ~150 Android specific patches on top and some patches for the Galaxy SIII 4G (i9305) on top

Repositories and changes

  • git://git.putti.eu/aosp/manifest_i9305.git
  • git://git.putti.eu/aosp/kernel_i9305.git
  • git://git.putti.eu/aosp/device_i9305.git
  • git://git.putti.eu/aosp/external_mesa3d.git
  • git://git.putti.eu/aosp/build_make.git
  • git://git.putti.eu/aosp/core.git

Building AOSP version

Source code

First get the source code:

$ repo init -u git://git.putti.eu/aosp/manifest_i9305.git -b android-9.0.0

For Trisquel 8

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip bc python-mako gcc-5-arm-linux-gnueabi

Building it

Once this is done, see the device/putti/i9305/README.md for the build instructions.

Updated by dl lud 9 days ago · 3 revisions