433 Star 2.3K Fork 518

OpenHarmony / docs

鸿蒙架构设计探讨

任务
待办的
zhiquan 00310732  Opened this issue

技术探讨:

一位外国工程师朋友针对鸿蒙咨询了如下问题,麻烦社区帮忙看看。我这边看了下,反馈解耦不彻底(二进制引用源文件,编译出错不终端,编译选项设计不独立等,文件路径引用多种样式)。
还有vendor,driver文件摆放位置不规范等等。
能帮忙答复下这些问题么?

  1. .json files to configure HarmonyOS build
    .json files are required by python build scripts for system components configuration. What is the reason for that? Is there a way to generate those files from some human readable format? Why is this a preferred way of configuring the system's build?
    json文件配置鸿蒙的编译系统
    python构建脚本需要使用json文件,用于系统组件配置。为什么要这样处理?有没有方法从更易读的格式生成这些文件?为什么json文件配置系统构建的首选方法?

  2. Kernel configuration options
    Why do kernel configuration options exist if most of them cannot be turned off? For instance, one can't disable FS_VFS_, COMPAT_POSIX, COMPAT_BSD otherwise the kernel won't build due to strong dependencies. It seems that there are cross dependencies between separate modules inside of the kernel code. For example, low-level memory management uses file system code. There is no clear isolation between some kernel components which makes it nearly impossible to exclude them from the build. Is that a mistake in design and should be changed or options that disable components crucial for the kernel build should be statically enabled without possibility to change?
    内核选项
    为什么内核配置选项大部分都无法关闭?例如,不能禁用FS_VFS_、COMPAT_POSIX、COMPAT_BSD这些选项,否则内核将由于强依赖性而无法构建。似乎内核代码内部的独立模块之间存在交叉依赖。例如,内存管理使用文件系统代码。某些内核组件之间没有明确的隔离界限,因此几乎不可能将它们排除在构建之外。这是设计中的错误,应该更改。还是禁用对内核构建关键组件的选项应该静态使能,而不能做更改?

  3. Third party libraries
    Why third party libraries, such as musl or nuttx, are outside of the kernel directory if:
    a) They are not vanilla versions and are modified or include kernel headers directly.
    b) Paths to those directories are either hard coded in the liteos build ("../../") or are kept as symbolic links in the liteos tree (musl). Why multiple ways of including those libs into the kernel?
    为什么第三方库(例如musl或nuttx)位于内核目录之外,如果:
    a)不是普通版本,而是直接修改或包含内核头。
    b)这些目录的路径要么是硬编码在liteos构建(../../")中,要么是作为符号链接保存在liteos目录(musl)中。为什么有多种方法将这些库包含到内核中?

  4. Vendor directories
    Kernel build depends strongly on vendor directory, that resides outside of the kernel. In some cases, such as wifiiot target, kernel files are stored in vendor. Generic drivers such as ARM UART PL011 include chip specific files from vendor. Generic kernel code depends on platform specific, HiSilicon files and functions. What is the reason of keeping vendor directory outside of the kernel if it
    a) contains liteos kernel code
    b) is required for the kernel to build
    c) cannot be re-used due to dependency on liteos

  5. Behavior when build fails
    Why failed build continues until the end and when retrying build removes previously created files? Is there a way to not rebuild everything from scratch when the build fails and gets re-started after solving the problem in the source code?
    为什么编译失败了,编译还会一直持续到结束。并且重新编译会删除以前创建的编译中间文件?有没有办法在构建失败并解决问题后,再次编译不从头开始重建所有内容?

  6. What is the real meaning of liteos_a and liteos_m ?
    Is A for application processors and M for microcontrollers? If so, why there seems to be liteos_riscv as a parallel kernel type used interchangeably with liteos_m in the build system?

  7. Harmony liteos_m vs LiteOS
    We can see that Harmony liteos contains files, function names, etc. no longer present in gitee LiteOS. In the latter one, the change was applied in the following commit: https://gitee.com/LiteOS/LiteOS/commit/f74e444138a4d811c2a8d606a252070de176267a
    Is there a reason for Harmony liteos to keep the old code base?
    我们可以看到,Harmony lieos中包含的文件、函数名等,不再存在于gite LiteOS中。在后一种系统中,有如下提交https://gitee.com/LiteOS/LiteOS/commit/f74e444138a4d811c2a8d606a252070de176267a
    而鸿蒙保留旧代码库有什么理由吗?

  8. Drivers
    What is the goal of keeping drivers directory in the HarmonyOS root directory? Are those drivers supposed to be used in the kernel or it is an unfortunate name for the userspace components?
    将drivers目录保留在HarmonyOS根目录下的目的是什么?这些驱动程序是应该在内核中使用的? 放置在用户空间不恰当

  9. File attributes
    Many files in the HarmonyOS tree has "executable" attribute. Why?
    很多文件在鸿蒙系统中拥有可执行的属性,为什么?

  10. Libraries in binary form
    We forcefully link with libraries in binary form such as libhi35xx_bsp.a. Because of that there is no way to disable some drivers as their init functions are called from the library in the binary form which then fails to link due to lack of related symbols. Why do we link with libraries in binary form if we have a source code for them?
    我们必须强制链接到二进制形式的库,如libhi35xx_bsp.a。因为它们的init函数被二进制形式库调用,我们禁用某些驱动程序,会因为缺少相关符号而无法链接。如果我们有一个二进制形式的库,为什么我们链接到它们的源代码。

  11. What are platforms in platform/Kconfig
    The description refers to "Boards" but it the macro definition it looks more like SoC. Which one is it?

+1 1
Attachments
24256 gmg137 1578915532 112318 simenhi 1578918054 1032666 null 078 7444 1578938753 969128 artrener 1578937067 1568278 aiweline admin 1578954762 total 8 participants

Comments (11)

spider 2020-10-14 20:04

问题都很有建设性,为什么没有鸿蒙的人回复?

+1 1
24256 gmg137 1578915532
gmg137 2020-10-15 09:26

开源太晚了,应该像谷歌那样从第一行代码开始开源,这样可以利用群众的智慧及早发现问题。

112318 simenhi 1578918054
hbc 2020-10-15 09:43

开源太晚了,应该像谷歌那样从第一行代码开始开源,这样可以利用群众的智慧及早发现问题。

@gmg137 没有早晚这种判定吧,什么最有效率就按照什么来

24256 gmg137 1578915532
gmg137 2020-10-15 11:29

@hbc 架构设计一旦确定便不好更改,何况已经在一些硬件上应用了,积重难返。

+1 1
1032666 null 078 7444 1578938753
Dylan_fly 2020-10-21 15:22

开源太晚了,应该像谷歌那样从第一行代码开始开源,这样可以利用群众的智慧及早发现问题。

@gmg137 从第一行代码开源说的你就会有解决方案一样

ycllz 2020-10-21 21:28

最主要还是设计的人经验不足,国内35退休,刚好有经验的都被优化退休了,一群没经验的就怎么方便怎么来了

+1 6
ycllz 2020-10-21 21:30

鸿蒙的代码质量还有架构质量如何?看问题,架构一般般,代码质量还没看

969128 artrener 1578937067
Artrener 2020-10-22 09:04

鸿蒙的代码质量还有架构质量如何?看问题,架构一般般,代码质量还没看

@ycllz 666,架构一般般在何处,有啥建议不

+1 2
1568278 aiweline admin 1578954762
秋枫雁飞 2020-10-22 09:36

感觉有些堆代码赶工的嫌疑

1568278 aiweline admin 1578954762
秋枫雁飞 2020-10-22 09:36

后期绝对头疼

spider 2020-11-02 16:52

@ycllz 666,架构一般般在何处,有啥建议不

@Artrener 首先一个优秀的OS,一定不能和芯片平台绑定的那么紧密,这个鸿蒙OS看起来像是华为为海思开发的一个项目,并不像一个开源OS。
其次对于编译框架来说,如果Google看到鸿蒙这么用他的gn,我相信一定会气的吐xue,整个gn的框架还是比较乱的,一个编译系统用到了gn、cmake、Python,没有一个十八班武艺,是不能随意改动的。

Sign in to comment

Assignees
Labels
product-question
Projects
Milestones
Branches
Planed to start
Not set
Planed to end
Not set
Top level
Priority
1
https://git.oschina.net/openharmony/docs.git
git@git.oschina.net:openharmony/docs.git
openharmony
docs
docs

Search