Exemple #1
0
void aboot(unsigned *info)
{
	unsigned bootdevice, n, len;

	board_mux_init();
	sdelay(100);

	scale_vcores();

	prcm_init();
	board_ddr_init();
	gpmc_init();

	board_late_init();

	serial_init();
	serial_puts("\n[ aboot second-stage loader ]\n\n");

	if (info) {
		bootdevice = info[2] & 0xFF;
	} else {
		bootdevice = 0x45;
	}

	switch (bootdevice) {
	case 0x45: /* USB */
		serial_puts("boot device: USB\n\n");
		n = load_from_usb(&len);
		break;
	case 0x05:
	case 0x06:
		serial_puts("boot device: MMC\n\n");
		n = load_from_mmc(bootdevice, &len);
		break;
	default:
		serial_puts("boot device: unknown\n");
		for (;;) ;
	}

	if (n) {
		serial_puts("io error\n");
	} else {
		boot_image(cfg_machine_type, CONFIG_ADDR_DOWNLOAD, len);
		serial_puts("invalid image\n");
	}
}
Exemple #2
0
void aboot(unsigned *info)
{
	unsigned n, len;
	unsigned bootdevice = -1;
	struct bootloader_ops *boot_ops;

	if (info)
		bootdevice = info[2] & 0xFF;
	else
		goto fail;

	boot_ops = boot_common(bootdevice);
	if (!boot_ops)
		goto fail;


#if !WITH_FLASH_BOOT
	n = load_from_usb(&len, &boot_ops->usb);
#else
	unsigned bootdevice;

	if (info) {
		bootdevice = info[2] & 0xFF;
	} else {
		bootdevice = 0x45;
	}

	switch (bootdevice) {
	case 0x45: /* USB */
		serial_puts("boot device: USB\n\n");
		n = load_from_usb(&len, &boot_ops->usb);
		break;
	case 0x05:
	case 0x06:
		serial_puts("boot device: MMC\n\n");
		n = load_from_mmc(boot_ops->storage_ops, &len);
		break;
	default:
		serial_puts("boot device: unknown\n");
		for (;;) ;
	}
#endif

	if (n) {
		serial_puts("*** IO ERROR ***\n");
	} else {
		if (boot_ops->proc_ops->proc_get_type() ==
			(char *)OMAP_TYPE_SEC) {
			void *data = (void *) (CONFIG_ADDR_DOWNLOAD);
			void *sign = (void *) (CONFIG_ADDR_DOWNLOAD +
								len - 280);
			if ((len < 281) || (len > (32 * 1024 * 1024)))
				goto fail_verify;

			len -= 280;

			n = verify(data, len, sign, 2);
			if (n != 0)
				goto fail_verify;

		fail_verify:
			serial_puts("*** SIGNATURE VERIFICATION FAILED ***\n");
			for (;;) ;
		}

		do_booti(boot_ops, "ram", NULL);
		serial_puts("*** BOOT FAILED ***\n");
	}

fail:
	for (;;) ;
}