1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

riscv: always initialize the static kernel environment

Ensure we initialize the static environment when not booting via
loader(8), and provide a static buffer if this is the case. This fixes
two issues.

First, performing the initialization ensures that kenv variables set in
the kernel's config file are honored. Previously, any new or overridden
values were ignored.

Second, providing the static buffer allows variables to be set in the
device tree's bootargs property of the chosen node. This can be set by
u-boot or by QEMU's '-append' flag. Attempting to this prior to this
change resulted in an early panic, since the static environment had no
buffer backing it.

Submitted by:	syrinx (earlier version)
Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D25034
This commit is contained in:
Mitchell Horne 2020-11-20 15:21:10 +00:00
parent 6936779347
commit 08241f9192
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367896

View File

@ -130,6 +130,8 @@ cpuset_t all_harts;
extern int *end;
static char static_kenv[PAGE_SIZE];
static void
cpu_startup(void *dummy)
{
@ -836,6 +838,8 @@ parse_metadata(void)
kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
if (kern_envp != NULL)
init_static_kenv(kern_envp, 0);
else
init_static_kenv(static_kenv, sizeof(static_kenv));
#ifdef DDB
ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t);
ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t);