1*545236f4Snia /* $NetBSD: md.h,v 1.11 2024/04/09 15:17:25 nia Exp $ */ 250dbef1aSdholland 350dbef1aSdholland /* 450dbef1aSdholland * Copyright 1997 Piermont Information Systems Inc. 550dbef1aSdholland * All rights reserved. 650dbef1aSdholland * 750dbef1aSdholland * Written by Philip A. Nelson for Piermont Information Systems Inc. 850dbef1aSdholland * 950dbef1aSdholland * Redistribution and use in source and binary forms, with or without 1050dbef1aSdholland * modification, are permitted provided that the following conditions 1150dbef1aSdholland * are met: 1250dbef1aSdholland * 1. Redistributions of source code must retain the above copyright 1350dbef1aSdholland * notice, this list of conditions and the following disclaimer. 1450dbef1aSdholland * 2. Redistributions in binary form must reproduce the above copyright 1550dbef1aSdholland * notice, this list of conditions and the following disclaimer in the 1650dbef1aSdholland * documentation and/or other materials provided with the distribution. 1750dbef1aSdholland * 3. The name of Piermont Information Systems Inc. may not be used to endorse 1850dbef1aSdholland * or promote products derived from this software without specific prior 1950dbef1aSdholland * written permission. 2050dbef1aSdholland * 2150dbef1aSdholland * THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``AS IS'' 2250dbef1aSdholland * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2350dbef1aSdholland * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2450dbef1aSdholland * ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE 2550dbef1aSdholland * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2650dbef1aSdholland * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2750dbef1aSdholland * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2850dbef1aSdholland * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2950dbef1aSdholland * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3050dbef1aSdholland * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 3150dbef1aSdholland * THE POSSIBILITY OF SUCH DAMAGE. 3250dbef1aSdholland * 3350dbef1aSdholland */ 3450dbef1aSdholland 3550dbef1aSdholland /* md.h -- Machine specific definitions for the i386 */ 3650dbef1aSdholland 3750dbef1aSdholland 3850dbef1aSdholland #include <machine/cpu.h> 3950dbef1aSdholland #include <sys/types.h> 4050dbef1aSdholland #include <sys/stat.h> 4150dbef1aSdholland #include <sys/bootblock.h> 4250dbef1aSdholland #include <fcntl.h> 4350dbef1aSdholland #include <unistd.h> 4450dbef1aSdholland 4550dbef1aSdholland /* i386 uses the mbr code. */ 4650dbef1aSdholland #include "mbr.h" 4750dbef1aSdholland 4850dbef1aSdholland /* constants and defines */ 49de7834a3Smartin #define DEFROOTSIZE 128 /* Default root size */ 50de7834a3Smartin #define DEFUSRSIZE 0 /* Default /usr size, if /home */ 51de7834a3Smartin #define XNEEDMB 300 /* Extra megs for full X installation */ 52de7834a3Smartin #define DEBNEEDMB 1400 /* Extra megs for debug sets */ 5350dbef1aSdholland 54de7834a3Smartin #define DEFSWAPSIZE (-1) 5550dbef1aSdholland 5650dbef1aSdholland /* use UFS2 by default for ffs */ 5750dbef1aSdholland #define DEFAULT_UFS2 5850dbef1aSdholland 5950dbef1aSdholland /* have support for booting from UFS2 */ 6050dbef1aSdholland #define HAVE_UFS2_BOOT 6150dbef1aSdholland 624103857bSmartin /* have support for booting from GPT disks */ 634103857bSmartin #define HAVE_GPT_BOOT 644103857bSmartin 6550dbef1aSdholland /* allow using tmpfs for /tmp instead of mfs */ 6650dbef1aSdholland #define HAVE_TMPFS 6750dbef1aSdholland 6850dbef1aSdholland /* have file system specific primary boot loader */ 6950dbef1aSdholland #define HAVE_BOOTXX_xFS 7050dbef1aSdholland #define BOOTXXDIR "/usr/mdec" 7150dbef1aSdholland #define BOOTXX_FFSV1 "bootxx_ffsv1" 7250dbef1aSdholland #define BOOTXX_FFSV2 "bootxx_ffsv2" 737935b6fcSpgoyette #define BOOTXX_LFSV2 "bootxx_lfsv2" 7450dbef1aSdholland 7550dbef1aSdholland 7650dbef1aSdholland /* 7750dbef1aSdholland * Default filesets to fetch and install during installation 7850dbef1aSdholland * or upgrade. The standard sets are: 79*545236f4Snia * base base32 etc comp games gpufw man manhtml misc rescue tests text 80*545236f4Snia * xbase xcomp xetc xfont xserver 8150dbef1aSdholland * 8250dbef1aSdholland * x86_64 has the MD set kern first, because generic kernels are too 8350dbef1aSdholland * big to fit on install floppies. 8450dbef1aSdholland * 8550dbef1aSdholland * Third entry is the last extension name in the split sets for loading 8650dbef1aSdholland * from floppy. 8750dbef1aSdholland */ 8850dbef1aSdholland #define SET_KERNEL_1_NAME "kern-GENERIC" 892f0931afSmartin #define SET_KERNEL_2_NAME "kern-GENERIC_KASLR" 9050dbef1aSdholland 9150dbef1aSdholland #define SET_KERNEL_GENERIC SET_KERNEL_1 9250dbef1aSdholland 9350dbef1aSdholland /* 9450dbef1aSdholland * Machine-specific command to write a new label to a disk. 9550dbef1aSdholland * For example, i386 uses "/sbin/disklabel -w -r", just like i386 9650dbef1aSdholland * miniroot scripts, though this may leave a bogus incore label. 9750dbef1aSdholland * Sun ports should probably use DISKLABEL_CMD "/sbin/disklabel -w" 9850dbef1aSdholland * to get incore to ondisk inode translation for the Sun proms. 9950dbef1aSdholland * If not defined, we assume the port does not support disklabels and 10050dbef1aSdholland * hand-edited disklabel will NOT be written by MI code. 10150dbef1aSdholland * 10250dbef1aSdholland * On amd64, do what the 1.2 install scripts did. 10350dbef1aSdholland */ 10450dbef1aSdholland #define DISKLABEL_CMD "disklabel -w -r" 10550dbef1aSdholland 10650dbef1aSdholland #define _PATH_MBR DEFAULT_BOOTDIR "/" DEFAULT_BOOTCODE 10750dbef1aSdholland #define _PATH_BOOTSEL DEFAULT_BOOTDIR "/" DEFAULT_BOOTSELCODE 10850dbef1aSdholland 10950dbef1aSdholland extern struct mbr_bootsel *mbs; 11050dbef1aSdholland 11150dbef1aSdholland 11250dbef1aSdholland /* 11350dbef1aSdholland * prototypes for MD code. 11450dbef1aSdholland */ 11532ea71a6Smartin 11632ea71a6Smartin /* 11732ea71a6Smartin * When we do an UEFI install, we have completely different default 11832ea71a6Smartin * partitions and need to adjust the description at runtime. 11932ea71a6Smartin */ 12032ea71a6Smartin void x86_md_part_defaults(struct pm_devs*, struct part_usage_info**, 12132ea71a6Smartin size_t *num_usage_infos); 1222f0931afSmartin 12332ea71a6Smartin #define MD_PART_DEFAULTS(A,B,C) x86_md_part_defaults(A,&(B),&(C)) 12432ea71a6Smartin 12532ea71a6Smartin /* no need to install bootblock if installing for UEFI */ 12632ea71a6Smartin bool x86_md_need_bootblock(struct install_partition_desc *install); 12732ea71a6Smartin #define MD_NEED_BOOTBLOCK(A) x86_md_need_bootblock(A) 12832ea71a6Smartin 1292f0931afSmartin /* post-process boot.cfg for KASLR if that kernel has been selected */ 1302f0931afSmartin void amd64_md_boot_cfg_finalize(const char*); 1312f0931afSmartin #define MD_BOOT_CFG_FINALIZE(P) amd64_md_boot_cfg_finalize(P) 132325b9996Smartin 133325b9996Smartin #define HAVE_EFI_BOOT 1 /* we support EFI boot partitions */ 134325b9996Smartin 135