Re: [PATCH 05/19] LoongArch: Add boot and setup routines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 27 Jul 2021 at 14:41, Arnd Bergmann <arnd@xxxxxxxx> wrote:
>
> On Tue, Jul 27, 2021 at 1:53 PM Huacai Chen <chenhuacai@xxxxxxxxx> wrote:
> > On Tue, Jul 6, 2021 at 6:16 PM Arnd Bergmann <arnd@xxxxxxxx> wrote:
> > > On Tue, Jul 6, 2021 at 6:18 AM Huacai Chen <chenhuacai@xxxxxxxxxxx> wrote:
> > >
> > > > +
> > > > +#ifdef CONFIG_64BIT
> > > > +       /* Guess if the sign extension was forgotten by bootloader */
> > > > +       if (start < CAC_BASE)
> > > > +               start = (int)start;
> > > > +#endif
> > > > +       initrd_start = start;
> > > > +       initrd_end += start;
> > > > +       return 0;
> > > > +}
> > > > +early_param("rd_start", rd_start_early);
> > > > +
> > > > +static int __init rd_size_early(char *p)
> > > > +{
> > > > +       initrd_end += memparse(p, &p);
> > > > +       return 0;
> > > > +}
> > > > +early_param("rd_size", rd_size_early);
> > >
> > > The early parameters should not be used for this, I'm fairly sure the UEFI
> > > boot protocol already has ways to communicate all necessary information.
> > We use grub to boot the Linux kernel. We found X86 uses private data
> > structures (seems not UEFI-specific) to pass initrd information from
> > grub to kernel. Some archs use fdt, and other archs use cmdline with
> > "initrd=start,size" (init/do_mounts_initrd.c). So, I think use cmdline
> > is not unacceptable, but we do can remove the the rd_start/rd_size
> > parsing code here
>
> (adding Ard Biesheuvel to Cc for clarification)
>
> As far as I understand it, this should be using the kernel's UEFI stub
> as documented in Documentation/admin-guide/efi-stub.rst
>

That document describes how the EFI stub can load an initrd from the
partition that the kernel image itself was loaded from.

After loading it, the EFI stub still needs to tell the kernel proper
where the initrd lives in memory, and it uses either struct bootparam
(x86) or DT's /chosen node (other arches) for this.

I think we should avoid inventing yet another way of passing this
information, but if the architecture in question does not use DT (and
is != x86), I don't think we have a choice. Does this system boot via
EFI to begin with?


> This lets you load the initrd from within the kernel and pass the
> address using the architecture specific boot information.
>
> Maybe I misunderstood and you already do it like this?
>
>        Arnd



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux