Date: Mon, 29 Apr 2019 05:02:50 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r346880 - head/stand/efi/loader Message-ID: <201904290502.x3T52o9H018319@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Mon Apr 29 05:02:50 2019 New Revision: 346880 URL: https://svnweb.freebsd.org/changeset/base/346880 Log: Implement uefi_rootdev If uefi_rootdev is set in the environment, then treat it like a device path. Convert the string to a device path and see if we can find a device that matches. If so, use that device at our root dev no matter what. If it's bad in any way, the boot will fail. Reviewed by: bcran Differential Revision: https://reviews.freebsd.org/D20016 Modified: head/stand/efi/loader/main.c Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Mon Apr 29 05:02:25 2019 (r346879) +++ head/stand/efi/loader/main.c Mon Apr 29 05:02:50 2019 (r346880) @@ -472,13 +472,35 @@ find_currdev(bool do_bootmgr, bool is_last, */ rootdev = getenv("rootdev"); if (rootdev != NULL) { - printf("Setting currdev to configured rootdev %s\n", rootdev); + printf(" Setting currdev to configured rootdev %s\n", + rootdev); set_currdev(rootdev); return (0); } /* - * Second choice: If we can find out image boot_info, and there's + * Second choice: If uefi_rootdev is set, translate that UEFI device + * path to the loader's internal name and use that. + */ + do { + rootdev = getenv("uefi_rootdev"); + if (rootdev == NULL) + break; + devpath = efi_name_to_devpath(rootdev); + if (devpath == NULL) + break; + dp = efiblk_get_pdinfo_by_device_path(devpath); + efi_devpath_free(devpath); + if (dp == NULL) + break; + printf(" Setting currdev to UEFI path %s\n", + rootdev); + set_currdev_pdinfo(dp); + return (0); + } while (0); + + /* + * Third choice: If we can find out image boot_info, and there's * a follow-on boot image in that boot_info, use that. In this * case root will be the partition specified in that image and * we'll load the kernel specified by the file path. Should there
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904290502.x3T52o9H018319>