Re: [PATCH v3] LoongArch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER

From: Huacai Chen
Date: Tue Jul 11 2023 - 21:19:46 EST


On Tue, Jul 11, 2023 at 11:27 PM ‎ donmor <donmor3000@xxxxxxxxxxx> wrote:
>
> 在 2023-07-11星期二的 22:26 +0800,Huacai Chen写道:
>
> ...
> > + if (IS_ENABLED(CONFIG_CMDLINE_EXTEND)) {
> > > + strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> > > + strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
> > > + strlcat(boot_command_line, init_command_line, COMMAND_LINE_SIZE);
> > You can simply the logic:
> > strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
> > strlcat(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> > And then modify the comments because you are appending built-in parts
> > to bootloader parts.
> >
> I think the command line retrieved from bootloader should be placed after the
> built-in one so that it can override params in the latter.
config CMDLINE_EXTEND
bool "Use built-in to extend bootloader kernel arguments"

The fdt version also uses this logic, but you are using bootloader
parts to extend built-in parts.

>
> > > }
> > > +
> > > + if (IS_ENABLED(CONFIG_CMDLINE_BOOTLOADER) && !boot_command_line[0])
> > > + strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> > This should be removed if you want to keep the exact meaning of
> > CONFIG_CMDLINE_BOOTLOADER.
> >
> > Huacai
> >
> Do you mean 'IS_ENABLED(CONFIG_CMDLINE_BOOTLOADER) && ' is not necessary? And I
> think the rest of this part should be here, because CONFIG_CMDLINE_BOOTLOADER
> won't append anything to boot_command_line unless it is empty, according to its
> description.

OK, you are right here.

Huacai