跳到主要内容

SDK 一键配置命令

V821 SDK提供 quick_config 功能,执行对应命令,可快速一键修改该功能相关的所有配置项。

使用 quick_config

lunch 后, 输入 quick_config 命令回车:

$ quick_config
Available Quick Config Name:
0 musl_toolchain : Change this board cross toolchain to musl
1 glibc_toolchain : Change this board cross toolchain to glibc
2 set_cpu_vf_0 : Set cpu 960mhz (0.92v)
3 set_cpu_vf_2 : Set cpu 1200mhz (1.00v)
4 kernel compression lzma : Set kernel compression method to lzma.
5 kernel compression gzip : Set kernel compression method to gzip.
6 kernel compression none : Set kernel compression method to none.
7 v821_smac : Set v821 smac for this board
8 v821_smac_etf : Set v821 smac_etf for this board
9 v821_fmac_etf : Set v821 fmac_etf for this board
10 memory_optimization : Set memory optimization for kernel, will disable some less commonly used functions
11 product_close_debug_config : Close debug configs for mass production
12 mpp_compile_dynamic_lib : Set mpp compile dynamic lib for this board
13 mpp_compile_static_lib : Set mpp compile static lib for this board
14 de_resize_config : Open de resize function for person detection
15 debug_linux : Open kallsyms and debug_fs for kernel debug
16 debug_rtos : Open rtos uart for rtos debug, will disable sdc0
17 secure_firmawre : Set to build secure firmawre for this board
18 default_sensor_config : Set to default camera config (gc1084)
19 one_gc1084_sensor : Set one camera of gc1084 online for this board
20 one_gc2083_sensor : Set one camera of gc2083 online for this board
21 one_sc2336_sensor : Set one camera of sc2336 online for this board
22 one_nvp6158c_sensor : Set nvp6158c 2h for this board
23 one_sc3336_sensor(2in1) : Set one camera of sc3336 2in1 mode for this board
24 one_gc4663_sensor(2in1) : Set one camera of gc4663 2in1 mode for this board
25 one_f37p_sensor : Set one camera of f37p online for this board
26 one_imx258(af)_sensor : Set one camera of imx258(af) online for this board
27 dual_gc1084_sensor : Set dual camera of gc1084 for this board
28 one_gc2083_and_one_os02g10_sensor : Set dual camera of gc2083 and os02g10 for this board, mipi and dvp
29 dual_gc2083_sensor : Set dual camera of gc2083 for this board, sensora: 0x6e, sensorb: 0x7e
30 dual_gc2083_sensor(stitch_mode) : Set dual camera of gc2083 for this board, sensora: 0x6e, sensorb: 0x7e
31 dual_sc2336_sensor : Set dual camera of sc2336 for this board, sensora: 0x60, sensorb: 0x64
32 change_to_emmc : Set device storage to emmc
33 change_to_nand : Set device storage to spi nand
34 e907_isp : Set e907 to run isp server
35 e907_dual_isp : Set e907 to run isp server (dual sensor)
36 lcd_nv3049f_480_854 : Set to support lcd nv3049f
37 pl2_pl3_uart3 : Set debug uart to pl2 pl3 with uart3
Which would you like?
  • 输入 quick_config 命令后,根据需要,选择上面序列号并回车,回车输入y(注意输入y后会修改本地环境的一些配置),就会自动修改相关配置文件,具体修改了哪些文件,执行y命令后会全部打印显示出来。请注意留意有些配置项输入y之后会提示一些额外操作,确保配置生效。
  • 输入 quick_config 命令后,若不需选择,直接回车即可,不会修改任何文件。
  • 使用 quick_config 命令配置后,这些改动是直接修改SDK中相关的文件,目前不支持清理命令。如果需要清理这些修改,需要手动使用 git 命令清理,或者根据 quick_config 命令执行后的提示,恢复相关的配置项。

quick_config 使用示例

切换板级摄像头到双目GC2083

更换摄像头模组为双目模组,可以使用 quick_config 修改配置到双目 GC2083 模组,输入 qucik_config 后可以看到选项 one_gc2083_sensor 编号为22,输入后即可切换配置。

Loading asciinema cast...

切换板级摄像头到双目GC2083

更换摄像头模组为双目模组,可以使用 quick_config 修改配置到双目 GC2083 模组,输入 qucik_config 后可以看到选项 dual_gc2083_sensor 编号为9,输入后即可切换配置。

image-20241121134552216

切换储存介质为 SPI NAND

切换储存器为NAND,输入 quick_config,可以看到用于切换的quick_config 是18,输入 18,之后会出现一个确认项,确认后将会自动执行其配置操作。

image-20241121134221893

切换 MPP 为动态库编译

默认配置下,MPP 是静态库编译的,这里可以用 quick_config 切换到动态库编译。输入 quick_config 选择选项 19,然后确认

image-20241121134711920

在切换后有提示,需要手动清除 mpp 的编译产物重新编译 mpp

image-20241121134759504

切换工具链为glibc库

SDK 默认配置使用的库是 MUSL 库,可以通过 quick_config 切换到使用 glibc 库。输入 quick_config 然后选择选项。

注意部分 quick_config 在执行前需要有其他的操作,请按照提示进行操作,例如切换工具链,会有如下提示。如果没按照要求执行可能会导致SDK无法编译通过,quick_config 也对部分文件做了检查,如果无视提示直接跳过,会直接报错。

例如这里,SDK 提示需要删除编译产物,需要手动执行 make distclean 然后再执行切换工具链的操作。

image-20241121134934915

如果无视,没有执行清理编译产物的操作,则报错退出

image-20241121135052420

执行了 make distclean 后,正常操作

image-20241121135509797

Quick Config 使用说明

整体框架

quick_conf  test
|--- 找到 quick_config.json,并解析
|--- 修改内核 ---> 引入fragment
|--- ${TINA_TOPDIR}/build.sh loadconfig lock_defconfig.fragment
|--- ${TINA_TOPDIR}/build.sh saveconfig
|--- 修改uboot的配置
|--- 修改 board.dts ---> 脚本处理
|--- 修改 boot_package_nor.fex ---> 脚本处理
|--- 修改 sys_config.cfg ---> 脚本处理
|--- 修改 uboot-board.dts ---> 脚本处理
|--- 修改 env.dts ---> 脚本处理
|--- 修改 tina defconfig ---> 脚本处理

脚本框架

img

注意事项

在 JSON 对象 中,元素是以键值对的形式表示的,每个键值对之间使用逗号分隔。最后一个键值对后不加逗号, JSON 规范规定不能在对象的结尾处使用多余的逗号。

在 JSON 数组 中,数组的元素之间用逗号分隔,最后一个元素后也不加逗号。

如果在最后一项后加逗号,可能导致解析错误,特别是在不同语言或工具中处理时。因此,为了确保 JSON 数据的有效性和跨平台的兼容性,最后一项后不加逗号是必须遵守的规范。

在VSCode中,错误使用逗号会显示警告 Trailing comma

img

同名配置项覆盖逻辑

以 V821-PERF2 板级为例,其配置参数如下:

{
"use_common_conifg": true,
"quick_config_include": [
"perf2_sensor.json",
"storage_change.json"
],
}

则覆盖逻辑如下所示:

device/config/chips/v821/configs/default/quick_config.json                         // common_conifg 平台共用配置文件
↑ 同 key 覆盖
device/config/chips/v821/configs/default/quick_config/perf2_sensor.json // perf2 板级 sensor 通用配置文件
↑ 同 key 覆盖
device/config/chips/v821/configs/default/quick_config/storage_change.json // 介质切换配置文件
↑ 同 key 覆盖
device/config/chips/v821/configs/perf2/quick_config.json // v821-perf2 板级配置文件

Quick Config 文件格式

Quick config main.png

例子:

{
"use_common_conifg": true,
"quick_config_include": [
"fastboot_common.json",
"fastboot_storage_change.json"
],
"test" : {
"sysconfig" : {
"target" : {
"storage_type" : 1
},
"product" : {
"version" : "\"101\""
}
},
"bootpkg" : {
"logo" : "test.bmp.lzma",
"logo-enable" : 1,
"logo-addsuffix" : ".lz4"
},
"env" : [
{ "name" : "wifi_mac", "val": "1.2.3.4", "method" : "add" },
{ "name" : "setargs_mmc", "val": " test=true", "method" : "append" },
{ "name" : "bt_mac", "method" : "del" }
],
"board.dts" : {
"add_node" : [
{ "name": "node0" },
{ "path" : "/", "name": "node1", "add_tail" : 1 },
{ "path" : "node0/", "name": "test0" },
{ "path" : "node1", "name": "test0" },
{ "path" : "node0/test0", "name": "test1" },
{ "path" : "node0//test0", "name": "test2" },
{ "path" : "node0/test0", "name": "test3" },
{ "path" : "node0/test0", "name": "test4" },
{ "path" : "node1/test0", "name": "test1" },
{ "path" : "node1/test0", "name": "test_label: test2" },
{ "path" : "node1/test0", "name": "test3" }
],
"del_node" : [
{ "path" : "node0/test0", "name": "test2" },
{ "path" : "node1/test0", "name": "test3" }
],
"set_property" : {
"node0" : {
"compatible" : "\"node0\",\"Tina\"",
"status" : "\"okay\""
},
"node1" : {
"compatible" : "\"node1\",\"Tina\"",
"status" : "\"okay\""
},
"node0/test0" : {
"reg" : "<xxxxxxx>"
},
"test1" : {
"status" : "\"okay\""
},
"test4" : {
"tast-bool" : null,
"will_del" : null,
"status" : "\"okay\""
},
"test_label" : {
"status" : "\"okay\""
}
},
"del_property" : {
"test4" : {
"will_del" : null
}
}
},
"uboot-board.dts" : {
"add_node" : [
{ "name": "&sunxi_flashmap" },
{ "path" : "sunxi_flashmap", "name": "nor_map" }
],
"set_property" : {
"nor_map" : {
"logic_offset" : "<4352>",
"boot_param_start" : "<248>",
"boot_param_size" : "<8>",
"uboot_start" : "<256>",
"uboot_size" : "<4096>",
"status" : "\"okay\""
}
}
},
"kernel" : [
"lock_defconfig.fragment", "ftrace_defconfig.fragment",
"# CONFIG_AW_GPADC is not set", "CONFIG_LOG_BUF_SHIFT=15"
],
"openwrt" : [
"CONFIG_TARGET_PREINIT_IP=\"192.168.1.2\"", "# CONFIG_HAS_FPU is not set"
]
}
}

内置参数

use_common_conifg

使用平台共有 quick_config 配置,路径: default/quick_config.json 这份配置为最基础配置,会被每一级的相同 Key 的配置完整覆盖(不是差异化覆盖)

例子:

{
"use_common_conifg": true, // 启用平台共有 quick_config 配置
}
{
"use_common_conifg": false, // 禁用平台共有 quick_config 配置
}
quick_config_include

quick_config 引用配置,共用配置减少代码维护量。其会去平台路径下 default/quick_config 文件夹中寻找对应配置文件名

其内容层级比 default/quick_config.json 高,会覆盖 default/quick_config.json 中的相同 key 的配置

{
"quick_config_include": [
"fastboot_common.json", // 引用 fastboot_common.json
"fastboot_storage_change.json" // 引用 fastboot_storage_change.json
],
}
desc

用于用户不带参数调用 quick_config 时,简要说明配置项的功能。

{
"config1" : {
"desc" : "config1"
....
},
"config2" : {
"desc" : "config2"
....
},
}
depends

用于加载其余所依赖的配置项,可以多层引用。

{
"env_init_for_all" : {
...
}
"all" : {
"depends" : [
"env_init_for_all", xxxx # 加载all时会先加载env配置项
]
}
}
cmd

用于执行一些 sh 命令(可以使用根目录下的 .buildconfig 里的环境变量)

提示

注意破坏性命令执行!

{
"cmd" : [
"mkdir -p ${LICHEE_PLAT_OUT}/ota_sdnand",
...
]
}

sysconfig

作用于 BOOT0 配置文件:sys_config.fex

"sysconfig" : {
/*
* 规则:
* "mainkey" : {
* "subkey" : val 重新设置val,字符串需要添加\"str\"
* }
*/
}

"rtos_sysconfig" : {
/*
* 规则:
* "mainkey" : {
* "subkey" : val 重新设置val,字符串需要添加\"str\"
* }
*/
}

示例:

"sysconfig" : {
"target" : {
"storage_type" : 1
},
"product" : {
"version" : "\"101\""
}
},

partition

作用于非 NOR 存储介质分区表文件:sys_partition.fex

"partition" : [
{ "name" : "分区名", "属性" : "属性值" }, // 修改/增加 分区
{ "name" : "分区名", "属性" : "属性值", "del" : true }, // 删除分区
],

示例:

"partition" : [
{ "name" : "inster_last", "size" : "1234" },
{ "name" : "inster_last2", "size" : "1234" },
{ "name" : "mbr", "size" : "32768" },
{ "name" : "env-redund", "size" : "12345", "user_type" : "0x123" },
{ "name" : "mbr" }, // use to location partion position for next item
{ "name" : "inster_after_mbr", "size" : "45678", "user_type" : "0x456", "downloadfile" : "\"test\"" },
{ "name" : "rootfs", "size" : "45678", "user_type" : "0x456", "test" : "12" },
{ "name" : "inster_last1", "del" : true }
],

partition_nor

作用于 NOR 存储介质分区表文件:sys_partition_nor.fex

"partition_nor" : [
{ "name" : "分区名", "属性" : "属性值" }, // 修改/增加 分区
{ "name" : "分区名", "属性" : "属性值", "del" : true }, // 删除分区
],

示例:

"partition_nor" : [
{ "name" : "inster_last", "size" : "1234" },
{ "name" : "inster_last2", "size" : "1234" },
{ "name" : "mbr", "size" : "32768" },
{ "name" : "env-redund", "size" : "12345", "user_type" : "0x123" },
{ "name" : "mbr" }, // use to location partion position for next item
{ "name" : "inster_after_mbr", "size" : "45678", "user_type" : "0x456", "downloadfile" : "\"test\"" },
{ "name" : "rootfs", "size" : "45678", "user_type" : "0x456", "test" : "12" },
{ "name" : "inster_last1", "del" : true }
],

bootpkg

作用于 boot_package.cfgboot_package_nor.cfg 的 boot_package 打包配置文件。

"bootpkg" : {
/*
* 规则:
* "item_name-enable" : val 重新设置val
* "item_name-enable" : 0/1 添加或减少item
* 如果val是以下后置,会自动在item后面添加后缀
* .ga -> 会给 item 添加 -gzip
* .lzma -> 会给 item 添加 -lzma
*/
"u-boot": 1, // 需要添加的item
"logo": 0, // 关闭logo, 即注释掉该item
}

示例:

"bootpkg" : {
"logo" : "test.bmp.lzma",
"logo-enable" : 1,
},

env

作用于 env.cfg ,env 配置文件

"env" : [
/*
* 规则:
* { "name" : "wifi_mac", "val": "1.2.3.4", "method" : "add" },
* { "name" : "setargs_mmc", "val": " test=true", "method" : "append" },
* { "name" : "bt_mac", "method" : "del" }
* PS: method目前只支持 add,append,del
*/
{ "name" : "wifi_mac", "val": "1.2.3.4", "method" : "add" },
{ "name" : "setargs_mmc", "val": " test=true", "method" : "append" },
]

示例:

"env" : [
{ "name" : "wifi_mac", "val": "1.2.3.4", "method" : "add" },
{ "name" : "setargs_mmc", "val": " test=true", "method" : "append" },
{ "name" : "bt_mac", "method" : "del" }
],

board.dts

作用于 board.dts 内核设备树配置文件

"board.dts" : {
"add_node" : [ # 要添加的节点
{ "path" : "路径(可选), "name" : "节点名", "add_tail" : 是否在尾部插入 }
],
"del_node" : [ # 要删除的节点
{ "path" : "路径(可选), "name" : "节点名" }
],
"set_property" : { # 要添加的属性
"节点名" : {
"属性名称" : "属性值"
}
},
"del_property" : { # 要删除的属性
"节点名" : {
"属性名称" : "属性值"
}
},
"bootargs" : {
"loglevel" : 8, # 修改
"rootwait" : null, # 删除
}
}

示例:

"board.dts" : {
"add_node" : [
{ "name": "node0" },
{ "path" : "/", "name": "node1", "add_tail" : 1 },
{ "path" : "node0/", "name": "test0" },
{ "path" : "node1", "name": "test0" },
{ "path" : "node0/test0", "name": "test1" },
{ "path" : "node0//test0", "name": "test2" },
{ "path" : "node0/test0", "name": "test3" },
{ "path" : "node0/test0", "name": "test4" },
{ "path" : "node1/test0", "name": "test1" },
{ "path" : "node1/test0", "name": "test_label: test2" },
{ "path" : "node1/test0", "name": "test3" }
],
"del_node" : [
{ "path" : "node0/test0", "name": "test2" },
{ "path" : "node1/test0", "name": "test3" }
],
"set_property" : {
"node0" : {
"compatible" : "\"node0\",\"Tina\"",
"status" : "\"okay\""
},
"node1" : {
"compatible" : "\"node1\",\"Tina\"",
"status" : "\"okay\""
},
"node0/test0" : {
"reg" : "<xxxxxxx>"
},
"test1" : {
"status" : "\"okay\""
},
"test4" : {
"tast-bool" : null,
"will_del" : null,
"status" : "\"okay\""
},
"test_label" : {
"status" : "\"okay\""
}
},
"del_property" : {
"test4" : {
"will_del" : null
}
}
},

uboot-board.dts

作用于 uboot-board.dts U-Boot 设备树配置文件

"board.dts" : {
"add_node" : [ # 要添加的节点
{ "path" : "路径(可选), "name" : "节点名", "add_tail" : 是否在尾部插入 }
],
"del_node" : [ # 要删除的节点
{ "path" : "路径(可选), "name" : "节点名" }
],
"set_property" : { # 要添加的属性
"节点名" : {
"属性名称" : "属性值"
}
},
"del_property" : { # 要删除的属性
"节点名" : {
"属性名称" : "属性值"
}
},
"bootargs" : {
"loglevel" : 8, # 修改
"rootwait" : null, # 删除
}
}

示例:

"uboot-board.dts" : {
"add_node" : [
{ "name": "&sunxi_flashmap" },
{ "path" : "sunxi_flashmap", "name": "nor_map" }
],
"set_property" : {
"nor_map" : {
"logic_offset" : "<4352>",
"boot_param_start" : "<248>",
"boot_param_size" : "<8>",
"uboot_start" : "<256>",
"uboot_size" : "<4096>",
"status" : "\"okay\""
}
}
},

BoardConfig

作用于 BoardConfig.mk 或者 BoardConfig_nor.mk 会根据目前存储介质自动识别。

"BoardConfig" : {
"LICHEE_FLASH" : "default", # 修改值
"LICHEE_RTOS_PROJECT_NAME" : null, # 删除item
"LICHEE_XXXXXX" : "add", # 新增item
},

kernel

作用于内核配置文件 bsp_defconfig,用于开关内核编译选项

"kernel" : [
"fragment文件名 or 配置名 or !配置名(表示去掉某个配置)"
"lock_defconfig.fragment", "ftrace_defconfig.fragment",
"# CONFIG_AW_GPADC is not set", "CONFIG_LOG_BUF_SHIFT=15"
],

rtos

作用于 RTOS 配置文件 defconfig,用于开关 RTOS 编译选项

"rtos" : [
"fragment文件名 or 配置名 or !配置名(表示去掉某个配置)"
"lock_defconfig.fragment", "ftrace_defconfig.fragment",
"# CONFIG_AW_GPADC is not set", "CONFIG_LOG_BUF_SHIFT=15"
],

openwrt

作用于 OpwnWRT 文件系统配置文件 defconfig,用于开关 OpwnWRT 软件包编译选项

"openwrt" : [
"CONFIG_TARGET_PREINIT_IP=\"192.168.1.2\"", "# CONFIG_HAS_FPU is not set"
]

boot0

作用于 Boot0 编译 .mk 文件,需要指定修改的 mk 文件名

"boot0": {
"common.mk": { // boot0需要修改的mk文件名
"CFG_SUNXI_VF_2_1": true, // 新增=y的配置,如果是注释则取消注释然后配置=y,如果没有配置则新增配置=y
"CFG_X509_CERT_DISABLE": false, // 新增=n的配置,如果是注释则取消注释然后配置=n,如果没有配置则新增配置=n
"CFG_FLASHFLAG_RTC_INDEX": "0x11110", // 修改数值, 如果是注释则取消注释并修改数值,如果不是注释则直接修改数值,如果没有配置则新增配置
"CFG_X509_CERT_DISABLE": null, // 修改为注释, 如果是注释则不做修改,如果有配置则修改为注释
}
}

`