初识 OpenHarmony Linux Kernel
先看技术架构:
既然 OH 是多内核设计,那必然会有个抽象层(KAL)统一接口供上层使用,还多了个 HDF 驱动框架,官方的引入考虑:
How to smoothly adapt device drivers to different kernels on the same hardware and minimize the workloads on driver code porting and maintenance is an important issue to address in the OpenHarmony driver subsystem.
就是同一份 driver code 可以多个系统跑,有点那个 BPF CO-RE (compile once-run everywhere) 的味道。
此外,针对 Linux,OH 还添加了一些增强内核特性,比如 ESwap (内存融合相关)、任务调度。
OpenHarmony provides the enhanced swap (ESwap), related thread group (RTG), and lightweight CPU isolation features for the Linux kernel
还有一些基本特性,比如 hilog, hievent。
Currently, the basic kernel-mode code of OpenHarmony is related to the log service. The lightweight kernel log service code includes the following:
还有的藏的比较深,比如 accesstokenid:
tj@ubuntu:~/ohos-3.2.2/kernel/linux/linux-5.10/drivers/accesstokenid$ ls |
干啥用的?Kconfig:
config ACCESS_TOKENID |
这描述。。。貌似和 APP 权限有关。
当前 OH Linux 内核版本只有 4.19 和 5.10:
OpenHarmony uses Linux LTS versions as its base kernel. Currently, it supports Linux-4.19 and Linux-5.10.
既然用 Linux LTS 版本,为啥不用 5.4?I think it might not be related to technology… rt?
3.2.2 里只有 linux-5.10:
tj@ubuntu:~/ohos-3.2.2/kernel/linux$ ls |
这种情况,如果 Vendor/SoC 不支持 5.10,那三方有的干了。
我们来看下内核提交日志,好家伙,下面这种 log 对我没有任何用处, I can’t learn anything from this, what about you?
commit b840cb60753e1118e9d0e1eb4d2bfd353ec0e032 (grafted, HEAD, tag: OpenHarmony-v3.2.2-Release, m/refs/tags/OpenHarmony-v3.2.2-Release) |
附带过下代码目录。
tj@ubuntu:~/ohos-3.2.2$ ls |
有个 base 和 foundation 不太明白,其他目录看 name 还好。
官方解释:
base | Basic software service subsystem set and hardware service subsystem set.|
foundation | Basic system capability subsystem set.|
啊,就是架构图画到的。
Basic software service subsystem set: Provides OpenHarmony with common universal software services, including common event and notification, telephony, multimedia, and Design For X (DFX).
tj@ubuntu:~/ohos-3.2.2$ ls base |
Basic system capability subsystem set: Implements distributed application running, scheduling, and migration across OpenHarmony devices. This subsystem set provides the following basic capabilities: Distributed Soft Bus (DSoftBus), distributed data management, Distributed Scheduler, Utils, multimodal input, graphics, security, and AI.
tj@ubuntu:~/ohos-3.2.2$ ls foundation/ |
都能对号入座,就这么多,done。
References
版权声明:本站所有文章均采用 CC BY-NC-SA 4.0 CN 许可协议。转载请注明原文链接!