1. Article purpose[edit source]
This article is intended for Distribution Package users (see Which Package better suits your needs for more information).
The Android Linux Common kernel is used in the STM32MPU distribution for Android™.
The STM32MPU distribution for Android™ includes prebuilt kernel binaries used to generate the partition images (boot
, dt
and vendor
). These binaries are available in the device/stm/<SocId>-kernel/prebuilt
directory.
This page explains how to rebuild the kernel binaries.
2. Prerequisites[edit source]
The environment must be installed using the Distribution Package adapted to your selected microprocessor device, STM32MP1 Distribution Package for Android.
To be able to execute following instruction you need to work from your distribution root directory STM32MP1 Distribution Package for Android, initialise your environment and then launch:
source build/envsetup.sh
lunch aosp-eval-userdebug
3. Partition layout[edit source]
The Linux kernel binary is part of the boot
partition.
The Linux kernel drivers built as loadable modules (.ko
files) are part of the vendor
partition.
The device tree binary file is part of the dt
partition.
4. Loading the kernel sources[edit source]
By default, the kernel sources are not part of the STM32MPU distribution for Android. To load the sources, execute the following command:
load_kernel
This will load the Android™ Linux common kernel sources. These can then be found in the device/stm/<SocId>-kernel/linux-<SocId>
directory.
5. Building the kernel[edit source]
After retrieving the kernel sources you can build it using:
build_kernel
The output can be found in: out-bsp/<SocId>/KERNEL_OBJ
Usage: build_kernel [Options] [Command] This script allows building the Linux kernel source Options: -h/--help: print this message -i/--install: update prebuilt images -v/--version: get script version --verbose: enable verbosity Command: only one command at a time supported dtb: build only device-tree binaries gpu: build only gpu module (kernel is build if not already performed) defaultconfig: build only .config based on default defconfig files and fragments menuconfig: display standard Linux kernel menuconfig interface modules: build only kernel modules binaries (kernel is build if not already performed) mrproper: execute make mrproper on targeted kernel vmlinux: build only kernel vmlinux binary
6. Generating distribution without kernel prebuilt images[edit source]
In order to compile and generate the distribution with your custom kernel build you need to change the device/stm/<SocId>/BoardConfigCommon.mk
file and comment those lines:
TARGET_PREBUILT_KERNEL
TARGET_PREBUILT_MODULE_PATH
TARGET_PREBUILT_DTB_PATH
Then you need to rebuild the distribution:
make -j
7. Generating kernel prebuilt images[edit source]
When you have compiled your new kernel and your changes are validated, you can generate prebuilt images and integrate them easily by doing:
build_kernel -i
{{ReviewsComments| N. Louboutin: add some details on which defconfig is used (merge of several config files), which device tree is built and install)