Path: blob/main/usr.sbin/bsdinstall/partedit/partedit_efi.c
104817 views
/*1* Copyright (C) 2016 Cavium Inc.2* All rights reserved.3*4* Developed by Semihalf.5* Based on work by Nathan Whitehorn.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10* 1. Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15*16* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND17* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE18* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE19* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE20* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL21* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS22* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)23* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT24* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY25* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF26* SUCH DAMAGE.27*/2829#include <sys/types.h>30#include <string.h>3132#include "partedit.h"3334/*35* partedit implementation for platforms on which the installer only offers36* UEFI-based boot. Currently, this includes arm64 and RISC-V.37*/3839/* EFI partition size in bytes */40#define EFI_BOOTPART_SIZE (260 * 1024 * 1024)4142const char *43default_scheme(void)44{4546return ("GPT");47}4849int50is_scheme_bootable(const char *part_type)51{5253if (strcmp(part_type, "GPT") == 0)54return (1);5556return (0);57}5859int60is_fs_bootable(const char *part_type, const char *fs)61{6263if (strcmp(fs, "freebsd-ufs") == 0)64return (1);6566return (0);67}6869size_t70bootpart_size(const char *scheme)71{7273/* We only support GPT with EFI */74if (strcmp(scheme, "GPT") != 0)75return (0);7677return (EFI_BOOTPART_SIZE);78}7980const char *81bootpart_type(const char *scheme, const char **mountpoint)82{8384/* Only EFI is supported as boot partition */85*mountpoint = "/boot/efi";86return ("efi");87}8889const char *90bootcode_path(const char *part_type)91{9293return (NULL);94}9596const char *97partcode_path(const char *part_type, const char *fs_type)98{99100/* No boot partition data. */101return (NULL);102}103104105106