/*----------------------------------------------------------------------------- * do_fdosls -- *----------------------------------------------------------------------------- */ int do_fdosls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *path = ""; int drive = CONFIG_SYS_FDC_DRIVE_NUMBER; switch (argc) { case 1: break; case 2: path = argv [1]; break; } /* Init physical layer */ if (!fdc_fdos_init (drive)) { return (-1); } /* Open directory */ if (dos_open (path) < 0) { printf ("Unable to open %s\n", path); return 1; } return (dos_dir ()); }
/*----------------------------------------------------------------------------- * do_fdosboot -- *----------------------------------------------------------------------------- */ int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *name; char *ep; int size; int rcode = 0; char buf [12]; int drive = CONFIG_SYS_FDC_DRIVE_NUMBER; /* pre-set load_addr */ if ((ep = getenv("loadaddr")) != NULL) { load_addr = simple_strtoul(ep, NULL, 16); } /* pre-set Boot file name */ if ((name = getenv("bootfile")) == NULL) { name = "uImage"; } switch (argc) { case 1: break; case 2: /* only one arg - accept two forms: * just load address, or just boot file name. * The latter form must be written "filename" here. */ if (argv[1][0] == '"') { /* just boot filename */ name = argv [1]; } else { /* load address */ load_addr = simple_strtoul(argv[1], NULL, 16); } break; case 3: load_addr = simple_strtoul(argv[1], NULL, 16); name = argv [2]; break; default: return cmd_usage(cmdtp); } /* Init physical layer */ if (!fdc_fdos_init (drive)) { return (-1); } /* Open file */ if (dos_open (name) < 0) { printf ("Unable to open %s\n", name); return 1; } if ((size = dos_read (load_addr)) < 0) { printf ("boot error\n"); return 1; } flush_cache (load_addr, size); #ifdef CONFIG_AML_SECU_BOOT_V2 extern int g_nIMGReadFlag; g_nIMGReadFlag = 0; #endif //#ifdef CONFIG_AML_SECU_BOOT_V2 sprintf(buf, "%x", size); setenv("filesize", buf); printf("Floppy DOS load complete: %d bytes loaded to 0x%lx\n", size, load_addr); /* Check if we should attempt an auto-start */ if (((ep = getenv("autostart")) != NULL) && (strcmp(ep,"yes") == 0)) { char *local_args[2]; local_args[0] = argv[0]; local_args[1] = NULL; printf ("Automatic boot of image at addr 0x%08lX ...\n", load_addr); rcode = do_bootm (cmdtp, 0, 1, local_args); } return rcode; }
/*----------------------------------------------------------------------------- * do_fdosboot -- *----------------------------------------------------------------------------- */ int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *name; char *ep; int size; char buf [12]; int drive = CONFIG_SYS_FDC_DRIVE_NUMBER; /* pre-set load_addr */ if ((ep = getenv("loadaddr")) != NULL) { load_addr = simple_strtoul(ep, NULL, 16); } /* pre-set Boot file name */ if ((name = getenv("bootfile")) == NULL) { name = "uImage"; } switch (argc) { case 1: break; case 2: /* only one arg - accept two forms: * just load address, or just boot file name. * The latter form must be written "filename" here. */ if (argv[1][0] == '"') { /* just boot filename */ name = argv [1]; } else { /* load address */ load_addr = simple_strtoul(argv[1], NULL, 16); } break; case 3: load_addr = simple_strtoul(argv[1], NULL, 16); name = argv [2]; break; default: return cmd_usage(cmdtp); } /* Init physical layer */ if (!fdc_fdos_init (drive)) { return (-1); } /* Open file */ if (dos_open (name) < 0) { printf ("Unable to open %s\n", name); return 1; } if ((size = dos_read (load_addr)) < 0) { printf ("boot error\n"); return 1; } flush_cache (load_addr, size); sprintf(buf, "%x", size); setenv("filesize", buf); printf("Floppy DOS load complete: %d bytes loaded to 0x%lx\n", size, load_addr); return bootm_maybe_autostart(cmdtp, argv[0]); }