SDK目录说明¶
1. SDK目录结构¶
图1 sdk目录结构图
Source code说明:
sdk:关于 sample_code 的源码,以及依赖 Linux kernel 的相关 sdk 源码。
boot:U-Boot 的相关源码与编译环境。
kernel:Linux kernel 的相关源码与编译环境。
project:编译整个工程的配置文件和环境。
optee:OP-TEE 的相关源码与编译环境。
2. 内容详解¶
2.1. boot¶
目录结构和原版 U-Boot 基本一致,下面为通用示意(实际文件名以项目配置为准):
.
├── ...
├── common
│ └── sgs_android_bootreason.c // sgs 平台相关 boot reason 等逻辑示例
├── drivers
│ └── sgs_common // sgs 提供的外设/OS 封装驱动
├── configs
│ └── <UBOOT_DEFCONFIG> // 项目 U-Boot defconfig,
│ // 具体查看 project defconfig 中 CONFIG_UBOOT_CONFIG 的定义
└── ...
2.2. kernel¶
目录和原版 Linux kernel 基本一致,用户主要关注以下目录(以通用形式表示):
.
├── ...
├── arch
│ └── <arch> // arm 或 arm64 等
│ ├── boot
│ │ └── dts
│ │ └── <chip>-<board>.dts // 设备树文件
│ └── configs
│ └── <KERNEL_DEFCONFIG> // kernel defconfig,
│ // 具体查看 project defconfig 中 CONFIG_KERNEL_CONFIG 的定义
├── drivers
│ └── sgs_common // sgs 提供的通用外设驱动
└── ...
2.3. sdk¶
sdk
├── verify // 样例/验证工程
│ ├── sample_code // Linux 侧 sample code
│ └── system_app / bsp_demo // 系统/板级验证工程(根据版本可能略有差异)
├── driver
│ └── ... // 各类驱动源码(例如 PspiDriver 等)
└── linux // SDK 与 kernel 解耦后的 Linux 侧适配代码
2.4. project¶
.
├── board // 板子相关资源
│ ├── mhera
│ │ ├── SSM004A-S01A // 例如 SSM004A-S01A
│ │ │ └── config
│ │ │ ├── config_board.json // 板级配置
│ │ │ ├── config_fb.json // 显示相关配置
│ │ │ └── config.json // 其他板级参数
│ │ ├── boot
│ │ │ ├── <介质>/ipl/partition // 各种启动介质下的 IPL、分区配置
│ │ │ ├── optee // TEE 相关镜像
│ │ │ └── tf_a // TF-A(二阶段引导)等
│ │ ├── dla_file // IPU FW / model bin
│ │ ├── iqfile // ISP IQ 文件
│ │ ├── screen_param // 屏参配置
│ │ └── ... // 其他板级资源
│ └── json // 旧版本中 MI 外部参数 json 所在目录(新版本可能已合并到各板配置)
├── configs
│ └── verify
│ └── defconfigs
│ └── nvr_mhera.spinand.glibc-12.4.0-arm64-squashfs.ssm004a.s01a.1024x1024.fccsp16_ddr4_defconfig // project defconfig,决定 KERNEL/MMA/SENSORIQ/分区等配置
├── image // 制作 image 的配置/脚本/工具
│ ├── build // 已编译好的 image 制作工具(如 lfs/fwfs)
│ ├── busybox // 已裁剪编译好的 busybox
│ ├── configs
│ │ └── general
│ │ ├── customer.mk // 决定打包到 customer 分区的文件
│ │ ├── misc.mk // 决定打包到 misc 分区的文件
│ │ ├── miservice.mk // 决定打包到 miservice 分区的文件
│ │ ├── ramdisk.mk // 决定打包到 ramdisk 的文件及启动脚本
│ │ ├── rootfs_fastboot.mk // fastboot rootfs 配置
│ │ ├── rootfs.mk // 第二个 rootfs 的打包信息
│ │ ├── nor-ramdisk.rtos.partition.config
│ │ └── spinand-ramdisk.rtos.partition.config // 各介质分区脚本
│ ├── image.mk // 分区制作脚本,同时生成 PARTINFO.pni 等
│ ├── ota.mk // OTA bin 制作脚本(如使用 sgs OTA 工具)
│ ├── script.mk // 分区烧录脚本,生成在 images/scripts
│ ├── etc/init.d // 系统初始化配置
│ ├── firmwarefs-fuse // FWFS 应用
│ ├── littlefs-fuse // LFS 应用
│ ├── fuse // LFS/FWFS 运行依赖库
│ ├── makefiletools // 制作 rootfs 的工具
│ ├── rootfs // rootfs 包
│ └── systemtap // 内核调试工具
├── kbuild
│ └── customize
│ └── 6.1
│ └── mhera // 从 kernel 复制 ko 到 project/ramdisk 的脚本
├── release
│ ├── chip
│ │ └── mhera // 各芯片对应的 SDK 库文件
│ │ ├── nvr // 不同产品线的预编译库
│ │ └── sgs_common_libs // 通用库(按 toolchain 区分 glibc/uclibc 等)
│ └── include // SDK 头文件
├── scripts // project 使用的脚本
└── tools // 调试工具(如 iqtool 等)