README.md_defs revision 1.4
11.4Smartin/* $NetBSD: README.md_defs,v 1.4 2020/01/20 21:26:35 martin Exp $ */ 21.1Smartin 31.1SmartinThe following is trying to document the most important machine dependent 41.1Smartindefines used in the sysinst code. 51.1Smartin 61.1Smartin 71.1SmartinIf HAVE_GPT is true, the MD code may limit the space used for the 81.1SmartinGPT at the beginning of the disk to allow e.g. a bootloader 91.1Smartinbeing added after it (see evbarm on allwinner SoCs, u-boot is 101.1Smartincopied at 8k into the image). 111.1Smartin 121.1Smartin/* Size limit for the initial GPT part, in bytes */ 131.1Smartin#define MD_GPT_INITIAL_SIZE (8*1024) 141.1Smartin 151.1Smartin 161.1SmartinThe default installation description is created as a static array using 171.1Smartinlots of conditionals. It may be overriden / replaced in the MD code 181.1Smartin(see below), an example for that is arch/i386/md.c when we have been 191.1Smartinbooted from UEFI firmware. 201.1Smartin 211.1SmartinName Value / example Description 221.1SmartinPART_BOOT (8*MEG) (undefined) if defined, a boot partition 231.1Smartin of this size (in bytes, rounded) 241.1Smartin will be part of the default partition 251.1Smartin suggestions. Must be compile time 261.1Smartin const! Use MD_PART_DEFAULTS if 271.1Smartin runtime adjustment is needed. 281.1SmartinPART_BOOT_MOUNT "/boot" (undefined) Add boot partition to fstab for 291.1Smartin this mount point 301.1SmartinPART_BOOT_TYPE FS_BSDFS Kind of filesystem used 311.1SmartinPART_BOOT_SUBT MBR_PTYPE_FAT12 File system specific sub type 321.1Smartin 331.1Smartin 341.1SmartinThe boot partition is always inserted at the front of the suggested default 351.1Smartinpartitions, to cope with firmwares that may not be able to load from the 361.1Smartinwhole disk. 371.1Smartin 381.1SmartinIf multiple boot partitions are required (see ofppc, where various schemes 391.1Smartinare supported, depending on exact model), the variables above can all be 401.1Smartinrepeated with _BOOT1_ or _BOOT2_ name instead of _BOOT_. 411.1Smartin 421.1Smartin 431.1SmartinATTENTION: 441.1Smartin PART_BOOT is in BYTE (not MB), while most other sizes 451.1Smartin (DEFROOTSIZE, DEFSWAP, ...) are in MB! 461.1Smartin 471.1Smartin 481.1SmartinThe following macros provide optional MD hooks: 491.1Smartin 501.1SmartinMD_PART_DEFAULTS may be undefined 511.1Smartin 521.1Smartinused like: 531.1Smartin 541.1Smartin void MD_PART_DEFAULTS(struct pm_dev*, struct part_usage_info*, 551.1Smartin size_t num_usage_infos), 561.1Smartin 571.1SmartinCalled before any of the partition usage defaults is ever used, can be used 581.1Smartinto adjust e.g. partition sizes to actual system requirements (align boot 591.1Smartinpartition with cylindersize), or (since it is a macro and all params are 601.1Smartinby references) to completely swap the defaults (e.g. EFI vs. biosboot). 611.1SmartinIf swapping, make sure allocation and num_usage_infos stays consistent, 621.1Smartinold allocation is done by calloc(3), use free(3) to release. 631.1Smartin 641.1Smartin 651.1SmartinMD_NEED_BOOTBLOCK may be undefined 661.1Smartin 671.1Smartinused like: 681.1Smartin 691.1Smartin bool MD_NEED_BOOTBLOCK(struct install_partition_desc *install) 701.1Smartin 711.1Smartinreturns true if this setup needs boot blocks. Used for example on x86 721.1Smartinwhen UEFI installs do not need any bootblocks, but BIOS ones do. 731.1Smartin 741.4SmartinMD_MAY_SWAP_TO may be undefined 751.4Smartin 761.4Smartinused like: 771.4Smartin 781.4Smartin bool MD_MAY_SWAP_TO(const char *disk_name) 791.4Smartin 801.4Smartinreturns true if the disk is usable as a swap device. Typical implementation 811.4Smartinin utils.c:may_swap_if_not_sdmmc. 821.4Smartin 831.4SmartinMD_SET_EXTRACT_FINALIZE may be undefined 841.4Smartin 851.4Smartinused like: 861.4Smartin 871.4Smartin int MD_SET_EXTRACT_FINALIZE(int update) 881.4Smartin 891.4Smartinextracts any additional parts of the distribution. Returns an error code 901.4Smartinif something fails. 911.4Smartin 921.1Smartin 931.1SmartinHAVE_PLAIN_DISKLABEL_BOOT may be undefined, only used on architectures 941.1Smartin that have MBR as primary with disklabel as 951.1Smartin secondary partitioning scheme (RAW_PART != 2) 961.1Smartin 971.1Smartinused like: 981.1Smartin 991.1Smartin bool HAVE_PLAIN_DISKLABEL_BOOT(const char *disk) 1001.1Smartin 1011.1Smartinreturns true if the disk could be made bootable with only a disklabel 1021.1Smartin(and no MBR). 1031.1Smartin 1041.2Smartin 1051.2SmartinDISKLABEL_NO_ONDISK_VERIFY usually undefined 1061.2Smartin 1071.2SmartinIf defined, do not verify the presence of on-disk disklabels before 1081.2Smartinoffering the disklabel partitioning scheme. This allows ports to use 1091.3Sisakikernel translation for the disklabel ioctls (e.g. x68k uses Human68k 1101.2Smartinpartitions this way). 1111.4Smartin 1121.4Smartin 1131.4SmartinHAVE_GPT_BOOT defined if the architecture can boot from GPT 1141.4Smartin 1151.4SmartinNO_DISKLABEL_BOOT defined if the architecture can NOT boot 1161.4Smartin from a disklabel partitioned disk 117