1 // SPDX-License-Identifier: GPL-2.0
3 * bootstr.c: Boot string/argument acquisition from the PROM.
5 * Copyright(C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 * Copyright(C) 1996,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
9 #include <linux/string.h>
10 #include <linux/init.h>
11 #include <asm/oplib.h>
13 /* WARNING: The boot loader knows that these next three variables come one right
14 * after another in the .data section. Do not move this stuff into
15 * the .bss section or it will break things.
18 /* We limit BARG_LEN to 1024 because this is the size of the
19 * 'barg_out' command line buffer in the SILO bootloader.
25 char bootstr_buf
[BARG_LEN
];
27 .bootstr_len
= BARG_LEN
,
30 .bootstr_buf
= CONFIG_CMDLINE
,
35 prom_getbootargs(void)
37 /* This check saves us from a panic when bootfd patches args. */
38 if (bootstr_info
.bootstr_valid
)
39 return bootstr_info
.bootstr_buf
;
40 prom_getstring(prom_chosen_node
, "bootargs",
41 bootstr_info
.bootstr_buf
, BARG_LEN
);
42 bootstr_info
.bootstr_valid
= 1;
43 return bootstr_info
.bootstr_buf
;