- switch (argc) {
- case 1:
- addr = CONFIG_SYS_LOAD_ADDR;
- boot_device = getenv("bootdevice");
- break;
- case 2:
- addr = simple_strtoul(argv[1], NULL, 16);
- boot_device = getenv("bootdevice");
- break;
- case 3:
- addr = simple_strtoul(argv[1], NULL, 16);
- boot_device = argv[2];
- break;
- default:
- cmd_usage(cmdtp);
- return 1;
- }
-
- if (!boot_device) {
- puts("\n** No boot device **\n");
- return 1;
- }
-
- dev = simple_strtoul(boot_device, &ep, 16);
- stor_dev = usb_stor_get_dev(dev);
- if (stor_dev->type == DEV_TYPE_UNKNOWN) {
- printf("\n** Device %d not available\n", dev);
- return 1;
- }
- if (stor_dev->block_read == NULL) {
- printf("storage device not initialized. Use usb scan\n");
- return 1;
- }
- if (*ep) {
- if (*ep != ':') {
- puts("\n** Invalid boot device, use `dev[:part]' **\n");
- return 1;
- }
- part = simple_strtoul(++ep, NULL, 16);
- }
-
- if (get_partition_info(stor_dev, part, &info)) {
- /* try to boot raw .... */
- strncpy((char *)&info.type[0], BOOT_PART_TYPE,
- sizeof(BOOT_PART_TYPE));
- strncpy((char *)&info.name[0], "Raw", 4);
- info.start = 0;
- info.blksz = 0x200;
- info.size = 2880;
- printf("error reading partinfo...try to boot raw\n");
- }
- if ((strncmp((char *)info.type, BOOT_PART_TYPE,
- sizeof(info.type)) != 0) &&
- (strncmp((char *)info.type, BOOT_PART_COMP,
- sizeof(info.type)) != 0)) {
- printf("\n** Invalid partition type \"%.32s\""
- " (expect \"" BOOT_PART_TYPE "\")\n",
- info.type);