# Getting started Source: [https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html](https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html) This information explains how to download, configure, and develop the Qualcomm Linux kernel for Qualcomm platforms and their associated components to build and flash system images. Before you begin, set up your host machine as described in the [Qualcomm Linux Build Guide](bundle/publicresource/topics/80-70014-254). This guide also provides information about the common Qualcomm Linux workflows. ## Access Qualcomm Linux kernel source code Source: [https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html](https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html) ### About this task To access the source code for the Qualcomm Linux kernel, see the [Qualcomm Linux Build Guide](bundle/publicresource/topics/80-70014-254) and get all necessary meta layers. Qualcomm Linux uses supports the 6.6 LTS kernel, which is available through the kernel recipe under the `meta-qcom-hwe` layer in the `recipes-kernel/linux/linux-kernel-qcom_6.6.bb` file. The Linux kernel recipe in Qualcomm Linux is called as `linux-kernel-qcom`. See the `recipes-kernel/linux/linux-kernel-qcom_6.6.bb` file to know the Git uniform resource identifier (URI) used for kernel source code download. For more information on Qualcomm Linux layers, see [Qualcomm BSP metadata layers](https://docs.qualcomm.com/bundle/publicresource/topics/80-70014-27/platform_software_features.html#sub$qualcomm_bsp_metadata_layers). Note: Yocto recipe refers to Qualcomm kernel sources that are publicly hosted at [Codelinaro](https://git.codelinaro.org/clo/la/kernel/qcom). The following example shows the Qualcomm Linux kernel recipe: SECTION = "kernel" SUMMARY = "Linux kernel for QCOM devices" DESCRIPTION = "Recipe to build Linux kernel" LICENSE = "GPLv2.0-with-linux-syscall-note" LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" inherit kernel COMPATIBLE_MACHINE = "(qcom)" SRC_URI += "git://git.codelinaro.org/clo/la/kernel/qcom.git;protocol=https;rev=aea6160f0ba1c279fcdeded51e68a0da090f5ed9;branch=kernel.qclinux.1.0.r1-rel \ ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', ' file://selinux.cfg', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', ' file://selinux_debug.cfg', '', d)} \"Copy to clipboard ## Identify supported Qualcomm machines Source: [https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html](https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html) The Qualcomm machine configuration files are present in the `meta-qcom-hwe/conf/machine/` directory. The following example shows the list of supported machines that can be configured for Yocto machine configuration: $ ls -l meta-qcom-hwe/conf/machine/qcm6490.confCopy to clipboard The following example shows the machine configuration and the kernel selection for QCM6490: $ less meta-qcom-hwe/conf/machine/qcm6490.conf SOC_FAMILY:prepend = "qcom:" require conf/machine/include/soc-family.inc PREFERRED_PROVIDER_virtual/kernel = "linux-kernel-qcom"Copy to clipboard QCM6490 selects the `linux-kernel-qcom` kernel recipe to compile the kernel. Note: QCM5430 is a variant of QCM6490 and uses the same configurations as QCM6490. For more information about the QCM5430 device tree, see [Access the platform device tree](https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html#platform_device_tree). ## Build the Yocto image recipes and kernel configurations Source: [https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html](https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html) You can access the Qualcomm Linux image recipes to modify the kernel configurations. The following table lists the supported `meta-qcom-hwe` images: Table : Qualcomm Linux supported image recipes | Image name | Description | | --- | --- | | qcom-minimal-imageCopy to clipboard | This is a minimal rootfs image that boots to the shell. | | qcom-console-imageCopy to clipboard | This is a boot to shell image with the package group to bring in
all basic packages. | | qcom-multimedia-imageCopy to clipboard | This image recipe includes recipes for multimedia software
components, such as, audio, Bluetooth®, camera, computer vision,
display, and video. | | qcom-multimedia-test-imageCopy to clipboard | This image recipe includes tests. | After downloading the Qualcomm Linux code, use the `bitbake` command to build the image. To build the images listed in the [Table : Qualcomm Linux supported image recipes](https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html#kernel-configuration1__table_prb_xtm_l1c_barnchak_02-16-24-2034-27-125), the Qualcomm Linux kernel recipe uses one of the following kernel configuration fragments: Table : Kernel configuration fragments | Kernel configuration fragments | Description | | --- | --- | | /arch/arm64/configs/qcom_defconfigCopy to clipboard | The base configuration of the product must be aligned with the
upstream kernel. | | /arch/arm64/configs/qcom_debug.configCopy to clipboard | Debug configuration fragment from the upstream kernel. | | /arch/arm64/configs/qcom_addons.configCopy to clipboard | Additional Qualcomm downstream additions on top of the upstream
aligned base. | | /arch/arm64/configs/qcom_addons_debug.configCopy to clipboard | Qualcomm downstream debug enablement. | To build Qualcomm Linux including kernel, run the following commands: $ MACHINE=qcm6490 DISTRO=qcom-wayland source setup-environment # build qcom linux console image $ bitbake qcom-console-image # Build Images are produced under build-qcom-wayland/tmp-glibc/deploy/images/qcm6490/qcom-console-image/Copy to clipboard The kernel default builds as defined in the `linux-kernel-qcom_6.6.bb` Linux kernel recipe, supports #3 (perf) and #4 (debug) builds mentioned in the following table. The default build configuration is #3 (perf). Table : Kernel build configuration type and configurations | Serial number | Kernel build configuration type | Defconfig/config fragments | | --- | --- | --- | | 1 | Base | arch/arm64/configs/qcom_defconfigCopy to clipboard | | 2 | Debug enabled base |


  • arch/arm64/configs/qcom_defconfigCopy to clipboard




  • arch/arm64/configs/qcom_debug.configCopy to clipboard



| | 3 | Base with downstream additions |


  • arch/arm64/configs/qcom_defconfigCopy to clipboard




  • arch/arm64/configs/qcom_addons.configCopy to clipboard



| | 4 | Debug enabled base with downstream |


  • arch/arm64/configs/qcom_defconfigCopy to clipboard




  • arch/arm64/configs/qcom_debug.configCopy to clipboard




  • arch/arm64/configs/qcom_addons.configCopy to clipboard




  • arch/arm64/configs/qcom_addons_debug.configCopy to clipboard



| For more information on configuring the kernel, see [Kernel configurations](https://docs.qualcomm.com/doc/80-70014-3/topic/customize.html#kernel-configuration1). ### Qualcomm debug build Use the following command to compile a debug build: $ DEBUG_BUILD=1 bitbake qcom-console-imageCopy to clipboard To modify the build configurations update the `KERNEL_DEFCONFIG` and `KERNEL_CONFIG_FRAGMENTS` variables in the `linux-kernel-qcom_6.6.bb` kernel recipe in the `meta-qcom-hwe` layer. ### Example kernel configuration The following example shows the kernel configuration using the `linux-kernel-qcom_6.6.bb` kernel recipe: KERNEL_DEFCONFIG = "${S}/arch/arm64/configs/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)}"Copy to clipboard For more information on the build instructions, see [Build with QSC CLI](https://docs.qualcomm.com/bundle/publicresource/topics/80-70014-254/build_from_source_QSC_CLI.html) in the [Qualcomm Linux Build Guide](bundle/publicresource/topics/80-70014-254). ## Access the platform device tree Source: [https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html](https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html) The Qualcomm device tree source inclusion (DTSI) and device tree source (DTS) files specific to supported development kits are located under the kernel source in the `arch/arm64/boot/dts/qcom/` directory. These Qualcomm files segregate the upstream-aligned and Qualcomm downstream additions. The following table lists the Qualcomm device tree files for the RB3 Gen 2 development kit. By default the addons device tree blob (DTB) is used. Table : Qualcomm device tree source | Device tree source | Details | | --- | --- | | arch/arm64/boot/dts/qcom/sc7280.dtsiCopy to clipboard | QCS6490 SoC is derived from SC7280. | | arch/arm64/boot/dts/qcom/qcm6490.dtsiCopy to clipboard | QCS6490 DTSI that hosts any changes are different from the SC7280
SoC. | | arch/arm64/boot/dts/qcom/qcm6490-addons.dtsiCopy to clipboard | QCS6490 SoC specific downstream additions. | | arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dtsCopy to clipboard | QCS6490 RB3 Gen 2 development kit device tree source. | | arch/arm64/boot/dts/qcom/qcs6490-addons-rb3gen2.dtsCopy to clipboard | QCS6490 RB3 Gen 2 development kit specific downstream
additions. | | arch/arm64/boot/dts/qcom/qcs6490-addons-rb3gen2.dtsCopy to clipboard | QCS5430 feature pack-1 RB3 Gen 2 development kit specific downstream
additions. | | arch/arm64/boot/dts/qcom/qcs5430-fp2-addons-rb3gen2.dtsCopy to clipboard | QCS5430 feature pack-2 RB3 Gen 2 development kit downstream
additions. | The Qualcomm Linux machine configuration `conf/machine/qcm6490.conf` file has the configuration-related data for the necessary DTB selection. The following example shows the DTB inclusion into the device configuration file: KERNEL_DEVICETREE = " \ qcom/qcs6490-addons-rb3gen2.dtb \ "Copy to clipboard ## View out-of-tree DT overlay fragments Source: [https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html](https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html) QCM6490 machine configuration `conf/machine/qcm6490.conf` file includes additional out-of-tree DTB overlays (DTBOs). Graphics, camera, wireless local area network (WLAN) drivers, and their device tree configurations are maintained out of the kernel source tree. Their respective device tree source overlay (DTSO) fragments are overlaid at the build time onto the base DTBs. The DTBO configuration is done in the `conf/machine/qcm6490.conf` file. The following example shows the DTBO configuration: # OUT_OF_KERNEL_DTSO - qcm6490.conf # 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-rb3gen2.dtbo qcm6490-display-rb3gen2.dtbo qcm6490-bt.dtbo"Copy to clipboard ## View out-of-tree kernel modules Source: [https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html](https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html) Most of the kernel drivers are compiled from upstream kernel sources. However, some drivers are maintained outside the kernel source tree and are built as kernel modules using the Yocto build system. In the following example, Bluetooth is an out-of-tree kernel module with the recipe located at `recipes-connectivity/bt_dlkm_kernel/bt-dlkm-kernel_git.bb` that compiles the driver as a kernel module. To auto-load the kernel module on boot, you can add the module name to the `KERNEL_MODULE_AUTOLOAD` variable. # Example out-of-tree Kernel module recipe DESCRIPTION = "QCOM BT drivers" LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/${LICENSE};md5=801f80980d171dd6425610833a22dbe6" inherit module SRC_URI += "git://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/bt-kernel.git;protocol=https;rev=9e5cf29625d60f78e88440c94d096a9139445c00;branch=bt-performant.qclinux.1.0.r1-rel \ file://bt_dlkm \ file://bt_dlkm.service \ " S = "${WORKDIR}/git" RPROVIDES:${PN} += "kernel-module-bt-kernel" EXTRA_OEMAKE += "MACHINE='${MACHINE}'" MAKE_TARGETS = "modules" MODULES_INSTALL_TARGET = "modules_install" # Kernel module to be autoloaded KERNEL_MODULE_AUTOLOAD += "bt_fm_slim" Copy to clipboard ## Build device image Source: [https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html](https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html) Use the following Yocto commands to build the full image and kernel: # setup the build environment $ export SHELL=/bin/bash $ source setup-environment # (select "qcm6490 meta-qcom" → Enter → select "qcom-wayland meta-qcom-distro" → Enter) # build qcom linux console image $ bitbake qcom-console-image # Build kernel only $ bitbake linux-kernel-qcom # Build Images are produced under # build-qcom-wayland/tmp-glibc/deploy/images/qcm6490/qcom-console-image/Copy to clipboard For more information on how to build different images for QCM6490 supported Qualcomm distribution, see [Build the Yocto image recipes and kernel configurations](https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html#kernel-configuration1). ## Bring up the device Source: [https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html](https://docs.qualcomm.com/doc/80-70014-3/topic/getting_started_chapter2.html) The `efi.bin` file contains the systemd-boot (boot manager), kernel, DTB, and initramfs images. The Yocto build packs these images into the `efi.bin` that can be flashed to the EFI system partition (ESP) to boot the device. The following device tree blobs are used by default to build the `efi.bin` file: - `qcs6490-addons-rb3gen2.dtb` Device tree blobs are updated or added to the `KERNEL_DEVICETREE` variable in the `conf/machine/qcm6490.conf` file. The `efi.bin` image can be flashed using the following `fastboot` command: # Bring the device in fastboot mode # cd to the source root location $ cd build-qcom-wayland/tmp-glibc/deploy/images/qcm6490/qcom-console-image $ fastboot flash efi efi.bin $ fastboot rebootCopy to clipboard After the Qualcomm Linux build, the kernel build is completed, the kernel-related images are created in the `tmp-glibc/deploy/images/qcm6490/` directory. The following table lists the build artifacts related to the kernel: Table : Kernel build artifacts | Image | Image name | Build deploy path | Details | | --- | --- | --- | --- | | Kernel executable and linking format (ELF) | vmlinuxCopy to clipboard | temp-glibc/deploy/images/qcm6490/Copy to clipboard | Output kernel ELF with debug symbols. | | Initramfs | initramfs-qcom-image-qcm6490.cpio.gzCopy to clipboard | tmp-glibc/deploy/images/qcm6490/Copy to clipboard | Initramfs in copy in, copy out (CPIO) file format. | | Kernel image | ImageCopy to clipboard | tmp-glibc/deploy/images/qcm6490/Copy to clipboard | Kernel raw image binary, systemd-boot does not support compressed
images. | | Kernel modules | Different kernel dynamically loadable kernel modules (DLKMs)


modules-qcm6490.tgzCopy to clipboard | tmp-glibc/deploy/images/qcm6490/Copy to clipboard | Kernel drivers modules. | | Device tree blobs | qcm6490-addons-rb3gen2.dtbCopy to clipboard | tmp-glibc/deploy/images/qcm6490/Copy to clipboard | Individual device tree blobs. | | ESP partition | efi.binCopy to clipboard | tmp-glibc/deploy/images/qcm6490/Copy to clipboard | All required boot images including systemd-boot, kernel, DTB, and
initramfs are packaged into the extensible firmware interface
(`efi.bin`) binary. | Last Published: Jul 15, 2024 [Previous Topic Overview](https://docs.qualcomm.com/bundle/publicresource/80-70014-3/topics/overview.md) [Next Topic Features](https://docs.qualcomm.com/bundle/publicresource/80-70014-3/topics/features.md)