# Develop the kernel Qualcomm Linux kernel can be developed using Yocto build workflow or standalone. ## Use Yocto to develop kernel The Qualcomm Linux `meta-qcom-hwe` layer supports `linux-qcom-base_6.6.bb` and `linux-qcom-custom_6.6.bb` recipes that fetch and build the Qualcomm Linux kernel for supported machines. To develop kernel using Yocto development workflow, refer following sections. For more information about Yocto provisions, host patches, and how to apply them, see [Yocto Project Linux Kernel Development](https://docs.yoctoproject.org/1.5/kernel-dev/kernel-dev.html#applying-patches). ## Retrieve the kernel source Fetch the kernel source from the CodeLinaro repository as a part of BitBake builds. **Yocto kernel** MACHINE=-- DISTRO=qcom-wayland source setup-environment bitbake qcom-console-image # kernel source is downloaded under following location ls build-qcom-wayland/tmp-glibc/work-shared/--/kernel-source/ arch Documentation ipc MAINTAINERS samples virt block drivers Kbuild Makefile scripts certs fs Kconfig mm security COPYING include kernel net sound CREDITS init lib README tools crypto io_uring LICENSES rust usr Copy to clipboard Note Machine name for the previous commands is the same as the SoC-board-variant name. For example, for the QCS6490 SoC, `QCS6490` is the machine name, `rb3gen2` is the board, and `Visionkit` is the variant. For more information about the setup and obtaining a source, see the [Qualcomm Linux Build Guide](doc/80-70030-254). ## Retrieve the kernel recipe Qualcomm Linux maintains the `meta-qcom-hwe` layer and hosts kernel recipe files at the following locations: - Base BSP: `meta-qcom-hwe/recipes-kernel/linux//linux-qcom-base_6.6.bb` file. - Custom BSP: `meta-qcom-hwe/recipes-kernel/linux//linux-qcom-custom_6.6.bb` file. `PREFERRED_PROVIDER_virtual/kernel` is defined as `linux-qcom-base` or `linux-qcom-custom` in the `meta-qcom-hwe/conf/machine/include/qcom-base.inc` file. For the kernel recipe, run the following commands: # kernel recipe location ls -l meta-qcom-hwe/recipes-kernel/linux/ linux-kernel-headers-install_6.6.bb linux-kernel-qcom-headers_6.6.bb linux-qcom-base-6.6 linux-qcom-base_6.6.bb linux-qcom-custom linux-qcom-custom_6.6.bb Copy to clipboard ## Unpack the kernel source Unpack the kernel source for development and customization after cloning the meta layer. To unpack the source code, run the following commands: # unpack kernel # checkout kernel source aligned to upstream LTS base with patches applied from recipe # Following would checkout kernel source in build-qcom-wayland/workspace/sources/linux-qcom-base/ $ devtool modify linux-qcom-base Copy to clipboard Note For the custom BSP variant, use `linux-qcom-custom`. ## Make kernel changes Kernel changes or customizations are done in the `build-qcom-wayland/workspace/sources/linux-qcom-base` workspace. To modify the kernel configuration, run the following commands: # Modify sources in build-qcom-wayland/workspace/sources/linux-qcom-base, or update kernel configuration by running makemenufonfig devtool menuconfig linux-qcom-base # config fragment is updated in following location ls build-qcom-wayland/workspace/sources/linux-qcom-base/oe-local-files/devtool-fragment.cfg devtool-fragment.cfg # you may do other changes to kernel and commit Copy to clipboard Note For the custom BSP variant, use `linux-qcom-custom`. ## Commit kernel changes To commit your changes, run the following Git commands: cd build-qcom-wayland/workspace/sources/linux-qcom-base git add . git commit -s -m "my changes" Copy to clipboard ## Build the kernel image After the changes are done, to build the kernel and the image, run the following commands: > > > # to build kernel use > devtool build linux-qcom-base > Copy to clipboard # and following to build the image devtool build-image qcom-console-image Copy to clipboard # built images are produced in standard location ls build-qcom-wayland/tmp-glibc/deploy/images/--/ Copy to clipboard Note To compile the custom BSP, use `linux-qcom-custom`. ## Maintain kernel changes Use Devtool to develop and export the patch and create an append file in the `meta-mylayer` layer. To create your own layer, first add it to the host kernel `bbappend` files and make changes. To create and append kernel patches in the meta layer, run the following commands: # create your own layer first and add it to host kernel bbappend and changes bitbake-layers create-layer ~/meta-mylayer # mkdir -p ~/meta-mylayer/recipes-kernel/linux/linux-qcom-base bitbake-layers add-layer ~/meta-mylayer # following would update the meta-mylayer recipe and the change devtool finish linux-qcom-base ~/meta-mylayer # devtool finish shall populate the meta-mylayer recipes along with patches, ls -R meta-mylayer/recipes-kernel/ meta-mylayer/recipes-kernel/: linux meta-mylayer/recipes-kernel/linux: linux-qcom-base linux-qcom-base_%.bbappend meta-mylayer/recipes-kernel/linux/linux-qcom-base: 0001-my-patch.patch devtool-fragment.cfg less meta-mylayer/recipes-kernel/linux/linux-qcom-base%.bbappend FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" SRC_URI += "file://devtool-fragment.cfg \ file://0001-my-patch.patch" Copy to clipboard After running the `devtool finish` command, the `~/meta-mylayer` layer is updated with the following: - Corresponding kernel changes hosted as patches in `meta-mylayer/recipes-kernel/linux/linux-qcom-base/*.patch`. - Add and update `meta-mylayer/recipes-kernel/linux/linux-qcom-base_%.bbappend SRC_URI` with these patches. - Remove `build-qcom-wayland/workspace` after the development is completed. Note For the custom BSP variant, use `linux-qcom-custom`. ## Clean up the workspace To clean up the workspace, use the following Devtool and BitBake commands: # to remove layer bitbake-layers remove-layer ~/meta-mylayer # to clean complete workspace bitbake -c cleanall # reset using Devtool devtool reset linux-qcom-base # manually delete the workspace directory rm -rf build-qcom-wayland/workspace/sources/linux-qcom-base Copy to clipboard ## Configure the kernel The Yocto build system is used for modifying the kernel configuration, while invoking `menuconfig`. To modify the kernel configuration, run the following commands: MACHINE=-- DISTRO=qcom-wayland source setup-environment bitbake linux-qcom-base -c menuconfig # Above would update .config in kernel build directory build-qcom-wayland/tmp-glibc/work/--/linux-qcom-base/6.6-r0/build/ # one can create a config fragment for modifications made by issuing following bitbake linux-qcom-base -c diffconfig # Above would create fragment.cfg in build directory build-qcom-wayland/tmp-glibc/work/--/linux-qcom-base/6.6-r0/ Copy to clipboard Alternatively, use the Devtool to modify the kernel configuration: devtool modify linux-qcom-base devtool menuconfig linux-qcom-base devtool finish linux-qcom-base ~/meta-mylayer # this would create a config fragment as a patch and update in your meta layer Copy to clipboard Note For the custom BSP variant, use `linux-qcom-custom`. For more information about Yocto-related details on kernel configuration, see [Configuring the Kernel](https://docs.yoctoproject.org/4.3.1/kernel-dev/common.html#configuring-the-kernel). The `linux-kernel-qcom-base_6.6.bb`, or `linux-qcom-custom_6.6.bb` kernel recipe file uses the following configuration fragments to build the images: For example, `linux-qcom-custom_6.6.bb` uses the following fragments to append the kernel: KERNEL_CONFIG ??= "qcom_defconfig" KERNEL_CONFIG_FRAGMENTS:append = " ${S}/arch/arm64/configs/qcom_addons.config" KERNEL_CONFIG_FRAGMENTS:append = " ${@oe.utils.vartrue('DEBUG_BUILD', '${S}/arch/arm64/configs/qcom_debug.config', '', d)}" KERNEL_CONFIG_FRAGMENTS:append = " ${@oe.utils.vartrue('DEBUG_BUILD', '${S}/arch/arm64/configs/qcom_addons_debug.config', '', d)}" # Enable selinux support SELINUX_CFG = "${@oe.utils.vartrue('DEBUG_BUILD', 'selinux_debug.cfg', 'selinux.cfg', d)}" KERNEL_CONFIG_FRAGMENTS:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${WORKDIR}/${SELINUX_CFG}', '', d)}" Copy to clipboard To generate the debug build using debug configuration fragments, run the following commands: # Set DEBUG_BUILD to 1 to compile debug-enabled build source setup-environment DEBUG_BUILD=1 bitbake linux-kernel-custom Copy to clipboard For more information about different configuration fragments, see [Get started with Qualcomm Linux kernel](https://docs.qualcomm.com/doc/80-70030-3/topic/getting_started_chapter2.html). ## Create a debug build To create a debug build, pass `DEBUG_BUILD=1` as an argument in the shell: # setup the build environment export SHELL=/bin/bash MACHINE=-- DISTRO=qcom-wayland QCOM_SELECTED_BSP=base source setup-environment # build qcom linux console image DEBUG_BUILD=1 bitbake qcom-console-image Copy to clipboard Note For the custom BSP variant, use `QCOM_SELECTED_BSP=custom`. ## Update the kernel command-line parameters To update the kernel command-line, modify the Yocto configuration variable `KERNEL_CMDLINE_EXTRA` in the corresponding SoC-specific machine inclusion file. For example, `meta-qcom-hwe/conf/machine/include/qcom-.inc`. To update the kernel command-line, modify the following variable: KERNEL_CMDLINE_EXTRA = "root=/dev/disk/by-partlabel/system rw rootwait console=ttyMSM0,115200n8 pcie_pme=nomsi earlycon" Copy to clipboard ### Update the ESP images To compile the systemd-boot boot manager and kernel images into a packaged UKI type-2 image file, use the following methods: Yocto build for hardware SoC generates all the required images and package boot images as `efi.bin` that is flashed into the EFI partition. The `efi.bin` file consists of systemd-boot boot manager and kernel images, which are packaged as UKI type-2 image format. Rebuild the EFI image after updating the kernel source, configuration, or DTS and flash the generated `efi.bin` to the EFI partition. MACHINE=-- DISTRO=qcom-wayland source setup-environment # build qcom linux console image DEBUG_BUILD=1 bitbake qcom-console-image # build images are produced in following directory ls build-qcom-wayland/tmp-glibc/deploy/images/--/efi.bin efi.bin # reboot into fastboot fastboot flash efi efi.bin fastboot flash dtb_a dtb.bin Copy to clipboard For more information about the UKI type-2 image format, see [Type #2 EFI Unified Kernel Images](https://uapi-group.org/specifications/specs/boot_loader_specification/#type-2-efi-unified-kernel-images). For more information about ESP, see Boot and [Bring up the device](https://docs.qualcomm.com/doc/80-70030-3/topic/getting_started_chapter2.html#bring-up-the-device). ## Customize the initramfs package To update the initramfs package, modify the `PACKAGE_INSTALL` list in `meta-qcom-hwe/recipes-kernel/images/initramfs-qcom-image.bbappend` file: less meta-qcom-hwe/recipes-kernel/images/initramfs-qcom-image.bbappend # Add additional packages needed as part of initrd PACKAGE_INSTALL += " \ e2fsprogs \ e2fsprogs-e2fsck \ e2fsprogs-mke2fs \ e2fsprogs-resize2fs \ e2fsprogs-tune2fs \ ${VIRTUAL-RUNTIME_dev_manager} \ os-release-initrd \ " Copy to clipboard ## Add a kernel module To compile out-of-tree kernel modules using the Yocto build system, use the following procedure: 1. Create a `Makefile` for out-of-tree kernel driver. > > > The following is the sample `Makefile` for out-of-tree kernel driver: all: modules obj-m := hello.o SRC := $(shell pwd) modules: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules $(KBUILD_OPTIONS) modules_install: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install Copy to clipboard 2. Integrate the module into the Yocto build system. > > > See the following example to integrate the kernel modules using Yocto module class. DESCRIPTION = "${SUMMARY}" LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/${LICENSE};md5=801f80980d171dd6425610833a22dbe6" inherit module SRC_URI += "file://Makefile \ file://hello.c \ file://COPYING \ " S = "${WORKDIR}" EXTRA_OEMAKE += "MACHINE='${MACHINE}'" MAKE_TARGETS = "modules" MODULES_INSTALL_TARGET = "modules_install" # Kernel module to be autoloaded KERNEL_MODULE_AUTOLOAD += "hello" # The inherit of module.bbclass will automatically name module packages with # "kernel-module-" prefix as required by the oe-core build environment. RPROVIDES_${PN} += "kernel-module-hello" Copy to clipboard For more information about the out-of-tree module, see [Working with Out-of-Tree Modules](https://docs.yoctoproject.org/kernel-dev/common.html#working-with-out-of-tree-modules). ## Configure the DTB support Qualcomm Linux uses the following procedures to choose device tree files, change kernel configuration, and build out-of-tree kernel modules. ## Platform device tree Qualcomm Linux supports a device tree overlay feature to maintain and merge out-of-device tree blobs with the baseline device tree blobs. SoC device tree support is present in the kernel source in the `arch/arm64/boot/dts/qcom` directory. Qualcomm device tree source lists the device tree and maintains a clear separation to contain downstream additions for provisioning the upstream-aligned base distinctly. The downstream content is hosted outside the kernel source. The out-of-tree drivers maintain their device tree overlay additions outside the kernel. During the build process, the corresponding device tree overlay is merged with the base board DTB and a unified DTB is generated, which is used with boot images. The following figure shows the build process for device tree overlay, and DTB generation for custom BSP on QCS6490: Note - Base BSP follows the same build process without the **addons** downstream device-tree files. - All supported Qualcomm hardware SoCs follow the same build process for DT overlay and DTB generation. Page-1 Sheet.1070 Sheet.1030 Sheet.1051 Rectangle.1000 Kernel Kernel Rectangle.1001 sc7280.dtsi sc7280.dtsi Rectangle.1002 qcm6490.dtsi qcm6490.dtsi Rectangle.1004 qcs6490-rb3gen2.dts qcs6490-rb3gen2.dts Rectangle.1005 qcm6490-addons.dtsi qcm6490-addons.dtsi Rectangle.1007 qcm6490-addons-rb3gen2.dtsi qcm6490-addons-rb3gen2.dtsi Rectangle.1008 qcs6490-addons-rb3gen2.dts qcs6490-addons-rb3gen2.dts Rectangle.1009 qcs6490-addons-rb3gen2-ia.mezz.dts qcs6490-addons-rb3gen2-ia.mezz.dts Rectangle.1010 qcs6490-addons-rb3gen2-ptz-mezz.dts qcs6490-addons-rb3gen2-ptz-mezz.dts Rectangle.1011 qcs6490-addons-rb3gen2-video-mezz.dts qcs6490-addons-rb3gen2-video-mezz.dts Rectangle.1012 qcs6490-addons-rb3gen2-vision-mezz.dts qcs6490-addons-rb3gen2-vision-mezz.dts Rectangle.1013 Rectangle.1014 Camera Camera Rectangle.1015 qcm6490-camera.dtsi qcm6490-camera.dtsi Rectangle.1017 qcs6490-addons-camera-rb3gen2.dtso qcs6490-addons-camera-rb3gen2.dtso Rectangle.1019 Component N Component N Rectangle.1020 qcm6490-<component>.dtsi qcm6490-<component>.dtsi Rectangle.1021 qcm6490-addons-<component>.dtso qcm6490-addons-<component>.dtso Rectangle.1023 qcs6490-rb3gen2.dtb qcs6490-rb3gen2.dtb Rectangle.1026 qcs6490-addons-camera-rb3gen2.dtbo qcs6490-addons-camera-rb3gen2.dtbo Rectangle.1028 qcm6490-addons-<component>.dtbo qcm6490-addons-<component>.dtbo Sheet.1052 Rectangle.1029 Build time fdt overlay Build time fdt overlay Sheet.1031 Sheet.1032 Sheet.1033 Sheet.1035 (Board dependent) (Board dependent) Sheet.1036 (Board independent) (Board independent) Sheet.1037 Sheet.1040 Sheet.1041 Sheet.1043 Sheet.1045 Sheet.1046 Sheet.1047 Sheet.1048 Sheet.1050 Sheet.1054 Sheet.1060 Dynamic connector.1061 Rectangle.1062 qcs6490-addons-rb3gen2.dtb qcs6490-addons-rb3gen2.dtb Sheet.1063 Sheet.1057 Sheet.1073 Sheet.1074 Sheet.1079 Upstream Upstream Sheet.1080 Sheet.1081 Open source Open source Sheet.1082 Sheet.1083 Downstream Downstream Sheet.1084 Sheet.1085 Build blobs Build blobs **Figure: Device tree overlay on QCS6490** The build system uses an `fdt_overlay` tool to provision the out-of-tree device tree overlay handling during the build. The DTBO merge process supports merging the DTBO files listed in the `meta-qcom-hwe/conf/machine/--.conf` file. The following is an example of how device tree variables are enumerated on QCS6490. See the board-specific machine configuration file for platform-specific information. # List of dtbs for corresponding supported qcs6490 platforms KERNEL_DEVICETREE = " \ qcom/-addons-.dtb \ " # Additional list of dtbos to be overlaid on top of base kernel devicetree files # Format - KERNEL_TECH_DTBOS[] = " ..." # For example: KERNEL_TECH_DTBOS[qcs6490-addons-rb3gen2] = " \ qcm6490-graphics.dtbo qcm6490-wlan-rb3.dtbo \ qcm6490-display-rb3.dtbo qcm6490-bt.dtbo \ qcm6490-video.dtbo qcm6490-wlan-upstream.dtbo \ " Copy to clipboard To update the DTB support in the kernel and select a DTB on boot, use the following procedure: **DTB build support in kernel** To integrate the device tree of a new platform into the kernel build, update the `Makefile`. The following example shows customizing DTB for the QCS6490 SoC. Replicate the following method to add new DTBs. diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile index 183aeba47193..a7815c774f7c 100644 --- a/arch/arm64/boot/dts/qcom/Makefile +++ b/arch/arm64/boot/dts/qcom/Makefile dtb-$(CONFIG_ARCH_QCOM) += qcs6490-addons-rb3gen2.dtb +dtb-$(CONFIG_ARCH_QCOM) += qcs6490-my-board.dtb dtb-$(CONFIG_ARCH_QCOM) += qcs6490-rb3gen2.dtb dtb-$(CONFIG_ARCH_QCOM) += qcs404-evb-1000.dtb Copy to clipboard **DTB inclusion in machine configuration** The Yocto machine configuration is also updated to include the corresponding device tree blob. For example, to add the device tree for QCS6490 machine support, use the following file: `meta-qcom-hwe/conf/machine/qcs6490-rb3gen2-core-kit.conf`: OUT_OF_KERNEL_DTSO - qcs6490-rb3gen2-core-kit.conf # List of dtbs for corresponding supported qcs6490 platforms KERNEL_DEVICETREE = " \ qcom/qcs6490-my-board.dtb \ qcom/qcs6490-addons-rb3gen2.dtb \ qcom/qcs6490-my-board.dtb \ " # Additional list of DTBOs to be overlaid on top of base kernel devicetree # See how existing boards are managing it in the following example: # Format - KERNEL_TECH_DTBOS[] = " ..." KERNEL_TECH_DTBOS[qcs6490-addons-rb3gen2] = " \ qcm6490-graphics.dtbo qcm6490-wlan-rb3.dtbo \ qcm6490-display-rb3.dtbo qcm6490-bt.dtbo \ qcm6490-video.dtbo qcm6490-wlan-upstream.dtbo \ Copy to clipboard Note See machine configuration files in the `meta-qcom-hwe/conf/machine/*.conf` directory for different SoCs. The DTB filename for the custom BSP variant contains `addons`. **DTB selection on boot** The custom DTB is packaged as a part of the UKI image that is updated in EFI to boot with the selected DTB. Generate a UKI image using the ukify tool. The ukify tool is available as part of the Yocto build system in the `tmp-glibc/sysroots-components/x86_64/systemd-boot-native/usr/bin/ukify` build directory. To generate the UKI image, run the following: # Note - ukify tool need python 3.10 version or above ukify build --efi-arch=aa64 \ --stub=/tmp-glibc/deploy/images//linuxaa64.efi.stub \ --linux=/tmp-glibc/deploy/images//Image \ --initrd=/tmp-glibc/deploy/images//initramfs-qcom-image-.cpio.gz \ --cmdline="console=ttyMSM0,115200n8 earlycon qcom_geni_serial.con_enabled=1 kernel.sched_pelt_multiplier=4 mem_sleep_default=s2idle" \ --devicetree=/tmp-glibc/deploy/images//-my-board.dtb \ --output=./uki.efi Copy to clipboard The ukify build command generates the `uki.efi` image with a custom board DTB. To update the `uki.efi` image in the ESP partition, do the following: # Following may need sudo privilege # Take the yocto build generated efi.bin and mount it locally mount /tmp-glibc/deploy/images//efi.bin /mnt --options rw # Overwrite the uki.efi with one packaged above cp uki.efi /mnt/EFI/Linux/uki.efi umount /mnt # now efi.bin carries packaged uki.efi which can be flashed to the target and booted # UEFI shall now pick the -my-board.dtb that is part of uki.efi image # reboot into fastboot and flash efi.bin fastboot flash efi /tmp-glibc/deploy/images//efi.bin Copy to clipboard For more information about the device tree specification, see [The Devicetree Specification](https://www.devicetree.org/specifications/). For the Linux kernel documentation for device tree, see [Linux and the Devicetree](https://docs.kernel.org/devicetree/usage-model.html). **DTBO merge sequence** The `merge_dtbos()` task in the `image-qcom-deploy.bbclass` class merges DTBOs using the `fdt_overlay` tool. The `merge_dtbos()` task iteration occurs in the following sequence: 1. DTBO filenames get listed in the configuration file. 2. DTBO filenames are iterated through the `KERNEL_DEVICETREE` variable. 3. For each base DTB, the DTBO merge task overlays the DTBOs listed in the `KERNEL_TECH_DTBOS` variable. 4. After the overlay process is completed, the final DTB output is generated. ## Compile the kernel independent of Yocto Qualcomm Linux kernel can also be compiled without Yocto build system support. **Prerequisites** Provision the following dependencies to setup the kernel compilation process: > > > - aarch64 toolchain > - systemd-boot EFI stub to include it as a part of the UKI image > - systemd ukify tool to package the kernel image, initramfs, and DTB into the UKI image > - initramfs with UKI image > - ESP image that carries the updated UKI and must be flashed to boot the device These dependencies along with necessary tools have been provisioned with a [docker](https://git.codelinaro.org/clo/la/kernel/qcom). that can be used to develop kernel standalone. **Setup docker** git clone git@github.com:qualcomm-linux/kmake-image.git cd kmake-image docker build -t kmake-image . cd .. Copy to clipboard **Setup aliases** alias kmake-image-run='docker run -it --rm --user $(id -u):$(id -g) --workdir="$PWD" -v "$(dirname $PWD)":"$(dirname $PWD)" kmake-image' alias kmake='kmake-image-run make' Copy to clipboard **Get the Linux kernel source** Clone the Linux kernel source from the git repository hosted at [CodeLinaro](https://git.codelinaro.org/clo/la/kernel/qcom). To clone the repository and get the source code, run the following commands: git clone https://git.codelinaro.org/clo/la/kernel/qcom kernel cd kernel git checkout # e.g. git checkout origin/kernel.qclinux.1.0.r2-rel cd .. Copy to clipboard **Get ramdisk** You can use the custom initramfs. As a reference, you can get the initramfs for arm64 hosted at [Linaro Snapshots site](https://snapshots.linaro.org/member-builds/qcomlt/testimages/arm64/latest/), using the following command: mkdir artifacts wget https://snapshots.linaro.org/member-builds/qcomlt/testimages/arm64/latest/initramfs-test-image-qemuarm64-*.rootfs.cpio.gz -O artifacts/ramdisk.gz Copy to clipboard **Get systemd-boot binaries** wget -O artifacts/systemd-boot-efi.deb http://ports.ubuntu.com/pool/universe/s/systemd/systemd-boot-efi_255.4-1ubuntu8_arm64.deb dpkg-deb -xv artifacts/systemd-boot-efi.deb artifacts/systemd Copy to clipboard **Build kernel** One can use `arch/arm64/configs/qcom_defconfig` to configure kernel and build using below instructions: cd kernel kmake O=../kobj qcom_defconfig kmake O=../kobj -j$(nproc) kmake O=../kobj -j$(nproc) dir-pkg INSTALL_MOD_STRIP=1 Copy to clipboard **Package DLKMs into ramdisk** (cd ../kobj/tar-install ; find lib/modules | cpio -o -H newc -R +0:+0 | gzip -9 >> ../../artifacts/ramdisk.gz) Copy to clipboard **Generate efi.bin for boot/ESP partition** cd .. kmake-image-run generate_boot_bins.sh efi --ramdisk artifacts/ramdisk.gz \ --systemd-boot artifacts/systemd/usr/lib/systemd/boot/efi/systemd-bootaa64.efi \ --stub artifacts/systemd/usr/lib/systemd/boot/efi/linuxaa64.efi.stub \ --linux kobj/arch/arm64/boot/Image \ --cmdline "${CMDLINE}" \ --output images Copy to clipboard **Generate dtb.bin for targets supporting devicetree** kmake-image-run generate_boot_bins.sh dtb --input kobj/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dtb \ --output images Copy to clipboard The resulting **efi.bin** and **dtb.bin** are gathered in images directory and are ready to be booted on a QCS6490 RB3Gen2. **Flash the binaries and Boot** fastboot flash efi images/efi.bin fastboot flash dtb_a images/dtb.bin fastboot reboot Copy to clipboard For more information about how to flash the EFI image and reboot, see [Bring up the device](https://docs.qualcomm.com/doc/80-70030-3/topic/getting_started_chapter2.html#flash-images-and-boot). Note To build additional out-of-tree kernel modules, rely on the full Yocto build mechanism. ## Next steps - To debug the kernel issues, see [Configure debug methods](https://docs.qualcomm.com/doc/80-70030-3/topic/debug.html#debug). Last Published: Jun 25, 2026 [Previous Topic Configure the postboot settings](https://docs.qualcomm.com/bundle/publicresource/80-70030-3/topics/post-boot-settings.md) [Next Topic Configure the remoteprocessor (remoteproc) subsystems](https://docs.qualcomm.com/bundle/publicresource/80-70030-3/topics/remoteproc-overview.md)