diff --git a/source/android/Foundational_Components_Bootloaders.rst b/source/android/Foundational_Components_Bootloaders.rst index d71d385c3..2db2f48cc 100644 --- a/source/android/Foundational_Components_Bootloaders.rst +++ b/source/android/Foundational_Components_Bootloaders.rst @@ -8,20 +8,16 @@ The toolchains are automatically downloaded by the build scripts. **Install OPTEE-OS build dependencies** -.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62PX') - - Check OPTEE-OS docs to know list of dependencies needed to be installed : - https://optee.readthedocs.io/en/latest/building/prerequisites.html +Check OPTEE-OS docs to know list of dependencies needed to be installed : +https://optee.readthedocs.io/en/latest/building/prerequisites.html **Install additional dependencies** -.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62PX') - - .. code-block:: console +.. code-block:: console - $ sudo apt install bc bison build-essential curl u-boot-tools flex git libssl-dev python3 python3-pip wget -y - $ pip3 install pycryptodome pyelftools shyaml --user + $ sudo apt install bc bison build-essential curl u-boot-tools flex git libssl-dev python3 python3-pip wget -y + $ pip3 install pycryptodome pyelftools shyaml --user .. _android-download-bootloaders: @@ -30,18 +26,16 @@ The toolchains are automatically downloaded by the build scripts. Downloading sources ******************* -.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62PX') +Fetch the code using ``repo``: - Fetch the code using ``repo``: - - .. code-block:: console +.. code-block:: console - $ mkdir ${YOUR_PATH}/ti-bootloader-aosp/ && cd $_ - $ repo init -u https://git.ti.com/git/android/manifest.git -b android15-release -m releases/RLS_10_01_Bootloader.xml - $ repo sync + $ mkdir ${YOUR_PATH}/ti-bootloader-aosp/ && cd $_ + $ repo init -u https://git.ti.com/git/android/manifest.git -b android15-release -m releases/RLS_10_01_Bootloader.xml + $ repo sync - For more information about ``repo``, visit `Android's official - documentation `__ +For more information about ``repo``, visit `Android's official +documentation `__ .. _android-build-bootloaders: diff --git a/source/android/Foundational_Components_Kernel.rst b/source/android/Foundational_Components_Kernel.rst index b90e8c06b..52204b32c 100644 --- a/source/android/Foundational_Components_Kernel.rst +++ b/source/android/Foundational_Components_Kernel.rst @@ -2,29 +2,37 @@ Android Kernel ############## +Android is built around a Linux kernel. By default, Android's +``boot.img`` is build from a binary kernel Image located in: + +.. code-block:: text + + ${YOUR_PATH}/ti-aosp-15/device/ti/am62x-kernel/kernel/6.6 + +This guide describes how to rebuild and customize a Linux kernel for +Android. + .. _android-download-kernel: ******************* Downloading sources ******************* -.. ifconfig:: CONFIG_part_variant in ('AM62X' 'AM62PX') - - Fetch the code using ``repo``: +Fetch the code using ``repo``: - .. code-block:: console +.. code-block:: console - $ mkdir ${YOUR_PATH}/ti-kernel-aosp/ && cd $_ - $ repo init -u https://git.ti.com/git/android/manifest.git -b android15-release -m releases/RLS_10_01_Kernel-6.6.xml - $ repo sync + $ mkdir ${YOUR_PATH}/ti-kernel-aosp/ && cd $_ + $ repo init -u https://git.ti.com/git/android/manifest.git -b android15-release -m releases/RLS_10_01_Kernel-6.6.xml + $ repo sync - .. tip:: +.. tip:: - To save some disk space, pass the ``--depth=1`` option to ``repo init``: + To save some disk space, pass the ``--depth=1`` option to ``repo init``: - .. code-block:: console + .. code-block:: console - $ repo init -u https://git.ti.com/git/android/manifest.git -b android15-release -m releases/RLS_10_01_Kernel-6.6.xml --depth=1 + $ repo init -u https://git.ti.com/git/android/manifest.git -b android15-release -m releases/RLS_10_01_Kernel-6.6.xml --depth=1 .. _android-build-kernel: @@ -32,6 +40,13 @@ Downloading sources Build Instructions ****************** +In this section, we will assume that we already have an Android source +tree which has been fully build and is located in: + +.. code-block:: text + + ${YOUR_PATH}/ti-aosp-15/ + Building everything from scratch ================================ @@ -39,37 +54,24 @@ Building everything from scratch The kernel is compatible with all AM62x boards, such as the SK EVM and the Beagle Play. -.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62PX') - - .. code-block:: console +.. code-block:: console - $ cd ${YOUR_PATH}/ti-kernel-aosp/ - $ export TARGET_KERNEL_USE="6.6" - $ export DIST_DIR=${YOUR_PATH}/ti-aosp-15/device/ti/am62x-kernel/kernel/${TARGET_KERNEL_USE} - $ tools/bazel run //common:ti_dist -- --dist_dir=$DIST_DIR + $ cd ${YOUR_PATH}/ti-kernel-aosp/ + $ export TARGET_KERNEL_USE="6.6" + $ export DIST_DIR=${YOUR_PATH}/ti-aosp-15/device/ti/am62x-kernel/kernel/${TARGET_KERNEL_USE} + $ tools/bazel run //common:ti_dist -- --dist_dir=$DIST_DIR - Android uses Kleaf, a Bazel-based build system to build the kernel. - AOSP documentation can be found `here `__ and - Kleaf documentation `here `__ +Re-running this command will rebuild incrementally. - .. attention:: +Android uses Kleaf, a Bazel-based build system to build the kernel. +AOSP documentation can be found `here `__ and +Kleaf documentation `here `__ - Kernel builds hangs when using the ``btrfs`` file system. - This is a known issue according to the `kleaf documentation `_ - Make sure to pass the ``--workaround_btrfs_b292212788`` flag to bazel when using ``btrfs``. +.. attention:: - -Rebuilding faster -================= - -.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62PX') - - .. code-block:: console - - $ cd ${YOUR_PATH}/ti-kernel-aosp/ - $ export TARGET_KERNEL_USE="6.6" - $ export DIST_DIR=${YOUR_PATH}/ti-aosp-15/device/ti/am62x-kernel/kernel/${TARGET_KERNEL_USE} - $ tools/bazel run --config=fast //common:ti_dist -- --dist_dir=$DIST_DIR + Kernel builds hangs when using the ``btrfs`` file system. + This is a known issue according to the `kleaf documentation `_ + Make sure to pass the ``--workaround_btrfs_b292212788`` flag to bazel when using ``btrfs``. Defconfig/menuconfig changes @@ -77,50 +79,44 @@ Defconfig/menuconfig changes The usual (``make menuconfig``) is done via ``bazel`` command : -.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62PX') +.. code-block:: console - .. code-block:: console - - $ cd ${YOUR_PATH}/ti-kernel-aosp/ - $ tools/bazel run //common:ti_config -- menuconfig + $ cd ${YOUR_PATH}/ti-kernel-aosp/ + $ tools/bazel run //common:ti_config -- menuconfig -.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62PX') +This will automatically update the :file:`arch/arm64/configs/ti_gki.fragment`. - .. note:: +.. note:: - Users must have built the android kernel image prior to building the Android file system. - Otherwise pre-built kernel images present in :file:`device/ti/am62x-kernel` - will be used to create :file:`boot.img` + Users must have built the android kernel image prior to building the Android file system. + Otherwise pre-built kernel images present in :file:`device/ti/am62x-kernel` + will be used to create :file:`boot.img` Rebuild Android images ====================== -.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62PX') - - We should re-generate the Android images to include the newly build kernel. - Follow the Android :ref:`android-build-aosp` to do so. +We should re-generate the Android images to include the newly build kernel. +Follow the Android :ref:`android-build-aosp` to do so. ********************* Flashing instructions ********************* -.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62PX') +In order to flash a new kernel, several images should be flashed: - In order to flash a new kernel, several images should be flashed: - - .. code-block:: console +.. code-block:: console - $ adb reboot fastboot - < Wait for fastbootd reboot > + $ adb reboot fastboot + < Wait for fastbootd reboot > - $ cd - $ fastboot flash boot boot.img - $ fastboot flash vendor_boot vendor_boot.img - $ fastboot flash vendor_dlkm vendor_dlkm.img - $ fastboot reboot + $ cd + $ fastboot flash boot boot.img + $ fastboot flash vendor_boot vendor_boot.img + $ fastboot flash vendor_dlkm vendor_dlkm.img + $ fastboot reboot - The board should boot with the new kernel. +The board should boot with the new kernel. ******************** Enabling new drivers diff --git a/source/android/Overview_Building_the_SDK.rst b/source/android/Overview_Building_the_SDK.rst index bbb8f7843..8de2d3f23 100644 --- a/source/android/Overview_Building_the_SDK.rst +++ b/source/android/Overview_Building_the_SDK.rst @@ -28,24 +28,20 @@ To install it, please refer to this webpage : https://source.android.com/setup/d Downloading sources ******************* -.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62PX') +Create a folder for downloading all sources - Create a folder for downloading all sources - - .. code-block:: console - - $ mkdir ~/10_01_00 && cd $_ - $ export YOUR_PATH=$PWD +.. code-block:: console -.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62PX') + $ mkdir ~/10_01_00 && cd $_ + $ export YOUR_PATH=$PWD - Fetch the code using ``repo``: +Fetch the code using ``repo``: - .. code-block:: console +.. code-block:: console - $ mkdir ${YOUR_PATH}/ti-aosp-15 && cd $_ - $ repo init -u https://git.ti.com/git/android/manifest.git -b android15-release -m releases/RLS_10_01.xml - $ repo sync + $ mkdir ${YOUR_PATH}/ti-aosp-15 && cd $_ + $ repo init -u https://git.ti.com/git/android/manifest.git -b android15-release -m releases/RLS_10_01.xml + $ repo sync .. tip:: @@ -65,16 +61,14 @@ Downloading sources Build Instructions ****************** -.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62PX') - - .. code-block:: console +.. code-block:: console - $ cd ${YOUR_PATH}/ti-aosp-15 - $ source build/envsetup.sh - $ lunch - $ m - [...] - #### build completed successfully (49:14 (mm:ss)) #### + $ cd ${YOUR_PATH}/ti-aosp-15 + $ source build/envsetup.sh + $ lunch + $ m + [...] + #### build completed successfully (49:14 (mm:ss)) #### Where ```` is listed in the table below : @@ -129,22 +123,20 @@ The following build flags are available. **Default** values are **highlighted**. - **false**/true - Boot from SD card instead of eMMC -.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62PX') +After building is complete, the necessary images will be available in +:file:`${YOUR_PATH}/ti-aosp-15/out/target/product/am62*/`. - After building is complete, the necessary images will be available in - :file:`${YOUR_PATH}/ti-aosp-15/out/target/product/am62*/`. +To proceed to flash Android, see :ref:`android-flashing`. - To proceed to flash Android, see :ref:`android-flashing`. - - .. tip:: +.. tip:: - As stated previously, Android build contains **pre-built binaries** - for both the kernel and the bootloaders. - These are ready to be used as-is with the EVM boards. - For customization, it's possible to rebuild them. + As stated previously, Android build contains **pre-built binaries** + for both the kernel and the bootloaders. + These are ready to be used as-is with the EVM boards. + For customization, it's possible to rebuild them. - - See :ref:`android-build-kernel` for the kernel - - See :ref:`android-build-bootloaders` for the bootloaders + - See :ref:`android-build-kernel` for the kernel + - See :ref:`android-build-bootloaders` for the bootloaders .. ifconfig:: CONFIG_part_variant in ('AM62X')