Halium-7.1 - Building#

For Halium-7.1 porting it is necessary to build both halium-boot.img and system.img.

Initializing the build environment#

First you need to initialize the environment using the envsetup.sh tool included in your source tree. Enter your BUILDDIR and issue the command:

source build/envsetup.sh

The output will look like this:

including device/lge/bullhead/vendorsetup.sh
including vendor/cm/vendorsetup.sh
including sdk/bash_completion/adb.bash
including vendor/cm/bash_completion/git.bash
including vendor/cm/bash_completion/repo.bash

The breakfast command is used to set up the build environment for a specific device. From the root of your BUILDDIR run the following, replacing [CODENAME] with your device’s specific codename:

breakfast [CODENAME]

Breakfast will attempt to find your device, set up all of the environment variables needed for building, and give you a summary at the end.

Modify the kernel configuration#

The default LineageOS/Halium kernel configuration file needs modifications as Ubuntu Touch requires a slightly different kernel config than Halium, including enabling Apparmor. A script that does this job is provided in your Halium source tree: BUILDDIR/halium/halium-boot/check-kernel-config.

Locate your configuration file. It should be at arch/arm/configs/<CONFIG> or arch/arm64/configs/<CONFIG> depending on the architecture of your device. If you have trouble finding it, run grep "TARGET_KERNEL_CONFIG" device/<VENDOR>/<CODENAME>/BoardConfig.mk to determine the location.

Then, from the root of your BUILDDIR, run:

./halium/halium-boot/check-kernel-config path/to/my/defconfig -w

Vous devrez peut-être le faire deux fois. Cela va probablement corriger les choses les deux fois. Lancez ensuite le script sans l’indicateur -w pour voir s’il y a d’autres erreurs. S’il y en a, corrigez-les manuellement. Une fois terminé, lancez le script sans le l’indicateur -w` une fois de plus pour vous assurer que tout est correct.

Ubuntu Touch requière le paramètre console=tty0#

L’initramfs de halium-boot s’attend à ce que /dev/console soit une console système et ne démarrera pas si elle n’est pas disponible. C’est généralement pas le cas sur les appareils récents, car, soit ils n’ont pas d’UART activé, soit ils n’ont pas de console= défini par défaut. Cela peut être réglé en rajoutant console=tty0 à la fin des arguments du noyau. Pour ce faire, suivez les instructions suivantes :

Cela devrait être fait dans le makefile nommé BoardConfig.mk (ou BoardConfigCommon.mk) situé à la racine des sources de votre appareil, ex. ~/halium/device/<vendeur>/<nom_de_code_du_modèle>/BoardConfig.mk

Ajoutez les lignes suivantes :

BOARD_KERNEL_CMDLINE += console=tty0

Si votre makefile contient déja une ligne commençant par BOARD_KERNEL_CMDLINE, vous pouvez le rajouter juste en dessous pour tout garder en ordre.

Note

La méthode ci-dessus, bien que recommandée, peut ne pas fonctionner pour certains appareils Samsung. Le résultat sera que vous ne pourrez pas accéder à l’appareil par SSH après le démarrage et qu’Unity 8 ne pourra pas démarrer. Si vous rencontrez ce problème, vous pouvez spécifier le paramètre dans le fichier de configuration du noyau de votre périphérique à la place. Ajoutez les lignes suivantes

CONFIG_CMDLINE="console=tty0"
CONFIG_CMDLINE_EXTEND=y

Note

Dans de rares cas, le chargeur d’amorçage écrase l’argument de la ligne de commande du noyau, ce qui rend le paramètre ci-dessus inutile. C’est le cas pour le Google Pixel 3a (sargo). Pour régler ce problème, répliquez ce code.

Build#

Halium will use the mkbootimg tool for creating the boot image. In most cases it is not on the local harddisk, so it can be built by issuing:

mka mkbootimg

Now build the halium-boot.img using the commands:

export USE_HOST_LEX=yes
mka halium-boot

Note

If you prefer make instead of mka you should set -j[num] for parallel building, which reduces build time. Replace [num] with the number of threads in your system plus 2.

Build errors#

There are a number of known build errors which you might encounter, depending first of all upon how rigorous you have been in following the steps outlined, but you may also run into unforeseen issues. If your build fails at first, make sure you have done exactly as described, then go through the list of known errors in the Halium guide.

I your particular error is not listed, you will need to do some research of your own. If you end up here, know that there is a community of porters, developers and enthusiasts who might be able to help you. Refer to Obtenir de l’aide de la communauté.

Building the system image (system.img)#

Once you have successfully built halium-boot.img you can proceed to directly to building system.img:

mka systemimage

Likelier than not, you will run into one or more errors along the way when building the system image. A number of possible errors are documented in the Halium guide. If yours is not listed, seek community help.