https://ke.qq.com/course/4032547?flowToken=1042705

为什么要解析uboot代码呢?当然是因为遇到棘手的问题啦。

目录

前言

一 uboot启动都干了什么

二 找方法

三 我的目的:解决ramdisk问题

main_loop

run_main_loop

数组init_sequence_r

void board_init_r(gd_t *new_gd, ulong dest_addr)

void board_init_f(ulong dummy)

crt0.S

全局变量gd_t *gd;

do_bootm_linux :linux内核的入口函数

结构体typedef struct bootm_headers


前言

先记住这几个东西

全局变量:gd

全局数组:init_sequence_r和static init_fnc_t init_sequence_f[]

函数:main_loop,

linux启动入口函数do_bootm_linux

结构体typedef struct bootm_headers :要研究ramdisk,就得研究它,

它是我此次分析的重点和主线,这就是我的目的,解决ramdisk问题。

把复杂的事情简单化,就是功力。

一 uboot启动都干了什么

uboot启动以后,先初始化各种硬件,然后进入main_loop,等待用户的交互操作,bootdelay是uboot里的一个环境变量,里面存放着整数,存储秒数,将bootdelay秒时间,uboot未接收到交互信号,就进入linux内核,并结束自己的生命。

uboot根据bootcmd加载zImage和设备树,然后将设备树和bootargs传递给内核。然后内核根据设备树初始化外设,不同的设备树,决定了zImage使用在不同的设备上,例如同一款产品的不同系列,高配版和低配版。

二 找方法

分析代码,讲究方式方法。

第一确定找主线。

其次就是有目的。目的就是动力,不忘初心牢记使命,方得始终。

例如你想修改网卡的MAC地址,或者想修添加一个自定义的命令,也可以向在uboot设置仅通过网络网络启动内核,无论是什么,找到一个目的

三 我的目的:解决ramdisk问题

uboot的是一个大号的裸板程序,裸板程序的特点就是有一个死循环,那就是main_loop,

第一个函数

main_loop

这个函数主要就是和用户交互的,就是解析用户输入的命令,然后给出结果。

main_loop被run_main_loop调用

/* We come here after U-Boot is initialised and ready to process commands */
void main_loop(void)
{const char *s;bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");#ifndef CONFIG_SYS_GENERIC_BOARDputs("Warning: Your board does not use generic board. Please read\n");puts("doc/README.generic-board and take action. Boards not\n");puts("upgraded by the late 2014 may break or be removed.\n");
#endif#ifdef CONFIG_VERSION_VARIABLEsetenv("ver", version_string);  /* set version variable */
#endif /* CONFIG_VERSION_VARIABLE */cli_init();run_preboot_environment_command();#if defined(CONFIG_UPDATE_TFTP)update_tftp(0UL, NULL, NULL);
#endif /* CONFIG_UPDATE_TFTP */s = bootdelay_process();if (cli_process_fdt(&s))cli_secure_boot_cmd(s);autoboot_command(s);cli_loop();
}

run_main_loop

这个函数很简单,就是调用的main_loop,sandbox_main_loop_init先不管。

static int run_main_loop(void)
{
#ifdef CONFIG_SANDBOXsandbox_main_loop_init();
#endif/* main_loop() can return to retry autoboot, if so just run it again */for (;;)main_loop();return 0;
}

数组init_sequence_r

run_main_loop又被赋值给了数组init_sequence_r,先看下init_sequence_r的类型和定义,init_sequence_r 是一个函数指针数组,里面被赋值各种硬件的初始化函数,看看这个数组的真身,这个数组就是初始化函数列表,里面的函数被依次调用,最后调用run_main_loop。

typedef int (*init_fnc_t)(void);init_fnc_t init_sequence_r[]
/** Over time we hope to remove these functions with code fragments and* stub funtcions, and instead call the relevant function directly.** We also hope to remove most of the driver-related init and do it if/when* the driver is later used.** TODO: perhaps reset the watchdog in the initcall function after each call?*/
init_fnc_t init_sequence_r[] = {initr_trace,initr_reloc,/* TODO: could x86/PPC have this also perhaps? */
#ifdef CONFIG_ARMinitr_caches,/* Note: For Freescale LS2 SoCs, new MMU table is created in DDR.*     A temporary mapping of IFC high region is since removed,*   so environmental variables in NOR flash is not availble*    until board_init() is called below to remap IFC to high*    region.*/
#endifinitr_reloc_global_data,
#if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)initr_unlock_ram_in_cache,
#endifinitr_barrier,initr_malloc,initr_console_record,
#ifdef CONFIG_SYS_NONCACHED_MEMORYinitr_noncached,
#endifbootstage_relocate,
#ifdef CONFIG_DMinitr_dm,
#endifinitr_bootstage,
#if defined(CONFIG_ARM) || defined(CONFIG_NDS32)board_init, /* Setup chipselects */
#endif/** TODO: printing of the clock inforamtion of the board is now* implemented as part of bdinfo command. Currently only support for* davinci SOC's is added. Remove this check once all the board* implement this.*/
#ifdef CONFIG_CLOCKSset_cpu_clk_info, /* Setup clock information */
#endifstdio_init_tables,initr_serial,initr_announce,INIT_FUNC_WATCHDOG_RESET
#ifdef CONFIG_NEEDS_MANUAL_RELOCinitr_manual_reloc_cmdtable,
#endif
#if defined(CONFIG_PPC) || defined(CONFIG_M68K)initr_trap,
#endif
#ifdef CONFIG_ADDR_MAPinitr_addr_map,
#endif
#if defined(CONFIG_BOARD_EARLY_INIT_R)board_early_init_r,
#endifINIT_FUNC_WATCHDOG_RESET
#ifdef CONFIG_LOGBUFFERinitr_logbuffer,
#endif
#ifdef CONFIG_POSTinitr_post_backlog,
#endifINIT_FUNC_WATCHDOG_RESET
#ifdef CONFIG_SYS_DELAYED_ICACHEinitr_icache_enable,
#endif
#if defined(CONFIG_PCI) && defined(CONFIG_SYS_EARLY_PCI_INIT)/** Do early PCI configuration _before_ the flash gets initialised,* because PCU ressources are crucial for flash access on some boards.*/initr_pci,
#endif
#ifdef CONFIG_WINBOND_83C553initr_w83c553f,
#endif
#ifdef CONFIG_ARCH_EARLY_INIT_Rarch_early_init_r,
#endifpower_init_board,
#ifndef CONFIG_SYS_NO_FLASHinitr_flash,
#endifINIT_FUNC_WATCHDOG_RESET
#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_X86) || \defined(CONFIG_SPARC)/* initialize higher level parts of CPU like time base and timers */cpu_init_r,
#endif
#ifdef CONFIG_PPCinitr_spi,
#endif
#ifdef CONFIG_CMD_NANDinitr_nand,
#endif
#ifdef CONFIG_CMD_ONENANDinitr_onenand,
#endif
#ifdef CONFIG_GENERIC_MMCinitr_mmc,
#endif
#ifdef CONFIG_HAS_DATAFLASHinitr_dataflash,
#endifinitr_env,
#ifdef CONFIG_SYS_BOOTPARAMS_LENinitr_malloc_bootparams,
#endifINIT_FUNC_WATCHDOG_RESETinitr_secondary_cpu,
#if defined(CONFIG_ID_EEPROM) || defined(CONFIG_SYS_I2C_MAC_OFFSET)mac_read_from_eeprom,
#endifINIT_FUNC_WATCHDOG_RESET
#if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT)/** Do pci configuration*/initr_pci,
#endifstdio_add_devices,initr_jumptable,
#ifdef CONFIG_APIinitr_api,
#endifconsole_init_r,       /* fully init console as a device */
#ifdef CONFIG_DISPLAY_BOARDINFO_LATEshow_board_info,
#endif
#ifdef CONFIG_ARCH_MISC_INITarch_misc_init,     /* miscellaneous arch-dependent init */
#endif
#ifdef CONFIG_MISC_INIT_Rmisc_init_r,       /* miscellaneous platform-dependent init */
#endifINIT_FUNC_WATCHDOG_RESET
#ifdef CONFIG_CMD_KGDBinitr_kgdb,
#endifinterrupt_init,
#if defined(CONFIG_ARM) || defined(CONFIG_AVR32)initr_enable_interrupts,
#endif
#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32) || defined(CONFIG_M68K)timer_init,      /* initialize timer */
#endif
#if defined(CONFIG_STATUS_LED)initr_status_led,
#endif/* PPC has a udelay(20) here dating from 2002. Why? */
#ifdef CONFIG_CMD_NETinitr_ethaddr,
#endif
#ifdef CONFIG_BOARD_LATE_INITboard_late_init,
#endif
#ifdef CONFIG_FSL_FASTBOOTinitr_fastboot_setup,
#endif
#if defined(CONFIG_CMD_AMBAPP)ambapp_init_reloc,
#if defined(CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP)initr_ambapp_print,
#endif
#endif
#ifdef CONFIG_CMD_SCSIINIT_FUNC_WATCHDOG_RESETinitr_scsi,
#endif
#ifdef CONFIG_CMD_DOCINIT_FUNC_WATCHDOG_RESETinitr_doc,
#endif
#ifdef CONFIG_BITBANGMIIinitr_bbmii,
#endif
#ifdef CONFIG_CMD_NETINIT_FUNC_WATCHDOG_RESETinitr_net,
#endif
#ifdef CONFIG_POSTinitr_post,
#endif
#if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_CMD_IDE)initr_pcmcia,
#endif
#if defined(CONFIG_CMD_IDE)initr_ide,
#endif
#ifdef CONFIG_LAST_STAGE_INITINIT_FUNC_WATCHDOG_RESET/** Some parts can be only initialized if all others (like* Interrupts) are up and running (i.e. the PC-style ISA* keyboard).*/last_stage_init,
#endif
#ifdef CONFIG_CMD_BEDBUGINIT_FUNC_WATCHDOG_RESETinitr_bedbug,
#endif
#if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)initr_mem,
#endif
#ifdef CONFIG_PS2KBDinitr_kbd,
#endif
#if defined(CONFIG_SPARC)prom_init,
#endif
#ifdef CONFIG_FSL_FASTBOOTinitr_check_fastboot,
#endifrun_main_loop,
}

void board_init_r(gd_t *new_gd, ulong dest_addr)

init_sequence_r在函数board_init_r中被调用

void board_init_r(gd_t *new_gd, ulong dest_addr)
{
#ifdef CONFIG_NEEDS_MANUAL_RELOCint i;
#endif#ifdef CONFIG_AVR32mmu_init_r(dest_addr);
#endif#if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64)gd = new_gd;
#endif#ifdef CONFIG_NEEDS_MANUAL_RELOCfor (i = 0; i < ARRAY_SIZE(init_sequence_r); i++)init_sequence_r[i] += gd->reloc_off;
#endifif (initcall_run_list(init_sequence_r))hang();/* NOTREACHED - run_main_loop() does not return */hang();
}

void board_init_f(ulong dummy)

board_init_r被board_init_f调用

void board_init_f(ulong dummy)
{/* setup AIPS and disable watchdog */arch_cpu_init();ccgr_init();/* iomux and setup of i2c */board_early_init_f();/* setup GP timer */timer_init();/* UART clocks enabled and gd valid - init serial console */preloader_console_init();/* DDR initialization */spl_dram_init();/* Clear the BSS. */memset(__bss_start, 0, __bss_end - __bss_start);/* load/boot image from boot device */board_init_r(NULL, 0);
}

crt0.S

board_init_f在crt0.S被ENTRY(_main)调用,好了到头了。

ENTRY(_main)/** Set up initial C runtime environment and call board_init_f(0).*/#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)ldr    sp, =(CONFIG_SPL_STACK)
#elseldr    sp, =(CONFIG_SYS_INIT_SP_ADDR)
#endif
#if defined(CONFIG_CPU_V7M) /* v7M forbids using SP as BIC destination */mov    r3, spbic   r3, r3, #7mov   sp, r3
#elsebic    sp, sp, #7  /* 8-byte alignment for ABI compliance */
#endifmov   r0, spbl    board_init_f_alloc_reservemov   sp, r0/* set up gd here, outside any C code */mov   r9, r0bl    board_init_f_init_reservemov    r0, #0bl    board_init_f

全局变量gd_t *gd;

这些函数里还使用了一个全局变量gd,gd的类型如下所示

gd_t *gd;

研究uboot整体脉络,就是IXUS研究gd这个变量。

typedef struct global_data {bd_t *bd;unsigned long flags;unsigned int baudrate;unsigned long cpu_clk;    /* CPU clock in Hz!     */unsigned long bus_clk;/* We cannot bracket this with CONFIG_PCI due to mpc5xxx */unsigned long pci_clk;unsigned long mem_clk;
#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)unsigned long fb_base;  /* Base address of framebuffer mem */
#endif
#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)unsigned long post_log_word;  /* Record POST activities */unsigned long post_log_res; /* success of POST test */unsigned long post_init_f_time;  /* When post_init_f started */
#endif
#ifdef CONFIG_BOARD_TYPESunsigned long board_type;
#endifunsigned long have_console;   /* serial_init() was called */
#ifdef CONFIG_PRE_CONSOLE_BUFFERunsigned long precon_buf_idx;   /* Pre-Console buffer index */
#endifunsigned long env_addr;   /* Address  of Environment struct */unsigned long env_valid;    /* Checksum of Environment valid? */unsigned long ram_top;  /* Top address of RAM used by U-Boot */unsigned long relocaddr; /* Start address of U-Boot in RAM */phys_size_t ram_size;   /* RAM size */
#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
#define MEM_RESERVE_SECURE_SECURED  0x1
#define MEM_RESERVE_SECURE_MAINTAINED   0x2
#define MEM_RESERVE_SECURE_ADDR_MASK    (~0x3)/** Secure memory addr* This variable needs maintenance if the RAM base is not zero,* or if RAM splits into non-consecutive banks. It also has a* flag indicating the secure memory is marked as secure by MMU.* Flags used: 0x1 secured*             0x2 maintained*/phys_addr_t secure_ram;
#endifunsigned long mon_len;    /* monitor len */unsigned long irq_sp;      /* irq stack pointer */unsigned long start_addr_sp; /* start_addr_stackpointer */unsigned long reloc_off;struct global_data *new_gd;    /* relocated global data */#ifdef CONFIG_DMstruct udevice   *dm_root;   /* Root instance for Driver Model */struct udevice  *dm_root_f; /* Pre-relocation root instance */struct list_head uclass_root; /* Head of core tree */
#endif
#ifdef CONFIG_TIMERstruct udevice   *timer; /* Timer instance for Driver Model */
#endifconst void *fdt_blob; /* Our device tree, NULL if none */void *new_fdt;       /* Relocated FDT */unsigned long fdt_size;  /* Space reserved for relocated FDT */struct jt_funcs *jt;      /* jump table */char env_buf[32];   /* buffer for getenv() before reloc. */
#ifdef CONFIG_TRACEvoid     *trace_buff;    /* The trace buffer */
#endif
#if defined(CONFIG_SYS_I2C)int      cur_i2c_bus;    /* current used i2c bus */
#endif
#ifdef CONFIG_SYS_I2C_MXCvoid *srdata[10];
#endifunsigned long timebase_h;unsigned long timebase_l;
#ifdef CONFIG_SYS_MALLOC_F_LENunsigned long malloc_base;    /* base address of early malloc() */unsigned long malloc_limit; /* limit address */unsigned long malloc_ptr;    /* current address */
#endif
#ifdef CONFIG_PCIstruct pci_controller *hose;   /* PCI hose for early use */phys_addr_t pci_ram_top;    /* top of region accessible to PCI */
#endif
#ifdef CONFIG_PCI_BOOTDELAYint pcidelay_done;
#endifstruct udevice *cur_serial_dev;   /* current serial device */struct arch_global_data arch;    /* architecture-specific data */
#ifdef CONFIG_CONSOLE_RECORDstruct membuff console_out; /* console output */struct membuff console_in;  /* console input */
#endif
#ifdef CONFIG_DM_VIDEOulong video_top;      /* Top of video frame buffer area */ulong video_bottom;     /* Bottom of video frame buffer area */
#endif
}

do_bootm_linux :linux内核的入口函数

一切事物终将走向灭亡,但也会迎来心生,uboot死亡的时候,就是内核出生的地方。

/* Main Entry point for arm bootm implementation** Modeled after the powerpc implementation* DIFFERENCE: Instead of calling prep and go at the end* they are called if subcommand is equal 0.*/
int do_bootm_linux(int flag, int argc, char * const argv[],bootm_headers_t *images)
{/* No need for those on ARM */if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)return -1;if (flag & BOOTM_STATE_OS_PREP) {boot_prep_linux(images);return 0;}if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {boot_jump_linux(images, flag);return 0;}boot_prep_linux(images);boot_jump_linux(images, flag);return 0;
}

结构体typedef struct bootm_headers

typedef struct bootm_headers {/** Legacy os image header, if it is a multi component image* then boot_get_ramdisk() and get_fdt() will attempt to get* data from second and third component accordingly.*/image_header_t *legacy_hdr_os;     /* image header pointer */image_header_t    legacy_hdr_os_copy; /* header copy */ulong      legacy_hdr_valid;#if defined(CONFIG_FIT)const char  *fit_uname_cfg; /* configuration node unit name */void      *fit_hdr_os;    /* os FIT image header */const char *fit_uname_os;  /* os subimage node unit name */int     fit_noffset_os; /* os subimage node offset */void       *fit_hdr_rd;    /* init ramdisk FIT image header */const char   *fit_uname_rd;  /* init ramdisk subimage node unit name */int       fit_noffset_rd; /* init ramdisk subimage node offset */void     *fit_hdr_fdt;   /* FDT blob FIT image header */const char   *fit_uname_fdt; /* FDT blob subimage node unit name */int       fit_noffset_fdt;/* FDT blob subimage node offset */void     *fit_hdr_setup; /* x86 setup FIT image header */const char  *fit_uname_setup; /* x86 setup subimage node name */int     fit_noffset_setup;/* x86 setup subimage node offset */
#endif#ifndef USE_HOSTCCimage_info_t    os;     /* os image info */ulong        ep;     /* entry point of OS */ulong        rd_start, rd_end;/* ramdisk start/end */char        *ft_addr;   /* flat dev tree address */ulong        ft_len;     /* length of flat device tree */ulong       initrd_start;ulong      initrd_end;ulong        cmdline_start;ulong     cmdline_end;bd_t        *kbd;
#endifint       verify;     /* getenv("verify")[0] != 'n' */#define    BOOTM_STATE_START   (0x00000001)
#define BOOTM_STATE_FINDOS  (0x00000002)
#define BOOTM_STATE_FINDOTHER   (0x00000004)
#define BOOTM_STATE_LOADOS  (0x00000008)
#define BOOTM_STATE_RAMDISK (0x00000010)
#define BOOTM_STATE_FDT     (0x00000020)
#define BOOTM_STATE_OS_CMDLINE  (0x00000040)
#define BOOTM_STATE_OS_BD_T (0x00000080)
#define BOOTM_STATE_OS_PREP (0x00000100)
#define BOOTM_STATE_OS_FAKE_GO  (0x00000200)    /* 'Almost' run the OS */
#define BOOTM_STATE_OS_GO   (0x00000400)int     state;#ifdef CONFIG_LMBstruct lmb   lmb;        /* for memory mgmt */
#endif
}

static init_fnc_t init_sequence_f[]

static init_fnc_t init_sequence_f[] = {
#ifdef CONFIG_SANDBOXsetup_ram_buf,
#endifsetup_mon_len,
#ifdef CONFIG_OF_CONTROLfdtdec_setup,
#endif
#ifdef CONFIG_TRACEtrace_early_init,
#endifinitf_malloc,initf_console_record,
#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)/* TODO: can this go into arch_cpu_init()? */probecpu,
#endif
#if defined(CONFIG_X86) && defined(CONFIG_HAVE_FSP)x86_fsp_init,
#endifarch_cpu_init,        /* basic arch cpu dependent setup */initf_dm,arch_cpu_init_dm,mark_bootstage,       /* need timer, go after init dm */
#if defined(CONFIG_BOARD_EARLY_INIT_F)board_early_init_f,
#endif/* TODO: can any of this go into arch_cpu_init()? */
#if defined(CONFIG_PPC) && !defined(CONFIG_8xx_CPUCLK_DEFAULT)get_clocks,       /* get CPU and bus clocks (etc.) */
#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M) \&& !defined(CONFIG_TQM885D)adjust_sdram_tbs_8xx,
#endif/* TODO: can we rename this to timer_init()? */init_timebase,
#endif
#if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || \defined(CONFIG_BLACKFIN) || defined(CONFIG_NDS32) || \defined(CONFIG_SPARC)timer_init,      /* initialize timer */
#endif
#ifdef CONFIG_SYS_ALLOC_DPRAM
#if !defined(CONFIG_CPM2)dpram_init,
#endif
#endif
#if defined(CONFIG_BOARD_POSTCLK_INIT)board_postclk_init,
#endif
#if defined(CONFIG_SYS_FSL_CLK) || defined(CONFIG_M68K)get_clocks,
#endifenv_init,     /* initialize environment */
#if defined(CONFIG_8xx_CPUCLK_DEFAULT)/* get CPU and bus clocks according to the environment variable */get_clocks_866,/* adjust sdram refresh rate according to the new clock */sdram_adjust_866,init_timebase,
#endifinit_baud_rate,       /* initialze baudrate settings */serial_init,       /* serial communications setup */console_init_f,        /* stage 1 init of console */
#ifdef CONFIG_SANDBOXsandbox_early_getopt_check,
#endif
#ifdef CONFIG_OF_CONTROLfdtdec_prepare_fdt,
#endifdisplay_options,  /* say that we are here */display_text_info,    /* show debugging info if required */
#if defined(CONFIG_MPC8260)prt_8260_rsr,prt_8260_clks,
#endif /* CONFIG_MPC8260 */
#if defined(CONFIG_MPC83xx)prt_83xx_rsr,
#endif
#if defined(CONFIG_PPC) || defined(CONFIG_M68K)checkcpu,
#endifprint_cpuinfo,        /* display cpu info (and speed) */
#if defined(CONFIG_MPC5xxx)prt_mpc5xxx_clks,
#endif /* CONFIG_MPC5xxx */
#if defined(CONFIG_DISPLAY_BOARDINFO)show_board_info,
#endifINIT_FUNC_WATCHDOG_INIT
#if defined(CONFIG_MISC_INIT_F)misc_init_f,
#endifINIT_FUNC_WATCHDOG_RESET
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)init_func_i2c,
#endif
#if defined(CONFIG_HARD_SPI)init_func_spi,
#endifannounce_dram_init,/* TODO: unify all these dram functions? */
#if defined(CONFIG_ARM) || defined(CONFIG_X86) || defined(CONFIG_NDS32) || \defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32)dram_init,       /* configure available RAM banks */
#endif
#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_M68K)init_func_ram,
#endif
#ifdef CONFIG_POSTpost_init_f,
#endifINIT_FUNC_WATCHDOG_RESET
#if defined(CONFIG_SYS_DRAM_TEST)testdram,
#endif /* CONFIG_SYS_DRAM_TEST */INIT_FUNC_WATCHDOG_RESET#ifdef CONFIG_POSTinit_post,
#endifINIT_FUNC_WATCHDOG_RESET/** Now that we have DRAM mapped and working, we can* relocate the code and continue running from DRAM.** Reserve memory at end of RAM for (top down in that order):*  - area that won't get touched by U-Boot and Linux (optional)*  - kernel log buffer*  - protected RAM*  - LCD framebuffer*  - monitor code*  - board info struct*/setup_dest_addr,
#if defined(CONFIG_BLACKFIN)/* Blackfin u-boot monitor should be on top of the ram */reserve_uboot,
#endif
#if defined(CONFIG_SPARC)reserve_prom,
#endif
#if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)reserve_logbuffer,
#endif
#ifdef CONFIG_PRAMreserve_pram,
#endifreserve_round_4k,
#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF)) && \defined(CONFIG_ARM)reserve_mmu,
#endif
#ifdef CONFIG_DM_VIDEOreserve_video,
#else
# ifdef CONFIG_LCDreserve_lcd,
# endif/* TODO: Why the dependency on CONFIG_8xx? */
# if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \!defined(CONFIG_ARM) && !defined(CONFIG_X86) && \!defined(CONFIG_BLACKFIN) && !defined(CONFIG_M68K)reserve_legacy_video,
# endif
#endif /* CONFIG_DM_VIDEO */reserve_trace,
#if !defined(CONFIG_BLACKFIN)reserve_uboot,
#endif
#ifndef CONFIG_SPL_BUILDreserve_malloc,reserve_board,
#endifsetup_machine,reserve_global_data,reserve_fdt,reserve_arch,reserve_stacks,setup_dram_config,show_dram_config,
#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_MIPS)setup_board_part1,
#endif
#if defined(CONFIG_PPC) || defined(CONFIG_M68K)INIT_FUNC_WATCHDOG_RESETsetup_board_part2,
#endifdisplay_new_sp,
#ifdef CONFIG_SYS_EXTBDINFOsetup_board_extra,
#endifINIT_FUNC_WATCHDOG_RESETreloc_fdt,setup_reloc,
#if defined(CONFIG_X86) || defined(CONFIG_ARC)copy_uboot_to_ram,clear_bss,do_elf_reloc_fixups,
#endif
#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX)jump_to_copy,
#endifNULL,
}

uboot代码解析1:根据目的找主线相关推荐

  1. uboot代码解析3:内存管理、控制台、网络、启动函数

    https://ke.qq.com/course/4032547?flowToken=1042705 目录 https://ke.qq.com/course/4032547?flowToken=104 ...

  2. uboot代码解析4:内核传参、ramdisk、initrd

    https://ke.qq.com/course/4032547?flowToken=1042705 目录 前言 一 struct tag结构体传参 二 boot_prep_linux函数 三 ima ...

  3. ARM Uboot经历——Uboot初始化代码解析

    Uboot初始化代码主要是在Uboot重定位之前的一系列处理,起源于start.s文件,涉及crt0.s和board.c等文件,会完成最系统环境最初始的设置和结构体赋值. reset的相关处理 从_s ...

  4. 嵌入式linux的u-boot系统启动过程,嵌入式linux操作系统u-boot启动顺序以及代码解析...

    嵌入式linux操作系统u-boot启动顺序以及代码解析 (9页) 本资源提供全文预览,点击全文预览即可全文预览,如果喜欢文档就下载吧,查找使用更方便哦! 9.9 积分 Bootloader/u-bo ...

  5. 【u-boot】uboot代码简要分析 (u-boot 移植)

    uboot代码简要分析 (u-boot 移植) 2012-12-19 22:46:04 [转] 先来看看源码目录结构,再按照代码的执行顺序简单地分析源码 1.U-boot源码整体框架 源码解压以后,我 ...

  6. uboot代码详细分析.pdf

    目录 u-boot-1.1.6 之cpu/arm920t/start.s 分析 ............................................................ ...

  7. MATLAB程序详细解析,遗传算法——matlab代码解析

    遗传算法--matlab代码解析 本文为学习B站老哥数学建模课程之后的一点笔记,图片源自web,代码源自老哥程序包,侵权删. 详细的遗传算法原理不再赘述,百度即可找到. 算法定义 遗传算法(GA)是模 ...

  8. s3c6410 uboot代码分析《二》

    s3c6410 uboot代码分析<二> http://hi.baidu.com/__eabi/blog/item/be67533797bc73f014cecb49.html(s3c641 ...

  9. Uboot代码结构详细分析

    1. Bootloader功能分析 Bootloader(如Uboot.Redboot.Blob.vivi等)直接和CPU.外围硬件设备(存储器.网卡.LCD等)打交道,负责初始化硬件设备,以及负责拉 ...

最新文章

  1. top在html5里什么意思,html中的scrolltop是什么意思
  2. Docker(八):Docker Compose
  3. 2011-02 Emacs相关闪存
  4. 【Linux 内核】Linux 操作系统结构 ( Linux 内核在操作系统中的层级 | Linux 内核子系统及关系 | 进程调度 | 内存管理 | 虚拟文件系统 | 网络管理 | 进程间通信 )
  5. mybatis Example 使用方法
  6. Go学习笔记—并发高级
  7. javascript好文---深入理解定位父级offsetParent及偏移大小
  8. mysql新增后默认返回值_mybatis insert、update 、delete默认返回值解释与如何设置返回表主键...
  9. 获取占用fd最大的前20个进程
  10. Unity3D资源热更新(一)
  11. 河南大学软件学院宿舍楼综合布线设计方案
  12. 世界传说 换装迷宫2 所有人物及所有技能及奖励技能 传说系列各秘奥技和台词
  13. mysql求平方根_MySQL数据库中如何求一个数的二次平方根(SQRT函数)呢?
  14. 对梯度概念的直观理解
  15. 【老生谈算法】matlabBOOST电路的设计与仿真——BOOST电路
  16. REST API Concerns
  17. Exata卫星通信仿真
  18. 科大讯飞董事长刘庆峰:人工智能窗口期有多远?【软件网每日新闻播报│第10-19期】
  19. 如何测出PAT 测试点的测试数据?
  20. 小学生C++趣味编程 上机作业 每日一练 第7单元 函数

热门文章

  1. luogu 1137
  2. 【功防世界】base64stego
  3. FPGA实战操作(2) -- PCIe总线(协议简述)
  4. 【第二章】 C语言之牛客网刷题笔记 【点进来保证让知识充实你一整天】
  5. GEE学习笔记:在Google Earth Engine(GEE)中导出shp文件
  6. Ftp连接-200 Switching to ASCII mode,227 Entering Passive Mode
  7. web前端性能(一)
  8. 效率源希捷自校准配套专修软件 免费
  9. 今日头条实习面经--20180509
  10. 球球音响机器人怎么合成的_球球大作战合成音响机器人孢子在哪合成