System customization
UI Customization
Change the boot logo
The Boot logo can be placed in 2 locations:
The boot logo shared by all schemes is placed at:
device/soc/spacemit/k1/kernel/boot/bootfs is as follows:
|-- boot_logo_spacemit_0.bmp
|-- boot_logo_spacemit_180.bmp
|-- boot_logo_spacemit_270.bmp
`-- boot_logo_spacemit_90.bmp
There are 4 images of the same boot logo, divided into 4 directions. Each plan selects a logo in different directions according to needs. Generally, a 0° logo image is selected.
The customized boot logo for a specific solution is placed at:
device/board/spacemit/xxx/kernel/boot/bootfs
as follows:
|-- boot_logo_ry_270.bmp
The image requirement for bootlogo is a 32-bit bmp image. Place the new boot logo in the above directory, then modify the build_kernel.sh file in device/board/spacemit/smt001/kernel and copy the boot logo to the packaging path.
cp ${OHOS_SOURCE_ROOT}/device/soc/${DEVICE_BOARD}/k1/kernel/boot/bootfs/boot_logo_spacemit_0.bmp ${OHOS_IMAGES_DIR}/bootfs/bianbu.bmp
Change kernel logo
The kernel logo is the logo displayed after the boot logo and between the boot animation. The purpose is to avoid a long black screen between the boot logo and the boot animation. Generally, the pattern of the kernel logo is consistent with the boot logo.
kernel_logo is placed in
device/board/spacemit/common/kernel_logo is as follows:
|-- 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
After adding the new kernel logo, modify the build_kernel.sh file in device/board/spacemit/smt001/kernel and copy the kernel logo to the kernel compilation path.
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 bmp to ppm Install the conversion tool sudo apt-get install netpbm Execute the script, and xxx.ppm will be generated in the current directory. ./bmp2ppm.sh xxx.bmp The script content is as follows:
#!/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
Change boot animation
There are two ways to change the boot animation. One is to change the native boot animation, and the other is to add a custom animation. The following are the two ways:
Replace native animation
The native boot animation is bootpic.zip in foundation/graphic/graphic_2d/frameworks/bootanimation/data, which can replace this zip package.
The boot animation zip package includes:
|-- 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
The content of config.json is:
{
"Remark": "FrameRate Support 30, 60 frame rate configuration",
"FrameRate": 30
}
To customize your own boot animation, you need to follow the above format and content.
Adding custom animations
In the vendor/spacemit/xxx directory, add the bootanimation_custom_config.json configuration file and configure the path of the custom animation as follows:
{
"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"
}
And put the customized boot animation in the path corresponding to the above file.
Change the startup music
There are two ways to change the startup music. One is to change the original startup music, and the other is to add custom music. The following are the two ways:
Replace original music
The native boot music is bootsound.wav in foundation/graphic/graphic_2d/frameworks/bootanimation/data. You can replace this wav file. The music does not need to be too long.
Add custom music
In the vendor/spacemit directory, add the bootanimation_custom_config.json configuration file and configure the path of the custom music as follows:
{
"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"
}
And put the customized startup music in the path corresponding to the above file.
Change boot video
There are two ways to change the boot video. One is to change the native boot video, and the other is to add a custom video. The following are the two ways:
Replace the original video
The native boot video is bootvideo.mp4 in foundation/graphic/graphic_2d/frameworks/bootanimation/data. You can replace this mp4 file and ensure that the video encoding format of the boot video is H.264 and the aspect ratio of the video is consistent with the aspect ratio of the screen.
Add a custom video
Under the vendor/spacemit directory, add a bootanimation_custom_config.json configuration file, which configures the path to the customized video as follows:
{
"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"
}
And put the customized startup video in the path corresponding to the above file.
Application customization
Pre-built applications
Place hap in applications/standard/hap
Modify the configuration of applications/standard/hap/BUILD.gn as follows (taking browser hap as an example):
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 -= [
Modify the vendor/spacemit/xxx/preinstall-config/install_list.json configuration for installation, as shown below:
diff --git a/smt001/preinstall-config/install_list.json b/smt001/preinstall-config/install_list.json
index dd859c2..0107e85 100755
--- a/smt001/preinstall-config/install_list.json
+++ b/smt001/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
Deleting Pre-installed Applications
Deleting an application is the reverse operation of adding an application. You can refer to the above section and delete the corresponding hap configuration in vendor/spacemit/xxx/preinstall-config/install_list.json.
Replace system apps
By Ability, system applications can be divided into the following two categories:
UIAbility, such as Settings, Photos, Camera, etc., these system applications can be displayed on the desktop. ExtensionAbility, such as Launcher, SystemUI, Settingsdata, etc., some of these system applications create windows to display the interface, while others are pageless resident services to provide corresponding capabilities. Therefore, the traditional hdc install command and IDE automatic installation cannot be installed normally. At this time, the replacement of system applications is needed.
Taking Launcher as an example, the steps to replace system applications are as follows:
Find the Launcher preset hap path /system/app/com.ohos.launcher, you can see there are 2 haps under this path: Launcher.hap and Launcher_Settings.hap. Execute the following command
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"
You can replace and install the Launcher you built normally
Photo Album
Push video
Prepare xxx.mp4 video
Push the video into the machine via hdc
D:\>hdc file send D:\xxx.mp4 /storage/media/100/local/files/Videos/
Triggering a media scan
D:\>hdc shell
Open the photo app and play the video. If there is no video, delete the photo app in the background and re-enter the push image to prepare xxx.jpg or xxx.png images. Push the images to the machine through hdc.
D:\>hdc file send D:\xxx.jpg /storage/media/100/local/files/Pictures/
Triggering a media scan
D:\>hdc shell
# scanner
#
Open the photo app and display the pictures. If there are no pictures, delete the photo app in the background and re-enter the app.
Launcher
Replace background image
The location of the background image is: applications/standard/launcher/product/phone/src/main/ets/common/pics/img_wallpaper_default.jpg
After replacing the image, recompile Launcher, put the newly generated Launcher.hap into the applications/standard/hap folder, and generate a new img.
Lock screen
Remove lock screen
Remove the lock screen application related code in the applications/standard/hap/BUILD.gn file as follows:
diff --git a/BUILD.gn b/BUILD.gn
index e213683..7382b97 100755
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -463,7 +463,6 @@ group("hap") {
"//applications/standard/hap:note_hap",
"//applications/standard/hap:notificationManagement_hap",
"//applications/standard/hap:photos_hap",
- "//applications/standard/hap:screenLock_hap",
"//applications/standard/hap:screen_shot_hap",
"//applications/standard/hap:settingsData_hap",
"//applications/standard/hap:settings_faceauth_hap",
@@ -518,7 +517,6 @@ group("hap") {
"//applications/standard/hap:navigationBar_hap",
"//applications/standard/hap:notificationManagement_hap",
"//applications/standard/hap:photos_hap",
- "//applications/standard/hap:screenLock_hap",
"//applications/standard/hap:screen_shot_hap",
"//applications/standard/hap:settingsData_hap",
"//applications/standard/hap:settings_faceauth_hap",
Remove the detection of the lock screen application status at boot time in the foundation/systemabilitymgr/safwk/etc/profile/foundation.cfg file as follows:
diff --git a/etc/profile/foundation.cfg b/etc/profile/foundation.cfg
index f2573fa..1a21510 100644
--- a/etc/profile/foundation.cfg
+++ b/etc/profile/foundation.cfg
@@ -25,7 +25,6 @@
"name" : "services:restartfoundation",
"cmds" : [
"unset_bootevent bootevent.appfwk.ready",
- "unset_bootevent bootevent.lockscreen.ready",
"unset_bootevent bootevent.launcher.ready",
"reset appspawn",
"reset accountmgr",
@@ -141,7 +140,6 @@
"bootevents": [
"bootevent.wms.fullscreen.ready",
"bootevent.appfwk.ready",
- "bootevent.lockscreen.ready",
"bootevent.launcher.ready",
"bootevent.wms.ready"
],
Remove the window controller's response to the lock screen signal; because here we only remove the lock screen application, but the mechanism for triggering the lock screen is still there, such as key triggering and remote control triggering, but there is no actual response. If it is not removed, when the mechanism for entering the lock screen is triggered again, the application interface may freeze. Modify the foundation/window/window_manager/wmserver/src/window_controller.cpp file as follows:
diff --git a/wmserver/src/window_controller.cpp b/wmserver/src/window_controller.cpp
index 32c6a60ec..98df12ffc 100644
--- a/wmserver/src/window_controller.cpp
+++ b/wmserver/src/window_controller.cpp
@@ -783,8 +783,8 @@ void WindowController::NotifyDisplayStateChange(DisplayId defaultDisplayId, sptr
WLOGFD("NotifyDisplayStateChange start: %{public}u", type);
switch (type) {
case DisplayStateChangeType::BEFORE_SUSPEND: {
- isScreenLocked_ = true;
- windowRoot_->ProcessWindowStateChange(WindowState::STATE_FROZEN, WindowStateChangeReason::KEYGUARD);
+ //isScreenLocked_ = true;
+ //windowRoot_->ProcessWindowStateChange(WindowState::STATE_FROZEN, WindowStateChangeReason::KEYGUARD);
break;
}
case DisplayStateChangeType::BEFORE_UNLOCK: {
Side Effect: No drop-down menu
System customization
Power management customization
Mainly modify vendor/spacemit/xxx/power_config/power_mode_config.xml as follows:
<!--
Power Mode Definitions:
MODE_NORMAL = 600,
MODE_POWER_SAVE = 601,
MODE_PERFORMANCE = 602,
MODE_EXTREME_POWER_SAVE = 603,
-->
<!--
Action Definitions:
DisplayOffTime = 101,
SystemAutoSleepTime = 102,
AutoAdjustBrightness = 103,
AutoWindowRotation = 107,
SystemBrightness = 115,
VibratorsState = 120,
-->
<switch_proxy version="1">
<proxy id="600">
<switch id="101" value="300000" recover_flag="0"/>
<switch id="102" value="0" recover_flag="0"/>
<switch id="103" value="-1" recover_flag="0"/>
<switch id="107" value="1" recover_flag="0"/>
<switch id="115" value="76" recover_flag="0"/>
<switch id="120" value="1" recover_flag="0"/>
</proxy>
<proxy id="601">
<switch id="101" value="10000" recover_flag="0"/>
<switch id="102" value="5000" recover_flag="0"/>
<switch id="103" value="-1" recover_flag="0"/>
<switch id="107" value="-1" recover_flag="0"/>
<switch id="115" value="50" recover_flag="0"/>
<switch id="120" value="-1" recover_flag="0"/>
</proxy>
<proxy id="602">
<switch id="101" value="-1" recover_flag="0"/>
<switch id="102" value="-1" recover_flag="0"/>
<switch id="103" value="-1" recover_flag="0"/>
<switch id="107" value="1" recover_flag="0"/>
<switch id="115" value="255" recover_flag="0"/>
<switch id="120" value="1" recover_flag="0"/>
</proxy>
<proxy id="603">
<switch id="101" value="5000" recover_flag="0"/>
<switch id="102" value="1000" recover_flag="0"/>
<switch id="103" value="-1" recover_flag="0"/>
<switch id="107" value="-1" recover_flag="0"/>
<switch id="115" value="25" recover_flag="0"/>
<switch id="120" value="-1" recover_flag="0"/>
</proxy>
</switch_proxy>
This file mainly defines several power management modes, including normal/power saving/performance/super power saving, etc., as well as the parameters of the corresponding management modes, including screen off time, standby time, etc.
The default system is in MODE_NORMAL mode, and you can switch to other modes through commands. For example, if you don't want the system to go into sleep mode, you can switch to performance mode as follows:
power-shell setmode 602
Window management customization
Mainly modify display_manager_config.xml and window_manager_config.xml in the vendor/spacemit/smt001/window_config path
display_manager_config.xml
<Configs>
<!--Window display dpi, valid range is 80~640, use 0 if no configuration is requeired-->
<dpi>240</dpi>
<!-- Indicate the deviation between the default device display direction and the direction -->
<!-- of the sensor. Use 0 in default, available values are {0, 90, 180, 270} -->
<defaultDeviceRotationOffset>0</defaultDeviceRotationOffset>
<!-- Svg path for cutout, use empty string if there is not cutout on the screen -->
<!-- format: string -->
<!-- default value: empty string -->
<!-- sample: M 100,100 m -75,0 a 75,75 0 1,0 150,0 a 75,75 0 1,0 -150,0 z -->
<defaultDisplayCutoutPath></defaultDisplayCutoutPath>
<!-- Indicates the boundary of the curved screen, each value corresponds to the px from each edge -->
<!-- format: number(left) number(top) number(right) number(bottom) -->
<!-- default value: 0 0 0 0 -->
<!-- sample: 150 150 0 0 -->
<curvedScreenBoundary>0 0 0 0</curvedScreenBoundary>
<!-- Indicates whether the built-in display is a waterfall display -->
<!-- format: boolean -->
<!-- default value: false -->
<!-- sample: false -->
<isWaterfallDisplay enable="false"></isWaterfallDisplay>
<!-- Indicate whether to enable display area compression for waterfall display when displayed in landscape -->
<!-- or landscape_inverted mode. -->
<!-- This configuration item takes effect only when isWaterfallDisplay above is true -->
<!-- format: boolean -->
<!-- default value: false -->
<isWaterfallAreaCompressionEnableWhenHorizontal enable="false"></isWaterfallAreaCompressionEnableWhenHorizontal>
<!-- Indicate the size of both sides of the waterfall display which to be compressed when displayed in landscape -->
<!-- or landscape_inverted mode. -->
<!-- This configuration item takes effect only when isWaterfallDisplay above is true -->
<!-- format: uint32_t, the unit is vp. -->
<!-- default value: 0 -->
<waterfallAreaCompressionSizeWhenHorzontal>0</waterfallAreaCompressionSizeWhenHorzontal>
<!-- Indicates orientation of the built-in screen -->
<!-- 0: Orientation::UNSPECIFIED -->
<!-- 1: Orientation::VERTICAL 2: Orientation::HORIZONTAL-->
<!-- 3: Orientation::REVERSE_VERTICAL 4: Orientation::REVERSE_HORIZONTAL -->
<buildInDefaultOrientation>0</buildInDefaultOrientation>
</Configs>
The main modified configurations are:
dpi: pixel density, the larger the dpi, the smaller the icon buildInDefaultOrientation: desktop rotation angle configuration window_manager_config.xml is mainly used to configure window animations, effects, etc., and there are not many modifications
Network management customization
Wi-Fi Customization
Driver debugging
The debugging function is mainly performed by iteration to ensure that the driver layer functions normally and can compile ko.
Copy ko (taking rtl8852bs as an example)
Copy it in build_kernel.sh of device/board/spacemit/xxx/kernel as follows:
function cp_ko(){
# cp ko to userspace
cp ${KERNEL_BUILD_ROOT}/drivers/usb/typec/typec.ko ${OHOS_SOURCE_ROOT}/device/board/${DEVICE_BOARD}/${DEVICE_NAME}/kernel/ko
cp ${KERNEL_BUILD_ROOT}/drivers/usb/typec/husb239.ko ${OHOS_SOURCE_ROOT}/device/board/${DEVICE_BOARD}/${DEVICE_NAME}/kernel/ko
cp ${KERNEL_BUILD_ROOT}/drivers/net/wireless/realtek/rtl8852be/8852be.ko ${OHOS_SOURCE_ROOT}/device/board/${DEVICE_BOARD}/${DEVICE_NAME}/kernel/ko
cp ${KERNEL_BUILD_ROOT}/drivers/net/wireless/realtek/rtl8852bs/8852bs.ko ${OHOS_SOURCE_ROOT}/device/board/${DEVICE_BOARD}/${DEVICE_NAME}/kernel/ko
}
After compiling the kernel, copy the ko files in the kernel compilation directory to the OpenHarmony system directory. When compiling OpenHarmony, these ko files will be copied to the vendor partition and packaged.
Load ko (take 8852bs as an example)
Load ko in init.xxx.cfg in device/board/spacemit/xxx/cfg as follows:
{
"name" : "fs",
"cmds" : [
"insmod /vendor/modules/8852bs.ko ifname=wlan0 if2name=p2p0",
"insmod /vendor/modules/typec.ko",
"insmod /vendor/modules/husb239.ko"
]
},
After booting, these ko files will be loaded in the init process. Use the lsmod command to check whether the loading is successful, as follows:
# lsmod
Module Size Used by
husb239 110592 0
typec 323584 1 husb239
8852bs 10031104 0
Multimedia system customization
Audio path customization
Add sound card information in vendor\spacemit\xxx\hals\audio\alsa_adapter.json.
{
"adapters": [
{
"name": "primary",
"cardId": 0,
"cardName": "sndes8326"
},
{
"name": "usb",
"cardId": 1,
"cardName": "C"
}
]
}
Configure the audio properties of different sound cards in vendor\spacemit\xxx\hals\audio\config\riscv64\audio_policy_config.xml, including the sampling rate, number of channels, buffer size, etc. for playback and recording.
<adapter name="primary" supportSelectScene="0">
<pipes>
<pipe name="primary_output" role="output">
<paProp lib="libmodule-hdi-sink.z.so" role="sink" fixed_latency="1" render_in_idle_state="1" moduleName="Speaker"/>
<streamProps>
<streamProp format="s16le" sampleRates="48000" channelLayout="CH_LAYOUT_STEREO" bufferSize="4096"/>
</streamProps>
<attributes>
<attribute name="preload" value="true"/>
</attributes>
</pipe>
<pipe name="primary_input" role="input">
<paProp lib="libmodule-hdi-source.z.so" role="source" moduleName="Built_in_mic"/>
<streamProps>
<streamProp format="s16le" sampleRates="48000" channelLayout="CH_LAYOUT_STEREO" bufferSize="4096"/>
</streamProps>
</pipe>
</pipes>
<devices>
<device name="Speaker_Out" type="DEVICE_TYPE_SPEAKER" pin="PIN_OUT_SPEAKER" role="output" supportPipes="primary_output"/>
<device name="Wired_Headset_Out" type="DEVICE_TYPE_WIRED_HEADSET" pin="PIN_OUT_HEADSET" role="output" supportPipes="primary_output"/>
<device name="Wired_Headphones_Out" type="DEVICE_TYPE_WIRED_HEADPHONES" pin="PIN_OUT_HEADPHONE" role="output" supportPipes="primary_output"/>
<device name="Builtin_Mic_In" type="DEVICE_TYPE_MIC" pin="PIN_IN_MIC" role="input" supportPipes="primary_input"/>
<device name="Wired_Headset_In" type="DEVICE_TYPE_WIRED_HEADSET" pin="PIN_IN_HS_MIC" role="input" supportPipes="primary_input"/>
</devices>
</adapter>
<adapter name="usb">
<pipes>
<pipe name="usb_output" role="output">
<paProp lib="libmodule-hdi-sink.z.so" role="sink" fixed_latency="1" render_in_idle_state="1" moduleName="Usb_arm_speaker"/>
<streamProps>
<streamProp format="s16le" sampleRates="48000" channelLayout="CH_LAYOUT_STEREO" bufferSize="4096"/>
</streamProps>
<attributes>
<attribute name="preload" value="true"/>
</attributes>
</pipe>
<pipe name="usb_input" role="input">
<paProp lib="libmodule-hdi-source.z.so" role="source" moduleName="Usb_arm_mic"/>
<streamProps>
<streamProp format="s16le" sampleRates="48000" channelLayout="CH_LAYOUT_STEREO" bufferSize="19200"/>
</streamProps>
</pipe>
</pipes>
<devices>
<device name="Usb_Headset_Out" type="DEVICE_TYPE_USB_HEADSET" pin="PIN_OUT_USB_HEADSET" role="output" supportPipes="usb_output"/>
<device name="Usb_Headset_In" type="DEVICE_TYPE_USB_HEADSET" pin="PIN_IN_USB_HEADSET" role="input" supportPipes="usb_input"/>
</devices>
</adapter>
Kernel customization
Modify kernel defconfig configuration
The kernel defconfig is located at:
kernel/linux/spacemit_kernel-6.6/arch/riscv/configs/k1_defconfig
After the modification, compile the kernel separately and then package it, as follows:
./build.sh --product-name xxx --ccache --prebuilt-sdk -T build_kernel
./build/gen_zip.sh xxx
Modify kernel dts configuration
The kernel's dts configuration is located at:
kernel/linux/spacemit_kernel-6.6/arch/riscv/boot/dts/spacemit
As shown below:
|-- k1-x-camera-reserved-mm.dtsi
|-- k1-x-camera-sdk.dtsi
|-- k1-x-camera-sensor.dtsi
|-- k1-x_deb1.dts
|-- k1-x_deb2.dts
|-- k1-x.dtsi
|-- k1-x-efuse.dtsi
|-- k1-x_evb.dts
|-- k1-x-hdmi.dtsi
|-- k1-x_hs450.dts
|-- k1-x_kx312.dts
|-- k1-x-lcd.dtsi
|-- k1-x_lpi3a.dts
|-- k1-x_milkv-jupiter.dts
|-- k1-x_mingo.dts
|-- k1-x_MINI-PC.dts
|-- k1-x_MUSE-Book.dts
|-- k1-x_MUSE-Card.dts
|-- k1-x_MUSE-N1.dts
|-- k1-x_MUSE-Paper2.dts
|-- k1-x_MUSE-Paper.dts
|-- k1-x_MUSE-Paper-mini-4g.dts
|-- k1-x_MUSE-Pi.dts
|-- k1-x_opp_table.dtsi
|-- k1-x_pinctrl.dtsi
|-- k1-x_SMT001.dts
|-- k1-x_thermal_cooling.dtsi
|-- k1-x_ZT001H.dts
|-- lcd
| |-- lcd_ft8201sinx101_mipi.dtsi
| |-- lcd_gc9503v_mipi.dtsi
| |-- lcd_gx09inx101_mipi.dtsi
| |-- lcd_icnl9911c_mipi.dtsi
| |-- lcd_icnl9951r_mipi.dtsi
| |-- lcd_jd9365dah3_mipi.dtsi
| |-- lcd_jd9365da_mipi_1280x800.dtsi
| |-- lcd_lt8911_edp_1920x1080.dtsi
| |-- lcd_lt8911_edp_1920x1200.dtsi
| |-- lcd_lt9711_dp_1920x1080.dtsi
| `-- lcd_orisetech_ota7290b_mipi.dtsi
|-- m1-x_milkv-jupiter.dts
`-- Makefile
After modifying the dts configuration of the corresponding solution, compile the kernel separately and then package it, as follows:
./build.sh --product-name xxx --ccache --prebuilt-sdk -T build_kernel
./build/gen_zip.sh xxx
Add the ko that needs to be loaded
If you need to load the ko file compiled by the kernel when the system starts, you need to modify the configuration of the upper layer of OpenHarmony, which is mainly divided into two steps:
Copy ko
Copy it in build_kernel.sh of device/board/spacemit/xxx/kernel as follows:
function cp_ko(){
# cp ko to userspace
cp ${KERNEL_BUILD_ROOT}/drivers/usb/typec/typec.ko ${OHOS_SOURCE_ROOT}/device/board/${DEVICE_BOARD}/${DEVICE_NAME}/kernel/ko
cp ${KERNEL_BUILD_ROOT}/drivers/usb/typec/husb239.ko ${OHOS_SOURCE_ROOT}/device/board/${DEVICE_BOARD}/${DEVICE_NAME}/kernel/ko
cp ${KERNEL_BUILD_ROOT}/drivers/net/wireless/realtek/rtl8852be/8852be.ko ${OHOS_SOURCE_ROOT}/device/board/${DEVICE_BOARD}/${DEVICE_NAME}/kernel/ko
cp ${KERNEL_BUILD_ROOT}/drivers/net/wireless/realtek/rtl8852bs/8852bs.ko ${OHOS_SOURCE_ROOT}/device/board/${DEVICE_BOARD}/${DEVICE_NAME}/kernel/ko
}
After compiling the kernel, copy the ko file in the kernel compilation directory to the OpenHarmony system directory.
Load ko
Load ko in init.xxx.cfg in device/board/spacemit/xxx/cfg as follows:
{
"name" : "fs",
"cmds" : [
"insmod /vendor/modules/8852bs.ko ifname=wlan0 if2name=p2p0",
"insmod /vendor/modules/typec.ko",
"insmod /vendor/modules/husb239.ko"
]
},
After booting, these ko will be loaded in the init process.
Patching the kernel
First generate the kernel modifications into a patch, and then place the generated patch in the OpenHarmony configuration directory.
For patches common to all platforms, place them in:
device/board/spacemit/kernel_patches/linux-6.6
For patches specific to a particular platform, place them in:
device/board/spacemit/xxx/kernel/kernel_patch
Inside the build_kernel.sh file located in the device/board/spacemit/xxx/kernel directory, apply the relevant patches as follows:
patch -p1 <${OHOS_SOURCE_ROOT}/device/board/spacemit/kernel_patches/linux-6.6/0001-bounds_checking_function-include.patch
patch -p1 <${OHOS_SOURCE_ROOT}/device/board/spacemit/kernel_patches/linux-6.6/0002-fix-hmdfs-permission.patch
patch -p1 <${OHOS_SOURCE_ROOT}/device/board/${DEVICE_BOARD}/${DEVICE_NAME}/kernel/kernel_patch/0001-kernel-audio.patch