int start_linux(void) { void (*theKernel)(uint32_t zero, uint32_t arch, uint32_t *params); uint32_t i = 0, j = 0,ret; uint32_t *exec_at = ZIMAGE_LOAD_ADDRESS; uint32_t *parm_at = (uint32_t *)( DRAM_BASE + 0x100) ; // 256 bytes away from the base address of DRAM uint32_t machine_type; debug_print("about to copy linux image to load address: "); uart_print_address(exec_at); ret = load_image((uint32_t)ZIMAGE_START_BLOCK_NUMBER,(uint32_t*)exec_at,(uint16_t)ZIMAGE_BLOCK_SIZE); /* copy image into RAM */ debug_print("done copying linux image ...\n\r\0"); // debug_print("about to copy ramdisk image ..."); // load_image((uint32_t*) INITRD_LOAD_ADDRESS, INITRD_LOAD_END_ADDRESS);/* copy initial ramdisk image into RAM */ // debug_print("done copying ramdisk image ..."); debug_print("setting up ATAGS ...\n\r\0"); setup_tags(parm_at); /* sets up parameters */ machine_type = 3466; /* get machine type */ theKernel = (void (*)(uint32_t, uint32_t, uint32_t*))exec_at; /* set the kernel address */ debug_print("jumping to the kernel ... brace yourself!\n\r\0"); asm("mrc p15, 0, r1, c1, c0, 0"); /* Read Control Register configuration data*/ asm("bic r1, r1, #(0x1 << 12)"); /* Disable I Cache*/ asm("bic r1, r1, #(0x1 << 2)"); /* Disable D Cache*/ asm("mcr p15, 0, r1, c1, c0, 0"); /* Write Control Register configuration data*/ theKernel(0, machine_type, parm_at); /* jump to kernel with register set */ return 0; }
//control passed here from bootTestCrt.S after creating stack int boot(){ uint32 *STORE1 = (uint32 *)0x4090002c; //Use RTC alarms as uint32 *STORE2 = (uint32 *)0x40900030; // storage for debugging int i,j; *STORE1 = 0x98765; setupLEDs(); setLEDs(GREEN); uint32 *kernel = (uint32 *)(RAM_START + KERNEL_OFFSET); uint32 *tags = (uint32 *)(RAM_START + TAGS_OFFSET); uint32 cs; setLEDs(GREEN); //now we need to copy the kernel code to where it likes to be cs = copyMem((uint32*)kernel_start,kernel, (kernel_end - kernel_start)); if(cs != KERN_CHECKSUM) error(5,0); setup_tags(tags); setLEDs(BLUE); uint32 mtype = MACH_TYPE_HPIPAQ214; void (*theKernel)(uint32 zero, uint32 mtype, uint32 *tags); theKernel = (void (*)(uint32, uint32, uint32 *))kernel; /* set the kernel address */ theKernel(0, mtype, tags); /* jump to kernel with register set */ death: __asm("nop"); goto death; }
int start_linux(void) { void (*theKernel)(uint32_t zero, uint32_t arch, uint32_t *params); uint32_t i = 0, j = 0,ret; load_addr = (uint32_t) ZIMAGE_LOAD_ADDRESS; uint32_t *exec_at = ZIMAGE_LOAD_ADDRESS; uint32_t *parm_at = (uint32_t *)( DRAM_BASE + 0x100) ; // 256 bytes away from the base address of DRAM uint32_t machine_type; // debug_print("about to copy linux image to load address: "); // uart_print_address(exec_at); // ret = load_image((uint32_t)ZIMAGE_START_BLOCK_NUMBER,(uint32_t*)exec_at,(uint16_t)2666); /* copy image into RAM */ // debug_print("done copying linux image ...\n\r"); // debug_print("about to copy ramdisk image ..."); // load_image((uint32_t*) INITRD_LOAD_ADDRESS, INITRD_LOAD_END_ADDRESS);/* copy initial ramdisk image into RAM */ // debug_print("done copying ramdisk image ..."); theKernel = (void (*)(uint32_t, uint32_t, uint32_t*))exec_at; /* set the kernel address */ print_format("Setting up timers next ...\n\r"); init_system_timer(); init_timer(); // uint32_t start_time = get_timer(0); // // while(1){ // print_format("time difference in ms is %d\n\r",start_time - get_timer(0)); // udelay(1000000); // } print_format("fetching kernel ... \n\r"); net_loop(TFTPGET); // net_loop(ARP); print_format("kernel loaded to RAM ...\n\r"); debug_print("setting up ATAGS ...\n\r"); setup_tags(parm_at); /* sets up parameters */ machine_type = 3466; /* get machine type */ debug_print("jumping to the kernel ... brace yourself!\n\r\0"); asm("mrc p15, 0, r1, c1, c0, 0"); /* Read Control Register configuration data*/ asm("bic r1, r1, #(0x1 << 12)"); /* Disable I Cache*/ asm("bic r1, r1, #(0x1 << 2)"); /* Disable D Cache*/ asm("mcr p15, 0, r1, c1, c0, 0"); /* Write Control Register configuration data*/ theKernel(0, machine_type, parm_at); /* jump to kernel with registers set */ // uint32_t start_time = get_timer(0); // while(1){ // print_format("time difference in ms is %d\n\r",get_timer(start_time)); // udelay(1000000); // } return 0; }