|
1 | 1 | /* |
2 | | - * Misc. bootloader code for many machines. |
3 | | - * |
4 | 2 | * Copyright 2001 MontaVista Software Inc. |
5 | | - * Author: Matt Porter <mporter@mvista.com> Derived from |
6 | | - * arch/ppc/boot/prep/misc.c |
| 3 | + * Author: Matt Porter <mporter@mvista.com> |
7 | 4 | * |
8 | 5 | * Copyright (C) 2009 Lemote, Inc. |
9 | 6 | * Author: Wu Zhangjin <wuzhangjin@gmail.com> |
|
19 | 16 |
|
20 | 17 | #include <asm/addrspace.h> |
21 | 18 |
|
22 | | -/* These two variables specify the free mem region |
| 19 | +/* |
| 20 | + * These two variables specify the free mem region |
23 | 21 | * that can be used for temporary malloc area |
24 | 22 | */ |
25 | 23 | unsigned long free_mem_ptr; |
26 | 24 | unsigned long free_mem_end_ptr; |
27 | | -char *zimage_start; |
28 | 25 |
|
29 | 26 | /* The linker tells us where the image is. */ |
30 | 27 | extern unsigned char __image_begin, __image_end; |
@@ -83,38 +80,31 @@ void *memset(void *s, int c, size_t n) |
83 | 80 |
|
84 | 81 | void decompress_kernel(unsigned long boot_heap_start) |
85 | 82 | { |
86 | | - int zimage_size; |
87 | | - |
88 | | - /* |
89 | | - * We link ourself to an arbitrary low address. When we run, we |
90 | | - * relocate outself to that address. __image_beign points to |
91 | | - * the part of the image where the zImage is. -- Tom |
92 | | - */ |
93 | | - zimage_start = (char *)(unsigned long)(&__image_begin); |
| 83 | + unsigned long zimage_start, zimage_size; |
| 84 | + |
| 85 | + zimage_start = (unsigned long)(&__image_begin); |
94 | 86 | zimage_size = (unsigned long)(&__image_end) - |
95 | 87 | (unsigned long)(&__image_begin); |
96 | 88 |
|
97 | | - /* |
98 | | - * The zImage and initrd will be between start and _end, so they've |
99 | | - * already been moved once. We're good to go now. -- Tom |
100 | | - */ |
101 | 89 | puts("zimage at: "); |
102 | | - puthex((unsigned long)zimage_start); |
| 90 | + puthex(zimage_start); |
103 | 91 | puts(" "); |
104 | | - puthex((unsigned long)(zimage_size + zimage_start)); |
| 92 | + puthex(zimage_size + zimage_start); |
105 | 93 | puts("\n"); |
106 | 94 |
|
107 | | - /* this area are prepared for mallocing when decompressing */ |
| 95 | + /* This area are prepared for mallocing when decompressing */ |
108 | 96 | free_mem_ptr = boot_heap_start; |
109 | 97 | free_mem_end_ptr = boot_heap_start + BOOT_HEAP_SIZE; |
110 | 98 |
|
111 | | - /* Display standard Linux/MIPS boot prompt for kernel args */ |
| 99 | + /* Display standard Linux/MIPS boot prompt */ |
112 | 100 | puts("Uncompressing Linux at load address "); |
113 | 101 | puthex(VMLINUX_LOAD_ADDRESS_ULL); |
114 | 102 | puts("\n"); |
| 103 | + |
115 | 104 | /* Decompress the kernel with according algorithm */ |
116 | | - decompress(zimage_start, zimage_size, 0, 0, |
| 105 | + decompress((char *)zimage_start, zimage_size, 0, 0, |
117 | 106 | (void *)VMLINUX_LOAD_ADDRESS_ULL, 0, error); |
118 | | - /* FIXME: is there a need to flush cache here? */ |
| 107 | + |
| 108 | + /* FIXME: should we flush cache here? */ |
119 | 109 | puts("Now, booting the kernel...\n"); |
120 | 110 | } |
0 commit comments