Skip to main content

添加客户自定义配置文件

以下内容以 HALLY6_BASEBOARD_V2.0 开发板为参照

1 创建整体自定义配置文件

​ 比如客户想创建自己的主配置,比如为 x1600_example_factory_defconfig, 那就可以拷贝 HALLY6_BASEBOARD_V2.0 板级主配置 x1600e_halley6_nand_factory_defconfig 为 x1600_example_factory_defconfig

/build$ cp configs/x1600e_halley6_nand_factory_defconfig configs/x1600_example_factory_defconfig -arf

2 修改uboot 配置

确定当前使用的uboot配置

使用IConfigTool工具选择上面创建的主配置文件

2023-06-21_15-29

点击Open, 打开工程/编译 配置

6

2023-06-21_10-31

或者通过以下命令:

build$ grep -nr "uboot" configs/x1600e_halley6_nand_factory_defconfig 
3:APP_uboot_toolchain_dir=../tools/toolchains/mips-gcc520-glibc222
4:APP_uboot_dir=../bootloader/uboot-x2000
5:APP_uboot_config=x1600e_base_halley6_xImage_sfc_nand

可知,当前的uboot配置为:x1600e_base_halley6_xImage_sfc_nand

bootloader/uboot-x2000$ grep -nr "x1600e_base_halley6_xImage_sfc_nand" boards.cfg
673:x1600e_base_halley6_xImage_sfc_nand mips xburst x1600_base ingenic x1600 x1600_base:SPL_SFC_NAND,MTD_SFCNAND,SPL_OS_BOOT,SPL_PARAMS_FIXER,X1600E_DDR

在文件boards.cfg 添加自己的uboot配置为 x1600_base_xImage_example_sfc_nand

x1600_base_xImage_example_sfc_nand   mips        xburst x1600_base   ingenic    x1600       x1600_base:SPL_SFC_NAND,MTD_SFCNAND,SPL_OS_BOOT,SPL_PARAMS_FIXER,X1600E_DDR

3 修改 kernel 配置

确定当前使用的kernel配置

使用IConfigTool工具选择上面创建的主配置文件

2023-06-21_15-29

点击Open, 打开工程/编译 配置

6

2023-06-21_11-37

或者通过以下命令:

build$ grep -nr "kernel" configs/x1600e_halley6_nand_factory_defconfig 
6:APP_kernel_dir=../kernel/kernel-x2000
7:APP_kernel_config=x1600_halley6_module_base_linux_sfc_nand_defconfig

可知,当前的kernel 配置为:x1600_halley6_module_base_linux_sfc_nand_defconfig

创建客户自己的kernel配置,比如为:x1600_module_base_example_linux_sfc_nand_defconfig

kernel/kernel-x2000$ cp arch/mips/configs/x1600_halley6_module_base_linux_sfc_nand_defconfig arch/mips/configs/x1600_module_base_example_linux_sfc_nand_defconfig -arf

4 修改 kernel 加载的 dts 文件

确定当前使用 .dts 文件

首先确定当前使用的.dts文件

通过如下命令:

kernel/kernel-x2000$ grep -nr ".dts" arch/mips/configs/x1600_module_base_example_linux_sfc_nand_defconfig
70:CONFIG_DT_X1600_MODULE_BASE_DTS_FILE="x1600_halley6_module_base.dts"

可知当前dts文件为:x1600_halley6_module_base.dts

2023-06-21_11-43

创建客户自己的.dts文件

进入 kernel/kernel-x2000/arch/mips/boot/dts/ingenic 目录创建 .dts 文件,比如命名为:x1600_example.dts

cp kernel/kernel-x2000/arch/mips/boot/dts/ingenic/x1600_halley6_module_base.dts kernel/kernel-x2000/arch/mips/boot/dts/ingenic/x1600_example.dts

kenel 使用创建的 x1600_example.dts 文件

打开 menuconfig 更改配置文件

cd kernel/kernel-x2000

make x1600_module_base_example_linux_sfc_nand_defconfig

make menuconfig

目标位于

-> Machine selection

​ -> SOC Type Selection

2023-06-21_11-49

将红色区域内文件名改成我们创建的文件名,然后保存退出

2023-06-21_11-50

将 .config 配置保存,重新拷贝到我们创建的文件

kernel/kernel-x2000$ cp .config arch/mips/configs/x1600_module_base_example_sfc_nand_defconfig -arf

5 修改buildroot配置

确定当前使用的buildroot配置

使用IConfigTool工具选择上面创建的主配置文件

2023-06-21_15-29

点击Open, 打开工程/编译 配置

6

2023-06-21_15-34

或者通过以下命令:

build$ grep -nr "buildroot" configs/x1600_example_factory_defconfig
8:APP_br_dir=../buildroot/buildroot
9:APP_br_config_file=configs/buildroot/buildroot_wifi_common_defconfig
377:# APP_br_root_login_keep_buildroot is not set

可知,当前的buildroot 配置为:buildroot_wifi_common_defconfig

创建客户自己的buildroot配置,比如为:buildroot_x1600_example_darwin_debug

build$ cp configs/buildroot/buildroot_wifi_common_defconfig configs/buildroot/buildroot_x1600_example_darwin_debug -arf

6 更新主配置文件

重新选择客户创建的uboot,kernel ,buildroot配置

使用IConfigTool工具选择上面创建的主配置文件

2023-06-21_15-29

点击Open, 打开工程/编译 配置

6

2023-06-21_15-39

2023-06-21_15-40

点击 Yes保存。这样主配置文件x1600_example_factory_defconfig里面使用的uboot,kernel,buildroot配置就都是客户自己添加的配置了,整个客户自定义的配置修改完成。

7 整体编译

编译命令如下:

build$ make x1600_example_factory_defconfig

build$ make