README.md_defs revision 1.3
11.3Sisaki/* $NetBSD: README.md_defs,v 1.3 2019/12/10 06:25:50 isaki 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.1Smartin
751.1SmartinHAVE_PLAIN_DISKLABEL_BOOT	may be undefined, only used on architectures
761.1Smartin				that have MBR as primary with disklabel as
771.1Smartin				secondary partitioning scheme (RAW_PART != 2)
781.1Smartin
791.1Smartinused like:
801.1Smartin
811.1Smartin	bool HAVE_PLAIN_DISKLABEL_BOOT(const char *disk)
821.1Smartin
831.1Smartinreturns true if the disk could be made bootable with only a disklabel
841.1Smartin(and no MBR).
851.1Smartin
861.2Smartin
871.2SmartinDISKLABEL_NO_ONDISK_VERIFY	usually undefined
881.2Smartin
891.2SmartinIf defined, do not verify the presence of on-disk disklabels before
901.2Smartinoffering the disklabel partitioning scheme. This allows ports to use
911.3Sisakikernel translation for the disklabel ioctls (e.g. x68k uses Human68k
921.2Smartinpartitions this way).
93