# ユーザーによるカスタマイズ

このセクションでは、Qualcomm Linuxをカスタマイズする手順について説明します。トピックは以下のとおりです。

- カスタムマシン構成の追加
- ディストリビューション構成を変更する
- イメージレシピの作成
- カーネルのカスタマイズ

## カスタムマシン構成の追加

カスタムマシン構成を追加してワークスペースを再ビルドするには、以下を実行します。

1. マシンを追加するには、`layers/meta-qcom-hwe/conf/machine/` の新しいマシン構成ファイルを導入します（例：`layers/meta-qcom-hwe/conf/machine/test-board.conf`）。
2. 新しいマシンがQCS6490ハードウェアSoCを使用している場合は、新規作成したファイルに以下の内容を追加します。

#@TYPE: Machine
        #@NAME: TestBoard
        #@DESCRIPTION: Machine configuration for a development board, based on Qualcomm QCS6490
        
        require conf/machine/include/qcom-qcs6490.inc
        Copy to clipboard
3. setup-environmentスクリプトをsourceコマンドで実行します。

MACHINE=test-board DISTRO=qcom-wayland QCOM_SELECTED_BSP=custom source setup-environment
        Copy to clipboard

注釈

`meta-qcom-extras` にアクセスできる場合は、`conf/bblayers.conf` ファイルの `EXTRALAYERS ?=` `${WORKSPACE}/layers/meta-qcom-extras` に追加します。
4. 追加したマシンのイメージをビルドするには、以下のコマンドを実行します。

bitbake qcom-multimedia-image
        Copy to clipboard

## カスタムマシン・ディストリビューションの追加

以下のサブセクションでは、カスタム・ディストリビューション構成を追加し、ワークスペースを再ビルドする方法を説明します。

### クアルコムで定義されたディストリビューション構成の概要

Qualcomm Linux用に定義されたリファレンス・ディストリビューションは `<workspace>/layers/meta-qcom-distro/conf/distro/qcom-wayland.conf` にあります。DISTRO\_FEATURES変数の内容は、以下のコマンドで確認できます。

bitbake -e | grep ^DISTRO_FEATURES=
    Copy to clipboard

出力：

DISTRO_FEATURES="acl alsa argp bluetooth debuginfod ext2 ipv4 ipv6 largefile pcmcia usbgadget usbhost wifi xattr nfs zeroconf pci 3g nfc  vfat seccomp pam overlayfs acl xattr selinux ptest security virtualization tpm wayland vulkan opengl systemd pulseaudio gobject-introspection-data ldconfig"
    Copy to clipboard

注釈

出力に表示されるDISTRO\_FEATURESについては、[ディストリビューション機能](https://docs.yoctoproject.org/5.0.6/singleindex.html#distro-features) に記載されています。

### ディストリビューション構成を追加する

ディストリビューション構成ファイルを追加するには、以下を実行します。

1. `<workspace>/layers/meta-qcom-distro/conf/distro` に `test-distro.conf` ファイルを追加します。
2. `qcom-wayland.conf` と同じ内容を使用します。すなわち、`cp qcom-wayland.conf test-distro.conf` を実行します。
3. `test-distro.conf` ファイルで `DISTRO_NAME = "Test Reference Distro with Wayland"` と設定します。
4. `test-distro.conf` ファイルで `DISTROOVERRIDES = "test-dist"` と設定します。
5. 環境をセットアップするsourceコマンドの実行と変数のエクスポートについては以下のとおりです。

MACHINE="qcs6490-rb3gen2-core-kit" DISTRO="test-distro" source setup-environment
        Copy to clipboard

環境をセットアップするsourceコマンドの実行が完了すると、カレント・ワークスペースのディレクトリが `<workspace>/build-test-distro` に変わります。`test-distro` が有効になっているかを確認するには、`conf/auto.conf` ファイルを開いて以下を確認します。

# This configuration file is dynamically generated every time
    # set_bb_env.sh is sourced to set up a workspace.  DO NOT EDIT.
    #--------------------------------------------------------------
    DISTRO ?= "test-distro"
    Copy to clipboard

出力を確認するには、以下のコマンドを実行します。

bitbake -e | grep ^DISTROOVERRIDES=
    DISTROOVERRIDES="test-dist"
    Copy to clipboard

注釈

`meta-qcom-extras` にアクセスできる場合は、`conf/bblayers.conf` ファイルの `EXTRALAYERS ?=` `${WORKSPACE}/layers/meta-qcom-extras` に追加します。

イメージを再ビルドするには、以下のコマンドを実行します。

bitbake qcom-multimedia-image
    Copy to clipboard

### DISTRO\_FEATURESの有効化または無効化

DISTRO\_FEATURESは、生成されるイメージにどのパッケージが含まれていなければならないかを確認する仕組みを提供します。有効にする機能はDISTRO\_FEATURES変数を利用して選択できます。この変数は、ディストリビューションの `test-distro.conf` 構成ファイルで設定または追加されます。詳細については、[ディストリビューション機能](https://docs.yoctoproject.org/5.0.6/singleindex.html#distro-features) を参照してください。

注釈

コミュニティによって定義された機能を選択します。

1. `test-distro.conf` ファイルを開き、以下の行を追加します。

DISTRO_FEATURES:append = " cramfs"
        Copy to clipboard
2. 変更が有効になっているかをテストした後、再ビルドします。

bitbake -e | grep ^DISTRO_FEATURES=
        Copy to clipboard

    出力は以下のとおりです。

DISTRO_FEATURES="acl alsa argp bluetooth debuginfod ext2 ipv4 ipv6 largefile pcmcia usbgadget usbhost wifi xattr nfs zeroconf pci 3g nfc  vfat seccomp pam overlayfs acl xattr selinux ptest security virtualization tpm usrmerge sota wayland vulkan opengl cramfs systemd pulseaudio gobject-introspection-data ldconfig"
        Copy to clipboard
3. 再ビルドするには、以下のコマンドを実行します。

bitbake qcom-multimedia-image
        Copy to clipboard

## イメージ・レシピを追加する

**イメージレシピを追加する**

1. イメージレシピを追加するには、ディレクトリを `<workspace>/layers/meta-qcom-distro/recipes-products/images` に変更します。
2. 例えば、`test-image.bb` のようなファイルを作成し、以下の内容を追加します。

SUMMARY = "Test image"
        
        LICENSE = "BSD-3-Clause-Clear"
        
        IMAGE_FEATURES += "splash \
            tools-debug \
            debug-tweaks \
            enable-adbd \
        "
        
        inherit core-image features_check extrausers image-adbd image-qcom-deploy image-efi
        
        REQUIRED_DISTRO_FEATURES = "pam systemd"
        
        CORE_IMAGE_BASE_INSTALL += " \
            kernel-modules \
            packagegroup-filesystem-utils \
        "
        
        CORE_IMAGE_EXTRA_INSTALL += "overlayfs-qcom-paths"
        Copy to clipboard
3. 環境をセットアップするsourceコマンドを実行します。

MACHINE=qcs6490-rb3gen2-core-kit DISTRO=qcom-wayland source setup-environment
        Copy to clipboard
4. 以下の手順は任意であり、ワークスペースで `meta-qcom-extras` のクローンを作成した場合にのみ適用されます。

    `conf/bblayer.conf` ファイルを開き、内容の変更を確認します。

    | 変更前 | 変更後 |
    | --- | --- |
    | # Add your overlay location to EXTRALAYERS<br>        # Make sure to have a conf/layers.conf in there<br>        EXTRALAYERS ?= ""<br>        Copy to clipboard | # Add your overlay location to EXTRALAYERS<br>        # Make sure to have a conf/layers.conf in there<br>        EXTRALAYERS ?= "${WORKSPACE}/layers/meta-qcom-extras"<br>        Copy to clipboard |
5. BitBakeコマンドを使用してビルドします。

bitbake test-image
        Copy to clipboard

生成されたイメージは以下のとおりです。

build-qcom-wayland> $ ls tmp-glibc/deploy/images/qcs6490-rb3gen2-core-kit/test-image
    aop.mbn     gpt_backup0.bin  gpt_backup5.bin  gpt_main4.bin  kernel-modules.tgz  patch2.xml             prog_firehose_lite.elf  rawprogram2.xml  system.img    xbl_config.elf
    cpucp.elf   gpt_backup1.bin  gpt_main0.bin    gpt_main5.bin  logfs_ufs_8mb.bin   patch3.xml             qdl                     rawprogram3.xml  tz.mbn        xbl.elf
    devcfg.mbn  gpt_backup2.bin  gpt_main1.bin    hypvm.mbn      multi_image.mbn     patch4.xml             qupv3fw.elf             rawprogram4.xml  uefi.elf      XblRamdump.elf
    dtb.bin     gpt_backup3.bin  gpt_main2.bin    Image          patch0.xml          patch5.xml             rawprogram0.xml         rawprogram5.xml  uefi_sec.mbn  zeros_5sectors.bin
    efi.bin     gpt_backup4.bin  gpt_main3.bin    imagefv.elf    patch1.xml          prog_firehose_ddr.elf  rawprogram1.xml         shrm.elf         vmlinux
    Copy to clipboard

## イメージ機能をカスタマイズする

このセクションでは、イメージをカスタマイズする方法の例を示します。

**イメージからディスプレイパッケージを削除する**

`layers/meta-qcom-distro/recipes-products/packagegroups/packagegroup-qcom-multimedia.bb`

| 変更前 | 変更後 |
| --- | --- |
| RDEPENDS:${PN}:append:qcom-custom-bsp = "\<br>        camera-server \<br>        packagegroup-qcom-audio \<br>        packagegroup-qcom-bluetooth \<br>        packagegroup-qcom-camera \<br>        packagegroup-qcom-display \<br>        packagegroup-qcom-fastcv \<br>        packagegroup-qcom-graphics \<br>        packagegroup-qcom-iot-base-utils \<br>        packagegroup-qcom-location \<br>        packagegroup-qcom-video \<br>        packagegroup-qcom-voiceai \<br>        "<br>    Copy to clipboard | RDEPENDS:${PN}:append:qcom-custom-bsp = "\<br>        camera-server \<br>        packagegroup-qcom-audio \<br>        packagegroup-qcom-bluetooth \<br>        packagegroup-qcom-camera \<br>        packagegroup-qcom-fastcv \<br>        packagegroup-qcom-graphics \<br>        packagegroup-qcom-iot-base-utils \<br>        packagegroup-qcom-location \<br>        packagegroup-qcom-video \<br>        packagegroup-qcom-voiceai \<br>        "<br>    Copy to clipboard |

`bitbake qcom-multimedia-image` コマンドを実行すると、ディスプレイ関連のパッケージがビルドから削除されます。`packagegroup-qcom-display.bb` パッケージ・グループの内容がイメージから削除されます。

**イメージからBluetooth**^®^ **を削除する**

`layers/meta-qcom-distro/recipes-products/packagegroups/packagegroup-qcom-multimedia.bb`

| 変更前 | 変更後 |
| --- | --- |
| RDEPENDS:${PN}:append:qcom-custom-bsp = "\<br>       camera-server \<br>       packagegroup-qcom-audio \<br>       packagegroup-qcom-bluetooth \<br>       packagegroup-qcom-camera \<br>       packagegroup-qcom-display \<br>       packagegroup-qcom-fastcv \<br>       packagegroup-qcom-graphics \<br>       packagegroup-qcom-iot-base-utils \<br>       packagegroup-qcom-location \<br>       packagegroup-qcom-video \<br>       packagegroup-qcom-voiceai \<br>       "<br>    Copy to clipboard | RDEPENDS:${PN}:append:qcom-custom-bsp = "\<br>       camera-server \<br>       packagegroup-qcom-audio \<br>       packagegroup-qcom-camera \<br>       packagegroup-qcom-fastcv \<br>       packagegroup-qcom-graphics \<br>       packagegroup-qcom-iot-base-utils \<br>       packagegroup-qcom-location \<br>       packagegroup-qcom-video \<br>       packagegroup-qcom-voiceai \<br>       "<br>    Copy to clipboard |

`bitbake qcom-multimedia-image` コマンドを実行すると、Bluetooth関連のパッケージがビルドから削除されます。`packagegroup-qcom-bluetooth.bb` パッケージ・グループの内容がイメージ・レシピから削除されます。

## パーティションレイアウトの変更

このセクションでは、パーティションの追加、削除、変更、名前の変更について説明します。UFSデバイスのパーティションを定義する構成ファイルは `layers/meta-qcom-hwe/recipes-devtools/partition-utils/qcom-partition-confs/qcm6490-partitions.conf` にあります。パーティションを追加するには、このファイルに行エントリーを追加します。パーティションを削除するには、対応するエントリーを削除して、フラッシュされるイメージのセットから目的のパーティションを削除します。

多くのパーティションは機能の提供に不可欠です。このファイルがパーティション・テーブルを生成する際に担う役割を理解するには、[Qualcomm Linuxでパーティションを管理する](https://docs.qualcomm.com/doc/80-70018-27JA/topic/qualcomm_linux_software_components.html#managing-partitions-in-qualcomm-linux) を参照してください。

**例1：パーティションの追加**

LUN0に `test` という名前のパーティションを追加するには、`qcm6490-partitions.conf` のLUN0セクションに以下の行を追加します。

--partition --lun=0 --name=test --size=4096KB --type-guid=1B81F7E6-F50D-419B-A739-2AEFF8DA3335
    Copy to clipboard

これにより、テストという4MBのパーティションがLUN0とユーザーが定義したGUIDに追加されます。このパーティションはイメージでフラッシュされませんが、デバイスが起動した後にロー・パーティションとして利用できます。このパーティションがLUN0に追加されると、以下のいずれかのオプションで表示されます。

- `/dev/sda<N>`
- `/dev/disk/by-partlabel/test`

注釈

`qcm6490-partitions.conf` の変更を反映させるために、優先プロバイダーを更新します。詳細は [パーティションを変更する](https://docs.qualcomm.com/doc/80-70018-27JA/topic/qualcomm_linux_software_components.html#modify-partition) を参照してください。

**例2：新規作成したパーティションに、フラッシュするバイナリを持つサンプル・パーティションを追加する**

LUN0に `test1` という名前のパーティションを追加するには、`qcm6490-partitions.conf` のLUN0セクションに以下の行を追加します。

--partition --lun=0 --name=test --size=4096KB --type-guid=1B81F7E6-F50D-419B-A739-2AEFF8DA3335 --filename=test1.bin
    Copy to clipboard

新しい `test1.bin` バイナリを `build-qcom-wayland/tmp-glibc/deploy/images/qcs6490-rb3gen2-core-kit/$(image_name)` に展開します。

## devtoolの使用

以下の例は、Qualcommソフトウェアコンポーネントに対するdevtoolの使用例を示しています。

- **カーネル**

    [Yoctoのサポート](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-3/yocto-kernel-support.html) を参照してください。
- **QDLツール**

    devtoolを使用して、作成されたワークスペースのQDLソースを修正します。

devtool modify qdl
        INFO: Source tree extracted to <workspace>/build-qcom-wayland/workspace/sources/qdl
        INFO: Using source tree as build directory since that would be the default for this recipe
        INFO: Recipe qdl now set up to build from <workspace>/build-qcom-wayland/workspace/sources/qdl
        Copy to clipboard

    1. 以下のツリーはローカルにチェックアウトされています。

tree -L 2 build-qcom-wayland/workspace/
            build-qcom-wayland/workspace/
            ├── appends
            │   └── qdl_git.bbappend
            ├── conf
            │   └── layer.conf
            ├── README
            └── sources
                └── qdl
            Copy to clipboard
    2. チェックアウトされたQDLソースツリーを検査します。

ls workspace/sources/qdl/
            firehose.c  LICENSE  Makefile  patch.c  patch.h  program.c  program.h  qdl.c  qdl.h  README  sahara.c  ufs.c  ufs.h  util.c
            Copy to clipboard
    3. `workspace/sources/qdl/` 以下のソースツリーを変更し、変更点をビルドします。

devtool build qdl
            devtool build-image qcom-multimedia-image
            Copy to clipboard
    4. 生成されたイメージは `build-qcom-wayland/tmp-glibc/deploy/images/qcs6490-rb3gen2-core-kit/qcom-multimedia-image` パスにあります。
- **Weston**

devtool modify weston
        INFO: Adding local source files to srctree...
        INFO: Source tree extracted to <workspace>/build-qcom-wayland/workspace/sources/pulseaudio
        INFO: Recipe weston now set up to build from <workspace>/build-qcom-wayland/workspace/sources/weston
        Copy to clipboard

    1. 以下のツリーはローカルにチェックアウトされています。

tree -L 2 build-qcom-wayland/workspace/
            build-qcom-wayland/workspace/
            ├── appends
            │   └── weston_10.0.2.bbappend
            ├── conf
            │   └── layer.conf
            ├── README
            └── sources
                └── weston
            Copy to clipboard
    2. チェックアウトされたWestonのソースツリーを検査します。

ls workspace/sources/weston/
            clients           COPYING      desktop-shell     include      libweston          meson.build        oe-local-files  pipewire    releasing.rst  tests  weston.ini.in
            compositor        data         doc               ivi-shell    libweston-desktop  meson_options.txt  oe-logs         protocol    remoting       tools  xwayland
            CONTRIBUTING.rst  DCO-1.1.txt  fullscreen-shell  kiosk-shell  man                notes.txt          oe-workdir      README.rst  shared         wcap
            Copy to clipboard
    3. `workspace/sources/weston/` 以下のソースツリーを変更し、変更点をビルドします。

devtool build weston
            devtool build-image qcom-multimedia-image
            Copy to clipboard
    4. 生成されたイメージは `build-qcom-wayland/tmp-glibc/deploy/images/qcs6490-rb3gen2-core-kit/qcom-multimedia-image` パスにあります。

## カーネルのカスタマイズ

カーネルをカスタマイズするには、[Qualcomm Linuxカーネル・ガイド](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-3/) を参照してください。

## サードパーティーのレイヤーをワークスペースに追加する

サードパーティーのレイヤーをワークスペースに追加するには、以下の手順を実行します。

1. `<WORKSPACE>/layers/` 以下のレイヤーをクローンします。
2. 以下のように、`layers/meta-qcom-distro/conf/bblayers.conf` ファイルにレイヤーを `BBLAYERS` 変数の一部として追加します。

# These layers hold machine specific content, aka Board Support Packages
        BSPLAYERS ?= " \
          ${WORKSPACE}/layers/meta-testlayer \
          ${WORKSPACE}/layers/meta-qcom-hwe \
          ${WORKSPACE}/layers/meta-qcom \
        "
        Copy to clipboard

レイヤーをクローンして追加すると、BitBakeがレイヤーを解析できるようになります。

## デバッグ用のビルドを作成する

Yocto BitBakeのビルド指示を発行する前に、`DEBUG_BUILD=1` をエクスポートするデバッグビルドを生成するには、以下のコマンドを実行します。

DEBUG_BUILD=1 bitbake qcom-multimedia-image
    Copy to clipboard

`DEBUG_BUILD` が **1** に設定されているときに、どのカーネルのdefconfigとconfigのフラグメントが使用されるかを理解するには、[カーネルレシピ](https://docs.qualcomm.com/doc/80-70018-27JA/topic/qualcomm_linux_metadata_layers_overview.html#kernel-recipes-section) の「カーネル構成」を参照してください。

## 起動KPIを最適化したビルドを作成する

デバイスの最速の起動時間を実現するには、`PERFORMANCE_BUILD` 変数を使用します。`PERFORMANCE_BUILD` 変数を **1** に設定すると、コマンドラインから **console** オプションを削除するように `KERNEL_CMDLINE_EXTRA` が変更されます。`PERFORMANCE_BUILD` 変数は、`DEBUG_BUILD` を **0** に設定すると有効になります。

起動時間に与える `PERFORMANCE_BUILD` 変数の影響については、以下の表を参照してください。

|  | PERFORMANCE\_BUILD=“0” | PERFORMANCE\_BUILD=“1” |
| --- | --- | --- |
| `DEBUG_BUILD=0` | UART上のコンソール：有効 | <ul class="simple"><br><li><p>UART上のコンソール：無効</p></li><br><li><p>最速の起動時間</p></li><br></ul> |
| `DEBUG_BUILD=1` | UART上のコンソール：有効 | <ul class="simple"><br><li><p><code class="docutils literal notranslate"><span class="pre">DEBUG_BUILD</span></code> が <code class="docutils literal notranslate"><span class="pre">&quot;1&quot;</span></code> と設定されている場合、<code class="docutils literal notranslate"><span class="pre">PERFORMANCE_BUILD=&quot;1&quot;</span></code> となります。</p></li><br></ul> |

Last Published: Sep 17, 2025

[Previous Topic
Qualcomm Linuxのソフトウェアコンポーネント](https://docs.qualcomm.com/bundle/publicresource/80-70018-27JA/topics/qualcomm_linux_software_components.md) [Next Topic
デバッグ](https://docs.qualcomm.com/bundle/publicresource/80-70018-27JA/topics/debug.md)