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

  • 0lk 启动总体流程
  • 1lk启动流程代码
    • lk app aboot abootc

更多相关文章:

《高通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

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

时间: 2024-09-11 18:43:25

高通Qualcomm平台lk(light kernel)启动流程2——aboot_init()的相关文章

高通Qualcomm平台lk(light kernel)启动流程3——到高通lcm屏点亮

0lk 启动总体流程 1lk启动流程代码 lk app aboot abootc lk target msm8953 target_displayc lk dev gcdb display gcdb_displayc 更多相关文章: <高通Qualcomm平台lk(light kernel)启动流程1--aboot_init()之前>: http://blog.csdn.net/u014134180/article/details/78133916 <高通Qualcomm平台lk(lig

高通自称,中国发改委已启动对该公司反垄断调查

近日,高通自称,中国发改委已启动对该公司反垄断调查,但是被调查的原因讳莫如深.发改委为何"突袭"高通中国?这将对高通中国产生怎样的影响?笔者进行了调查. 1.市场垄断 公开资料显示,截至今年9月的2013财年,高通总营收249亿美元,49%来自中国市场,其中部分营收来自在中国组装并在 其他 国家销售的设备. 高通全球副总裁沈劲在接受笔者采访时表示,高通与中移动TD-LTE配合默契,目前4G试商用南方某城市推出6款 手机 ,其中5款就是高通提供的芯片支持.中移动2013年二季度采购TD-

Opera Mini浏览器进驻高通BrewMP平台

中介交易 http://www.aliyun.com/zixun/aggregation/6858.html">SEO诊断 淘宝客 云主机 技术大厅 来自国外的最新消息称,全球领先的浏览器厂商Opera软件公司宣布已与高通公司签署协议,旗下最受欢迎的手机浏览器Opera Mini将进驻高通Brew MP平台,并面向全球发布.全球数以百万计的消费者将因此而受益,因为他们将能够在大众款手机上享受到类似智能手机浏览网络的体验.目前,Opera Mini已拥有超过九千一百万用户,是全球最受欢迎的手

高通-Qualcomm 9x15 qmi_simple_ril_test使用

问题描述 Qualcomm 9x15 qmi_simple_ril_test使用 Qualcomm 9x15 apps有个测试程序qmi_simple_ril_test 此程序用于radio interface layer的封装 请问有没有相关使用手册

[lcm] Qualcomm平台兼容多显示屏lcd的方法&amp;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获取LK保存的pbuf 3-3 解析出所用的LCD并初始化 更多相关文章: <高通Qualcomm平台lk(light kernel)启动流程1--aboot_init()之前>: http://blog.csdn.net/u014134

[lcm] Qualcomm平台显示屏lcd添加I2C读取功能

1硬件设计分析采用IC 的I2C 功能读取ID 寄存器 2ARM9 更改GPIO 配置 3LK 添加代码 4LK 阶段不接屏不亮背光 5kernel 阶段不接屏不亮背光 6kernel 阶段I2C 配置 更多相关文章: 更多相关文章: <高通Qualcomm平台lk(light kernel)启动流程1--aboot_init()之前>: http://blog.csdn.net/u014134180/article/details/78133916 <高通Qualcomm平台lk(li

[lcm] Qualcomm平台的显示屏lcd驱动移植步骤

1lk部分 1-1 target_displayc 1-2 oem_panelc 1-3 panel_innont51021b_1200p_videoh 2Kernel 2-1 dsi-panel-boent51012_1200_videodtsi 2-2 msm8953-mdss-panelsdtsi 2-3 msm8953-mtpdtsi 更多相关文章: <高通Qualcomm平台lk(light kernel)启动流程1--aboot_init()之前>: http://blog.csd

中国发改委已启动对高通的反垄断调查

摘要: 近日,高通自称,中国发改委已启动对该公司反垄断调查,但是被调查的原因讳莫如深.发改委为何突袭高通中国?这将对高通中国产生怎样的影响?笔者进行了调查. 1.市场垄断 公开 近日,高通自称,中国发改委已启动对该公司反垄断调查,但是被调查的原因讳莫如深.发改委为何"突袭"高通中国?这将对高通中国产生怎样的影响?笔者进行了调查. 1.市场垄断 公开资料显示,截至今年9月的2013财年,高通总营收249亿美元,49%来自中国市场,其中部分营收来自在中国组装并在 其他 国家销售的设备. 高

华硕大幅缩减英特尔手机芯片订单,转投高通联发科怀抱

本文综合了腾讯科技.台湾媒体digitimes.com.手机中国的相关报道. 据台湾媒体digitimes.com报道,英特尔(Intel)智能型手机芯片最重要客户华硕,近期持续缩减下单英特尔比重,扩大高通(Qualcomm)与联发科芯片平台订单比重,2016年华硕ZenFone系列采用英特尔平台比重将低于2成,以华硕全年手机出货2,500万支目标估算,英特尔手机芯片订单已不及500万颗,且2017年订单规模可能再腰斩. 华硕电脑一直是英特尔芯片产品的坚定盟友,华硕是全球五大个人电脑厂商之一,自