/*
 * boot zImage
 * setup linux parameter , command line, and the boot linux from addr 
 * addr : base address of linux zImage
 */
int boot_zimage(ulong addr)
{
	int ret __attribute__((unused));
	ulong boot_mem_base;	/* base address of bootable memory 嘎唱? */
	ulong to;
	ulong mach_type;

	boot_mem_base = SDRAM_START;
	to = addr;

	if (*(ulong *)(to + 9*4) != LINUX_ZIMAGE_MAGIC) {
		printf("Warning: this binary is not compressed linux kernel image\n");
		printf("zImage magic = 0x%08lx\n", *(ulong *)(to + 9*4));
	} else {
		printf("zImage magic = 0x%08lx\n", *(ulong *)(to + 9*4));
	}

	/* Setup linux parameters and linux command line */
	setup_linux_param(boot_mem_base + LINUX_PARAM_OFFSET);

	/* Get machine type */
	mach_type = MACH_TYPE_TQ2440;

	printf("\nnow, booting linux......\n");	
	call_linux(0, mach_type, to);

	return 0;	
}
Example #2
0
int linux(void)
{
	int taglist = 0x30000100;
	void (*fp)(int, int, int);
	
	// load linux kernel from flash 1M: -> SDRAM 0x30008000 (size = 2M)
	puts("load linux kernel from flash 0x30000: -> SDRAM 0x30008000 (size = 2M) \n");
	//nand_read(0x30000, (char *)0x30008000, 0x200000);	
	
	fp = (void (*)(int, int, int))0x30008000;
	
	puts("linux go to 0x30008000\n");
	
	setup_linux_param(taglist);
	fp(0, 193, taglist);
	
	return 0;
}
int boot_zImage(long from, int size)
{
	//puts("BootingLinux2\n\r");
	int ret;
	long boot_mem_base;	/* base address of bootable memory */
	long to;
	long mach_type;

	boot_mem_base = 0x30000000;

	/* copy kerne image */
	to = boot_mem_base + LINUX_KERNEL_OFFSET;
	puts("Copy linux kernel from 0x00200000 to 0x30008000, size = 0x40000 .....\n\r ");
	ret = copy_kernel_img(to, (char *)from, size);
	if (ret) {
		puts("failed\n\r");
		return -1;
	} else {
		puts("Copy Kernel to SDRAM done,\n\r");
	}

	if (*(long *)(to + 9*4) != LINUX_ZIMAGE_MAGIC) {
		puts("Warning: this binary is not compressed linux kernel image\n");
		puts("zImage magic = 0x%08lx\n", *(long *)(to + 9*4));
	} else {
//		puts("zImage magic = 0x%08lx\n", *(long *)(to + 9*4));
		;
	}

	/* Setup linux parameters and linux command line */
	setup_linux_param(boot_mem_base + LINUX_PARAM_OFFSET);

	/* Get machine type */
	mach_type = MACH_TYPE_S3C2440;
	puts("MACH_TYPE = 168\n\r");

	/* Go Go Go */
	puts("NOW, Booting Linux......\n");	
	call_linux(0, mach_type, to);

	return 0;	
}