# BoardSupportPackage **Repository Path**: wwf2023/board-support-package ## Basic Information - **Project Name**: BoardSupportPackage - **Description**: 本仓库用于维护TenonOS的板级支持包,提供各种开发板的tenonos镜像构建打包入口 - **Primary Language**: Shell - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 7 - **Created**: 2024-08-06 - **Last Updated**: 2024-08-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # TenonOS Board Support Package ## 介绍 本仓库提供TenonOS已支持板卡的kernel打包脚本及bootloader ## 目录结构 Tenon的工作目录结构如下: ``` bsp_workdir ├── apps/ /*存放各类应用微库*/ ├── drivers/ /*存放驱动微库*/ ├── libs/ /*存放各类功能微库*/ ├── plats/ /*存放适配各类开发板的平台微库*/ ├── tenon/ /*基于libos架构的操作系统框架和核心微库*/ └── board-support-package /*TenonOS的板级支持包*/ ├── board_info.json /*存放板卡支持信息,请勿修改*/ ├── build.sh /*执行构建与打包操作的入口脚本*/ ├── version-management /*存放版本控制信息*/ ├── kvm/ /*以下目录为目前所支持的板卡,存放内容请参考下文*/ ├── ok3568/ └── raspberry-pi-3b+/ ``` 对于支持的不同板卡,存放的目录结构如下: ``` board-name /*开发板名称*/ ├── bootloaders/ /*用于保存开发板bootloader,必要的烧录镜像也可以保存在本目录,如firmware、atf、系统更新镜像等*/ ├── dts/ /*设备树文件*/ ├── scripts/ /*TenonOS kernel构建、打包脚本*/ ├── third_party/ /*板卡供应商提供的构建、打包工具*/ ├── defconfig /*适配开发板的默认配置*/ └── README.md /*使用方式说明,包括kernel打包说明、bootloaders目录下各文件用途、烧录工具下载链接及配置说明等*/ ``` ## 使用构建脚本 ### 显示帮助信息: ``` $ ./build.sh --help * Usage: ./build.sh [Sub Command] [--board=|--plat=] [--kernel=] * Examples: Initialize working context: ./build.sh --init-libs=version-management/lib_config_Tenon_v0.1.0.json Update working context: ./build.sh --update-libs=version-management/lib_config_Tenon_v0.1.0.json Build TenonOS ./build.sh [--board=|--plat=] [--kernel=] [Other Options] Pack TenonOS only ./build.sh pack [--board=|--plat=] [--kernel=] * Sub Command(Optional): pack Packing boot files and Tenon image without building or compiling. clean Delete all files created by build for all libraries including final images, but keep fetched files. distclean Delete build directory and configurations (including .config). * Options: --init-libs= Optional. Create working directories, and clone lib repo described in config file. ***No need to be used with a command.*** Please use the version control file stored in the version-management directory as a configuration template. --update-libs= Optional. Make each lib repo in the working directory consistent with the version described in lib_config.json. ***No need to be used with a command.*** Please use the version control file stored in the version-management directory as a configuration template. --board=, -b= One of '--board' or '--plat' is required. Specify a board to build the os image. --plat=, -p= One of '--board' or '--plat' is required. Specify a plat to build the os image. Use this option when building 'virtual-plat' image like kvm. --kernel=, -k= Optional. Path to the tenon. Default: 'bsp_workdir/tenon'. --app=, -a= Optional. Path to the application if you want to build it within TenonOS. --config=, -c= Optional. Specify a configuration file used to build TenonOS. Use 'defconfig' in plat or board directory if not set --help, -h Display this help message and exit. --support-boards, -s Display supported board information and exit. Use this option without any command. ``` ### 查看支持的板卡信息: ```bash $ ./build.sh --support-boards Currently Supported Boards: -------------------------------------------------------------- Plat | Board | Brief -------------------------------------------------------------- rk3568 | ok3568 | 飞凌嵌入式,OK3568-C-V1.1 kvm | - | kvm平台,当前支持arm64架构 raspi | raspberry-pi-3b+ | 树莓派3b+开发板 -------------------------------------------------------------- ``` ### 初始化构建环境: ```bash $ ./build.sh --init-libs=version-management/lib_config_Tenon_v0.1.0.json Initializing build context, please wait several minutes.. Initializing tenon... Initializing apps... Initializing libs... Initializing plats... Initializing drivers... Initializing finished. ``` #### 修改构建环境配置文件 BSP仓库提供了默认的微库信息模板lib_config.json。如果需要提供自己的配置文件,需遵循下述格式要求 - 微库配置 支持的微库类型包括:apps、libs、drivers、plats,每个类型下可提供若干微库,格式如下: ``` "微库类型": [ { "name": "配置的微库名称(必填)", "version": "配置使用的版本号(选填)", "branch": "配置使用的分支名称(选填), 当version与branch字段同时存在时version字段生效", "url": "配置微库的git clone地址(必填)" } ], ``` - 内核配置 ``` "tenon": { "version": "配置使用的版本号(选填)", "branch": "配置使用的分支名称(选填), 当version与branch字段同时存在时version字段生效", "url": "配置Tenon的git clone地址(必填)" } ``` ### 构建Tenon镜像 使用如下命令构建Tenon镜像 --kernel为可选参数,如未指定,将使用Tenon的工作目录结构中默认的tenon路径。 --config为可选参数,如未指定,将使用板卡目录下的defconfig进行构建(如:[kvm](kvm/defconfig)、[raspi](raspberry-pi-3b+/defconfig))。构建过程中会弹出menuconfig交互界面,允许调用者手动添加、删除微库,调整后的配置保存在tar包的config文件中。如不需要改动,退出即可。 ```bash ./build.sh --board= --kernel= --config= ``` **需要注意:build脚本通过--board或--plat参数确定构建的平台及CPU架构。如果调用者通过menuconfig修改了这些参数,或者配置文件中设置了不一致的参数,会导致构建失败。** #### 清理生成文件 - 清理构建目录 ```bash ./build.sh distclean --board= ``` - 清理构建产物 ```bash ./build.sh clean --board= ``` ### 单独打包镜像 如果镜像已经编译完成,可以执行以下命令直接打包 ```bash ./build.sh pack --board= ``` ## 代码贡献 代码贡献指导请参考[Contributing][tenon-contributing] [tenon-contributing]: https://gitee.com/tenonos/documents/CONTRIBUTING.md