Go to file
authName b0a5f0701a add readme for security directory
Change-Id: Id0ec27d50f9109ed1e45d67c24c51070dc8f99bc

Match-id-a2badf836628e4cdc3c223247e886f73f3e30039
2023-12-05 16:50:26 +08:00
docs add readme for security directory 2023-12-05 16:50:26 +08:00
figures add readme for security directory 2023-12-05 16:50:26 +08:00
frameworks remove callback and update doc 2023-12-05 00:19:35 +08:00
interfaces update ndk doc 2023-12-01 16:13:12 +08:00
sa_profile fix device reboot can not delete asset data when package removed 2023-11-21 19:11:23 +08:00
scripts fix device reboot can not delete asset data when package removed 2023-11-21 19:11:23 +08:00
services keep remote and current same 2023-12-04 17:40:27 +08:00
test/unittest Merge remote-tracking branch 'refs/remotes/origin/master' 2023-12-05 00:20:27 +08:00
.gitignore remove .idea 2023-10-12 21:32:58 +08:00
BUILD.gn keep remote and current same 2023-12-04 17:40:27 +08:00
bundle.json hitrace 2023-11-06 09:11:48 +08:00
Cargo.toml add doc 2023-11-25 09:39:52 +08:00
hisysevent.yaml modify error code 2023-11-22 00:52:03 +08:00
LICENSE add doc 2023-11-25 09:39:52 +08:00
README_zh.md update font in pictures 2023-12-05 10:50:49 +08:00
README.md refactor user auth 2023-11-15 15:51:05 +08:00
rustfmt.toml do cargo fmt 2023-10-19 11:09:20 +08:00

asset

环境配置

  1. 单框架代码下载:
mkdir hmos_trunk
cd hmos_trunk
repo init -u http://mgit-tm.rnd.huawei.com/platform/manifest -m system_general.xml -b hmos_trunk --repo-branch=stable --no-repo-verify --repo-branch=stable_py3
repo sync -c -j32
./build/prebuilts_download.sh --skip-ssl --tool-repo=http://hmf.inhuawei.com:9080 --npm-registry=http://mirrors.tools.huawei.com/npm/ --pypi-url=http://mirrors.tools.huawei.com/pypi/simple/
  1. asset代码下载
cd base/security
rm -rf asset
git clone ssh://git@szv-y.codehub.huawei.com:2222/y00522150/asset.git

编译运行

# 运行前配置
cd vendor/huawei/build
git fetch https://szv-cr-y.codehub.huawei.com/CBG_CR_HarmonyOS/huawei/build.git refs/change-requests/1032/1 && git cherry-pick FETCH_HEAD
cd -
cd third_party/sqlite
git fetch https://szv-open.codehub.huawei.com/OpenSourceCenter_CR/openharmony/third_party_sqlite.git refs/change-requests/12/2 && git cherry-pick FETCH_HEAD
cd -
cd base/security/huks
git fetch https://szv-open.codehub.huawei.com/OpenSourceCenter_CR/openharmony/security_huks.git refs/change-requests/67/2 && git cherry-pick FETCH_HEAD
git fetch https://szv-open.codehub.huawei.com/OpenSourceCenter_CR/openharmony/security_huks.git refs/change-requests/59/2 && git cherry-pick FETCH_HEAD
cd -

# 首次编译命令修改BUILD.gn时执行
./build_system.sh --abi-type generic_generic_arm_64only --device-type hisi_all_phone_standard --ccache --build-variant root --build-target asset --build-target asset_test

# 非首次编译命令未修改BUILD.gn时执行
./build_system.sh --abi-type generic_generic_arm_64only --device-type hisi_all_phone_standard --ccache --build-variant root --build-target asset --build-target asset_test --fast-rebuild

# 打点文件编译命令修改hisysevent.yaml时执行
./build/ohos/hisysevent/gen_def_from_all_yaml.py --yaml-list base/security/asset/hisysevent.yaml --def-path out/generic_generic_arm_64only/hisi_higeneric_newphone_standard/security/asset

# 支持SA自启(仅在调试设备上执行一次)
./scripts/push_asset_cfg.bat

# 运行环境:(每次代码修改后执行)
./scripts/push_asset.bat


测试

测试DEMOhttps://codehub-y.huawei.com/y00522150/AssetDemo/files?ref=master 测试Sample: https://codehub-y.huawei.com/z00639827/asset_sample/files?ref=master

# 自动化用例推包运行
hdc file send Z:\workspace\hmos_trunk\out\generic_generic_arm_64only\hisi_all_phone_standard\tests\unittest\asset\asset_UT_test\asset_rust_test ./data/
hdc file send Z:\workspace\hmos_trunk\out\generic_generic_arm_64only\hisi_all_phone_standard\tests\unittest\asset\asset_UT_test\asset_ndk_test ./data/
hdc file send Z:\workspace\hmos_trunk\out\generic_generic_arm_64only\hisi_all_phone_standard\tests\unittest\asset\asset_UT_test\asset_module_test ./data/

hdc shell chmod 777 ./data/asset_rust_test
hdc shell chmod 777 ./data/asset_ndk_test
hdc shell chmod 777 ./data/asset_module_test

hdc shell "./data/asset_rust_test --test-threads=1"
hdc shell "./data/asset_ndk_test --gtest_output=xml:/data/"
hdc shell "./data/asset_module_test --test-threads=1"

单线程运行测试用例

执行的时候 在后面加 --test-threads=1

工具汇总

# 格式化BUILD.gn文件在asset目录下执行
find -name "*.gn" -or -name "*.gni" | xargs ../../../prebuilts/build-tools/linux-x86/bin/gn format

# 代码格式化在asset目录下执行
cargo fmt

# disable样机打卡软件, 在设备上执行
hdc shell
find -name com.huawei.hmsapp.samplemanagement | xargs rm -rf

WIKI汇总

**BUILD.gn规范**https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-build-component-building-rules.md **日志打印规范:**https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/OpenHarmony-Log-guide.md **可靠性设计和编码规范:**https://w3.huawei.com/ipd/tsl/#!tsl_new/standard/standard.html?standardId=152795 **RUST编码规范**https://w3.huawei.com/tsl/#/standard/standardDetail?standardId=217651 **可信构建:**https://wiki.huawei.com/domains/6660/wiki/8/WIKI20230410978631?title=_15