QCOM FFBM 模式启动流程梳理

时间:2024-04-05 16:38:21

名词解释

FFBM: Fast Factory Boot Mode
提供了一种Linux系统最小UI交互界面的设计参考方式

Kernel FFBM 启动流程图

QCOM FFBM 模式启动流程梳理

Kernel FFBM 启动步骤解析

  1. boot mode参数解析

    通过process_kernel_cmdline,解析”/proc/cmdline”, 如果有”androidboot.” 关键字,则设置ro.bootmode

  2. 根据ro.bootmode,做event trigger

    std::string bootmode = property_get("ro.bootmode");
    if (bootmode == "charger") {
    am.QueueEventTrigger("charger");
    } else if (strncmp(bootmode.c_str(), "ffbm", 4) == 0) {
    NOTICE("Booting into ffbm mode\n");
    am.QueueEventTrigger("ffbm");
    } else {
    am.QueueEventTrigger("late-init");
    }

  3. 根据ro.bootmode,判断是否启动zygote

    static int queue_fs_event(int code) {
    int ret = code;
    std::string bootmode = property_get("ro.bootmode");
    if (strncmp(bootmode.c_str(), "ffbm", 4) == 0) {
    NOTICE("ffbm mode, not start class main\n");
    return 0;
    .......
    }

    zygote 通过class_start main启动, 通过阻止nonencrypted的trigger,达到不启动zygote的目的

  4. ffbm service

    做最小系统的启动
    on ffbm
    trigger early-fs
    trigger factory-fs
    trigger fs
    trigger post-fs
    trigger load_system_props_action
    trigger post-fs-data
    trigger load_persist_props_action
    trigger firmware_mounts_complete
    trigger early-boot
    trigger mmi