Commit f5a5cca35b3d8d198b7f41de3fc543f9bf25d0a6

Authored by edgar_igl
1 parent 8ab94444

ETRAX-FS: Add support for passing kernel command lines

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5516 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 15 additions and 2 deletions
hw/etraxfs.c
... ... @@ -119,11 +119,13 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size,
119 119 }
120 120  
121 121 if (kernel_filename) {
122   - uint64_t entry;
  122 + uint64_t entry, high;
  123 + int kcmdline_len;
  124 +
123 125 /* Boots a kernel elf binary, os/linux-2.6/vmlinux from the axis
124 126 devboard SDK. */
125 127 kernel_size = load_elf(kernel_filename, -0x80000000LL,
126   - &entry, NULL, NULL);
  128 + &entry, NULL, &high);
127 129 bootstrap_pc = entry;
128 130 if (kernel_size < 0) {
129 131 /* Takes a kimage from the axis devboard SDK. */
... ... @@ -132,6 +134,17 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size,
132 134 env->regs[9] = 0x40004000 + kernel_size;
133 135 }
134 136 env->regs[8] = 0x56902387; /* RAM init magic. */
  137 +
  138 + if (kernel_cmdline && (kcmdline_len = strlen(kernel_cmdline))) {
  139 + if (kcmdline_len > 256) {
  140 + fprintf(stderr, "Too long CRIS kernel cmdline (max 256)\n");
  141 + exit(1);
  142 + }
  143 + pstrcpy_targphys(high, 256, kernel_cmdline);
  144 + /* Let the kernel know we are modifying the cmdline. */
  145 + env->regs[10] = 0x87109563;
  146 + env->regs[11] = high;
  147 + }
135 148 }
136 149 env->pc = bootstrap_pc;
137 150  
... ...