Example #1
0
void c_start(void)
{
	/* Main C entry point */
	loader.kernel_size = (uint32_t)&kernel_end - (uint32_t)&kernel_start;
	loader.initrd_start = (uint32_t)&fs_start;
	loader.initrd_size = (uint32_t)&fs_end - (uint32_t)&fs_start;
	loader.kernel_entry = (uint32_t)&kernel_entry;
	if (loader.kernel_size) {
		loader.cmdline_start = (uint32_t)&kernel_cmd;
		loader.cmdline_size = &kernel_cmd_end - &kernel_cmd;
	}
	load_kernel(&loader);

	/* Start the kernel */
	if(loader.fdt_start) {
		boot_kernel(&loader, 0, -1, loader.fdt_start, 0);
	} else {
		boot_kernel(&loader, 0, PLAT_ID, loader.atags_start, 0);
	}

	semi_write0("[bootwrapper] ERROR: returned from boot_kernel\n");
}
Example #2
0
int get_command(void)
{
	char command[10];

	while(1){
		printf("\n\rPlease select a command(input number)\n\r");
		printf("1: boot linux kernel\n\r"); 
		printf("2: format nand flash\n\r"); 
		printf("3: download linux kernel\n\r"); 

		gets(command);

		if(strcmp(command, "1") == 0){		
			boot_kernel();
		}
		if(strcmp(command, "2") == 0){
			format_nand();
		}
		if(strcmp(command, "3") == 0){
			down_kernel();
		}
	}
	return 0;
}
Example #3
0
/**********************************************************
 * Execute menu item
 * int index , the index of menu_items[] to execute.
 * return -2 means index great than all menu item in array menu_items.
 * retunr -1 means missing some parameter of current menu item, or 
 * parameter of current menu item was incorrect.
 * return 0 means successfully execute the menu item.
 *********************************************************/
int load_kernel_from_menu(Menu_Item* pItem)
{
	char cmd[1025];
	int is_root = 0;
	int stat;

	if (pItem == NULL)
	{
		return -1;
	}
	
	if (pItem->kernel == NULL || pItem->kernel[0] == '\0')
	{
		return -1;
	}
	
	if (pItem != NULL && pItem->root[0] != '\0')
	{
		is_root = 1;
	}
		
	printf("Now booting the %s\n", pItem->title);
	if(pItem->kernel[0] != '\0')
	{
		memset(cmd, 0, sizeof(cmd));
		strncpy(cmd, pItem->kernel, 5);
#if 0
		if (is_root && strcasecmp(cmd, "/dev/") != 0 && cmd[0] != '(')
		{
			sprintf(cmd, "load %s/%s", pItem->root, pItem->kernel);
		}
		else
		{
			sprintf(cmd, "load %s", pItem->kernel);
		}
#endif
		if (is_root && strcasecmp(cmd, "/dev/") != 0 && cmd[0] != '(')
		{
			sprintf(cmd, "%s/%s", pItem->root, pItem->kernel);
		}
		else
		{
			strcpy(cmd, pItem->kernel);
		}

#ifdef MENU_DEBUG
		printf("%s\n",cmd);
#endif
//		stat=do_cmd(cmd);
		stat = boot_kernel(cmd, 0, NULL, 0);
#ifdef MENU_DEBUG
		printf("Load Kernel return %d\n",stat);
#endif
		if(stat)
			return -1;
	}
	else
	{
		printf("No kernel to load for current menu item.\n");
		return -1;
	}
	
	return 0;
}
static uint32_t
twostop_main_firmware(struct twostop_fmap *fmap, void *gbb,
		      crossystem_data_t *cdata, void *vb_shared_data)
{
	VbError_t err;
	VbSelectAndLoadKernelParams kparams;
	VbCommonParams cparams;
	size_t size = 0;

#ifdef CONFIG_BOOTSTAGE_STASH
	bootstage_unstash((void *)CONFIG_BOOTSTAGE_STASH,
			CONFIG_BOOTSTAGE_STASH_SIZE);
#endif
	bootstage_mark_name(BOOTSTAGE_VBOOT_TWOSTOP_MAIN_FIRMWARE,
			"twostop_main_firmware");
	if (twostop_init_cparams(fmap, gbb, vb_shared_data, &cparams)) {
		VBDEBUG("failed to init cparams\n");
		return TWOSTOP_SELECT_ERROR;
	}

	/*
	 * Note that in case "kernel" is not found in the device tree, the
	 * "size" value is going to remain unchanged.
	 */
	kparams.kernel_buffer = cros_fdtdec_alloc_region(gd->fdt_blob,
		"kernel", &size);
	kparams.kernel_buffer_size = size;

	VBDEBUG("kparams:\n");
	VBDEBUG("- kernel_buffer:      : %p\n", kparams.kernel_buffer);
	VBDEBUG("- kernel_buffer_size: : %08x\n",
			kparams.kernel_buffer_size);

#ifdef CONFIG_EXYNOS_DISPLAYPORT
	/*
	 * Make sure the LCD is up before we load the kernel. Partly this
	 * is because VbSelectAndLoadKernel may do a software sync.
	 */
	exynos_lcd_check_next_stage(gd->fdt_blob, 1);
#endif

	if ((err = VbSelectAndLoadKernel(&cparams, &kparams))) {
		VBDEBUG("VbSelectAndLoadKernel: %d\n", err);
		switch (err) {
		case VBERROR_SHUTDOWN_REQUESTED:
			return TWOSTOP_SELECT_POWER_OFF;
		case VBERROR_BIOS_SHELL_REQUESTED:
			return TWOSTOP_SELECT_COMMAND_LINE;
		case VBERROR_EC_REBOOT_TO_RO_REQUIRED:
			request_ec_reboot_to_ro();
			return TWOSTOP_SELECT_POWER_OFF;
		}
		return TWOSTOP_SELECT_ERROR;
	}

	VBDEBUG("kparams:\n");
	VBDEBUG("- kernel_buffer:      : %p\n", kparams.kernel_buffer);
	VBDEBUG("- kernel_buffer_size: : %08x\n",
			kparams.kernel_buffer_size);
	VBDEBUG("- disk_handle:        : %p\n", kparams.disk_handle);
	VBDEBUG("- partition_number:   : %08x\n",
			kparams.partition_number);
	VBDEBUG("- bootloader_address: : %08llx\n",
			kparams.bootloader_address);
	VBDEBUG("- bootloader_size:    : %08x\n",
			kparams.bootloader_size);
	VBDEBUG("- partition_guid:     :");
#ifdef VBOOT_DEBUG
	int i;
	for (i = 0; i < 16; i++)
		VbExDebug(" %02x", kparams.partition_guid[i]);
	VbExDebug("\n");
#endif /* VBOOT_DEBUG */

	/* EC might jump between RO and RW during software sync. We need to
	 * update active EC copy in cdata. */
	set_active_ec_firmware(cdata);
	crossystem_data_dump(cdata);
#if defined(CONFIG_SANDBOX)
	return TWOSTOP_SELECT_COMMAND_LINE;
#else
	boot_kernel(&kparams, cdata);

	/* It is an error if boot_kenel returns */
	return TWOSTOP_SELECT_ERROR;
#endif
}