Kernel development

Copyright © Quectel Wireless Solutions Co., Ltd. 2026. All rights reserved.


Purpose and Scope

This section guides users through recompiling the Linux kernel and DTB after applying customizations (such as drivers, configurations, or patches), and replacing them on the Debian system.

  • Applicable platform: Quectel Pi H1 (based on the Pi-H1 Linux SDK).

  • Applicable OS: Debian 13.

Prerequisites

Development environment requirements

  • A functional Linux host environment (Ubuntu or Debian-based distributions are supported; refer to the SDK documentation for specific distribution requirements).

  • At least 200 GB of free disk space is recommended (allocated for sources, downloads, sstate-cache, the build-qcom-wayland build directory, the prebuilt root filesystem, and packaged build artifacts).

  • Bash is required to execute SDK scripts: The build script quectel_build/compile/build.sh specifies #!/bin/bash and relies on Bash-specific features such as arrays, [[ ]] conditional syntax, and source. Distributions like Ubuntu symlink /bin/sh to dash by default, which causes syntax parse errors if invoked via sh. Verify that /bin/sh points to bash(ls -l /bin/sh), or execute the commands directly in a Bash terminal session.

Obtain/ prepare the SDK

Make sure you have obtained the Pi-H1 Linux SDK and are using the SDK version that matches the current Debian image (or the same release/ tag). If the SDK and image versions do not match, the following issues may occur:

  • Kernel/ module version mismatch, causing drivers to fail to load.

  • DTB mismatch, causing peripherals to be unavailable or the system to fail to boot.

Build command workflow

The main workflow of this section is as follows: After initializing the environment and configuring the project, build the kernel and DTB individually as needed with the target commands provided by the SDK, and use them to replace the kernel/ DTB in the Debian system.

Go to the SDK directory

cd your/path/to/Pi-H1-Linux-SDK/

Initialize the build environment

source quectel_build/compile/build.sh

Note

This script loads the build functions of the SDK (such as buildconfig/buildkernel/builddtb/buildpackage) and sets the required environment variables.
If source is not run, subsequent commands usually report "command not found" or missing environment variables.
After running this command, the terminal automatically switches to the build-qcom-wayland directory, which is normal. The subsequent buildconfig, buildkernel, builddtb, buildpackage commands are all run in this directory.

Select the build configuration

buildconfig QSM565DWF SG565DWFPARL1A01_BL01BP01K0M01_QDP_LP6.6.0XX.01.00X_V0X STD

Note

QSM565DWF: Target platform/ product family configuration (selecting the correct platform is critical, as it affects the kernel configuration, device tree, packaging rules, and so on).
SG565DWFPARL1A01_BL01BP01K0M01_QDP_LP6.6.0XX.01.00X_V0X: Project version/ configuration (example); Select from the valid fields shown in the prompt.
STD: Standard build configuration (different configurations may affect the build options, debug symbols, packaged content, and so on).

You can also enter a customized project_name, project_rev, and custom_name as prompted, choosing the currently valid fields from the Valid Projects and Valid CUST_NAME lists in the prompt.

After the configuration succeeds, the current build configuration is displayed (example):

MACHINE    = qcm6490-idp
DISTRO     = qcom-wayland
BUILDTYPE  = default
BSP-TYPE   = qcom-custom-bsp

The confirmed project configuration is also displayed (example):

Current QUECTEL_PROJECT_NAME = QSM565DWF
Current QUECTEL_PROJECT_REV  = SG565DWFPARL1A01_BL01BP01K0M01_QDP_LP6.6.0XX.01.00X_V0X
Current QUECTEL_CUSTOM_NAME  = STD

Enable the kernel build switch

setopenkernel

Note

This step enables the kernel build pipeline within the SDK build system (including the kernel image, DTBs, and kernel modules built alongside the kernel). If you skip this step, subsequent buildkernel, builddtb, or buildpackage commands might not generate the expected kernel/ DTB artifacts or may fall back to default prebuilt/ proprietary binary branches (depending on SDK-specific build rules).

Build the kernel individually (generate efi.bin)

buildkernel

Note

This command triggers the kernel build within the SDK environment and generates efi.bin, the kernel artifact required for booting.
Output directory: Once the build completes, efi.bin is located at Pi-H1-Linux-SDK/quectel_build/output/efi.bin.
Firmware package replacement guideline: Copy output/efi.bin to overwrite the existing kernel file in the firmware package directory generated by buildpackage. This file serves as the final kernel image for release delivery and flashing (see Step 7).

Build the DTB individually (generate dtb.bin)

builddtb

Note

This command generates the device tree artifact dtb.bin (which may be a package/ collection of multiple dtb files).
Output directory: Once the build completes, dtb.bin is located at Pi-H1-Linux-SDK/quectel_build/output/dtb.bin.
Firmware package replacement guideline: Copy output/dtb.bin to overwrite the existing kernel file in the firmware package directory generated by buildpackage. This file serves as the final kernel image for release delivery and flashing (see Step 7).

Generate the firmware package directory and replace the kernel/ DTB

Run buildpackage to generate the firmware package directory (TARGET_DIR), then overwrite the corresponding files in that directory with the new artifacts from quectel_build/output/.

buildpackage

Note

This step usually takes 10~20 seconds. On success, it generates the firmware package directory (example): Pi-H1-Linux-SDK/quectel_build/SG565DWFPARL1A01_BL01BP01K0M01_QDP_LP6.6.0XX.01.00X_V0X/.
Key point: The directory generated by buildpackage is where the final flashing/ delivery package is located. After customizing the kernel/ DTB, overwrite the files there with the following files:
Source: Pi-H1-Linux-SDK/quectel_build/output/efi.bin
Source: Pi-H1-Linux-SDK/quectel_build/output/dtb.bin
Target: The corresponding efi.bin and dtb.bin in the Pi-H1-Linux-SDK/quectel_build/SG565DWFPARL1A01_BL01BP01K0M01_QDP_LP6.6.0XX.01.00X_V0X/ directory

Example (the actual file names are subject to the contents of the firmware package directory):

# Go to the SDK root directory
cd Pi-H1-Linux-SDK

# Overwrite the files in the firmware package with the individually built artifacts
cp -f quectel_build/output/efi.bin quectel_build/SG565DWFPARL1A01_BL01BP01K0M01_QDP_LP6.6.0XX.01.00X_V0X/efi.bin
cp -f quectel_build/output/dtb.bin quectel_build/SG565DWFPARL1A01_BL01BP01K0M01_QDP_LP6.6.0XX.01.00X_V0X/dtb.bin

Artifact description

This section helps you quickly identify the target files that must be replaced:

  • efi.bin: The partition image of the entire EFI System Partition (ESP), mapped to the partition labeled efi in the GPT partition table (Type GUID: C12A7328-F81F-11D2-BA4B-00A0C93EC93B, 500 MB capacity, FAT16 filesystem).

    • Contents: Contains the systemd-boot bootloader (/EFI/BOOT/bootaa64.efi), bootloader configuration files (/boot/loader/loader.conf, /boot/loader/entries/*.conf), and the Unified Kernel Image (UKI: /EFI/Linux/linux-qcm6490-idp.efi, bundled from the kernel Image, initramfs, and kernel command line parameters).

    • Boot/ loading flow: During the XBL/ ABL (UEFI) phase, the bootloader identifies the ESP partition type and loads /EFI/BOOT/bootaa64.efi directly; systemd-boot then executes the kernel contained within the UKI. This is not a standalone kernel file residing under /boot in the Debian root filesystem; updates must be flashed directly as a raw partition image.

  • dtb.bin: The partition image of the dtb partition, mapped to the partition labeled dtb_a in the GPT partition table (64 MB capacity, FAT filesystem), containing the concatenated Device Tree Blob combined-dtb.dtb.

    • Boot / Loading Flow: This partition is not mounted or parsed by Debian userspace; rather, it is read during the XBL/ ABL (UEFI) stage by the bootloader and passed directly to the kernel. Custom Device Tree modifications require reflashing the dtb partition rather than replacing .dtb files in the root filesystem.

  • package: The aggregated build release archive generated by the SDK, recommended as the primary delivery bundle. It typically packages efi.bin, dtb.bin, and associated target dependencies (refer to the generated package manifest for the exact directory tree).

Verification and rollback

Verification

Perform at least the following two verification checks:

  • Kernel version verification: Run uname -r on the board to verify the kernel release string (for example, 6.6.116-qli-1.7-ver.1.1, based on your specific build output). Run uname -a to inspect the build timestamp following the release string, or run cat /proc/version to view the build timestamp and compiler toolchain details, confirming that the newly recompiled kernel is running rather than the previous image.

  • Functional verification: Perform minimal closed-loop tests on customized drivers or configuration options (such as peripheral enumeration, driver loading, and dmesg log keywords).

Rollback

Implement the following rollback strategy:

  • Always maintain a bootable backup of the baseline kernel and DTB (via file-level backups or dual boot entries).

  • The platform boot chain uses XBL/ ABL (UEFI) + systemd-boot and does not use extlinux or GRUB. Boot entries are defined in /boot/loader/entries/*.conf within the EFI System Partition (ESP, the efi partition). Validate a newly compiled kernel by adding a secondary boot entry and setting it as default via the default parameter in loader.conf. Overwrite the production kernel files only after verifying that the system boots and operates stably.

FAQs

  • build command not found: Ensure you sourced the build environment by running source quectel_build/compile/build.sh in your active shell session.

  • buildkernel or builddtb produces no output: Verify that you selected the target build configuration via buildconfig, and ensure you ran setopenkernel to enable the kernel build pipeline.

  • System fails to boot after replacing images: Roll back immediately to the backup files. Verify that the kernel and DTB paths declared in the boot loader entry match the actual file paths on the filesystem.

  • DTB modifications do not take effect: The Device Tree is loaded from the dtb partition (labeled dtb_a) during the ABL stage. Ensure that you copied the updated dtb.bin into the firmware package directory and reflashed the partition. To verify active Device Tree changes on the board:

    • Run cat /proc/device-tree/model (confirm it matches the model property in the compiled DTS) and cat /proc/device-tree/compatible.

    • Alternatively, navigate to the modified node by traversing /proc/device-tree/ with ls and inspect the property files with cat to cross-check against your DTS source changes.

  • Kernel module version mismatch: Ensure the module directory /lib/modules/<kernel_version>/ matches the kernel release string returned by uname -r, then run depmod -a.