Image Build
This chapter describes in detail how to configure the SDK and build the Boot, kernel, and root file system images. The SDK supports a one-click full build as well as building individual modules to suit different development and debugging needs.
Note
This SDK provides two build methods: the make tool and the run.sh script.
1. Building with the run.sh Script
The SDK root directory provides the run.sh one-click build script, which wraps common build, clean, and info-query operations for easier use. The script automatically loads the build environment, so you do not need to manually run source build/env.sh.
1.1 Basic Usage
./run.sh <command> [-j[N]]Here -j[N] is an optional parallel build parameter; when N is omitted, all CPU cores are used automatically.
1.2 Configuration and Info Commands
lunch — Interactively select the board configuration
Use the interactive menu to select the board model and kernel version, and a cfg.mk configuration file is generated automatically:
./run.sh lunchAfter execution, the following interactive menu appears:
- Select the board model (lists all available board configs under the
configs/directory) - Select the kernel version (for example
linux-5.10,linux-4.9, and the corresponding quickstart versions)
Tip
The lunch command replaces the manual make menuconfig chip-selection step. Use it for first-time builds or when switching the target platform.
check — Check the build environment
Checks whether the toolchain, commands, and other items required for the build are correctly installed, including bash, make, gcc, the cross-compilation toolchain, and fakeroot:
./run.sh checkinfo — Show current build information
Displays the configuration in the current cfg.mk, including chip model, chip architecture, kernel version, bootloader, toolchain, and Flash support:
./run.sh infoenv — Show environment configuration
Displays current environment information such as the toolchain path:
./run.sh envlist — List available board configurations
Lists all available board configurations and kernel versions, and marks the one currently in use:
./run.sh list1.3 Build Commands
| Command | Description |
|---|---|
./run.sh uboot | Build the U-Boot bootloader |
./run.sh kernel | Build the Linux kernel |
./run.sh rootfs | Build the root file system |
./run.sh driver | Build kernel drivers (GMP) |
./run.sh sysdrv | Build uboot + kernel + rootfs |
./run.sh osal | Build the OSAL adaptation layer |
./run.sh media | Build the media libraries |
./run.sh sample | Build the MPP sample applications |
./run.sh mcu | Build the MCU firmware |
./run.sh all | Build all components |
Note
./run.sh all first cleans all build artifacts and then rebuilds, equivalent to make clean && make build. For incremental builds, use sysdrv or build individual target modules.
1.4 Clean Commands
| Command | Description |
|---|---|
./run.sh clean uboot | Clean U-Boot |
./run.sh clean kernel | Clean the kernel |
./run.sh clean rootfs | Clean rootfs |
./run.sh clean driver | Clean the drivers |
./run.sh clean sysdrv | Clean uboot/kernel/rootfs |
./run.sh clean media | Clean the media libraries |
./run.sh clean sample | Clean the MPP sample applications |
./run.sh clean osal | Clean the OSAL adaptation layer |
./run.sh clean mcu | Clean the MCU firmware |
./run.sh clean all | Clean all components |
Note
./run.sh <target> clean and ./run.sh clean <target> are equivalent and both supported.
1.5 Parallel Build
All build and clean commands support the -j parameter for parallel building to speed up the build:
# Build in parallel using all CPU cores
./run.sh kernel -j
# Build in parallel using 4 threads
./run.sh kernel -j4
# Full build using all cores
./run.sh all -j1.6 Usage Examples
Below is a sample complete first-time build flow:
# 1. First time: select the board configuration
./run.sh lunch
# 2. Check that the build environment is ready
./run.sh check
# 3. Confirm the current configuration
./run.sh info
# 4. Full build (use all cores)
./run.sh all -jIncremental build examples for daily development:
# Only the kernel code was modified; rebuild the kernel
./run.sh kernel -j
# uboot and kernel were modified; build the system drivers
./run.sh sysdrv -j
# Build the MPP application samples
./run.sh sample -j
# Clean the kernel build results and rebuild
./run.sh clean kernel
./run.sh kernel -j2. Building with the make Tool
2.1 Build Steps
Step 1: Configure environment variables.
Enter the SDK root directory and run the following command to load the build environment:
source build/env.shStep 2: Select the chip model
ShiMetaPi-Pico-G1 offers two chip models: GK7206V12A and GK7206V11A. The configuration steps are as follows:
tip
This setting persists until you re-select it; you do not need to configure it for every build.
Chip type selection
make menuconfigBase --> Chip Type --> xm7206v12a --> Save and Exit
Note
To select GK7206V11A, choose xm7206v11a.
DDR model selection
Board --> Boot Regfile Config --> XM7206V12A_EVB_6L_DDR3_2133M_256M_1x16bit --> Save and Exit
Note
- GK7206V11A input: XM7206V11A_EVB_6L_DDR3_2133M_128M_1x16bit
- GK7206V12A input: XM7206V12A_EVB_6L_DDR3_2133M_256M_1x16bit
Step 3: Build configuration (optional).
If you need to modify the SDK default build configuration, configure it through menuconfig. See 3. menuconfig Configuration for details.
make menuconfigStep 4: Build
After saving the configuration, you can run build or packaging commands from the SDK root directory to build or package, generating all required images (including uboot, kernel, and rootfs). The following uses a full build as an example:
make build -jAfter the build completes, the system generates the corresponding images based on the target boot media (NAND / eMMC / SPI) and outputs them to the out/<board_name>/image directory, ready for use by flashing tools.
Note
A number can follow -j to enable multi-threaded parallel builds, e.g. make build -j16. Adjust this based on the CPU cores and memory size of your build server to speed up the build.
2.2 Other Common Build Commands
2.2.1 Full SDK build
Builds in sequence: uboot, kernel, rootfs, sample, and packages the images.
make build2.2.2 Clean all SDK build artifacts
Deletes out/, temporary files, object files, and image files — equivalent to restoring the "unbuilt" state.
make clean2.2.3 Build U-Boot only
If only source/uboot was modified, you can build U-Boot only. U-Boot is the first-stage bootloader after the board powers on.
make uboot2.2.4 Clean U-Boot build results
make uboot_clean2.2.5 Build the kernel only
If only kernel-related code, such as source/kernel, was modified, you can build the kernel only.
make linux2.2.6 Clean kernel build results
make linux_clean2.2.7 Build the sample code only
make sample2.2.8 Clean sample build results
make sample_clean3. menuconfig Configuration
3.1 Overview
menuconfig is a graphical terminal configuration tool based on the Kconfig configuration system. It centralizes the scattered configuration items in the SDK into a single interface, organizing a large number of build options — chip model, toolchain, kernel version, Flash type, file system type, and so on — into a hierarchical menu of text-based options for interactive selection.
In the GK7206 SDK, menuconfig is mainly used to generate and maintain the SDK's global configuration file cfg.mk. Developers run a configuration command to enter the menu, select the target chip, toolchain, kernel version, bootloader configuration, Flash type, and other options, then save to generate or update cfg.mk. The SDK top-level Makefile and build/base.mk include cfg.mk and use the CONFIG_ items in it to drive subsequent build behavior.
Configuration options have four possible states:
| Symbol | Meaning |
|---|---|
[ ] or <> | Do not compile |
[*] | Compile into the kernel |
<M> | Compile as a module (.ko) |
<*> | Compile into the kernel (forced) |
Tip: Type
/in this interface to enter the search interface.
3.2 Configuration Options
3.2.1 Top-Level Menu Structure
xmedia SDK Configuration
├── Base
├── Board
├── Bootloader System
└── Linux SystemBase
The Base menu configures the SDK base platform information, including chip model, chip architecture, cross-compilation toolchain, log mode, and the QuickStart fast-boot switch.
Base
├── Chip Type
│ ├── xm7206v11a
│ │ └── Select the target chip xm7206v11a.
│ │
│ ├── xm7206v10
│ │ └── Select the target chip xm7206v10.
│ │
│ ├── xm7206v10b
│ │ └── Select the target chip xm7206v10b.
│ │
│ ├── xm7206v12a
│ │ └── Select the target chip xm7206v12a.
│ │
│ ├── xm7206v11
│ │ └── Select the target chip xm7206v11.
│ │
│ └── xm7206v11at
│ └── Select the target chip xm7206v11at.
│
├── Toolchains Config
│ ├── kernel toolchains
│ │ ├── arm-gcc12.2.0-linux
│ │ │ └── Select the ARM glibc toolchain for kernel builds.
│ │ │
│ │ ├── aarch64-gcc12.2.0-linux
│ │ │ └── Select the AArch64 64-bit toolchain for kernel builds.
│ │ │
│ │ └── arm-gcc12.2.0-linux-uclibceabi
│ │ └── Select the ARM uClibc toolchain for kernel builds.
│ │
│ └── usr 32bit toolchains
│ ├── arm-gcc12.2.0-linux
│ │ └── Select the ARM glibc toolchain for 32-bit user-space builds.
│ │
│ └── arm-gcc12.2.0-linux-uclibceabi
│ └── Select the ARM uClibc toolchain for 32-bit user-space builds.
│
├── SDK Log Mode
│ ├── log
│ │ └── Enable SDK log mode.
│ │ Adds log-related macros such as CONFIG_LOG_TRACE_SUPPORT=1 during the build.
│ │
│ └── nolog
│ └── Disable SDK log mode.
│ Suitable for release builds or scenarios that do not need debug logs.
│
└── Support QuickStart
└── Whether to enable QuickStart fast-boot mode.
When enabled, it affects bootstrap, qs_mcu, initrd, partition table, bootargs, and other boot-chain configuration.3.2.2 Board
The Board menu configures board-level parameters.
Board
├── Flash Config
│ ├── Nand Flash support: Whether to enable overall NAND Flash support. When enabled, the NAND Flash device type selection appears.
│ │ │
│ │ └─── Nand Flash device support
│ │ ├──Nand Flash Support
│ │ │ └── Enable legacy parallel NAND Flash support.
│ │ │ This option affects the NAND partition table, NAND rootfs image, and NAND boot parameters.
│ │ │
│ │ └── Spi-Nand Flash Support
│ │ └── Enable SPI-NAND Flash support.
│ │ This option affects the SPI-NAND partition table, rootfs image, and boot parameters.
│ │
│ ├── SPI Flash Support
│ │ └── Whether to enable SPI NOR Flash support.
│ │ │ Enabled by default.
│ │ │ When enabled, the corresponding SPI Flash image, partition, and boot parameters can be generated.
│ │ │
│ │ Block Size
│ │ └── SPI Flash block size configuration.
│ │ Only effective when SPI Flash Support is enabled.
│ │ Default value is 64k.
│ │
│ └── eMMC Flash Support
│ └── Whether to enable eMMC Flash support.
│ When enabled, you can choose to generate images suitable for eMMC such as ext4 rootfs.
│
└── Boot Regfile Config
└── Boot Reg File
└── Configure the register initialization file name used during the boot stage.
Typically used for DDR, pinmux, or chip boot-stage register initialization.3.2.3 Bootloader System
Bootloader System configures parameters related to the system bootloader, mainly the U-Boot version, U-Boot default configuration, environment variable storage area, and DDR Training support.
Bootloader System
├── Boot Type
│ └── uboot
│ └── Select U-Boot as the bootloader type.
│ The current project provides only uboot as the Boot Type.
│
├── U-boot Version
│ └── u-boot-2020.01
│ └── Select u-boot-2020.01 as the U-Boot version.
│ The current project provides only this version.
│
├── Boot Defconfig
│ └── Configure the U-Boot default defconfig file name.
│ For example, xxxxx_defconfig.
│ The corresponding file is located in the U-Boot source directory.
│
├── Environment Variables Partition Start Address
│ └── Configure the start address of the U-Boot environment variable partition.
│ Default value is 0x80000.
│ This address should be aligned with the block size of NAND, SPI-NAND, or SPI-NOR.
│
├── Environment Variables Image Size
│ └── Configure the U-Boot environment variable image size.
│ Default value is 0x40000.
│
├── DDR Training Command Support
│ └── Whether to enable DDR Training command support in the bootloader.
│ Enabled by default.
│ Used to test the DDR window or debug DDR stability.
│
└── APP Support
└── Whether to enable bootloader-stage APP support.
Enabled by default.
This option is typically used to support additional applications or function modules at the boot stage.3.2.4 Linux System
Linux System is the Linux system-level configuration entry, with three sub-menus underneath:
Linux System
├── Kernel
├── Filesystem
└── ToolsLinux System -> Kernel
The Kernel menu configures the Linux kernel version, SMP, the multimedia driver build mode, and InitRamdisk-related settings.
Linux System
└── Kernel
├── Kernel Version
│ ├── linux-5.10.y
│ │ └── Select Linux Kernel version 5.10.y.
│ │ Current default.
│ │
│ └── linux-4.9.y
│ └── Select Linux Kernel version 4.9.y.
│
│
├── Kernel SMP Support
│ └── Whether to enable Linux Kernel SMP multi-core support.
│ Enabled by default.
│ When enabled, the multi-core kernel build path is used; otherwise, the single-core kernel build path is used.
│
├── Kernel Defconfig
│ └── Configure the Linux Kernel default defconfig file name.
│ For example, xxxxx_defconfig.
│ The corresponding config file is usually located in the kernel source directory:
│ arch/arm/configs/
│
├── Build GMP in Kernel
│ └── Whether to build GMP-related drivers into the kernel as built-in.
│ When selected, they are typically built as built-in;
│ when not selected, they are typically generated as kernel modules.
│
└── InitRamdisk Config
└── Toybox Config File For InitRamdisk
└── Configure the Toybox configuration file name used by the InitRamdisk.
Default value is toybox-0.8.8.
The corresponding config file is usually located in the toybox source config directory.Linux System -> Filesystem
The Filesystem menu configures the root file system, BusyBox, the C++ runtime library, strip behavior, and the rootfs image format.
Linux System
└── Filesystem
├── Busybox Config File For Root
│ └── Configure the BusyBox config file name used in the RootFS.
│ Default value is busybox-1_26_2.
│ The corresponding config file is usually located in the BusyBox source config directory.
│
├── C++ Runtime Libarary Support
│ └── Whether to support the C++ runtime library in the RootFS.
│ Enabled by default.
│ If your user programs depend on libstdc++ or other C++ runtime libraries, enable this.
│
├── Enable Strip
│ └── Whether to strip executables and libraries in the root file system.
│ Enabled by default.
│ When enabled, it reduces rootfs size but removes debug symbols;
│ if you need to debug with gdb, disable it.
│
├── Create Yaffs Rootfs Image
│ └── Whether to generate a YAFFS rootfs image.
│ Only effective when Nand Flash Support or Spi-Nand Flash Support is enabled.
│
├── Create Jffs2 Rootfs Image
│ └── Whether to generate a JFFS2 rootfs image.
│ Only effective when SPI Flash Support is enabled.
│
├── Create Squashfs Rootfs Image
│ └── Whether to generate a SquashFS rootfs image.
│ SquashFS is a read-only compressed file system, suitable for size-sensitive firmware scenarios.
│
├── Create ext4 Rootfs Image
│ └── Whether to generate an ext4 rootfs image.
│ Only effective when eMMC Flash Support is enabled.
│
├── eMMC Rootfs Size
│ └── Configure the eMMC rootfs image size.
│ Only effective when Create ext4 Rootfs Image is enabled.
│ Default unit is MB; default value is 32.
│
├── Create Ubi Rootfs Image
│ └── Whether to generate a UBI rootfs image.
│ Only effective when Nand Flash Support or Spi-Nand Flash Support is enabled.
│
└── UBI Rootfs Size
└── Configure the UBI rootfs partition size.
Only effective when Create Ubi Rootfs Image is enabled.
Default value is 64M.Linux System -> Tools
The Tools menu configures whether to add common system tools, debug tools, and file system tools to the rootfs or SDK build.
Linux System
└── Tools
├── Udev Support
│ └── Whether to enable udev support.
│ udev is used for Linux user-space device node management.
│
├── Fat32 fsck Support
│ └── Whether to add FAT32 file system check tools.
│ Used to detect or repair FAT/FAT32 file systems.
│
├── Ext3/Ext4 format Support
│ └── Whether to add ext3/ext4 file system formatting tools.
│ Suitable for formatting block-device file systems such as eMMC and SD cards.
│
├── GDB Support
│ └── Whether to add GDB debug support.
│ Note: This option requires you to provide the GDB source package yourself;
│ if the source package is missing, enabling this may cause the build to fail.
│
├── Ubi/Jffs2 format Support
│ └── Whether to add UBI/JFFS2-related formatting and management tools.
│ Commonly used in NAND or SPI-NAND Flash scenarios.
│
├── Read/Write Registers Support
│ └── Whether to add register read/write tools.
│ Used for low-level debugging and viewing or modifying hardware registers.
│
├── Mii ethphy Support
│ └── Whether to add MII/Ethernet PHY debug tools.
│ Used to view or configure Ethernet PHY registers.
│
└── CAN Tools Support
└── Whether to add CAN-bus-related tools.
Used for CAN interface debugging and send/receive tests.