Skip to content

Commit bd0ddcf

Browse files
committed
Revert "of: fdt: Honor CONFIG_CMDLINE* even without /chosen node"
This reverts commit a7d550f. Some arches (PPC at least) don't call early_init_dt_scan_nodes(), so moving the cmdline processing there breaks them. Reported-by: Geoff Levand <[email protected]> Cc: Alexander Sverdlin <[email protected]> Tested-by: Geoff Levand <[email protected]> Reviewed-by: Alexander Sverdlin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring <[email protected]>
1 parent 1d7a4a4 commit bd0ddcf

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

drivers/of/fdt.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,26 @@ int __init early_init_dt_scan_chosen(char *cmdline)
11751175
if (p != NULL && l > 0)
11761176
strscpy(cmdline, p, min(l, COMMAND_LINE_SIZE));
11771177

1178+
/*
1179+
* CONFIG_CMDLINE is meant to be a default in case nothing else
1180+
* managed to set the command line, unless CONFIG_CMDLINE_FORCE
1181+
* is set in which case we override whatever was found earlier.
1182+
*/
1183+
#ifdef CONFIG_CMDLINE
1184+
#if defined(CONFIG_CMDLINE_EXTEND)
1185+
strlcat(cmdline, " ", COMMAND_LINE_SIZE);
1186+
strlcat(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
1187+
#elif defined(CONFIG_CMDLINE_FORCE)
1188+
strscpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
1189+
#else
1190+
/* No arguments from boot loader, use kernel's cmdl*/
1191+
if (!((char *)cmdline)[0])
1192+
strscpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
1193+
#endif
1194+
#endif /* CONFIG_CMDLINE */
1195+
1196+
pr_debug("Command line is: %s\n", (char *)cmdline);
1197+
11781198
rng_seed = of_get_flat_dt_prop(node, "rng-seed", &l);
11791199
if (rng_seed && l > 0) {
11801200
add_bootloader_randomness(rng_seed, l);
@@ -1279,26 +1299,6 @@ void __init early_init_dt_scan_nodes(void)
12791299
if (rc)
12801300
pr_warn("No chosen node found, continuing without\n");
12811301

1282-
/*
1283-
* CONFIG_CMDLINE is meant to be a default in case nothing else
1284-
* managed to set the command line, unless CONFIG_CMDLINE_FORCE
1285-
* is set in which case we override whatever was found earlier.
1286-
*/
1287-
#ifdef CONFIG_CMDLINE
1288-
#if defined(CONFIG_CMDLINE_EXTEND)
1289-
strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
1290-
strlcat(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
1291-
#elif defined(CONFIG_CMDLINE_FORCE)
1292-
strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
1293-
#else
1294-
/* No arguments from boot loader, use kernel's cmdl */
1295-
if (!boot_command_line[0])
1296-
strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
1297-
#endif
1298-
#endif /* CONFIG_CMDLINE */
1299-
1300-
pr_debug("Command line is: %s\n", boot_command_line);
1301-
13021302
/* Setup memory, calling early_init_dt_add_memory_arch */
13031303
early_init_dt_scan_memory();
13041304

0 commit comments

Comments
 (0)