[PATCH 1/1] RISC-V: Change signature header field to use `.ascii` instead of opcode

Palmer Dabbelt palmer at dabbelt.com
Thu Jan 20 11:06:43 PST 2022


On Mon, 17 Jan 2022 17:25:40 PST (-0800), atishp at atishpatra.org wrote:
> On Mon, Jan 17, 2022 at 11:00 AM Jessica Clarke <jrtc27 at jrtc27.com> wrote:
>>
>> On 17 Jan 2022, at 17:39, Florian Wagner <florian.wagner at nextsilicon.com> wrote:
>> >
>> > The `MZ` in the signature header field is now encoded via `.ascii` to make
>> > the kernel compile without the `c` extension.
>> >
>> > Signed-off-by: Florian Wagner <florian.wagner at nextsilicon.com>
>> > Signed-off-by: Yaron Dinkin <yaron.dinkin at nextsilicon.com>
>> > ---
>> > arch/riscv/kernel/head.S | 2 +-
>> > 1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
>> > index f52f01ecbeea..931b63464b90 100644
>> > --- a/arch/riscv/kernel/head.S
>> > +++ b/arch/riscv/kernel/head.S
>> > @@ -48,7 +48,7 @@ ENTRY(_start)
>> >       /*
>> >        * This instruction decodes to "MZ" ASCII required by UEFI.
>> >        */
>> > -     c.li s4,-13
>> > +     .ascii "MZ"
>> >       j _start_kernel
>>
>> CONFIG_EFI has select RISCV_ISA_C, so this doesn’t seem to achieve
>> anything? If you then remove that select, well, you get an EFI binary
>> that works, but if you jump to it directly as a non-EFI binary then
>> you’ll trap on a non-RVC system as that won’t be a valid instruction.
>> So I think this needs more explanation and discussion.
>>
>
> Here is the previous discussion regarding this.
>
> http://lists.infradead.org/pipermail/linux-riscv/2021-March/004998.html
>
> TLDR, there is no cleaner way to support both EFI & non-UEFI booting
> on a platform
> without C extension. Linux kernel anyways recommend rv64gc for platforms.

Yep, though if there's a use case for yes-EFI, no-C then we could always 
allow users to build EFI-only kernels (as pointed out in the thread).  
Is there hardware that actually does that?



More information about the linux-riscv mailing list