2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 2N/A/* description of required partitions for error reporting of libzfs */ 2N/A * Return whether we are running on a UEFI system. 2N/A * We recognize being on a UEFI system if a property named "efi-systab" 2N/A * exists on root node of device tree. 2N/A * No need to check for this on SPARC since we know it is not a UEFI system. 2N/A * On SPARC machine, we can boot off an EFI/GPT label if OBP has 2N/A * support for it, i.e if a property named "gpt" exists on 2N/A "or di_prom_init failed\n");
2N/A "the OBP on this system does not support booting " 2N/A "Solaris from GPT-partitioned disks. Please contact " 2N/A "Oracle Support for an OBP update");
2N/A * This file path must be synchronized with pybootmgmt: 2N/A * If GRUB2 is installed, return TRUE, otherwise FALSE. This, of 2N/A * course doesn't cover cases where some other entity installed GRUB2 2N/A * elsewhere and is using it to boot the system. For that case, 2N/A * we would need to do deep inspection of the boot devices, which is 2N/A * a whole lot of pain for not much gain. It also doesn't cover the 2N/A * case of GRUB2 being installed in /, but not installed on the boot 2N/A * device. For UEFI systems, we just assume that we're using a GPT- 2N/A * aware boot loader. 2N/A "loader files in the root filesystem could not be " 2N/A "located. The system cannot boot Solaris from " 2N/A "GPT-partitioned disks without GRUB 2");
2N/A /* try to mount the file system, since fstyp is not reliable */ 2N/A /* pick fw-appropriate */ 2N/A /* just pick the first one */ 2N/A else {
/* check MBR */ 2N/A * Detect all conditions where we have an ESP in MBR on 2N/A * the base disk. We should never really get 2N/A * BOOT_REQ_PART_SAME_AS_VDEV. 2N/A * Get the required partition tag, size (in bytes) and a description 2N/A * for the partition for a GPT label. 2N/A * If an efi_vtoc is given, we will return the info on the first partition 2N/A * that matches "any" required boot partition. 2N/A * for desc, we allocate the iarea and caller will need to free it. 2N/A * Otherwise, we return the required partition info based on system requirement 2N/A /* SPARC does not need any GPT required partition */ 2N/A * Get the required partition tag, size (in bytes) and a description 2N/A * for the partition for a Legacy MBR label 2N/A * -1 none is required 2N/A * 0 if one is required 2N/A * handy utility to create a path, takes the give slice path, 2N/A * chops ending sx or px if any, append slice string (e.g "p", or "s") 2N/A * Given an EFI/GPT label, check whether we have the required partition. 2N/A * BOOT_REQ_PART_NOT_REQUIRED if none is required. 2N/A * BOOT_REQ_PART_EXISTS if one is required and exists 2N/A * BOOT_REQ_PART_DOESNOT_EXIST if one is required and does not exist 2N/A * BOOT_ERR error (invalid arg) 2N/A /* make sure we have a pcfs on it */ 2N/A * Given an MBR label, check whether there is a preexisting ESP. 2N/A * BOOT_REQ_PART_NOT_REQUIRED if none is required. 2N/A * BOOT_REQ_PART_EXISTS if one is required and exists 2N/A * BOOT_REQ_PART_DOESNOT_EXIST if one is required and does not exist 2N/A * BOOT_ERR if there was an error. 2N/A/* check all requirements for a bootable VTOC labeled disk on a UEFI system */ 2N/A /* make sure we have a pcfs on it */ 2N/A /* check extended */ 2N/A /* make sure we have a pcfs on it */ 2N/A * check the disk for whether the label has all required boot partitions 2N/A * and whether system support booting off this label type 2N/A * out: labeltype will be set to type of label on the disk: 2N/A * BOOT_ERR if there was an error 2N/A * BOOT_REQ_PART_NOT_REQUIRED 2N/A * BOOT_REQ_PART_EXISTS 2N/A * BOOT_LABEL_SYSTEM_NOT_CAPABLE 2N/A * BOOT_REQ_PART_DOESNOT_EXIST 2N/A * XXX more was added 2N/A "check_disk_boot_label open of %s failed\n",
2N/A /* gpt label, system not gpt boot capable */ 2N/A * if efi_vtoc is set that is the gpt label on the disk 2N/A * if none found 0, or all succeeded