> From: Aleksandar Markovic <aleksandar.marko...@rt-rk.com> > Sent: Monday, August 6, 2018 7:00 PM > Subject: [PATCH v7 56/80] mips_malta: Add basic nanoMIPS boot code for MIPS' > Malta > > From: Matthew Fortune <matthew.fort...@mips.com> > > Added very very basic nanoMIPS boot code but this is hacked in > unconditionally currently. > > Signed-off-by: Yongbok Kim <yongbok....@mips.com> > Signed-off-by: Aleksandar Markovic <amarko...@wavecomp.com> > Signed-off-by: Stefan Markovic <smarko...@wavecomp.com> > --- > hw/mips/mips_malta.c | 75 > +++++++++++++++++++++++++++++++++++++++++++++++----- > 1 file changed, 69 insertions(+), 6 deletions(-) > > diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c > > @@ -813,10 +865,16 @@ static int64_t load_kernel (void) > NULL, (uint64_t *)&kernel_entry, NULL, > (uint64_t *)&kernel_high, big_endian, EM_MIPS, 1, > 0); > if (kernel_size < 0) { > - error_report("could not load kernel '%s': %s", > - loaderparams.kernel_filename, > - load_elf_strerror(kernel_size)); > - exit(1); > + kernel_size = load_elf(loaderparams.kernel_filename, > + cpu_mips_kseg0_to_phys, NULL, > + (uint64_t *)&kernel_entry, NULL, > + (uint64_t *)&kernel_high, big_endian, EM_NANOMIPS, 1, 0); > + if (kernel_size < 0) { > + error_report("could not load kernel '%s': %s", > + loaderparams.kernel_filename, > + load_elf_strerror(kernel_size)); > + exit(1); > + } > } >
Instead of invoking load_elf() twice, in load_elf32 (aka glue(load_elf, SZ)), there should be something like this: case EM_MIPS: case EM_NANOMIPS: if ((ehdr.e_machine != EM_MIPS) && (ehdr.e_machine != EM_NANOMIPS)) { ret = ELF_LOAD_WRONG_ARCH; goto fail; } } break; In any case, Malta board should work with both EM_MIPS and EM_NANOMIPS. Please make sure both cases are well understood and tested.