Introdución á portaxe¶
Esta primeira sección presentaráche as especificidades para transportar Ubuntu Touch a un dispositivo Android. Ten en conta que está escrito pensando no público en xeral, non principalmente no experimentado desenvolvedor de portas. Nas seccións posteriores fixemos un esforzo por diferenciar mantendo o texto principal máis conciso para satisfacer as necesidades do lector máis experimentado, á vez que fornecemos ligazóns a lectura complementaria para os menos experimentados.
A guía no seu conxunto está escrita como unha secuencia de pasos que describen como podería proceder un porto ideal. Non obstante, a portabilidade é imprevisible e desordenada. Todos os dispositivos son diferentes e, en realidade, é probable que itineredes e revisedes algúns pasos, saltedes outros pasos e descubriredes retos novos e indocumentados.
Que é Ubuntu Touch?¶
Ubuntu Touch é un sistema operativo de código aberto para dispositivos móbiles. Pódese transportar a dispositivos que se enviaron orixinalmente con sistema operativo Android. Por desgraza, a maioría destes dispositivos dependen ata certo punto do software propietario.
To be specific, device vendors tend to keep the code that speaks directly to the device hardware (the low level device drivers) proprietary. These components are commonly called the vendor “blobs” (Binary Large OBjects). The vendor blobs need to be incorporated into an Ubuntu Touch port. Note that these components are specific not only to each device, but also to each Android version. It is therefore necessary to secure the correct version of these components when building a port.
É por iso que Ubuntu Touch non se pode construír completamente a partir do código fonte para a maioría dos dispositivos comerciais. Pola contra, levar o sistema a estes dispositivos implica integrar os blobs do fornecedor mencionados anteriormente no resto do sistema, que se poden construír desde a fonte.
The next component of Ubuntu Touch is a pre-compiled root filesystem which needs to be installed on the device. This component does not communicate directly with the device hardware. Instead, this communication is mediated by a Hardware Abstraction Layer (HAL) which needs to be built for each specific device, because each device has its specific hardware architecture. This component is called Halium and is available in different versions corresponding to different Android versions.
The Halium project enables Linux systems to run on Android hardware. It is a joint effort by multiple mobile operating systems, notably Lune OS, Droidian and Ubuntu Touch.
Ubuntu Touch porting builds on top of the Halium GSI. The Halium GSI is discussed further below. At times it may also be helpful to test with one of the other operating systems to debug a problem from different angles.
Halium is an indispensible part of an Ubuntu Touch port and is available in the form of open source software. Developing a new version of Halium is a very considerable task which is why only a few versions of Halium are available. Each port of Ubuntu Touch has to be based on one of the available Halium versions and vendor blobs from the corresponding Android version. See the first two columns of the table below for details.
- Así, un porto Ubuntu Touch componse destes compoñentes:
O sistema de ficheiros raíz de Ubuntu Touch (UT) (rootfs)
Halium (contained in the boot and system images)
O vendedor blobs
You, the porter, need to build a Halium kernel, which is installed together with the Ubuntu Touch rootfs and the Halium GSI, to create a functioning Ubuntu Touch port.
Android and Halium versions¶
Halium is built using source code for a modified version of the Android operating system called LineageOS (see the LineageOS website and wiki). The required source code is available online and needs to be downloaded and configured to build the correct Halium version for each individual device port. The table below shows which versions are required for the different Halium versions.
Versión de Android |
Versión de Halium |
Lineage OS (LOS) |
|---|---|---|
7.1 |
7.1 |
14.1 |
9.0 |
9.0 |
16.0 |
10.0 |
10.0 |
17.1 |
11.0 |
11.0 |
18.1 |
12.0 |
12.0 |
19.1 |
13.0 |
13.0 |
20.0 |
Since 20.04, Ubuntu Touch ports are normally based on Halium 9.0 or later. Older versions of Halium are considered deprecated and are no longer supported for new ports.
Generic System Image¶
Starting with Android version 9.0, a significant change of architecture was introduced. The device-specific vendor blobs now reside on a separate partition instead of sharing a partition with the rest of the system image. This separation of device-specific code from generic code made possible what is known as the Generic System Image (GSI).
A GSI is a system image that is built to be able to function with a wide range of devices. Android devices, as of version 9.0, use a GSI. For more information, see the Android Developer pages
The development of the Android GSI architecture also cleared the way for the now available generic Halium 9.0 arm64 system image (hereafter referred to as the Halium GSI, or simply the GSI) which is used for Ubuntu Touch. This, however, is somewhat different from the Android GSI. For a more detailed explanation of the Halium GSI, please refer to the wiki page on Gitlab CI builds of the generic Halium system image.
What does this mean for the porting process?¶
Since the GSI is a prebuilt, device-independent component, it effectively simplifies the task of building a viable port by removing much of the meticulous and time consuming task of getting the hardware-specific vendor blobs compiled into the system image and configured to function properly.
Os retos do proceso de portaxe¶
Building the necessary components and getting them to work together properly always involves an amount of code modifications, configuring and testing.
Luckily, there is a community of porters out there who are eager to see Ubuntu Touch ported to new devices. When you run into trouble, you should search the sources below (Conseguir axuda da comunidade) to see if others before you have solved the issue. There are online Telegram chat groups you can join to ask for help, but please bear in mind that those participating are doing so in their spare time.
Nota
In the past there used to be different methods for porting. Find the historic details linked in the deprecated porting section.
Coñecementos e habilidades previas¶
Porters come in all sizes and shapes, so to speak. Therefore, this guide does not presuppose extensive knowledge or skills in any particular field. You should, however, as a bare minimum be familiar with some common shell commands and be comfortable working from the terminal on you host PC. Furthermore, the guide is based on a host PC running Linux. If you have some knowledge of programming, this will come in handy at some point, especially if you are familiar with C / C++. Also, you should familiarize yourself with git and set up a Github or Gitlab account to keep track of your code changes. It is wise to start documenting your steps from the very beginning.
We have attempted to give a certain amount of explanation along the way. However, this guide is not an in-depth reference into the architecture and inner workings of Ubuntu Touch, and gaining a deeper understanding will consequently require an amount of research on your part.
Conseguir axuda da comunidade¶
Cando teña problemas, consulte unha ou máis das fontes seguintes:
Aviso xeral¶
The more rigorous you are at making notes and documenting your steps, the less time you will spend backtracking your steps and guessing your way along. When dealing with issues that arise along the way, it is wise to work on them one at a time. If you try to correct several things at once, you risk ending up trying to guess which changes solved a given issue, which easily leads to breaking the functionality in question once more at some later stage.
If you are not discouraged after reading this, we welcome your efforts and wish you the best of luck!
The next section presents a key to the rest of this guide.