git: eaed7ff9d014 - stable/13 - kboot: Fetch hostfs_root and bootdev from the environment
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 24 Jan 2023 22:14:32 UTC
The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=eaed7ff9d014a7707181719fe6f0cc6c34a34926 commit eaed7ff9d014a7707181719fe6f0cc6c34a34926 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2023-01-13 21:20:56 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2023-01-24 21:49:47 +0000 kboot: Fetch hostfs_root and bootdev from the environment Fetch bootdev from the environment variable (so it should be set on the command line). Default to 'zfs:' which will in the future look for the first zpool that we can boot from. Prior versions of kboot would set this from the second argument on the command line. Fetch hostfs_root from the environment (defaulting to '/'). Prior versions of kboot would set this from the first arg on the command line. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D38010 (cherry picked from commit 4f3be6b8d94a388ce7ae239c785ea447d0adbf48) --- stand/kboot/main.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/stand/kboot/main.c b/stand/kboot/main.c index d333737e164a..9a0f8b8baf69 100644 --- a/stand/kboot/main.c +++ b/stand/kboot/main.c @@ -172,6 +172,9 @@ main(int argc, const char **argv) heapbase = host_getmem(heapsize); setheap(heapbase, heapbase + heapsize); + /* Parse the command line args -- ignoring for now the console selection */ + parse_args(argc, argv); + /* * Set up console. */ @@ -180,8 +183,20 @@ main(int argc, const char **argv) /* Initialize all the devices */ devinit(); - /* Parse the command line args -- ignoring for now the console selection */ - parse_args(argc, argv); + bootdev = getenv("bootdev"); + if (bootdev == NULL) + bootdev="zfs:"; + hostfs_root = getenv("hostfs_root"); + if (hostfs_root == NULL) + hostfs_root = "/"; +#if defined(LOADER_ZFS_SUPPORT) + if (strcmp(bootdev, "zfs:") == 0) { + /* + * Pseudo device that says go find the right ZFS pool. + */ + printf("WARNING: bare 'zfs:' for boot device not yet implemented\n"); + } +#endif printf("Boot device: %s with hostfs_root %s\n", bootdev, hostfs_root);