Halium 9 - ubports/porting-notes GitHub Wiki
This page attempts to collect information regarding current Halium 9 development which is not integrated into Halium documentation yet. Porters are expected to partly follow Halium documentation with changes described here.
-
Initialize the repo:
repo init -u https://github.com/Halium/android -b halium-9.0 --depth=1
-
Create local manifest for your device and do
repo sync
-
To apply patches run this script while being in Halium root folder:
hybris-patches/apply-patches.sh --mb
-
Make your device tree inherit from
halium.mk
instead offull_base_*
and remove Java-dependent parts (see https://github.com/ubports-on-fxtec-pro1/android_device_fxtec_pro1/commit/b71de9a1307b094263b6d640a6b87bac4ab8bb18, https://github.com/ubports-on-fxtec-pro1/proprietary_vendor_idealte/commit/65cfe7583aaa886709b6142d8b79c276a3028ad9 as example) - search for$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)
- It can also be namedaosp_base_telephony.mk
! -
If your Android 9 device is system-as-root (A/B device), you will likely need this kernel change: https://github.com/sailfish-on-fxtecpro1/kernel-fxtec-pro1/commit/4995be221047acf5b40610e5c4eacf4b75434500. Otherwise kernel skips ramdisk and boots directly into /system partition
-
source build/envsetup.sh && breakfast YOUR_DEVICE_CODENAME
(e.g.cheeseburger
for OnePlus 5) -
make halium-boot
-
either use Erfan's generic systemimage (https://t.me/ErfanGSI) or
make systemimage
to compile your own
- Only UBPorts rootfs has been tested and it needs modifications:
- pull in packages compiled against Android 8/9 header files
- mount scripts and custom LXC android container config (more to follow)
- More info on to-do list.
The changes needed to UBPorts rootfs with Halium 9 are collected as debos tool configuration in the following repo:
https://gitlab.com/ubports/core/rootfs-builder-debos/-/blob/master/android9-generic.yaml
Prebuilt rootfs tarballs can be downloaded from UBPorts CI.
At the time of writing this, @erfanoabdi's fork has more patches, and may work better. Please submit PR upstream if you find this to be the case.
Currently all hybris/halium specific patches to LineageOS repos are kept in https://github.com/Halium/hybris-patches and need to be applied manually instead of forking individual repositories as before. An attempt was made to deviate as little as possible from mer-hybris setup to keep changes small system/core has ueventd reenabled to run inside LXC, but otherwise keeps many Mer patches and would not mount core filesystems by itself, so LXC config has to be adjusted to do that Large part of former LXC pre-start.sh script is not relevant anymore as system image is read-only and becomes root of container instead of unpacked ramdisk as before
DEVICE=lavender # replace with your device codename
cat /var/lib/lxc/android/rootfs/ueventd*.rc /vendor/ueventd*.rc | grep ^/dev | sed -e 's/^\/dev\///' | awk '{printf "ACTION==\"add\", KERNEL==\"%s\", OWNER=\"%s\", GROUP=\"%s\", MODE=\"%s\"\n",$1,$3,$4,$2}' | sed -e 's/\r//' >/etc/udev/rules.d/70-$DEVICE.rules
-
If you get an error like
ninja: error: '<build>/out/soong/host/linux-x86/framework/turbine.jar', needed by...
, then it's because there are still some Android Java packages in the image. You should remove them, but the difficult part is to find out which packages they are. One possible shortcut is to look at the Halium device tree of a similar already ported device (from the same vendor) and try applying the same changes you'll find in there. -
Look for and eventually grep for
telephony-ext
in yourdevice.mk
configuration file and comment it out, as follows:
PRODUCT_BOOT_JARS += \
# telephony-ext
or another example is:
PRODUCT_BOOT_JARS += \
# WfdCommon
-
To avoid
EasterEggs.jar
errors you need to comment out any occurrency of .jar/.apk needed libraries or files. In particular, check in your devicelineage_{devicename, platformname}.mk
(atdevice/your_vendor/{devicename, platformname}
) and assure to comment out#$(call inherit-product, vendor/lineage/config/common_full_phone.mk)
and#$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)
-
If the build fails with an error like
File "build/make/tools/check_radio_versions.py", line 56 print "*** Error opening \"%s.sha1\"; can't verify %s" % (fn, key) ^ SyntaxError: invalid syntax
it's because your Linux distribution ships python3 as the default python interpreter, while Halium still uses python2. You can workaround this by creating a virtual environment:
virtualenv --python 2.7 ~/python27 # adjust the path to your prefs source ~/python27/bin/activate
You'll have to run the second line every time you want to setup your build environment (that is, everytime you run
breakfast
).As an alternative, you can:
$ sudo update-alternatives --config python There are 2 choices for the alternative python (providing /usr/bin/python). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/python3.7 2 auto mode 1 /usr/bin/python2.7 1 manual mode 2 /usr/bin/python3.7 2 manual mode Press <enter> to keep the current choice[*], or type selection number: 1 update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in manual mode $
Apply these patches in this particular order:
-
tty: check before stopping kthread
(link) -
tty: move tty_port workqueue to be a kthread
(link) -
tty: add tty_port_set_policy function
(link) -
Revert "serial: msm_serial_hs: Protect spurious irqs after wakeup irq enablement"
(link) -
msm_serial_hs: make the Bluetooth tty thread RT
(link) -
Make msm_serial_hs RT to improve bluetooth performance
(link)
Apply these patches in this particular order:
-
tty: move tty_port workqueue to be a kthread
(link) -
tty: add tty_port_set_policy function
(link) -
msm_serial_hs: make the Bluetooth tty thread RT
(link)
- Example for the android_kernel_oneplus_msm8996 - OP3(T)
You need to add in BoardConfig.mk
or BoardConfigCommon.mk
the following lines:
# To enable system image
BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
During your porting, unless you use GSI images, if you would like to specify it in your installation with halium-install
, you need to specify -s
option, as follows:
$ halium-install -v -s -p ut your_rootfs.targz your_system.img
Although it might pose at risk you device, you might need to treblerize your device by creating a vendor
partition, previously not foreseen in other device.
For instance, in device msm8953, you can convert an oem
partition into a vendor
as follows:
https://github.com/Sohamlad7/android_kernel_motorola_msm8937/commit/cbe246c5f38ae7743311849ff64edfdbf2419e06#diff-10d64499f13f6f9b8be9d3a43b5250983234dede9d3bca038f25788c51923d0a
In this case, it might usefull to force the system to create a vendor image with mka vendorimage
command, by adding in BoardConfig.mk
(as in device LG V20) the following lines:
# Require for treble
BOARD_VENDORIMAGE_PARTITION_SIZE := 665845760
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
PRODUCT_FULL_TREBLE_OVERRIDE := true
TARGET_COPY_OUT_VENDOR := vendor
BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
# VNDK
# PRODUCT_USE_VNDK_OVERRIDE := false
BOARD_VNDK_VERSION := current
BOARD_VNDK_RUNTIME_DISABLE := true
keeping in mind that the partition dimension must be adapted to your device. You also need to add or integrate in device.mk
# VNDK
PRODUCT_PACKAGES += \
libstdc++.vendor \
vndk_package