zoukankan      html  css  js  c++  java
  • 鸿蒙系统怎么快速编译

    1. hb build -f是全量编译,有近2k文件,编译速度非常慢
    2. 我使用的嵌入式板子是Hi3518EV300,编译过程中我发现了很多test也参与了编译,这些在对于非硬件驱动开发工程师来讲不需要。故 把此部分干掉会节省很多时间。修改如下文件/vendor/hisilicon/hispark_aries/config.json把子系统test删除,你会发现编译文件数量立即降到1k以内,我配置的config.json如下:
    {
        "product_name": "ipcamera_hispark_aries",
        "ohos_version": "OpenHarmony 1.0",
        "device_company": "hisilicon",
        "board": "hispark_aries",
        "kernel_type": "liteos_a",
        "kernel_version": "",
        "subsystems": [
          {
            "subsystem": "aafwk",
            "components": [
              { "component": "ability", "features":[ "enable_ohos_appexecfwk_feature_ability = false" ] }
            ]
          },
          {
            "subsystem": "applications",
            "components": [
              { "component": "test_app", "features":[] }
            ]
          },
          {
            "subsystem": "hiviewdfx",
            "components": [
              { "component": "hilog", "features":[] }
            ]
          },
          {
            "subsystem": "distributed_schedule",
            "components": [
              { "component": "system_ability_manager", "features":[] },
              { "component": "foundation", "features":[] },
              { "component": "distributed_schedule", "features":[] }
            ]
          },
          {
            "subsystem": "security",
            "components": [
              { "component": "hichainsdk", "features":[] },
              { "component": "permission", "features":[] },
              { "component": "app_verify", "features":[] }
            ]
          },
          {
            "subsystem": "graphic",
            "components": [
              { "component": "graphic_utils", "features":[] },
              { "component": "surface", "features":[] }
            ]
          },
          {
            "subsystem": "startup",
            "components": [
              { "component": "syspara", "features":[] },
              { "component": "bootstrap", "features":[] },
              { "component": "init", "features":[] },
              { "component": "appspawn", "features":[] }
            ]
          },
          {
            "subsystem": "kernel",
            "components": [
              { "component": "liteos_a", "features":[] }
            ]
          },
          {
            "subsystem": "communication",
            "components": [
              { "component": "ipc", "features":[] },
              { "component": "soft_bus", "features":[] },
              { "component": "wpa_supplicant", "features":[] }
            ]
          },
          {
            "subsystem": "drivers",
            "components": [
              { "component": "adapter_uhdf", "features":[] },
              { "component": "peripheral_display", "features":[] },
              { "component": "peripheral_input", "features":[] },
              { "component": "peripheral_wlan", "features":[] }
            ]
          },
          {
            "subsystem": "appexecfwk",
            "components": [
              { "component": "bundle_mgr", "features":[] }
            ]
          },
          {
            "subsystem": "utils",
            "components": [
              { "component": "kv_store", "features":[] },
              { "component": "os_dump", "features":[] }
            ]
          },
          {
            "subsystem": "vendor",
            "components": [
              { "component": "middleware", "features":[] },
              { "component": "hi3518ev300_init", "features":[] },
              { "component": "hardware", "features":[] }
            ]
          }
        ],
        "vendor_adapter_dir": "//device/hisilicon/hardware",
        "third_party_dir": "//third_party",
        "product_adapter_dir": "//vendor/hisilicon/hispark_aries/hals",
        "ohos_product_type":"",
        "ohos_manufacture":"",
        "ohos_brand":"",
        "ohos_market_name":"",
        "ohos_product_series":"",
        "ohos_product_model":"",
        "ohos_software_model":"",
        "ohos_hardware_model":"",
        "ohos_hardware_profile":"",
        "ohos_serial":"",
        "ohos_bootloader_version":"",
        "ohos_secure_patch_level":"",
        "ohos_abi_list":""
      }
    
    

    applications子系统是我自己写的测试demo,我把ai_server和media_server全部删除了,因为我这个dmeo不需要

    1. /vendor/hisilicon/hispark_aries/init_configs/init_liteos_a_3518ev300.cfg是系统启动后,init进程拉起的进程配置,配置如下:
    {
        "jobs" : [{
                "name" : "pre-init",
                "cmds" : [
                    "mkdir /storage/data/log",
                    "chmod 0755 /storage/data/log",
                    "chown 4 4 /storage/data/log",
                    "loadcfg /patch/fstab.cfg",
                    "mkdir /storage/data/softbus",
                    "chmod 0700 /storage/data/softbus",
                    "chown 7 7 /storage/data/softbus",
                    "mkdir /sdcard",
                    "chmod 0777 /sdcard",
                    "mount vfat /dev/mmcblk0 /sdcard rw,umask=000",
                    "mount vfat /dev/mmcblk1 /sdcard rw,umask=000"
                ]
            }, {
                "name" : "init",
                "cmds" : [
                    "start shell",
                    "start apphilogcat",
                    "start foundation",
                    "start bundle_daemon",
                    "start appspawn",
                    "start hiview"
                ]
            }, {
                "name" : "post-init",
                "cmds" : [
                    "chown 0 99 /dev/hdf/dev_mgr",
                    "chown 0 99 /dev/hdf/hdfwifi",
                    "chown 0 99 /dev/gpio",
                    "chown 0 99 /dev/i2c-0",
                    "chown 0 99 /dev/i2c-1",
                    "chown 0 99 /dev/i2c-2",
                    "chown 0 99 /dev/uartdev-0",
                    "chown 0 99 /dev/uartdev-1",
                    "chown 0 99 /dev/uartdev-2",
                    "chown 0 99 /dev/spidev0.0",
                    "chown 0 99 /dev/spidev1.0",
                    "chown 0 99 /dev/spidev1.1"
                ]
            }
        ],
        "services" : [{
                "name" : "foundation",
                "path" : ["/bin/foundation"],
                "uid" : 7,
                "gid" : 7,
                "once" : 0,
                "importance" : 1,
                "caps" : [10, 11, 12, 13]
            }, {
                "name" : "shell",
                "path" : ["/bin/shell"],
                "uid" : 2,
                "gid" : 2,
                "once" : 0,
                "importance" : 0,
                "caps" : [4294967295]
            }, {
                "name" : "appspawn",
                "path" : ["/bin/appspawn"],
                "uid" : 1,
                "gid" : 1,
                "once" : 0,
                "importance" : 0,
                "caps" : [2, 6, 7, 8, 11, 23]
            }, {
                "name" : "apphilogcat",
                "path" : ["/bin/apphilogcat"],
                "uid" : 4,
                "gid" : 4,
                "once" : 1,
                "importance" : 0,
                "caps" : []
            }, {
                "name" : "wms_server",
                "path" : ["/bin/wms_server"],
                "uid" : 6,
                "gid" : 6,
                "once" : 1,
                "importance" : 0,
                "caps" : []
            }, {
                "name" : "bundle_daemon",
                "path" : ["/bin/bundle_daemon"],
                "uid" : 8,
                "gid" : 8,
                "once" : 0,
                "importance" : 0,
                "caps" : [0, 1]
            }, {
                "name" : "hiview",
                "path" : ["/bin/hiview"],
                "uid" : 4,
                "gid" : 4,
                "once" : 1,
                "importance" : 0,
                "caps" : []
            }
        ]
    }
    
    
    1. 这个时候编译你会发现还是有单元测试的模块编译进来如ai service,找到对应的BUILD.gn你会发现原来当编译是debug系统时会编译单元测试模块
    import("//build/lite/config/component/lite_component.gni")
    
    # manage all components of aisystem
    
    lite_component("ai") {
      features = [
        "client:client",
        "server:server",
      ]
      if (ohos_build_type == "debug") {
        deps = [ "//foundation/ai/engine/test" ]
      }
    }
    

    而我们hb build编译时默认就是debug,如果编译release就不会有了,我们执行 hb build -f -b release,发现又少了100多个文件参与编译,我这边编译一次系统只有600多个文件了,速度比之前快了很多

    1. 另外鸿蒙支持模块编译,此模块对应的名称在/build/lite/components下面的json文件中,如我只想编译soft_bus模块,输入 hb build soft_bus即可,同时通过修改可以裁剪子系统下面的对应的模块
    作者:Bonker
    出处:http://www.cnblogs.com/Bonker
    QQ:519841366
           
    本页版权归作者和博客园所有,欢迎转载,但未经作者同意必须保留此段声明, 且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利
  • 相关阅读:
    【2019】微软Power BI 每月功能更新系列——Power BI 10月版本功能完整解读
    教你写一个含信息的汇编程序
    为安卓手机刷上手机kali系统Nethunter
    多年珍藏的55w御剑字典
    netsh命令获取wifi历史连接密码
    win7/10获取本地wifi密码明文
    Wordpress综合检测和爆破工具
    那些年我们一起追逐过的安全工具
    大部分政府网站U-mail存在直接拿shell漏洞
    无需密码攻击 Microsoft SQL Server
  • 原文地址:https://www.cnblogs.com/Bonker/p/14582265.html
Copyright © 2011-2022 走看看