How to Query the Source of BMC Files
更新时间: 2025/10/15
在Gitcode上查看源码

How to Query the Source of BMC Files

During troubleshooting, people often ask which component is responsible for a particular file. This article describes the sources of openUBMC files in detail and provides guidance on managing these files.

Two-Level Pipeline

openUBMC is built using a two-level pipeline. The first level is the component level, which is responsible for developing, testing, and releasing components. The second level is the product level, which integrates RTOS, drivers, components, and product customization to construct a rootfs image that can run. Finally, it generates an HPM package for upgrades.

Source 1: RTOS

The RTOS provides the foundation for openUBMC and includes a complete rootfs base image. You download a prepared compressed package (rtos.tar.gz) for daily builds. During version release, you can build the package from source code as required for trusted building.

For individual builds, rtos.tar.gz is downloaded to ./temp/build_<board_name>_<build_type>/sdk/rtos.tar.gz (for example, ./temp/build_Openubmc_debug/sdk/rtos.tar.gz).

To check if a file originates from rtos.tar.gz, run the following command:

shell
xuhj@DESKTOP-M0FU0HP:~/litebmc/manifest$ tar -tvf ./temp/build_Openubmc_debug/sdk/rtos.tar.gz | grep passwd
-rw-r--r-- huawei/user     106 2023-08-22 20:47 rtos_with_driver/rootfs/etc/pam.d/passwd
-rw-r--r-- huawei/user     182 2023-08-22 20:47 rtos_with_driver/rootfs/etc/pam.d/chpasswd

Source 2: Component Artifacts

During a build, the system integrates required components based on the product description (dependencies in manifest.yml). It then collects artifacts from each component, copies them to the rootfs, and assigns permissions.

You can build a product package locally once and then use the following methods to check if a file originates from a component:

Method 1: Check if a component provides the target artifact

shell
# Search for artifact files in the Conan cache directory. If a file is found, it originates from that component.
find ~/.conan/data/ -name profile_schema | grep package

Method 2: Check if a component assigns permissions to the target artifact

shell
# Search for the permissions.ini file in the Conan cache directory. If a match is found, the file originates from that component.
find ~/.conan/data/ -name permissions.ini | xargs -i{} grep  profile_schema {} -RH

Method 3: Some components have complex artifacts, where simple file generation does not meet requirements. In such cases, the system creates files or directories in the rootfs through customization. The following command provides clues:

shell
# Search for component customization files in the Conan cache directory. If the search keyword is not specific, many results may be returned. You must analyze the results.
find ~/.conan/ -name customization.py | xargs -i{} grep "opt/bmc/conf" {} -RH

Result examples:

shell
# Method 1: Find the component that provides profile_schema.
xuhj@DESKTOP-M0FU0HP:~/litebmc/manifest$ find ~/.conan/data/ -name profile_schema | grep package
/home/xuhj/.conan/data/profile_schema/1.10.4/openubmc.release/rc/package/eb863b30644119aa8446f0771512037d0aea/opt/bmc/profile_schema
# Method 2: Find the component that provides permissions.ini.
xuhj@DESKTOP-M0FU0HP:~/litebmc/manifest$ find ~/.conan/data/ -name permissions.ini | xargs -i{} grep  profile_schema {} -RH
/home/xuhj/.conan/data/profile_schema/1.10.4/openubmc.release/rc/package/eb863b30644119aa8446f0771512037d0aea/permissions.ini:opt/bmc/profile_schema rd 550 0 0
/home/xuhj/.conan/data/profile_schema/1.10.4/openubmc.release/rc/package/eb863b30644119aa8446f0771512037d0aea/permissions.ini:opt/bmc/profile_schema r 440 0 0
# Method 3: Find the components that may provide opt/bmc/conf and find the most matched record based on the search result.
xuhj@DESKTOP-M0FU0HP:~/litebmc/manifest$ find ~/.conan/ -name customization.py | xargs -i{} grep "opt/bmc/conf" {} -RH
/home/xuhj/.conan/data/product_mgmt/1.10.2/openubmc.release/rc/source/build/customization.py:        subprocess.run(['/usr/bin/sudo', '/usr/bin/mkdir', '-p', f'{self.rootfs_path}/data/opt/bmc/conf/oem/profile/'])
/home/xuhj/.conan/data/product_mgmt/1.10.2/openubmc.release/rc/package/5f2d38da3deee6d7c3c2572d1f9649a97ef90ed6/include/customization.py:        subprocess.run(['/usr/bin/sudo', '/usr/bin/mkdir', '-p', f'{self.rootfs_path}/data/opt/bmc/conf/oem/profile/'])

Source 3: Drivers

The chip solution component delivered by the driver team to openUBMC contains an sdk.tar.gz compressed package. Most of its contents are .ko driver files, except for insmod_drv.sh, Module.symvers, and link_emmc_devs.

sdk.tar.gz is downloaded to ./temp/build_<board_name>_<build_type>/sdk/sdk.tar.gz (for example, ./temp/build_Openubmc_debug/sdk/sdk.tar.gz).

To check if a file originates from rtos.tar.gz, run the following command:

shell
xuhj@DESKTOP-M0FU0HP:~/litebmc/manifest$ tar -tvf ./temp/build_Openubmc_debug/sdk/sdk.tar.gz | grep ko/dboot_drv.ko
-r-xr-x--- huawei/user   18344 2023-08-22 20:44 ko/dboot_drv.ko

Note: .ko files do not only originate from the SDK. openUBMC itself also builds .ko driver files.

Source 4: Product Customization

The manifest repository has built-in product customization capabilities, including static file customization and customization scripts.

  • Static file customization: For example, directories such as build/rootfs/ and build/product/Kunpeng/Openubmc/rootfs/ store customization files highly related to the product. You can search the manifest repository to see if specific files exist.
  • Customization scripts: The product manifest.yml specifies customization scripts that the board can run. These scripts execute a series of customization commands, which may create, rename, or delete files.
shell
# Search for specific files in the static file customization of the manifest repository.
xuhj@DESKTOP-M0FU0HP:~/litebmc/manifest$ sudo find . -name common-auth
./build/product/Kunpeng/Openubmc/rootfs/etc/pam.d/common-auth
./build/product/Kunpeng/ /rootfs/etc/pam.d/common-auth
./build/product/Kunpeng/openubmc /rootfs/etc/pam.d/common-auth

# Search the customization scripts to see if they create files.
xuhj@DESKTOP-M0FU0HP:~/litebmc/manifest$ sudo grep usr/bin/df build/ -Rnw
build/customization/prototype.py:169:        self.work.run_command("ln -s /bin/busybox.nosuid usr/bin/df", sudo=True)
build/customization/prototype.py:174:        self.work.run_command("ln -s /bin/busybox.nosuid usr/bin/df", sudo=True)

TIP

You are advised to build a product once before searching for files to generate the required materials.

shell
# Enter the manifest directory.
cd manifest
# Run the bmcgo command to build the product package. This step downloads all dependent components.
bmcgo build