高通Qualcomm平台lk(light kernel)启动流程2——aboot_init()

本文涉及的产品
云数据库 Redis 版,社区版 2GB
推荐场景:
搭建游戏排行榜
简介: 0lk 启动总体流程1lk启动流程代码lk app aboot abootc更多相关文章:《高通Qualcomm平台lk(light kernel)启动流程1——aboot_init()之前》: http://blog.

更多相关文章:

《高通Qualcomm平台lk(light kernel)启动流程1——aboot_init()之前》:
http://blog.csdn.net/u014134180/article/details/78133916
《高通Qualcomm平台lk(light kernel)启动流程2——aboot_init()》:
http://blog.csdn.net/u014134180/article/details/78132580
《高通Qualcomm平台lk(light kernel)启动流程3——到高通lcm屏点亮》:
http://blog.csdn.net/u014134180/article/details/78177040

《[lcm] Qualcomm Android Display Subsystem 架构》
http://blog.csdn.net/u014134180/article/details/78129502

《[lcm] Qualcomm平台的显示屏lcd驱动移植步骤》:
http://blog.csdn.net/u014134180/article/details/78129499
《[lcm] Qualcomm平台兼容多显示屏lcd的方法&并从lk传输到kernel过程》:
http://blog.csdn.net/u014134180/article/details/78166978
《[lcm] Qualcomm平台显示屏lcd添加I2C读取功能》:
http://blog.csdn.net/u014134180/article/details/78176160

0、lk 启动总体流程

这里写图片描述

1、lk启动流程代码

lk/ app/ aboot/ aboot.c

下面是aboot.c的部分代码,核心代码在的aboot_init()函数开始:void aboot_init(const struct app_descriptor *app)

/*
 * Copyright (c) 2009, Google Inc.
 * All rights reserved.
 *
 * Copyright (c) 2009-2016, The Linux Foundation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of The Linux Foundation nor
 *       the names of its contributors may be used to endorse or promote
 *       products derived from this software without specific prior written
 *       permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

#include <app.h>
#include <debug.h>
#include <arch/arm.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <kernel/thread.h>
#include <arch/ops.h>

#include <dev/flash.h>
#include <dev/flash-ubi.h>
#include <lib/ptable.h>
#include <dev/keys.h>
#include <dev/fbcon.h>
#include <baseband.h>
#include <target.h>
#include <mmc.h>
#include <partition_parser.h>
#include <platform.h>
#include <crypto_hash.h>
#include <malloc.h>
#include <boot_stats.h>
#include <sha.h>
#include <platform/iomap.h>
#include <boot_device.h>
#include <boot_verifier.h>
#include <image_verify.h>
#include <decompress.h>
#include <platform/timer.h>
#include <sys/types.h>
#if USE_RPMB_FOR_DEVINFO
#include <rpmb.h>
#endif

#if ENABLE_WBC
#include <pm_app_smbchg.h>
#endif

#if DEVICE_TREE
#include <libfdt.h>
#include <dev_tree.h>
#endif

#if WDOG_SUPPORT
#include <wdog.h>
#endif

#include <reboot.h>
#include "image_verify.h"
#include "recovery.h"
#include "bootimg.h"
#include "fastboot.h"
#include "sparse_format.h"
#include "meta_format.h"
#include "mmc.h"
#include "devinfo.h"
#include "board.h"
#include "scm.h"
#include "mdtp.h"
#include "secapp_loader.h"
#include <menu_keys_detect.h>
#include <display_menu.h>
#include "fastboot_test.h"
#ifdef CONFIG_LK_CUSTOM_P3588
#include <smb1360.h>
#endif
#include <lct/lct_config.h>

extern  bool target_use_signed_kernel(void);
extern void platform_uninit(void);
extern void target_uninit(void);
extern int get_target_boot_params(const char *cmdline, const char *part,
                  char **buf);

void *info_buf;
void write_device_info_mmc(device_info *dev);
void write_device_info_flash(device_info *dev);
static int aboot_save_boot_hash_mmc(uint32_t image_addr, uint32_t image_size);
static int aboot_frp_unlock(char *pname, void *data, unsigned sz);

/* fastboot command function pointer */
typedef void (*fastboot_cmd_fn) (const char *, void *, unsigned);

struct fastboot_cmd_desc {
    char * name;
    fastboot_cmd_fn cb;
};

#define EXPAND(NAME) #NAME
#define TARGET(NAME) EXPAND(NAME)

#define DISPLAY_PANEL_HDMI "hdmi"

#ifdef MEMBASE
#define EMMC_BOOT_IMG_HEADER_ADDR (0xFF000+(MEMBASE))
#else
#define EMMC_BOOT_IMG_HEADER_ADDR 0xFF000
#endif

#ifndef MEMSIZE
#define MEMSIZE 1024*1024
#endif

#define MAX_TAGS_SIZE   1024

/* make 4096 as default size to ensure EFS,EXT4's erasing */
#define DEFAULT_ERASE_SIZE  4096
#define MAX_PANEL_BUF_SIZE 196
#define FOOTER_SIZE 16384

#define DISPLAY_DEFAULT_PREFIX "mdss_mdp"
#define BOOT_DEV_MAX_LEN  64

#define IS_ARM64(ptr) (ptr->magic_64 == KERNEL64_HDR_MAGIC) ? true : false

#define ADD_OF(a, b) (UINT_MAX - b > a) ? (a + b) : UINT_MAX

//Size of the header that is used in case the boot image has
//a uncompressed kernel + appended dtb
#define PATCHED_KERNEL_HEADER_SIZE 20

//String used to determine if the boot image has
//a uncompressed kernel + appended dtb
#define PATCHED_KERNEL_MAGIC "UNCOMPRESSED_IMG"

#if USE_BOOTDEV_CMDLINE
static const char *emmc_cmdline = " androidboot.bootdevice=";
#else
static const char *emmc_cmdline = " androidboot.emmc=true";
#endif
static const char *usb_sn_cmdline = " androidboot.serialno=";
#ifdef CONFIG_LCT_CUSTOM_LX_COMMON
static const char *lenovo_sn2_cmdline = " androidboot.lenovosn2=";
#endif
static const char *androidboot_mode = " androidboot.mode=";
static const char *alarmboot_cmdline = " androidboot.alarmboot=true";
static const char *loglevel         = " quiet";
static const char *battchg_pause = " androidboot.mode=charger";
static const char *androidboot = " androidboot.";
//static const char *country_code = "countrycode=";
static const char *auth_kernel = " androidboot.authorized_kernel=true";
static const char *secondary_gpt_enable = " gpt";
static const char *mdtp_activated_flag = " mdtp";

static const char *baseband_apq     = " androidboot.baseband=apq";
static const char *baseband_msm     = " androidboot.baseband=msm";
static const char *baseband_csfb    = " androidboot.baseband=csfb";
static const char *baseband_svlte2a = " androidboot.baseband=svlte2a";
static const char *baseband_mdm     = " androidboot.baseband=mdm";
static const char *baseband_mdm2    = " androidboot.baseband=mdm2";
static const char *baseband_sglte   = " androidboot.baseband=sglte";
static const char *baseband_dsda    = " androidboot.baseband=dsda";
static const char *baseband_dsda2   = " androidboot.baseband=dsda2";
static const char *baseband_sglte2  = " androidboot.baseband=sglte2";
static const char *warmboot_cmdline = " qpnp-power-on.warm_boot=1";
static const char *baseband_apq_nowgr   = " androidboot.baseband=baseband_apq_nowgr";

#if VERIFIED_BOOT
#if !VBOOT_MOTA
static const char *verity_mode = " androidboot.veritymode=";
static const char *verified_state= " androidboot.verifiedbootstate=";
static const char *keymaster_v1= " androidboot.keymaster=1";
//indexed based on enum values, green is 0 by default

struct verified_boot_verity_mode vbvm[] =
{
#if ENABLE_VB_ATTEST
    {false, "eio"},
#else
    {false, "logging"},
#endif
    {true, "enforcing"},
};
struct verified_boot_state_name vbsn[] =
{
    {GREEN, "green"},
    {ORANGE, "orange"},
    {YELLOW,"yellow"},
    {RED,"red" },
};
#endif
#endif
/*As per spec delay wait time before shutdown in Red state*/
#define DELAY_WAIT 30000
static unsigned page_size = 0;
static unsigned page_mask = 0;
static unsigned mmc_blocksize = 0;
static unsigned mmc_blocksize_mask = 0;
static char ffbm_mode_string[FFBM_MODE_BUF_SIZE];
static char area_code_string[AREA_CODE_BUF_SIZE];
static bool boot_into_ffbm;
static bool get_area_code;
static char *target_boot_params = NULL;
static bool boot_reason_alarm;
static bool devinfo_present = true;
bool boot_into_fastboot = false;
static uint32_t dt_size = 0;

/* Assuming unauthorized kernel image by default */
static int auth_kernel_img = 0;
#if VBOOT_MOTA
static device_info device = {DEVICE_MAGIC, 0, 0, 0, 0, {0}, {0},{0}};
#else
static device_info device = {DEVICE_MAGIC, 0, 0, 0, 0, {0}, {0},{0}, 1};
#endif
static bool is_allow_unlock = 0;

static char frp_ptns[2][8] = {"config","frp"};

static const char *critical_flash_allowed_ptn[] = {
    "aboot",
    "rpm",
    "tz",
    "sbl",
    "sdi",
    "sbl1",
    "xbl",
    "hyp",
    "pmic",
    "bootloader",
    "devinfo",
    "partition"};

struct atag_ptbl_entry
{
    char name[16];
    unsigned offset;
    unsigned size;
    unsigned flags;
};

/*
 * Partition info, required to be published
 * for fastboot
 */
struct getvar_partition_info {
    const char part_name[MAX_GPT_NAME_SIZE]; /* Partition name */
    char getvar_size[MAX_GET_VAR_NAME_SIZE]; /* fastboot get var name for size */
    char getvar_type[MAX_GET_VAR_NAME_SIZE]; /* fastboot get var name for type */
    char size_response[MAX_RSP_SIZE];        /* fastboot response for size */
    char type_response[MAX_RSP_SIZE];        /* fastboot response for type */
};

/*
 * Right now, we are publishing the info for only
 * three partitions
 */
struct getvar_partition_info part_info[] =
{
    { "system"  , "partition-size:", "partition-type:", "", "ext4" },
    { "userdata", "partition-size:", "partition-type:", "", "ext4" },
    { "cache"   , "partition-size:", "partition-type:", "", "ext4" },
};

char max_download_size[MAX_RSP_SIZE];
char charger_screen_enabled[MAX_RSP_SIZE];
char sn_buf[13];
char lenovo_sn2_buf[32];
char display_panel_buf[MAX_PANEL_BUF_SIZE];
char panel_display_mode[MAX_RSP_SIZE];

#if CHECK_BAT_VOLTAGE
char battery_voltage[MAX_RSP_SIZE];
char battery_soc_ok [MAX_RSP_SIZE];
#endif

char get_variant[MAX_RSP_SIZE];

extern int emmc_recovery_init(void);

#if NO_KEYPAD_DRIVER
extern int fastboot_trigger(void);
#endif




。。。 。。。





void aboot_init(const struct app_descriptor *app)
{   dprintf(INFO, "** [wuchengbing] %s %d %s **.\n", __FILE__, __LINE__, __func__);

    unsigned reboot_mode = 0;
    dprintf(INFO, "** [wuchengbing] %d: reboot_mode:%#x **\n", __LINE__, reboot_mode);          ///reboot_mode
    dprintf(INFO, "** [wuchengbing] %d: boot_into_fastboot:%#x **\n", __LINE__, boot_into_fastboot);            ///reboot_mode

    /* Initialise wdog to catch early lk crashes */
#if WDOG_SUPPORT
    msm_wdog_init();
#endif


    /* Setup page size information for nv storage */
    if (target_is_emmc_boot())
    {   dprintf(INFO, "** [wuchengbing] %d: if(target_is_emmc_boot()): %d**.\n", __LINE__, target_is_emmc_boot());

        page_size = mmc_page_size();
        page_mask = page_size - 1;
        mmc_blocksize = mmc_get_device_blocksize();
        mmc_blocksize_mask = mmc_blocksize - 1;
    }
    else
    {   dprintf(INFO, "** [wuchengbing] %d: else:%d**.\n", __LINE__, target_is_emmc_boot());

        page_size = flash_page_size();
        page_mask = page_size - 1;
    }
    ASSERT((MEMBASE + MEMSIZE) > MEMBASE);
    dprintf(INFO, "** [wuchengbing] %d: reboot_mode:%#x **\n", __LINE__, reboot_mode);          ///reboot_mode
    dprintf(INFO, "** [wuchengbing] %d: boot_into_fastboot:%#x **\n", __LINE__, boot_into_fastboot);            ///boot_into_fastboot

#ifdef CONFIG_LK_CUSTOM_P3588
    smb1360_init();
#endif

    read_device_info(&device);
    read_allow_oem_unlock(&device);

    dprintf(INFO, "** [wuchengbing] %d: reboot_mode:%#x **\n", __LINE__, reboot_mode);          ///reboot_mode
    dprintf(INFO, "** [wuchengbing] %d: boot_into_fastboot:%#x **\n", __LINE__, boot_into_fastboot);            ///boot_into_fastboot

    target_serialno((unsigned char *) sn_buf);
    get_sn(sn_buf);
    dprintf(SPEW,"serial number: %s\n",sn_buf);

#ifdef CONFIG_LCT_CUSTOM_LX_COMMON
    get_lenovo_sn2();
    dprintf(INFO,"lenovo serial number: %s\n",lenovo_sn2_buf);
#endif

    memset(display_panel_buf, '\0', MAX_PANEL_BUF_SIZE);

    /*
     * Check power off reason if user force reset,
     * if yes phone will do normal boot.
     */
    if (is_user_force_reset())
    {   dprintf(INFO, "** [wuchengbing] is_user_force_reset():%d**.\n", is_user_force_reset());

        dprintf(INFO, "** [wuchengbing] %d: reboot_mode:%#x **\n", __LINE__, reboot_mode);          ///reboot_mode
        dprintf(INFO, "** [wuchengbing] %d: boot_into_fastboot:%#x **\n", __LINE__, boot_into_fastboot);///boot_into_fastboot

        goto normal_boot;
    }

    /* Check if we should do something other than booting up */
    dprintf(INFO, "** [wuchengbing] %d: (KEY_VOLUMEUP):%d , (KEY_VOLUMEDOWN):%d **.\n", __LINE__, (KEY_VOLUMEUP), (KEY_VOLUMEDOWN));
    dprintf(INFO, "** [wuchengbing] %d: keys_get_state(KEY_VOLUMEUP):%d && keys_get_state(KEY_VOLUMEDOWN):%d **.\n", __LINE__, keys_get_state(KEY_VOLUMEUP), keys_get_state(KEY_VOLUMEDOWN));
    if (keys_get_state(KEY_VOLUMEUP) && keys_get_state(KEY_VOLUMEDOWN))                             ///boot_into_ffbm = true;
    {
#if 0
        dprintf(ALWAYS,"dload mode key sequence detected\n");
        reboot_device(EMERGENCY_DLOAD);
        dprintf(CRITICAL,"Failed to reboot into dload mode\n");

        dprintf(INFO, "** [wuchengbing] boot_into_fastboot ;** if.\n");
        boot_into_fastboot = true;
#else
        dprintf(INFO, "** [wuchengbing] boot_into_ffbm = true;** if.\n");
        boot_into_ffbm = true;              ///boot_into_ffbm = true;
        strcpy(ffbm_mode_string, "ffbm-00");
#endif
        dprintf(INFO, "** [wuchengbing] %d: reboot_mode:%#x **\n", __LINE__, reboot_mode);              ///reboot_mode
        dprintf(INFO, "** [wuchengbing] %d: boot_into_fastboot:%#x **\n", __LINE__, boot_into_fastboot);///boot_into_fastboot
    }
    else{
        dprintf(INFO, "**[wuchengbing] %d: boot_into_ffbm = false;** else.\n", __LINE__);
        boot_into_ffbm = false;
    //  strcpy(ffbm_mode_string, "nomal");
    }

    dprintf(INFO, "** [wuchengbing] %d: (boot_into_fastboot):%d && (boot_into_ffbm):%d **.\n", __LINE__, (boot_into_fastboot), (boot_into_ffbm));
    dprintf(INFO, "** [wuchengbing] %d: (!boot_into_fastboot):%d && (!boot_into_ffbm):%d **.\n", __LINE__, (!boot_into_fastboot), (!boot_into_ffbm));
    if (!boot_into_fastboot&&!boot_into_ffbm )
    {
        dprintf(INFO, "** [wuchengbing] %d: (KEY_HOME):%d , (KEY_VOLUMEUP):%d **.\n", __LINE__, (KEY_HOME), (KEY_VOLUMEUP));
        dprintf(INFO, "** [wuchengbing] %d: keys_get_state(KEY_HOME):%d || keys_get_state(KEY_VOLUMEUP):%d **.\n", __LINE__, keys_get_state(KEY_HOME), keys_get_state(KEY_VOLUMEUP));
        if (keys_get_state(KEY_HOME) || keys_get_state(KEY_VOLUMEUP))                               ///boot_into_recovery = 1;
        {
            dprintf(INFO, "** [wuchengbing] if(usb_exist):%d **.\n", (usb_exist));
            if(usb_exist) ///lc mike_zhu 2016121f13             ///boot_into_recovery = 1;
            {
                dprintf(INFO, "** [wuchengbing] (EMERGENCY_DLOAD):%d **.if\n", (EMERGENCY_DLOAD));
                reboot_device(EMERGENCY_DLOAD);
            }
            else
            {   dprintf(INFO, "** [wuchengbing] boot_into_recovery = 1;  **.else\n");

                boot_into_recovery = 1;
            }
        }

        dprintf(INFO, "** [wuchengbing] %d: boot_into_recovery:%d , (KEY_BACK):%d , (KEY_VOLUMEDOWN):%d **.\n", __LINE__, boot_into_recovery, (KEY_HOME), (KEY_VOLUMEDOWN));
        dprintf(INFO, "** [wuchengbing] %d: if( !boot_into_recovery==%d || ( keys_get_state(KEY_BACK)==%d || keys_get_state(KEY_VOLUMEDOWN)==%d) ) **.\n", __LINE__, !boot_into_recovery, keys_get_state(KEY_BACK), keys_get_state(KEY_VOLUMEDOWN));
        if (!boot_into_recovery &&  (keys_get_state(KEY_BACK) || keys_get_state(KEY_VOLUMEDOWNlp)))///boot_into_fastboot = true;
        {
            dprintf(INFO, "** [wuchengbing] boot_into_fastboot = true;  **.if\n");
            boot_into_fastboot = true;
        }
    }
    #if NO_KEYPAD_DRIVER
    dprintf(INFO, "** [wuchengbing] fastboot_trigger():%d **\n", fastboot_trigger());
    if (fastboot_trigger())                                 
    {   dprintf(INFO, "** [wuchengbing] boot_into_fastboot = true;  **.if\n");                      ///boot_into_fastboot = true;

        boot_into_fastboot = true;
    }
    #endif

    //dprintf(INFO, "** [wuchengbing] USE_PON_REBOOT_REG:%d **\n", USE_PON_REBOOT_REG);
#if USE_PON_REBOOT_REG
    reboot_mode = check_hard_reboot_mode();
#else
    reboot_mode = check_reboot_mode();
    dprintf(INFO, "** [wuchengbing] %d:check_reboot_mode() reboot_mode:%#x **       \n", __LINE__, reboot_mode);            ///reboot_mode
    dprintf(INFO, "** [wuchengbing] %d:check_reboot_mode() boot_into_fastboot:%#x **\n", __LINE__, boot_into_fastboot);     ///boot_into_fastboot
#endif

    dprintf(INFO, "** [wuchengbing] %d: reboot_mode:%#x **\n", __LINE__, reboot_mode);          ///reboot_mode
    dprintf(INFO, "** [wuchengbing] RECOVERY_MODE:%#x **\n", RECOVERY_MODE);
    dprintf(INFO, "** [wuchengbing] FASTBOOT_MODE:%#x **\n", FASTBOOT_MODE);                    ///FASTBOOT_MODE
    dprintf(INFO, "** [wuchengbing] ALARM_BOOT:%#x **\n", ALARM_BOOT);
    dprintf(INFO, "** [wuchengbing] DM_VERITY_ENFORCING:%#x **\n", DM_VERITY_ENFORCING);
    dprintf(INFO, "** [wuchengbing] DM_VERITY_EIO:%#x **\n", DM_VERITY_EIO);
    dprintf(INFO, "** [wuchengbing] ALARM_BOOT:%#x **\n", ALARM_BOOT);
    //dprintf(INFO, "** [wuchengbing] DM_VERITY_LOGGING:%#x **\n", DM_VERITY_LOGGING);
    dprintf(INFO, "** [wuchengbing] DM_VERITY_KEYSCLEAR:%#x **\n\n", DM_VERITY_KEYSCLEAR);
    dprintf(INFO, "** [wuchengbing] VERIFIED_BOOT:%d ...**\n\n", VERIFIED_BOOT);
    if (reboot_mode == RECOVERY_MODE)
    {   dprintf(INFO, "** [wuchengbing] RECOVERY_MODE:%d **\n", RECOVERY_MODE);

        boot_into_recovery = 1;
    }
    else if(reboot_mode == FASTBOOT_MODE)
    {   dprintf(INFO, "** [wuchengbing] FASTBOOT_MODE:%d **\n", FASTBOOT_MODE);

        boot_into_fastboot = true;
    }
    else if(reboot_mode == ALARM_BOOT)
    {   dprintf(INFO, "** [wuchengbing] ALARM_BOOT:%d **\n", ALARM_BOOT);

        boot_reason_alarm = true;
    }


#if VERIFIED_BOOT //1
    //dprintf(INFO, "** [wuchengbing] !VBOOT_MOTA:%d **\n", !VBOOT_MOTA);
#if !VBOOT_MOTA
    else if (reboot_mode == DM_VERITY_ENFORCING)
    {   dprintf(INFO, "** [wuchengbing] DM_VERITY_ENFORCING:%d **\n", DM_VERITY_ENFORCING);

        device.verity_mode = 1;
        write_device_info(&device);
    }

    //dprintf(INFO, "** [wuchengbing] ENABLE_VB_ATTEST:%d **\n", ENABLE_VB_ATTEST);
#if ENABLE_VB_ATTEST
    else if (reboot_mode == DM_VERITY_EIO)
#else
    else if (reboot_mode == DM_VERITY_LOGGING)
#endif
    {   dprintf(INFO, "** [wuchengbing] DM_VERITY_EIO:%d **\n", DM_VERITY_EIO);
        //dprintf(INFO, "** [wuchengbing] DM_VERITY_LOGGING:%d **\n", DM_VERITY_LOGGING);

        device.verity_mode = 0;
        write_device_info(&device);
    }
    else if (reboot_mode == DM_VERITY_KEYSCLEAR)
    {   dprintf(INFO, "** [wuchengbing] DM_VERITY_KEYSCLEAR:%d **\n", DM_VERITY_KEYSCLEAR);

        if(send_delete_keys_to_tz())
            ASSERT(0);
    }
#endif
#endif









    dprintf(INFO, "** [wuchengbing] %d: normal_boot:** before\n", __LINE__);
normal_boot:
    dprintf(INFO, "** [wuchengbing] %d: normal_boot:** after.\n", __LINE__);


    /* Display splash screen if enabled */
    dprintf(INFO, "** [wuchengbing] DISPLAY_SPLASH_SCREEN:%d **\n", DISPLAY_SPLASH_SCREEN);
#if DISPLAY_SPLASH_SCREEN //

    //dprintf(INFO, "** [wuchengbing] NO_ALARM_DISPLAY:%d **\n", NO_ALARM_DISPLAY);
#if NO_ALARM_DISPLAY ///NO_ALARM_DISPLAY
    if (!check_alarm_boot()) {
#endif
        dprintf(INFO, "Display Init: Start\n");

    //dprintf(INFO, "** [wuchengbing] DISPLAY_HDMI_PRIMARY:%d **\n", DISPLAY_HDMI_PRIMARY);
#if DISPLAY_HDMI_PRIMARY
    if (!strlen(device.display_panel))
        strlcpy(device.display_panel, DISPLAY_PANEL_HDMI,
            sizeof(device.display_panel));
#endif

    //dprintf(INFO, "** [wuchengbing] ENABLE_WBC:%d **\n", ENABLE_WBC);
#if ENABLE_WBC
        /* Wait if the display shutdown is in progress */
        while(pm_app_display_shutdown_in_prgs());
        if (!pm_appsbl_display_init_done())
            target_display_init(device.display_panel);
        else
            display_image_on_screen();
#else
        target_display_init(device.display_panel);
#endif
        dprintf(INFO, "Display Init: Done\n");

    //dprintf(INFO, "** [wuchengbing] NO_ALARM_DISPLAY:%d **\n", NO_ALARM_DISPLAY);
#if NO_ALARM_DISPLAY ///NO_ALARM_DISPLAY
    }
#endif
#endif //DISPLAY_SPLASH_SCREEN

    dprintf(INFO, "** [wuchengbing] if(!boot_into_fastboot == %d)**\n", !boot_into_fastboot);
    if (!boot_into_fastboot)
    {
        dprintf(INFO, "** [wuchengbing] if(target_is_emmc_boot = %d)**\n", target_is_emmc_boot());
        if (target_is_emmc_boot())
        {   dprintf(INFO, "** [wuchengbing] %d: if(target_is_emmc_boot == %d)** if \n", __LINE__, target_is_emmc_boot());

            dprintf(INFO, "** [wuchengbing] if(emmc_recovery_init == %d)**\n", emmc_recovery_init());
            if(emmc_recovery_init())
            {
                dprintf(ALWAYS,"error in emmc_recovery_init\n");
            }
            dprintf(INFO, "** [wuchengbing] if(target_use_signed_kernel == %d)**\n", target_use_signed_kernel());
            if(target_use_signed_kernel())
            {
                dprintf(INFO, "** [wuchengbing] if((device.is_unlocked == %d) || (device.is_tampered == %d))**\n", (device.is_unlocked) , (device.is_tampered));
                if((device.is_unlocked) || (device.is_tampered))
                {
                //dprintf(INFO, "** [wuchengbing] TZ_TAMPER_FUSE:%d **\n", TZ_TAMPER_FUSE);     
                #ifdef TZ_TAMPER_FUSE
                    set_tamper_fuse_cmd();
                #endif

                //dprintf(INFO, "** [wuchengbing] USE_PCOM_SECBOOT:%d **\n", USE_PCOM_SECBOOT);
                #if USE_PCOM_SECBOOT
                    set_tamper_flag(device.is_tampered);
                #endif
                }
            }

            boot_linux_from_mmc();//
        }
        else
        {   dprintf(INFO, "** [wuchengbing] %d: if(target_is_emmc_boot == %d)** else \n", __LINE__, target_is_emmc_boot());

            recovery_init();

            //dprintf(INFO, "** [wuchengbing] USE_PCOM_SECBOOT:%d **\n", USE_PCOM_SECBOOT);     
            #if USE_PCOM_SECBOOT
                dprintf(INFO, "** [wuchengbing] if((device.is_unlocked = %d) || (device.is_tampered = %d))**\n", (device.is_unlocked) , (device.is_tampered));
                if((device.is_unlocked) || (device.is_tampered))
                {
                    set_tamper_flag(device.is_tampered);
                }
            #endif
            boot_linux_from_flash();
        }
        dprintf(CRITICAL, "ERROR: Could not do normal boot. Reverting "
            "to fastboot mode.\n");
    }

    /* We are here means regular boot did not happen. Start fastboot. */

    dprintf(INFO, "** [wuchengbing] aboot_fastboot_register_commands();**before\n");        
    /* register aboot specific fastboot commands */
    aboot_fastboot_register_commands();

    dprintf(INFO, "** [wuchengbing] Upartition_dump(); **before\n");        
    /* dump partition table for debug info */
    partition_dump();

    dprintf(INFO, "** [wuchengbing] fastboot_init(target_get_scratch_address(), target_get_max_flash_size()); **before\n");     
    /* initialize and start fastboot */
    fastboot_init(target_get_scratch_address(), target_get_max_flash_size());
    dprintf(INFO, "** [wuchengbing] FBCON_DISPLAY_MSG:%d **\n", FBCON_DISPLAY_MSG);     
#if FBCON_DISPLAY_MSG
    dprintf(INFO, "** [wuchengbing] display_fastboot_menu(); **before\n");      
    display_fastboot_menu();
#endif

    dprintf(INFO, "** [wuchengbing] %d: aboot() end **\n", __LINE__);       

}




。。。 。。。


APP_START(aboot)
    .init = aboot_init,
APP_END

Wu_Being 博客声明:本人博客欢迎转载,请标明博客原文和原链接!谢谢!
《高通Qualcomm平台lk(light kernel)启动流程2——aboot_init()》
http://blog.csdn.net/u014134180/article/details/78132580

Wu_Being 吴兵博客接受赞助费二维码

如果你看完这篇博文,觉得对你有帮助,并且愿意付赞助费,那么我会更有动力写下去。

相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore &nbsp; &nbsp; ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库&nbsp;ECS 实例和一台目标数据库&nbsp;RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&amp;RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
目录
相关文章
|
8月前
|
编解码 Linux 开发工具
瑞芯微RV1109支持V4L2 Camera
瑞芯微RV1109支持V4L2 Camera
114 0
|
15天前
|
Android开发
Android Mediatek USB 核心驱动中增加设备 PID/VID 检查
Android Mediatek USB 核心驱动中增加设备 PID/VID 检查
4 0
|
11月前
|
IDE 编译器 开发工具
【NXP】LPC55S69-RT-Thread Micropython移植日志
【NXP】LPC55S69-RT-Thread Micropython移植日志
126 0
ALSA驱动源码之devm_snd_soc_register_component源码分析
ALSA驱动源码之devm_snd_soc_register_component源码分析
|
机器学习/深度学习 前端开发 Linux
高通Qualcomm平台lk(light kernel)启动流程1——aboot_init()之前
0lk 启动总体流程 1lk启动流程代码 lk arch arm crt0S lk kernel mainc lk app appc 更多相关文章: 《高通Qualcomm平台lk(light kernel)启动流程1——aboot_init()之前》: http://blog.
3728 0
|
数据库 Android开发
高通Qualcomm平台lk(light kernel)启动流程3——到高通lcm屏点亮
0lk 启动总体流程 1lk启动流程代码 lk app aboot abootc lk target msm8953 target_displayc lk dev gcdb display gcdb_displayc 更多相关文章: 《高通Qual...
3448 0
|
Android开发
[lcm] Qualcomm平台兼容多显示屏lcd的方法&amp;并从lk传输到kernel过程
1如何兼容不同的LCD模组 1-1 通过LCD_ID的电平状态区分 1-2 通过IC的ID区分 1-3 通过LCD_ID和IC ID的结合区分 2LCD初始化过程 3读取LK屏的ID传输到kernel 3-1 LK把相关参数报存到pbuf 3-2 kernel...
3005 0
|
Android开发
[lcm] Qualcomm Android Display Subsystem 架构
更多相关文章: 《高通Qualcomm平台lk(light kernel)启动流程1——aboot_init()之前》: http://blog.csdn.net/u014134180/article/details/78133916 《高通Qualcomm平台lk(light kernel)启动流程2——aboot_init()》: http://blog.
1766 0