K1 OH5.0 系统定制说明
修订记录
修订版本 | 修订日期 | 修订说明 |
001 | 2025-01-13 | 初始版本 |
002 | 2025-04-18 | 添加“camera通路定制”章节 |
1. UI 定制
1.1. 更换 boot logo
Boot logo 可放置在 2 个位置:
- 所有方案共用的 boot logo 放置在
device/soc/spacemit/k1/kernel/boot/bootfs
,如下,同一个图案的 boot logo 有 4 张图,分 4 个方向,每个方 案根据需要选择不同方向的 logo,一般情况下,都是选用 0° 的 logo 图片。
|-- boot_logo_spacemit_0.bmp
|-- boot_logo_spacemit_180.bmp
|-- boot_logo_spacemit_270.bmp
`-- boot_logo_spacemit_90.bmp
- 特定方案定制的 boot logo 放置在
device/board/spacemit/xxx/kernel/boot/bootfs
,如下:
|-- boot_logo_ry_270.bmp
bootlogo 对于图像的要求为 32bit 的 bmp 图像,放置新的 boot logo 在上述目录,再修改 device/board/spacemit/musepaper/kernel
的 build_kernel.sh
文件,拷贝 boot logo 到打包路径即可。
cp ${OHOS_SOURCE_ROOT}/device/soc/${DEVICE_BOARD}/k1/kernel/boot/bootfs/boot_logo_spacemit_0.bmp ${OHOS_IMAGES_DIR}/bootfs/bianbu.bmp
1.2. 更换 kernel logo
Kernel logo 是在 boot logo 之后和开机动画之间展示的 logo,目的是避免 boot logo 和开机动画之间黑屏太久,一般 kernel logo 的图案和 boot logo 保持一致。
kernel_logo 放置在 device/board/spacemit/common/kernel_logo
,如下:
|-- kernel_logo_ry_270.ppm
|-- kernel_logo_spacemit_0.ppm
|-- kernel_logo_spacemit_180.ppm
|-- kernel_logo_spacemit_270.ppm
`-- kernel_logo_spacemit_90.ppm
Kernel logo 为 ppm 格式,添加新的 kernel logo 后,再修改 device/board/spacemit/xxx/kernel
的 build_kernel.sh
文件,拷贝 kernel logo 到内核的编译路径即可。
cp -rf ${OHOS_SOURCE_ROOT}/device/board/${DEVICE_BOARD}/common/kernel_logo/kernel_logo_spacemit_0.ppm ${KERNEL_BUILD_ROOT}/drivers/video/logo/logo_linux_clut224.ppm
1.2.1. bmp 转 ppm
- 安装转换工具
sudo apt-get install netpbm
- 执行脚本,会在当前目录生成 xxx.ppm
./bmp2ppm.sh xxx.bmp
脚本内容如下:
#!/bin/bash
if [ " $1" == " " ];
then
echo "usage:$0 bmp_file"
exit 0
fi
if [ -f "$1" ]
then
echo $1
else
echo "no find file [$1]"
exit 0
fi
name=${1%%.*}
bmptopnm $1 > $name.pnm
pnmquant 224 $name.pnm > $name.clut224.pnm
pnmtoplainpnm $name.clut224.pnm > $name.ppm
rm $name.pnm $name.clut224.pnm
1.3. 更换开机动画
更换开机动画有 2 种方式,一个是更换原生开机动画,另一个是添加定制动画,下面分别说明:
1.3.1. 更换原生动画
原生开机动画是 foundation/graphic/graphic_2d/frameworks/bootanimation/data
的 bootpic.zip
,可以替换这个 zip 包。
开机动画 zip 包内容包括:
|-- config.json
`-- OH_bootAni compressed
|-- OH_bootAni_00000.jpg
|-- OH_bootAni_00001.jpg
|-- OH_bootAni_00002.jpg
|-- OH_bootAni_00003.jpg
|-- ...
|-- OH_bootAni_00146.jpg
|-- OH_bootAni_00147.jpg
|-- OH_bootAni_00148.jpg
`-- OH_bootAni_00149.jpg
config.json 的内容为:
{
"Remark": "FrameRate Support 30, 60 frame rate configuration",
"FrameRate": 30
}
自己定制开机动画需要按照上面的格式和内容来定制。
1.3.2. 添加定制动画
vendor/spacemit/xxx
目录下,加入 bootanimation_custom_config.json
配置文件,里面配置定制动画的路径,如下:
{
"cust.bootanimation.pics": "/sys_prod/etc/bootanimation/cust_bootpic.zip",
"cust.bootanimation.sounds": "/sys_prod/etc/bootanimation/cust_bootsound.wav",
"cust.bootanimation.video": "/sys_prod/etc/bootanimation/cust_bootvideo.mp4"
}
并在上述文件对应的路径放入定制开机动画。
1.4. 更换开机音乐
更换开机音乐有 2 种方式,一个是更换原生开机音乐,另一个是添加定制音乐,下面分别说明:
1.4.1. 更换原生音乐
原生开机音乐是 foundation/graphic/graphic_2d/frameworks/bootanimation/data
的 bootsound.wav
,可以替换这个 wav 文件,音乐的时长不用太长。
1.4.2. 添加定制音乐
vendor/spacemit
目录下,加入 bootanimation_custom_config.json
配置文件,里面配置定制音乐的路径,如下:
{
"cust.bootanimation.pics": "/sys_prod/etc/bootanimation/cust_bootpic.zip",
"cust.bootanimation.sounds": "/sys_prod/etc/bootanimation/cust_bootsound.wav",
"cust.bootanimation.video": "/sys_prod/etc/bootanimation/cust_bootvideo.mp4"
}
并在上述文件对应的路径放入定制开机音乐。
1.5. 更换开机视频
更换开机视频有 2 种方式,一个是更换原生开机视频,另一个是添加定制视频,下面分别说明:
1.5.1. 更换原生视频
原生开机视频是 foundation/graphic/graphic_2d/frameworks/bootanimation/data
的 bootvideo.mp4
,可以替换这个 mp4 文件,确保开机视频的视频编码格式为 H.264,视频长宽比例与屏幕长宽比例一致。
1.5.2. 添加定制视频
vendor/spacemit
目录下,加入 bootanimation_custom_config.json
配置文件,里面配置定制视频的路径,如下:
{
"cust.bootanimation.pics": "/sys_prod/etc/bootanimation/cust_bootpic.zip",
"cust.bootanimation.sounds": "/sys_prod/etc/bootanimation/cust_bootsound.wav",
"cust.bootanimation.video": "/sys_prod/etc/bootanimation/cust_bootvideo.mp4"
}
并在上述文件对应的路径放入定制开机视频。
1.6. 开机视频切换为开机动画
目前系统中默认开启了开机视频,没有使用开机动画,如果想要切换为开机动画,需要关闭开机视频播放,进行修改:vendor/spacemit/xxx/config.json
的 "component": "graphic_2d"
中添加 graphic_2d_feature_player_framework_enable = false
,如下所示:
fuqiang@snode2:~/workspace/oh5_r_release/vendor/spacemit/musepaper2$ git diff
diff --git a/musepaper2/config.json b/musepaper2/config.json
index d70ad50..ef16ca6 100755
--- a/musepaper2/config.json
+++ b/musepaper2/config.json
@@ -21,7 +21,8 @@
"subsystem": "graphic",
"components": [
{
"component": "graphic_2d",
"features": [
"graphic_2d_feature_ace_enable_gpu = true",
"graphic_2d_feature_parallel_render_enable = true",
- "graphic_2d_feature_rs_enable_eglimage = true"
+ "graphic_2d_feature_rs_enable_eglimage = true",
+ "graphic_2d_feature_player_framework_enable = false"
]
},
{
2. 应用定制
2.1. 预置应用
2.1.1. 添加预置应用
- 将 hap 放置于
applications/standard/hap
- 修改
applications/standard/hap/BUILD.gn
配置,如下例(以浏览器 hap 为例):
diff --git a/BUILD.gn b/BUILD.gn
index c9ea451..87ed7aa 100755
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -407,6 +407,13 @@ ohos_prebuilt_etc("tetris_hap") {
subsystem_name = "applications"
}
+ohos_prebuilt_etc("broswer_hap") {
+ source = "Broswer.hap"
+ module_install_dir = "app/ohos.samples.browser"
+ part_name = "prebuilt_hap"
+ subsystem_name = "applications"
+}
+
group("hap") {
deps = [
":calendarData_hap",
@@ -464,6 +471,7 @@ group("hap") {
"//applications/standard/hap:wuziqi_hap",
"//applications/standard/hap:deviceinfo_hap",
"//applications/standard/hap:tetris_hap",
+ "//applications/standard/hap:broswer_hap",
]
if (defined(product_name) && product_name == "watchos") {
deps -= [
- 修改
vendor/spacemit/xxx/preinstall-config/install_list.json
配置进行安装,如下例:
diff --git a/musepaper/preinstall-config/install_list.json b/musepaper/preinstall-config/install_list.json
index dd859c2..0107e85 100755
--- a/musepaper/preinstall-config/install_list.json
+++ b/musepaper/preinstall-config/install_list.json
@@ -220,6 +220,10 @@
"app_dir": "/system/app/ohos.samples.game2048",
"removable": false
},
+ {
+ "app_dir": "/system/app/ohos.samples.label",
+ "removable": false
+ },
{
"app_dir": "/system/app/com.example.Digital_Huarong_Road",
"removable": false
2.1.2. 删除预置应用
删除应用是添加应用的逆操作,可以参考上面章节,将 vendor/spacemit/xxx/preinstall-config/install_list.json
中的对应 hap 的配置删除即可。
2.1.3. 预置应用可卸载
很多预置的系统应用是不可拆卸的,如果想将预置应用修改为可拆卸,修改如下:vendor/spacemit/xxx/preinstall-config/install_list.json
中将对应应用的 "removable"
设置为 true
,如下所示:
{
"app_dir" : "/system/app/com.ohos.note",
"removable" : true
},
2.2. 替换系统应用
通过 Ability 来区分的话,系统应用又会分为如下两类:
- UIAbility,如:Settings、Photos、Camera 等,这类系统应用能够展示在桌面。
- ExtensionAbility,如:Launcher、SystemUI、Settingsdata 等,这类系统应用有的创建了窗口从而能显示界面,而有的则属于无页面的常驻服务去提供对应的能力。
因此传统的 hdc install
命令以及 IDE 的自动安装都无法正常安装,这个时候,就需要用到系统应用的替换。
以 Launcher 为例,系统应用的替换步骤如下:
- 找到 Launcher 预置 hap 路径
/system/app/com.ohos.launcher
,可以看到该路径下有 2 个 hap:Launcher.hap
和Launcher_Settings.hap
- 执行以下指 令
hdc shell mount -o remount,rw /
hdc shell rm -rf /data/*
hdc file send Launcher.hap /system/app/com.ohos.launcher/Launcher.hap
hdc file send Launcher_Settings.hap /system/app/com.ohos.launcher/Launcher_Settings.hap
hdc shell reboot
- 即可正常替换安装自己构建的 Launcher