partedit_arm64.c revision 302408
1129202Scognet/* 2129202Scognet * Copyright (C) 2016 Cavium Inc. 3129202Scognet * All rights reserved. 4129202Scognet * 5129202Scognet * Developed by Semihalf. 6129202Scognet * Based on work by Nathan Whitehorn. 7129202Scognet * 8129202Scognet * Redistribution and use in source and binary forms, with or without 9129202Scognet * modification, are permitted provided that the following conditions 10129202Scognet * are met: 11129202Scognet * 1. Redistributions of source code must retain the above copyright 12129202Scognet * notice, this list of conditions and the following disclaimer. 13129202Scognet * 2. Redistributions in binary form must reproduce the above copyright 14129202Scognet * notice, this list of conditions and the following disclaimer in the 15129202Scognet * documentation and/or other materials provided with the distribution. 16129202Scognet * 17129202Scognet * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18129202Scognet * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19129202Scognet * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20129202Scognet * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21129202Scognet * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22129202Scognet * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23129202Scognet * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24129202Scognet * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25129202Scognet * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26129202Scognet * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27129202Scognet * SUCH DAMAGE. 28129202Scognet * 29129202Scognet * $FreeBSD: stable/11/usr.sbin/bsdinstall/partedit/partedit_arm64.c 302025 2016-06-20 06:40:58Z wma $ 30129202Scognet */ 31129202Scognet 32129202Scognet#include <sys/types.h> 33129202Scognet#include <string.h> 34129202Scognet 35129202Scognet#include "partedit.h" 36129202Scognet 37129202Scognet/* EFI partition size in KB */ 38129202Scognet#define EFI_BOOTPART_SIZE (50 * 1024) 39129202Scognet#define EFI_BOOTPART_PATH "/boot/boot1.efifat" 40129202Scognet 41129202Scognetconst char * 42129202Scognetdefault_scheme(void) 43129202Scognet{ 44129202Scognet 45129202Scognet return ("GPT"); 46129202Scognet} 47129202Scognet 48129202Scognetint 49129202Scognetis_scheme_bootable(const char *part_type) 50129202Scognet{ 51129202Scognet 52129202Scognet if (strcmp(part_type, "GPT") == 0) 53129202Scognet return (1); 54129202Scognet 55129202Scognet return (0); 56129202Scognet} 57129202Scognet 58129202Scognetint 59129202Scognetis_fs_bootable(const char *part_type, const char *fs) 60129202Scognet{ 61129202Scognet 62129202Scognet if (strcmp(fs, "freebsd-ufs") == 0) 63129202Scognet return (1); 64129202Scognet 65129202Scognet return (0); 66129202Scognet} 67129202Scognet 68129202Scognetsize_t 69275256Sandrewbootpart_size(const char *scheme) 70275256Sandrew{ 71129202Scognet 72129202Scognet /* We only support GPT with EFI */ 73129202Scognet if (strcmp(scheme, "GPT") != 0) 74129202Scognet return (0); 75129202Scognet 76129202Scognet return ((EFI_BOOTPART_SIZE) * 1024); 77129202Scognet} 78129202Scognet 79129202Scognetconst char * 80129202Scognetbootpart_type(const char *scheme) 81275256Sandrew{ 82137464Scognet 83129202Scognet /* Only EFI is supported as boot partition */ 84129202Scognet return ("efi"); 85129202Scognet} 86129202Scognet 87129202Scognetconst char * 88135682Scognetbootcode_path(const char *part_type) 89135682Scognet{ 90129202Scognet 91129202Scognet return (NULL); 92129202Scognet} 93129202Scognet 94129202Scognetconst char * 95129202Scognetpartcode_path(const char *part_type, const char *fs_type) 96129202Scognet{ 97129202Scognet 98137464Scognet if (strcmp(part_type, "GPT") == 0) 99129202Scognet return (EFI_BOOTPART_PATH); 100137464Scognet 101129202Scognet /* No boot partition data for non-GPT */ 102129202Scognet return (NULL); 103129202Scognet} 104129202Scognet 105129202Scognet