ulg decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p) { output_data = (uch *) output_start; free_mem_ptr = free_mem_ptr_p; free_mem_ptr_end = free_mem_ptr_end_p; disable_watchdog(); arch_decomp_setup(); /* initialize clock */ HAL_CLOCK_INITIALIZE(RTC_PERIOD); printf("MicroRedBoot v1.4, (c) 2009 DD-WRT.COM (%s REVISION %s)\n", __DATE__,SVN_REVISION); printf("keep the reset button pushed to enter redboot!\n"); printf("CPU Type: Atheros AR%s\n",get_system_type()); printf("CPU Clock: %dMhz\n", cpu_frequency() / 1000000); nvram_init(); char *ddboard = nvram_get("DD_BOARD"); if (ddboard) printf("Board: %s\n", ddboard); char *resetbutton = nvram_get("resetbutton_enable"); if (resetbutton && !strcmp(resetbutton, "0")) puts("reset button manual override detected! (nvram var resetbutton_enable=0)\n"); if (resetTouched() || (resetbutton && !strcmp(resetbutton, "0"))) { puts("Reset Button triggered\nBooting Recovery RedBoot\n"); int count = 5; while (count--) { if (!resetTouched()) // check if reset button is unpressed again break; udelay(1000000); } if (count <= 0) { puts("reset button 5 seconds pushed, erasing nvram\n"); if (!flashdetect()) flash_erase_nvram(flashsize, NVRAM_SPACE); } bootoffset = 0x800004bc; resettrigger = 0; puts("loading"); lzma_unzip(); puts("\n\n\n"); return output_ptr; } else { flashdetect(); linuxaddr = getLinux(); puts("Booting Linux\n"); resettrigger = 1; /* important, enable ethernet bus, if the following lines are not initialized linux will not be able to use the ethernet mac, taken from redboot source */ enable_ethernet(); puts("loading"); lzma_unzip(); set_cmdline(); } }
ulg decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p, int arch_id) { output_data = (uch *)output_start; /* Points to kernel start */ free_mem_ptr = free_mem_ptr_p; free_mem_end_ptr = free_mem_ptr_end_p; __machine_arch_type = arch_id; arch_decomp_setup(); putstr("Uncompressing Linux..."); gunzip(input_data, input_data_end - input_data, NULL); putstr(" done, booting the kernel.\n"); return output_ptr; }
ulg decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p, int arch_id) { #ifdef CONFIG_SERIAL_IT8712 unsigned char *addr; #endif output_data = (uch *)output_start; /* Points to kernel start */ free_mem_ptr = free_mem_ptr_p; free_mem_ptr_end = free_mem_ptr_end_p; __machine_arch_type = arch_id; arch_decomp_setup(); #ifdef CONFIG_SERIAL_IT8712 InitLPCInterface(); LPCSetConfig(0, 0x02, 0x01); LPCSetConfig(LDN_SERIAL1, 0x30, 0x1); LPCSetConfig(LDN_SERIAL1, 0x23, 0x0); it8712_uart_base = IT8712_IO_BASE; it8712_uart_base += ((LPCGetConfig(LDN_SERIAL1, 0x60) << 8) + LPCGetConfig(LDN_SERIAL1, 0x61)); do { addr = (unsigned char *)(it8712_uart_base + UART_LCR) ; *addr = 0x80; // Set Baud Rate addr = (unsigned char *)(it8712_uart_base+UART_DLL); *addr = 0x06 ; addr = (unsigned char *)(it8712_uart_base+UART_DLM); *addr = 0x00 ; addr = (unsigned char *)(it8712_uart_base+UART_LCR); // LCR *addr = 0x07 ; addr = (unsigned char *)(it8712_uart_base+UART_MCR); // MCR *addr = 0x08 ; addr = (unsigned char *)(it8712_uart_base+UART_FCR); // FCR *addr = 0x01 ; } while(0); #endif printf("DD-WRT LZMA Loader v1.0\nArch ID is %d\n",arch_id); printf("Uncompressing Linux"); lzma_unzip(); printf("\ndone, booting the kernel.\n"); return output_ptr; }
unsigned long decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p, unsigned long free_mem_ptr_end_p) { unsigned char *tmp; output_data = (unsigned char *)output_start; free_mem_ptr = free_mem_ptr_p; free_mem_end_ptr = free_mem_ptr_end_p; arch_decomp_setup(); tmp = (unsigned char *) (((unsigned long)input_data_end) - 4); output_ptr = get_unaligned_le32(tmp); arch_decomp_puts("Uncompressing Linux..."); decompress(input_data, input_data_end - input_data, NULL, NULL, output_data, NULL, error); arch_decomp_puts(" done, booting the kernel.\n"); return output_ptr; }