[External] [PATCH v3 2/2] riscv: kexec_file: Support loading Image binary file

Björn Töpel bjorn at kernel.org
Wed Apr 9 23:40:35 PDT 2025


Hey Yunhui!

yunhui cui <cuiyunhui at bytedance.com> writes:

> Hi Björn,
>
> On Thu, Apr 10, 2025 at 3:31 AM Björn Töpel <bjorn at kernel.org> wrote:

...

>> +       kbuf.buffer = kernel;
>> +       kbuf.bufsz = kernel_len;
>> +       kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
>> +       kbuf.memsz = le64_to_cpu(h->image_size);
>> +       kbuf.buf_align = le64_to_cpu(h->text_offset);
>
> It is necessary to ensure that the kernel entry is aligned to
> PMD_SIZE; otherwise, BUG_ON() in setup_vm() will be triggered.

Indeed, and text_offset is that [1]. FWIW, the text_offset name in the
Image has always weird/confusing to me.


Björn

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/riscv/kernel/head.S#n47




More information about the linux-riscv mailing list