# ohos-tutorial **Repository Path**: cheny-aa/ohos-tutorial ## Basic Information - **Project Name**: ohos-tutorial - **Description**: 我不信,除非我自己跑一遍 - **Primary Language**: C++ - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 7 - **Created**: 2021-11-12 - **Last Updated**: 2021-11-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 配置环境 ### 获取源码 建议使用马明帅提供的一键脚本([点我跳转](https://gitee.com/landwind/openharmony_oneclick_env_init))拉取代码。 ### 首次编译 假设你正在使用 wsl,则可以试着在 PC 端新建一个脚本,如 `build.bat`,其内容如下: ```bat ubuntu2004.exe run /home/mkl/repos-sep/openharmony_oneclick_env_init/OpenHarmony/build.sh --product-name Hi3516DV300 --ccache pause ``` ## 集成本套代码 ### 添加子系统 编辑 `build/subsystem_config.json`,添加如下配置: ```json "ohos-tutorial": { "path": "foundation/ohos-tutorial", "name": "ohos-tutorial" } ``` ### 添加部件 编辑 `productdefine/common/products/Hi3516DV300.json`,添加如下配置: ``` "ohos-tutorial:ohos-tutorial-sa":{}, "ohos-tutorial:ohos-tutorial-executable":{}, "ohos-tutorial:ohos-tutorial-napi":{} ``` ### 添加服务 ID 编辑 `utils/system/safwk/native/include/system_ability_definition.h`,添加如下配置: ``` TUTORIAL_SA_ID = 4999, ``` ## 编译验证 ### 验证 SA ```bat ubuntu2004.exe run /home/mkl/repos-sep/openharmony_oneclick_env_init/OpenHarmony/build.sh --product-name Hi3516DV300 --ccache --build-target ohos-tutorial-sa pause ``` 从前到后,依次作如下尝试: 1. `ps -A` 1. `bm dump -a` ### 验证 NAPI