kernel Compiling and Update
The Linux kernel recipes used by Qualcomm Linux is located at /layers/meta-qcom-hwe/recipes-kernel/linux. In this meta-qcom-hwe layer, there are two kernel solutions:
- The linux-qcom-custom_6.6.bb recipe supports BSP and fetches the kernel source code from the custom repository: qcom.gitgit.codelinaro.org.
- The linux-qcom-base_6.6.bb recipe supports BSP and retrieves the kernel source code from the base repository: linux.gitgit.kernel.org.
The custom kernel source code is currently used.
Directory Structure
qcm6490-idp/
├── kernel-source/ # kernel source code
└── kernel-build-artifacts/ # Build artifacts
kernel-source/Overview
Store the complete Linux kernel source code
- Kernel core code (subdirectories such as arch/, drivers/, fs/, net/, etc.)
- Device tree source files (.dts/.dtsi, describing hardware configurations like QCM6490 SoC peripherals)
- Kernel configurations (Kconfig) and compilation scripts (Makefile)
Directory Analysis
Name | Description | Name | Description |
---|---|---|---|
arch | Directory related to architecture | scripts | Directory of scripts related to kernel compilation/configuration |
block | Directory related to block device | security | Directory related to security framework |
certs | Directory related to certificates and signatures | sound | Directory related to audio systems |
crypto | Directory related to encryption | tools | Directory of kernel interaction tools |
documentation | Directory related to documentation | usr | initramfs-related directory used to generate initramfs |
drivers | Directory related to drivers | virt | Directory that provides virtual machine technology (KVM) |
fs | Directory related to file system | rust | Directory related to Rust |
include | Directory related to header files | Makefile | Main kernel compilation file |
init | Directory related to kernel initialization | Kbuild | Kernel settings configuration script |
ipc | Directory related to inter-process communication | Makefile | Main kernel compilation file |
kernel | Directory of most related to the kernel core | Kbuild | Kernel settings configuration script |
lib | Directory of kernel core library code | Kconfig | Configuration file of Graphical configuration interface |
mm | Directory related to memory management | MAINTAINERS | Maintainers list |
net | Directory related to networking protocols | CREDITS | Linux contributors |
samples | Directory related to kernel programming examples | COPYING | Copyright notice |
kernel-build-artifacts/Overview
Store compiled kernel artifacts:
- Kernel image (Image)
- Device tree binary file (.dtb, compiled by .dts)
- Kernel modules (.ko)
- Compilation logs and configuration files (.config、build.log)
Compile the Kernel
- Enter the build environment code working drectory and and configure the build environment:
source quectel_build/compile/build.sh
- Execute the kernel build command:
bitbake linux-qcom-custom
The kernel image will be generated at (temporarily cached in work directory): build-qcom-wayland/tmp-glibc/work/qcm6490_idp-qcom-linux/linux-qcom-custom/6.6-r0/deploy-linux-qcom-custom/.
Yocto copies the kernel image of the above directory to build-qcom-wayland/tmp-glibc/deploy/images/qcm6490-idp/. To facilitate the packaging of the kernel image file and execute the subsequent process, the script will obtain the kernel image from this directory.
Package Kernel and Device Tree Images
- Install the ukify tool:
sudo pip install pefile
- Package the kernel and device tree images:
do_kernel_images
Attention: Ignore the following ukify warnings:
Kernel version not specified, starting autodetection .
Real-Mode Kernel Header magic not found
+ readelf --notes {TOPDIR}/quectel_build/alpha/tools/pack/image_temp/Image
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start
Found uname version: 6.6.52-qli-1.3-ver.1.1
Wrote unsigned ${TOPDIR}/quectel_build/alpha/tools/pack/image_temp/uki.efi
The updated image efi.bin will be available at ${TOPDIR}/quectel_build/alpha/output/pack.
Update the Image
- Enter fastboot mode before flashing in two ways:
- a: Before powering on, press vol down to start QuecPi Alpha into fastboot mode.
- b: Use adb to enter fastboot mode.
adb reboot bootloader
- Flash the image:
fastboot flash efi efi.bin