📄 cmd_boot.c.svn-base
字号:
/* * (C) Copyright 2000-2003 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * See file CREDITS for list of people who contributed to this * project. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA *//* * Misc boot support */#include <common.h>#include <command.h>#include <net.h>#include <asm/mach-types.h>/* -------------------------------------------------------------------- */int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){#if defined(CONFIG_I386) DECLARE_GLOBAL_DATA_PTR;#endif ulong addr, rc; int rcode = 0; if (argc < 2) { printf ("Usage:\n%s\n", cmdtp->usage); return 1; } if(strcmp(argv[1], "linux") == 0){ addr = (ulong)KERNEL_RAM_BASE; printf("## Starting Linux kernel at 0x%08lx ...\n", KERNEL_RAM_BASE); }else if(strcmp(argv[1], "wince") == 0){ addr = (ulong)WINCE_KERNEL_RAM_BASE; printf("## Starting WinCE kernel at 0x%08lx ... \n", WINCE_KERNEL_RAM_BASE); }else{ addr = simple_strtoul(argv[1], NULL, 16); printf ("## Starting application at 0x%08lX ...\n", addr); } /* * pass address parameter as argv[0] (aka command name), * and all remaining args */#if defined(CONFIG_I386) /* * x86 does not use a dedicated register to pass the pointer * to the global_data */ argv[0] = (char *)gd;#endif#if !defined(CONFIG_NIOS) rc = ((ulong (*)(int, char *[]))addr) (--argc, &argv[1]);#else /* * Nios function pointers are address >> 1 */ rc = ((ulong (*)(int, char *[]))(addr>>1)) (--argc, &argv[1]);#endif if (rc != 0) rcode = 1; printf ("## Application terminated, rc = 0x%lX\n", rc); return rcode;}/* -------------------------------------------------------------------- */U_BOOT_CMD( go, CFG_MAXARGS, 1, do_go, "go - start application at address 'addr'\n", "addr [arg ...]\n - start application at address 'addr'\n" " passing 'arg' as arguments\n" " if arg is \"kernel\".. start at address 0x30008000\n");extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);U_BOOT_CMD( reset, 1, 0, do_reset, "reset - Perform RESET of the CPU\n", NULL);#if (CONFIG_COMMANDS & CONFIG_INTEL_28F128J3C) || \ (CONFIG_COMMANDS & CONFIG_SMC_K9S1208)void do_bootrom(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){ volatile unsigned long *img_src = 0, *img_dst = 0; long kernel_param[2]; void (*theKernel)(int zero, int arch); int len, i, which_os = 0; const char * nand_boot_cmd; if(strcmp(argv[1], "wince") == 0) which_os = 1; if(which_os == 0){ // booting linux kernel kernel_param[0] = 0; kernel_param[1] = MACH_TYPE_MBA2410;#if (CONFIG_MBA2410) kernel_param[1] = MACH_TYPE_MBA2410;#elif (CONFIG_MBA2440) kernel_param[1] = MACH_TYPE_MBA2440;#elif (CONFIG_smdk2443) //s3c2443 added by maddy220109 kernel_param[1] = MACH_TYPE_smdk2443;#endif printf("Loading images from boot flash to RAM\n\n"); sprintf(nand_boot_cmd, "nandr t 0x%x 0x%x 0x%x; nandr t 0x%x 0x%x 0x%x; go linux", KERNEL_RAM_BASE, KERNEL_ROM_BASE, KERNEL_MAX_SIZE, RAMDISK_RAM_BASE, RAMDISK_ROM_BASE, RAMDISK_MAX_SIZE); run_command(nand_boot_cmd, 0);/* //in case of INTEL 28F28J3C //copy kernel from flash to memory img_src = (unsigned long *)KERNEL_ROM_BASE; img_dst = (unsigned long *)KERNEL_RAM_BASE; len = KERNEL_MAX_SIZE; while(len--){ *img_dst++ = *img_src++; if(len%0x40000 == 0) printf("."); } //copy ramdisk from flash to memory img_src = (unsigned long *)RAMDISK_ROM_BASE; img_dst = (unsigned long *)RAMDISK_RAM_BASE; len = RAMDISK_MAX_SIZE; while(len--){ *img_dst++ = *img_src++; if(len%0x80000 == 0) printf("."); } printf("\n\n"); theKernel = (void (*)(int, int))KERNEL_RAM_BASE; theKernel(kernel_param[0], kernel_param[1]);*/ }else if(which_os == 1){ // booting WinCE kernel printf("Loading images from bootROM to RAM\n\n"); sprintf(nand_boot_cmd, "nandr t 0x%x 0x%x 0x%x; go wince", WINCE_KERNEL_RAM_BASE, WINCE_KERNEL_ROM_BASE, WINCE_KERNEL_MAX_SIZE); run_command(nand_boot_cmd, 0); } printf("kernel returned.. Something Wrong... \n"); return;}U_BOOT_CMD( bootrom, CFG_MAXARGS, 0, do_bootrom, "bootrom - just typing bootrom and enter\n", "bootrom - linux kernel booting from 0x80000(zImage)\n");#endif //(CONFIG_COMMANDS & CONFIG_INTEL_28F128J3C)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -