void board_init_r(gd_t *new_gd, ulong dest_addr) { #ifdef CONFIG_NEEDS_MANUAL_RELOC int i; #endif #ifdef CONFIG_AVR32 mmu_init_r(dest_addr); #endif #if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64) gd = new_gd; #endif #ifdef CONFIG_NEEDS_MANUAL_RELOC for (i = 0; i < ARRAY_SIZE(init_sequence_r); i++) init_sequence_r[i] += gd->reloc_off; #endif if (initcall_run_list(init_sequence_r)) hang(); /* NOTREACHED - run_main_loop() does not return */ hang(); }
void board_init_r(gd_t *new_gd, ulong dest_addr) { extern void malloc_bin_reloc (void); #ifndef CONFIG_ENV_IS_NOWHERE extern char * env_name_spec; #endif char *s; bd_t *bd; gd = new_gd; bd = gd->bd; gd->flags |= GD_FLG_RELOC; gd->reloc_off = dest_addr - CONFIG_SYS_MONITOR_BASE; /* Enable the MMU so that we can keep u-boot simple */ mmu_init_r(dest_addr); board_early_init_r(); monitor_flash_len = _edata - _text; #if defined(CONFIG_NEEDS_MANUAL_RELOC) /* * We have to relocate the command table manually */ fixup_cmdtable(&__u_boot_cmd_start, (ulong)(&__u_boot_cmd_end - &__u_boot_cmd_start)); #endif /* defined(CONFIG_NEEDS_MANUAL_RELOC) */ /* there are some other pointer constants we must deal with */ #ifndef CONFIG_ENV_IS_NOWHERE env_name_spec += gd->reloc_off; #endif timer_init(); /* The malloc area is right below the monitor image in RAM */ mem_malloc_init(CONFIG_SYS_MONITOR_BASE + gd->reloc_off - CONFIG_SYS_MALLOC_LEN, CONFIG_SYS_MALLOC_LEN); malloc_bin_reloc(); dma_alloc_init(); enable_interrupts(); bd->bi_flashstart = 0; bd->bi_flashsize = 0; bd->bi_flashoffset = 0; #ifndef CONFIG_SYS_NO_FLASH bd->bi_flashstart = CONFIG_SYS_FLASH_BASE; bd->bi_flashsize = flash_init(); bd->bi_flashoffset = (unsigned long)_edata - (unsigned long)_text; if (bd->bi_flashsize) display_flash_config(); #endif if (bd->bi_dram[0].size) display_dram_config(); gd->bd->bi_boot_params = malloc(CONFIG_SYS_BOOTPARAMS_LEN); if (!gd->bd->bi_boot_params) puts("WARNING: Cannot allocate space for boot parameters\n"); /* initialize environment */ env_relocate(); bd->bi_ip_addr = getenv_IPaddr ("ipaddr"); stdio_init(); jumptable_init(); console_init_r(); /* Initialize from environment */ load_addr = getenv_ulong("loadaddr", 16, load_addr); #ifdef CONFIG_BITBANGMII bb_miiphy_init(); #endif #if defined(CONFIG_CMD_NET) s = getenv("bootfile"); if (s) copy_filename(BootFile, s, sizeof(BootFile)); puts("Net: "); eth_initialize(gd->bd); #endif #ifdef CONFIG_GENERIC_ATMEL_MCI mmc_initialize(gd->bd); #endif for (;;) { main_loop(); } }