Commit 2b8f2d4165de7095b58927138458b8d30775891e
1 parent
59c0149b
Optionally setup old style linux bootparams for -kernel, by Juergen Lock.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3089 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
89 additions
and
1 deletions
hw/arm_boot.c
@@ -76,6 +76,77 @@ static void set_kernel_args(uint32_t ram_size, int initrd_size, | @@ -76,6 +76,77 @@ static void set_kernel_args(uint32_t ram_size, int initrd_size, | ||
76 | stl_raw(p++, 0); | 76 | stl_raw(p++, 0); |
77 | } | 77 | } |
78 | 78 | ||
79 | +static void set_kernel_args_old(uint32_t ram_size, int initrd_size, | ||
80 | + const char *kernel_cmdline, | ||
81 | + target_phys_addr_t loader_start) | ||
82 | +{ | ||
83 | + uint32_t *p; | ||
84 | + unsigned char *s; | ||
85 | + | ||
86 | + /* see linux/include/asm-arm/setup.h */ | ||
87 | + p = (uint32_t *)(phys_ram_base + KERNEL_ARGS_ADDR); | ||
88 | + /* page_size */ | ||
89 | + stl_raw(p++, 4096); | ||
90 | + /* nr_pages */ | ||
91 | + stl_raw(p++, ram_size / 4096); | ||
92 | + /* ramdisk_size */ | ||
93 | + stl_raw(p++, 0); | ||
94 | +#define FLAG_READONLY 1 | ||
95 | +#define FLAG_RDLOAD 4 | ||
96 | +#define FLAG_RDPROMPT 8 | ||
97 | + /* flags */ | ||
98 | + stl_raw(p++, FLAG_READONLY | FLAG_RDLOAD | FLAG_RDPROMPT); | ||
99 | + /* rootdev */ | ||
100 | + stl_raw(p++, (31 << 8) | 0); /* /dev/mtdblock0 */ | ||
101 | + /* video_num_cols */ | ||
102 | + stl_raw(p++, 0); | ||
103 | + /* video_num_rows */ | ||
104 | + stl_raw(p++, 0); | ||
105 | + /* video_x */ | ||
106 | + stl_raw(p++, 0); | ||
107 | + /* video_y */ | ||
108 | + stl_raw(p++, 0); | ||
109 | + /* memc_control_reg */ | ||
110 | + stl_raw(p++, 0); | ||
111 | + /* unsigned char sounddefault */ | ||
112 | + /* unsigned char adfsdrives */ | ||
113 | + /* unsigned char bytes_per_char_h */ | ||
114 | + /* unsigned char bytes_per_char_v */ | ||
115 | + stl_raw(p++, 0); | ||
116 | + /* pages_in_bank[4] */ | ||
117 | + stl_raw(p++, 0); | ||
118 | + stl_raw(p++, 0); | ||
119 | + stl_raw(p++, 0); | ||
120 | + stl_raw(p++, 0); | ||
121 | + /* pages_in_vram */ | ||
122 | + stl_raw(p++, 0); | ||
123 | + /* initrd_start */ | ||
124 | + if (initrd_size) | ||
125 | + stl_raw(p++, loader_start + INITRD_LOAD_ADDR); | ||
126 | + else | ||
127 | + stl_raw(p++, 0); | ||
128 | + /* initrd_size */ | ||
129 | + stl_raw(p++, initrd_size); | ||
130 | + /* rd_start */ | ||
131 | + stl_raw(p++, 0); | ||
132 | + /* system_rev */ | ||
133 | + stl_raw(p++, 0); | ||
134 | + /* system_serial_low */ | ||
135 | + stl_raw(p++, 0); | ||
136 | + /* system_serial_high */ | ||
137 | + stl_raw(p++, 0); | ||
138 | + /* mem_fclk_21285 */ | ||
139 | + stl_raw(p++, 0); | ||
140 | + /* zero unused fields */ | ||
141 | + memset(p, 0, 256 + 1024 - | ||
142 | + (p - ((uint32_t *)(phys_ram_base + KERNEL_ARGS_ADDR)))); | ||
143 | + s = phys_ram_base + KERNEL_ARGS_ADDR + 256 + 1024; | ||
144 | + if (kernel_cmdline) | ||
145 | + strcpy (s, kernel_cmdline); | ||
146 | + else | ||
147 | + stb_raw(s, 0); | ||
148 | +} | ||
149 | + | ||
79 | void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename, | 150 | void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename, |
80 | const char *kernel_cmdline, const char *initrd_filename, | 151 | const char *kernel_cmdline, const char *initrd_filename, |
81 | int board_id, target_phys_addr_t loader_start) | 152 | int board_id, target_phys_addr_t loader_start) |
@@ -140,6 +211,11 @@ void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename, | @@ -140,6 +211,11 @@ void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename, | ||
140 | bootloader[6] = entry; | 211 | bootloader[6] = entry; |
141 | for (n = 0; n < sizeof(bootloader) / 4; n++) | 212 | for (n = 0; n < sizeof(bootloader) / 4; n++) |
142 | stl_raw(phys_ram_base + (n * 4), bootloader[n]); | 213 | stl_raw(phys_ram_base + (n * 4), bootloader[n]); |
143 | - set_kernel_args(ram_size, initrd_size, kernel_cmdline, loader_start); | 214 | + if (old_param) |
215 | + set_kernel_args_old(ram_size, initrd_size, | ||
216 | + kernel_cmdline, loader_start); | ||
217 | + else | ||
218 | + set_kernel_args(ram_size, initrd_size, | ||
219 | + kernel_cmdline, loader_start); | ||
144 | } | 220 | } |
145 | } | 221 | } |
vl.c
@@ -197,6 +197,9 @@ const char *option_rom[MAX_OPTION_ROMS]; | @@ -197,6 +197,9 @@ const char *option_rom[MAX_OPTION_ROMS]; | ||
197 | int nb_option_roms; | 197 | int nb_option_roms; |
198 | int semihosting_enabled = 0; | 198 | int semihosting_enabled = 0; |
199 | int autostart = 1; | 199 | int autostart = 1; |
200 | +#ifdef TARGET_ARM | ||
201 | +int old_param = 0; | ||
202 | +#endif | ||
200 | const char *qemu_name; | 203 | const char *qemu_name; |
201 | int alt_grab = 0; | 204 | int alt_grab = 0; |
202 | #ifdef TARGET_SPARC | 205 | #ifdef TARGET_SPARC |
@@ -6801,6 +6804,7 @@ enum { | @@ -6801,6 +6804,7 @@ enum { | ||
6801 | QEMU_OPTION_semihosting, | 6804 | QEMU_OPTION_semihosting, |
6802 | QEMU_OPTION_name, | 6805 | QEMU_OPTION_name, |
6803 | QEMU_OPTION_prom_env, | 6806 | QEMU_OPTION_prom_env, |
6807 | + QEMU_OPTION_old_param, | ||
6804 | }; | 6808 | }; |
6805 | 6809 | ||
6806 | typedef struct QEMUOption { | 6810 | typedef struct QEMUOption { |
@@ -6902,6 +6906,9 @@ const QEMUOption qemu_options[] = { | @@ -6902,6 +6906,9 @@ const QEMUOption qemu_options[] = { | ||
6902 | #if defined(TARGET_SPARC) | 6906 | #if defined(TARGET_SPARC) |
6903 | { "prom-env", HAS_ARG, QEMU_OPTION_prom_env }, | 6907 | { "prom-env", HAS_ARG, QEMU_OPTION_prom_env }, |
6904 | #endif | 6908 | #endif |
6909 | +#if defined(TARGET_ARM) | ||
6910 | + { "old-param", 0, QEMU_OPTION_old_param }, | ||
6911 | +#endif | ||
6905 | { NULL }, | 6912 | { NULL }, |
6906 | }; | 6913 | }; |
6907 | 6914 | ||
@@ -7676,6 +7683,10 @@ int main(int argc, char **argv) | @@ -7676,6 +7683,10 @@ int main(int argc, char **argv) | ||
7676 | nb_prom_envs++; | 7683 | nb_prom_envs++; |
7677 | break; | 7684 | break; |
7678 | #endif | 7685 | #endif |
7686 | +#ifdef TARGET_ARM | ||
7687 | + case QEMU_OPTION_old_param: | ||
7688 | + old_param = 1; | ||
7689 | +#endif | ||
7679 | } | 7690 | } |
7680 | } | 7691 | } |
7681 | } | 7692 | } |
vl.h
@@ -164,6 +164,7 @@ extern int graphic_rotate; | @@ -164,6 +164,7 @@ extern int graphic_rotate; | ||
164 | extern int no_quit; | 164 | extern int no_quit; |
165 | extern int semihosting_enabled; | 165 | extern int semihosting_enabled; |
166 | extern int autostart; | 166 | extern int autostart; |
167 | +extern int old_param; | ||
167 | extern const char *bootp_filename; | 168 | extern const char *bootp_filename; |
168 | 169 | ||
169 | #define MAX_OPTION_ROMS 16 | 170 | #define MAX_OPTION_ROMS 16 |