xref: /netbsd/usr.sbin/sysinst/README.md_defs (revision 9afb46c6)
1/* $NetBSD: README.md_defs,v 1.1 2019/08/14 12:49:37 martin Exp $ */
2
3The following is trying to document the most important machine dependent
4defines used in the sysinst code.
5
6
7If HAVE_GPT is true, the MD code may limit the space used for the
8GPT at the beginning of the disk to allow e.g. a bootloader
9being added after it (see evbarm on allwinner SoCs, u-boot is
10copied at 8k into the image).
11
12/* Size limit for the initial GPT part, in bytes */
13#define	MD_GPT_INITIAL_SIZE		(8*1024)
14
15
16The default installation description is created as a static array using
17lots of conditionals. It may be overriden / replaced in the MD code
18(see below), an example for that is arch/i386/md.c when we have been
19booted from UEFI firmware.
20
21Name		Value / example		Description
22PART_BOOT	(8*MEG) (undefined)	if defined, a boot partition
23					of this size (in bytes, rounded)
24					will be part of the default partition
25					suggestions. Must be compile time
26					const! Use MD_PART_DEFAULTS if
27					runtime adjustment is needed.
28PART_BOOT_MOUNT	"/boot" (undefined)	Add boot partition to fstab for
29					this mount point
30PART_BOOT_TYPE	FS_BSDFS		Kind of filesystem used
31PART_BOOT_SUBT	MBR_PTYPE_FAT12		File system specific sub type
32
33
34The boot partition is always inserted at the front of the suggested default
35partitions, to cope with firmwares that may not be able to load from the
36whole disk.
37
38If multiple boot partitions are required (see ofppc, where various schemes
39are supported, depending on exact model), the variables above can all be
40repeated with _BOOT1_ or _BOOT2_ name instead of _BOOT_.
41
42
43ATTENTION:
44	PART_BOOT	is in BYTE (not MB), while most other sizes
45			(DEFROOTSIZE, DEFSWAP, ...) are in MB!
46
47
48The following macros provide optional MD hooks:
49
50MD_PART_DEFAULTS	may be undefined
51
52used like:
53
54	void MD_PART_DEFAULTS(struct pm_dev*, struct part_usage_info*,
55	    size_t num_usage_infos),
56
57Called before any of the partition usage defaults is ever used, can be used
58to adjust e.g. partition sizes to actual system requirements (align boot
59partition with cylindersize), or (since it is a macro and all params are
60by references) to completely swap the defaults (e.g. EFI vs. biosboot).
61If swapping, make sure allocation and num_usage_infos stays consistent,
62old allocation is done by calloc(3), use free(3) to release.
63
64
65MD_NEED_BOOTBLOCK	may be undefined
66
67used like:
68
69	bool MD_NEED_BOOTBLOCK(struct install_partition_desc *install)
70
71returns true if this setup needs boot blocks. Used for example on x86
72when UEFI installs do not need any bootblocks, but BIOS ones do.
73
74
75HAVE_PLAIN_DISKLABEL_BOOT	may be undefined, only used on architectures
76				that have MBR as primary with disklabel as
77				secondary partitioning scheme (RAW_PART != 2)
78
79used like:
80
81	bool HAVE_PLAIN_DISKLABEL_BOOT(const char *disk)
82
83returns true if the disk could be made bootable with only a disklabel
84(and no MBR).
85
86