Skip to content

Commit 83da30d

Browse files
donmorchenhuacai
authored andcommitted
LoongArch: Fix CMDLINE_EXTEND and CMDLINE_BOOTLOADER handling
On FDT systems these command line processing are already taken care of by early_init_dt_scan_chosen(). Add similar handling to the ACPI (non- FDT) code path to allow these config options to work for ACPI (non-FDT) systems too. Signed-off-by: Zhihong Dong <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent 03c53eb commit 83da30d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

arch/loongarch/kernel/setup.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,25 @@ static void __init bootcmdline_init(char **cmdline_p)
332332
strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
333333

334334
strlcat(boot_command_line, init_command_line, COMMAND_LINE_SIZE);
335+
goto out;
335336
}
336337
#endif
337338

339+
/*
340+
* Append built-in command line to the bootloader command line if
341+
* CONFIG_CMDLINE_EXTEND is enabled.
342+
*/
343+
if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) && CONFIG_CMDLINE[0]) {
344+
strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
345+
strlcat(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
346+
}
347+
348+
/*
349+
* Use built-in command line if the bootloader command line is empty.
350+
*/
351+
if (IS_ENABLED(CONFIG_CMDLINE_BOOTLOADER) && !boot_command_line[0])
352+
strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
353+
338354
out:
339355
*cmdline_p = boot_command_line;
340356
}

0 commit comments

Comments
 (0)