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:
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
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 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:
Locate your configuration file. It should be at
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
You may have to do this twice. It will likely fix things both times. Then, run the script without the
-w flag to see if there are any more errors. If there are, fix them manually. Once finished, run the script without the
-w flag one more time to make sure everything is correct.
Ubuntu Touch requires setting console=tty0¶
The halium-boot initramfs expects
/dev/console to be a console device and will not start init if it is not available. This is commonly the case on recent devices, because they either have UART disabled or
console= is not specified (null) by default. This can be fixed by supplying
console=tty0 as the last argument in the kernel cmdline. To achieve this, proceed as follows:
It should be done in the makefile named
BoardConfigCommon.mk) located in the root directory of your device tree, e.g.
Add the following line:
BOARD_KERNEL_CMDLINE += console=tty0
If your makefile already includes a line beginning with
BOARD_KERNEL_CMDLINE, you may add it just below that to keep things tidy.
The above method, although the preferred one, may not work for some Samsung devices. The result will be that you cannot get access to the device through ssh after boot, and Unity 8 will not be able to start. If you run into this problem, you can specify the setting in your device’s kernel config file instead. Add the following lines:
In rare cases the bootloader overwrites the kernel command line argument, rendering the setting above useless. This is the case for the Google Pixel 3a (sargo). To deal with this issue, replicate this commit.
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:
Now build the
halium-boot.img using the commands:
export USE_HOST_LEX=yes mka halium-boot
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.
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 Getting community help.
Building the system image (system.img)¶
Once you have successfully built halium-boot.img you can proceed to directly to building system.img:
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.