Commit 713c45faf81f9a68ca589ce37d7e1dee6c2127a2
1 parent
0b9dc5e4
initrd support (Blue Swirl)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1306 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
24 additions
and
1 deletions
hw/sun4m.c
... | ... | @@ -25,6 +25,7 @@ |
25 | 25 | #include "m48t08.h" |
26 | 26 | |
27 | 27 | #define KERNEL_LOAD_ADDR 0x00004000 |
28 | +#define INITRD_LOAD_ADDR 0x00800000 | |
28 | 29 | #define PROM_ADDR 0xffd00000 |
29 | 30 | #define PROM_FILENAMEB "proll.bin" |
30 | 31 | #define PROM_FILENAMEE "proll.elf" |
... | ... | @@ -135,7 +136,8 @@ void sun4m_init(int ram_size, int vga_ram_size, int boot_device, |
135 | 136 | { |
136 | 137 | char buf[1024]; |
137 | 138 | int ret, linux_boot; |
138 | - unsigned long vram_size = 0x100000, prom_offset; | |
139 | + unsigned int i; | |
140 | + unsigned long vram_size = 0x100000, prom_offset, initrd_size; | |
139 | 141 | |
140 | 142 | linux_boot = (kernel_filename != NULL); |
141 | 143 | |
... | ... | @@ -180,5 +182,26 @@ void sun4m_init(int ram_size, int vga_ram_size, int boot_device, |
180 | 182 | kernel_filename); |
181 | 183 | exit(1); |
182 | 184 | } |
185 | + | |
186 | + /* load initrd */ | |
187 | + initrd_size = 0; | |
188 | + if (initrd_filename) { | |
189 | + initrd_size = load_image(initrd_filename, phys_ram_base + INITRD_LOAD_ADDR); | |
190 | + if (initrd_size < 0) { | |
191 | + fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", | |
192 | + initrd_filename); | |
193 | + exit(1); | |
194 | + } | |
195 | + } | |
196 | + if (initrd_size > 0) { | |
197 | + for (i = 0; i < 64 * TARGET_PAGE_SIZE; i += TARGET_PAGE_SIZE) { | |
198 | + if (ldl_raw(phys_ram_base + KERNEL_LOAD_ADDR + i) | |
199 | + == 0x48647253) { // HdrS | |
200 | + stl_raw(phys_ram_base + KERNEL_LOAD_ADDR + i + 16, INITRD_LOAD_ADDR); | |
201 | + stl_raw(phys_ram_base + KERNEL_LOAD_ADDR + i + 20, initrd_size); | |
202 | + break; | |
203 | + } | |
204 | + } | |
205 | + } | |
183 | 206 | } |
184 | 207 | } | ... | ... |