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