int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) { bd_t *bd = gd->bd; char *s; int machid = bd->bi_arch_number; void (*theKernel)(int arch, uint params); /* * allow the PREP bootm subcommand, it is required for bootm to work */ if (flag & BOOTM_STATE_OS_PREP) return 0; if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) return 1; theKernel = (void (*)(int, uint))images->ep; s = env_get("machid"); if (s) { machid = simple_strtoul(s, NULL, 16); printf("Using machid 0x%x from environment\n", machid); } bootstage_mark(BOOTSTAGE_ID_RUN_OS); debug("## Transferring control to Linux (at address %08lx) ...\n", (ulong)theKernel); if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) { #ifdef CONFIG_OF_LIBFDT debug("using: FDT\n"); if (image_setup_linux(images)) { printf("FDT creation failed! hanging..."); hang(); } #endif } /* we assume that the kernel is in place */ printf("\nStarting kernel ...\n\n"); cleanup_before_linux(); if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) theKernel(machid, (unsigned long)images->ft_addr); /* does not return */ return 1; }
int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) { bd_t *bd = gd->bd; char *s; int machid = bd->bi_arch_number; void (*theKernel)(int zero, int arch, uint params); #ifdef CONFIG_CMDLINE_TAG char *commandline = getenv("bootargs"); #endif /* * allow the PREP bootm subcommand, it is required for bootm to work */ if (flag & BOOTM_STATE_OS_PREP) return 0; if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) return 1; theKernel = (void (*)(int, int, uint))images->ep; s = getenv("machid"); if (s) { machid = simple_strtoul(s, NULL, 16); printf("Using machid 0x%x from environment\n", machid); } bootstage_mark(BOOTSTAGE_ID_RUN_OS); debug("## Transferring control to Linux (at address %08lx) ...\n", (ulong)theKernel); if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) { #ifdef CONFIG_OF_LIBFDT debug("using: FDT\n"); if (image_setup_linux(images)) { printf("FDT creation failed! hanging..."); hang(); } #endif } else if (BOOTM_ENABLE_TAGS) { #if defined(CONFIG_SETUP_MEMORY_TAGS) || \ defined(CONFIG_CMDLINE_TAG) || \ defined(CONFIG_INITRD_TAG) || \ defined(CONFIG_SERIAL_TAG) || \ defined(CONFIG_REVISION_TAG) setup_start_tag(bd); #ifdef CONFIG_SERIAL_TAG setup_serial_tag(¶ms); #endif #ifdef CONFIG_REVISION_TAG setup_revision_tag(¶ms); #endif #ifdef CONFIG_SETUP_MEMORY_TAGS setup_memory_tags(bd); #endif #ifdef CONFIG_CMDLINE_TAG setup_commandline_tag(bd, commandline); #endif #ifdef CONFIG_INITRD_TAG if (images->rd_start && images->rd_end) setup_initrd_tag(bd, images->rd_start, images->rd_end); #endif setup_end_tag(bd); #endif /* we assume that the kernel is in place */ printf("\nStarting kernel ...\n\n"); #ifdef CONFIG_USB_DEVICE { extern void udc_disconnect(void); udc_disconnect(); } #endif } cleanup_before_linux(); if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) theKernel(0, machid, (unsigned long)images->ft_addr); else theKernel(0, machid, bd->bi_boot_params); /* does not return */ return 1; }