README.md_defs revision 1.4 1 /* $NetBSD: README.md_defs,v 1.4 2020/01/20 21:26:35 martin Exp $ */
2
3 The following is trying to document the most important machine dependent
4 defines used in the sysinst code.
5
6
7 If HAVE_GPT is true, the MD code may limit the space used for the
8 GPT at the beginning of the disk to allow e.g. a bootloader
9 being added after it (see evbarm on allwinner SoCs, u-boot is
10 copied 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
16 The default installation description is created as a static array using
17 lots 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
19 booted from UEFI firmware.
20
21 Name Value / example Description
22 PART_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.
28 PART_BOOT_MOUNT "/boot" (undefined) Add boot partition to fstab for
29 this mount point
30 PART_BOOT_TYPE FS_BSDFS Kind of filesystem used
31 PART_BOOT_SUBT MBR_PTYPE_FAT12 File system specific sub type
32
33
34 The boot partition is always inserted at the front of the suggested default
35 partitions, to cope with firmwares that may not be able to load from the
36 whole disk.
37
38 If multiple boot partitions are required (see ofppc, where various schemes
39 are supported, depending on exact model), the variables above can all be
40 repeated with _BOOT1_ or _BOOT2_ name instead of _BOOT_.
41
42
43 ATTENTION:
44 PART_BOOT is in BYTE (not MB), while most other sizes
45 (DEFROOTSIZE, DEFSWAP, ...) are in MB!
46
47
48 The following macros provide optional MD hooks:
49
50 MD_PART_DEFAULTS may be undefined
51
52 used like:
53
54 void MD_PART_DEFAULTS(struct pm_dev*, struct part_usage_info*,
55 size_t num_usage_infos),
56
57 Called before any of the partition usage defaults is ever used, can be used
58 to adjust e.g. partition sizes to actual system requirements (align boot
59 partition with cylindersize), or (since it is a macro and all params are
60 by references) to completely swap the defaults (e.g. EFI vs. biosboot).
61 If swapping, make sure allocation and num_usage_infos stays consistent,
62 old allocation is done by calloc(3), use free(3) to release.
63
64
65 MD_NEED_BOOTBLOCK may be undefined
66
67 used like:
68
69 bool MD_NEED_BOOTBLOCK(struct install_partition_desc *install)
70
71 returns true if this setup needs boot blocks. Used for example on x86
72 when UEFI installs do not need any bootblocks, but BIOS ones do.
73
74 MD_MAY_SWAP_TO may be undefined
75
76 used like:
77
78 bool MD_MAY_SWAP_TO(const char *disk_name)
79
80 returns true if the disk is usable as a swap device. Typical implementation
81 in utils.c:may_swap_if_not_sdmmc.
82
83 MD_SET_EXTRACT_FINALIZE may be undefined
84
85 used like:
86
87 int MD_SET_EXTRACT_FINALIZE(int update)
88
89 extracts any additional parts of the distribution. Returns an error code
90 if something fails.
91
92
93 HAVE_PLAIN_DISKLABEL_BOOT may be undefined, only used on architectures
94 that have MBR as primary with disklabel as
95 secondary partitioning scheme (RAW_PART != 2)
96
97 used like:
98
99 bool HAVE_PLAIN_DISKLABEL_BOOT(const char *disk)
100
101 returns true if the disk could be made bootable with only a disklabel
102 (and no MBR).
103
104
105 DISKLABEL_NO_ONDISK_VERIFY usually undefined
106
107 If defined, do not verify the presence of on-disk disklabels before
108 offering the disklabel partitioning scheme. This allows ports to use
109 kernel translation for the disklabel ioctls (e.g. x68k uses Human68k
110 partitions this way).
111
112
113 HAVE_GPT_BOOT defined if the architecture can boot from GPT
114
115 NO_DISKLABEL_BOOT defined if the architecture can NOT boot
116 from a disklabel partitioned disk
117