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

Być może będziesz musiał zrobić to dwa razy. Prawdopodobnie za każdym razem naprawi to coś innego. Wtedy, wykonaj skrypt bez flagi -w, żeby zobaczyć czy jest więcej błędów. Jeśli są, napraw je manualnie. Kiedy skończysz, wykonaj jeszcze raz skrypt z flagą -w, żeby upewnić się, że wszystko gra.

Ubuntu Touch wymaga ustawienia console=tty0#

Halium-boot oczekuje, że /dev/console będzie konsolą urządzenia i nie rozpocznie init’u jeśli nie będzie dostępna. To jest częsty przypadek w nowych urządzeniach, ponieważ mają wyłączone UART albo console= jest nie zdefiniowana domyślnie (null) . Można to rozwiązać dodając console=tty0 jako ostatni argument in wiersu poleceń kernela. Aby to osiągnąć, wykonaj następujące czynnośći:

Należy to zrobić w pliku makefile``BoardConfig.mk`` (albo BoardConfigCommon.mk``) znajdującym się w głownym folderze drzewka twojego urządzenia, np. `` ~/halium/device/<vendor>/<nazwa_kodowa>/BoardConfig.mk``

Dodaj następującą linie:

BOARD_KERNEL_CMDLINE += console=tty0

Jeśli twój makefile już zawiera linie zaczynającą się BOARD_KERNEL_CMDLINE, możesz dodać to w linijce poniżej, by zachować plik uporządkowanym.

Informacja

Powyższa metoda, mimo, że preferowana, może nie zadzałać z niektórymi urządzeniami Samsunga. W rezultacie nie będziesz w stanie dostać się do ssh po zbootowaniu i Unity 8 nie będzie w stanie wystartować. Jeśli spotkałeś się z tym problemem, zamiast tego możesz sprecyzować te ustawinie w configu twojego kernela. Dodaj następujące linie:

CONFIG_CMDLINE="console=tty0"
CONFIG_CMDLINE_EXTEND=y

Informacja

W rzadkich przypadkach bootloader nadpisuje argument wiersza poleceń kernela, czyniąc poprzednie ustawienie bezużytecznym. To właśnie przypadek pixela 3a (sargo). Żeby poradzić sobie z tym problemem odwzoruj ten commit.

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

Informacja

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 Uzyskiwanie pomocy od społeczności.

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.