Ejemplo n.º 1
0
Archivo: initrd.c Proyecto: 08opt/linux
static int __init read_initrd(void)
{
	void *area;
	long long size;
	int err;

	if (initrd == NULL)
		return 0;

	err = os_file_size(initrd, &size);
	if (err)
		return 0;

	/*
	 * This is necessary because alloc_bootmem craps out if you
	 * ask for no memory.
	 */
	if (size == 0) {
		printk(KERN_ERR "\"%s\" is a zero-size initrd\n", initrd);
		return 0;
	}

	area = alloc_bootmem(size);
	if (area == NULL)
		return 0;

	if (load_initrd(initrd, area, size) == -1)
		return 0;

	initrd_start = (unsigned long) area;
	initrd_end = initrd_start + size;
	return 0;
}
Ejemplo n.º 2
0
void mpc8560_boot_linux(){
	/* Fixme, will move it to skyeye.conf */
	load_initrd();
	set_bootcmd();

	/* just for linux boot, so we need to do some map */
	setup_boot_map();
	gCPU.ccsr = 0xE0000; /* Just for boot linux */
}
Ejemplo n.º 3
0
/* This is the C kernel entry point */
void kmain(struct multiboot *mboot_header, addr_t initial_stack)
{
	/* Store passed values, and initiate some early things
	 * We want serial log output as early as possible */
	kernel_state_flags=0;
	mtboot = mboot_header;
	i_stack = initial_stack;
	parse_kernel_elf(mboot_header, &kernel_elf);
#if CONFIG_MODULES
	init_kernel_symbols();
#endif
	init_serial();
	console_init_stage1();
	load_tables();
	puts("~ SeaOS Version ");	
	char ver[32];
	get_kernel_version(ver);
	puts(ver);
	puts(" Booting Up ~\n\r");
#if CONFIG_MODULES
	init_module_system();
#endif
	init_syscalls();
	load_initrd(mtboot);
	install_timer(1000);
	pm_init(placement, mtboot);
	init_main_cpu_1();

	/* Now get the management stuff going */
	printk(1, "[kernel]: Starting system management\n");
	init_memory(mtboot);
	init_main_cpu_2();
	console_init_stage2();
	parse_kernel_cmd((char *)(addr_t)mtboot->cmdline);
	init_multitasking();
	init_cache();
	init_dm();
	init_vfs();
	/* Load the rest... */
	process_initrd();
	init_kern_task();
	get_timed(&kernel_start_time);
	printk(KERN_MILE, "[kernel]: Kernel is setup (%2.2d:%2.2d:%2.2d, %s, kv=%d, ts=%d bytes: ok)\n", 
	       kernel_start_time.tm_hour, kernel_start_time.tm_min, 
	       kernel_start_time.tm_sec, kernel_name, KVERSION, sizeof(task_t));
	assert(!set_int(1));
	if(!fork())
		init();
	sys_setsid();
	enter_system(255);
	kernel_idle_task();
}
Ejemplo n.º 4
0
int linux_load(struct sys_info *info, const char *file, const char *cmdline)
{
    struct linux_header hdr;
    struct linux_params *params;
    uint32_t kern_addr, kern_size;
    char *initrd_file = NULL;

    fd = open_io(file);
    if (fd == -1) {
	return -1;
    }

    kern_addr = load_linux_header(&hdr);
    if (kern_addr == 0)
	return LOADER_NOT_SUPPORT;

    params = phys_to_virt(LINUX_PARAM_LOC);
    init_linux_params(params, &hdr);
    set_memory_size(params, info);
    initrd_file = parse_command_line(cmdline, phys_to_virt(COMMAND_LINE_LOC));
    set_command_line_loc(params, &hdr);

    kern_size = load_linux_kernel(&hdr, kern_addr);
    if (kern_size == 0) {
	if (initrd_file)
	    free(initrd_file);
	return -1;
    }

    if (initrd_file) {
	if (load_initrd(&hdr, info, kern_addr+kern_size, params, initrd_file)
		!= 0) {
	    free(initrd_file);
	    return -1;
	}
	free(initrd_file);
    }

    hardware_setup();

    start_linux(kern_addr, params);
    return 0;
}