### Define Remote Source Configuration Source: https://docs.halium.org/en/latest/porting/get-sources.html Configures a remote server for fetching source code. Requires a name and fetch URL, with optional review server and default revision settings. ```xml ``` -------------------------------- ### Initialize and Sync Halium Source Tree Source: https://docs.halium.org/en/latest/porting/get-sources.html Commands to create a build directory, initialize the repository with a specific branch, and sync the source code. The initialization commands vary based on the target Android version, while the sync command downloads the necessary repositories. ```bash mkdir halium && cd halium repo init -u https://github.com/Halium/android -b halium-12.0 --depth=1 repo init -u https://github.com/Halium/android -b halium-11.0 --depth=1 repo init -u https://github.com/Halium/android -b halium-10.0 --depth=1 repo init -u https://github.com/Halium/android -b halium-9.0 --depth=1 repo init -u https://github.com/Halium/android -b halium-7.1 --depth=1 repo init -u https://github.com/Halium/android -b halium-5.1 --depth=1 repo sync -c -j 16 ``` -------------------------------- ### Install Dependencies for Debian/Ubuntu (Stretch or newer) Source: https://docs.halium.org/en/latest/porting/first-steps.html Installs a comprehensive list of development dependencies required for building Halium on Debian and Ubuntu systems. Includes tools for building, version control, and specific libraries for multi-arch support. ```bash sudo apt install git gnupg flex bison gperf build-essential \ zip bzr curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \ libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \ libgl1-mesa-dev g++-multilib mingw-w64-i686-dev tofrodos \ python-markdown libxml2-utils xsltproc zlib1g-dev:i386 schedtool \ repo liblz4-tool bc lzop imagemagick libncurses5 rsync ``` -------------------------------- ### Configure PATH for Repo Tool (Ubuntu) Source: https://docs.halium.org/en/latest/porting/first-steps.html Creates a 'bin' directory in the home directory and adds it to the system's PATH environment variable. This ensures the 'repo' command is accessible system-wide after installation. ```bash mkdir -p ~/bin echo export PATH=$PATH:$HOME/bin >> ~/.bashrc source ~/.bashrc ``` -------------------------------- ### Install Dependencies for Ubuntu (20.04 or newer) Source: https://docs.halium.org/en/latest/porting/first-steps.html Installs development dependencies for Halium on Ubuntu 20.04 and newer. This list is similar to older Ubuntu versions but includes 'python-is-python3' for compatibility. ```bash sudo apt install git gnupg flex bison gperf build-essential \ zip bzr curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \ libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \ libgl1-mesa-dev g++-multilib mingw-w64-i686-dev tofrodos \ python-markdown libxml2-utils xsltproc zlib1g-dev:i386 schedtool \ liblz4-tool bc lzop imagemagick libncurses5 rsync \ python-is-python3 ``` -------------------------------- ### Install Halium Dependencies from AUR (Arch Linux) Source: https://docs.halium.org/en/latest/porting/first-steps.html Clones the 'halium-devel' package from the Arch User Repository (AUR), changes the directory, and installs it using 'makepkg'. This installs Halium-specific development packages and their dependencies. ```bash git clone https://aur.arch.linux.org/halium-devel.git && cd halium-devel && makepkg -i ``` -------------------------------- ### Convert Shallow Repository to Full History Source: https://docs.halium.org/en/latest/porting/get-sources.html Commands to fetch the full history for a repository that was initially cloned with a shallow depth. This is required if you intend to contribute patches or perform advanced git operations. ```bash git remote -v git fetch --unshallow [remote_name] ``` -------------------------------- ### Install Halium rootfs and system.img Source: https://docs.halium.org/en/latest/porting/install-build/reference-rootfs.html This script installs the Halium rootfs and Android system.img onto a device. The device needs to be in recovery mode. The script requires paths to the rootfs tarball and the system.img. The -v option provides verbose output for debugging. ```bash ./halium-install -p halium ``` -------------------------------- ### Enable i386 Architecture and Update Packages (Debian/Ubuntu) Source: https://docs.halium.org/en/latest/porting/first-steps.html Enables the i386 architecture for multi-arch support and updates package lists. This is a prerequisite for installing 32-bit development libraries on amd64 systems. ```bash sudo dpkg --add-architecture i386 sudo apt update ``` -------------------------------- ### Build System and Boot Images Source: https://docs.halium.org/en/latest/porting/build-sources.html Commands to build the necessary tools and images for Halium, including mkbootimg, hybris-boot, and systemimage. ```bash mka mkbootimg export USE_HOST_LEX=yes mka hybris-boot mka systemimage ``` -------------------------------- ### Define XML Manifest Structure Source: https://docs.halium.org/en/latest/porting/get-sources.html The base structure for a device-specific manifest file in Halium. This file is placed in the halium/devices/manifests/ directory. ```xml ``` -------------------------------- ### Run gdb for Backtrace Source: https://docs.halium.org/en/latest/porting/debug-build/debug-android-userspace.html Starts the gdb interactive debugger for a program, allowing you to execute it until a crash and then obtain a full backtrace. Ensure debug symbols are installed for maximum utility. ```bash EGL_PLATFORM=hwcomposer gdb test_hwcomposer run bt full ``` -------------------------------- ### Executing Init in boot.img (Shell) Source: https://docs.halium.org/en/latest/Distribution.html This snippet shows how the boot.img switches to the target rootfs and executes the init process, redirecting standard output and error to a log file for debugging purposes. ```shell exec switch_root /target $INIT --log-target=kmsg &> /target/init-stderrout ``` -------------------------------- ### Add Project Repository to Manifest Source: https://docs.halium.org/en/latest/porting/get-sources.html Defines a specific source repository to be included in the build. The path, name, remote, and revision attributes are used to map the repository to the local source tree. ```xml ``` -------------------------------- ### Mounting Partitions in boot.img (Shell) Source: https://docs.halium.org/en/latest/Distribution.html This snippet demonstrates the basic functionality of the boot.img, which involves mounting the data partition and the rootfs.img to the /target directory before switching to the target rootfs and executing the init process. ```shell mount $DATA_PARTITION /data mount /data/rootfs.img /target ``` -------------------------------- ### Download and Make Repo Executable (Ubuntu) Source: https://docs.halium.org/en/latest/porting/first-steps.html Downloads the 'repo' script from Google's storage and makes it executable. This script is essential for managing multiple Git repositories used in the Android build system. ```bash curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo chmod a+rx ~/bin/repo ```