Skip to content

Commit 817c21a

Browse files
committed
powerpc/powernv: Get kernel command line accross OPAL takeover
We stash it in boot_command_line which isn't in BSS and so won't be overwritten. We then use that as a default cmd_line before we walk the device-tree. Signed-off-by: Benjamin Herrenschmidt <[email protected]>
1 parent 27f4488 commit 817c21a

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

arch/powerpc/kernel/prom.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,13 @@ void __init early_init_devtree(void *params)
712712
of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL);
713713
#endif
714714

715+
/* Pre-initialize the cmd_line with the content of boot_commmand_line,
716+
* which will be empty except when the content of the variable has
717+
* been overriden by a bootloading mechanism. This happens typically
718+
* with HAL takeover
719+
*/
720+
strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
721+
715722
/* Retrieve various informations from the /chosen node of the
716723
* device-tree, including the platform type, initrd location and
717724
* size, TCE reserve, and more ...

arch/powerpc/kernel/prom_init.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,10 @@ static void prom_opal_takeover(void)
14491449
opal_addr = top_addr;
14501450
args->hal_addr = opal_addr;
14511451

1452+
/* Copy the command line to the kernel image */
1453+
strlcpy(RELOC(boot_command_line), RELOC(prom_cmd_line),
1454+
COMMAND_LINE_SIZE);
1455+
14521456
prom_debug(" k_image = 0x%lx\n", args->k_image);
14531457
prom_debug(" k_size = 0x%lx\n", args->k_size);
14541458
prom_debug(" k_entry = 0x%lx\n", args->k_entry);

arch/powerpc/kernel/prom_init_check.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ _end enter_prom memcpy memset reloc_offset __secondary_hold
2121
__secondary_hold_acknowledge __secondary_hold_spinloop __start
2222
strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224
2323
reloc_got2 kernstart_addr memstart_addr linux_banner _stext
24-
opal_query_takeover opal_do_takeover opal_enter_rtas opal_secondary_entry"
24+
opal_query_takeover opal_do_takeover opal_enter_rtas opal_secondary_entry
25+
boot_command_line"
2526

2627
NM="$1"
2728
OBJ="$2"

0 commit comments

Comments
 (0)