Home | History | Annotate | Line # | Download | only in sysinst
README.md_defs revision 1.8
      1  1.8  martin /* $NetBSD: README.md_defs,v 1.8 2023/01/06 15:05:52 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.7  andvar lots of conditionals. It may be overridden / 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.4  martin MD_MAY_SWAP_TO		may be undefined
     75  1.4  martin 
     76  1.4  martin used  like:
     77  1.4  martin 
     78  1.4  martin 	bool MD_MAY_SWAP_TO(const char *disk_name)
     79  1.4  martin 
     80  1.4  martin returns true if the disk is usable as a swap device. Typical implementation
     81  1.4  martin in utils.c:may_swap_if_not_sdmmc.
     82  1.4  martin 
     83  1.4  martin MD_SET_EXTRACT_FINALIZE	may be undefined
     84  1.4  martin 
     85  1.4  martin used like:
     86  1.4  martin 
     87  1.4  martin 	int MD_SET_EXTRACT_FINALIZE(int update)
     88  1.4  martin 
     89  1.4  martin extracts any additional parts of the distribution. Returns an error code
     90  1.4  martin if something fails.
     91  1.4  martin 
     92  1.1  martin 
     93  1.1  martin HAVE_PLAIN_DISKLABEL_BOOT	may be undefined, only used on architectures
     94  1.1  martin 				that have MBR as primary with disklabel as
     95  1.5  martin 				secondary partitioning scheme (RAW_PART == 3)
     96  1.1  martin 
     97  1.1  martin used like:
     98  1.1  martin 
     99  1.1  martin 	bool HAVE_PLAIN_DISKLABEL_BOOT(const char *disk)
    100  1.1  martin 
    101  1.1  martin returns true if the disk could be made bootable with only a disklabel
    102  1.1  martin (and no MBR).
    103  1.1  martin 
    104  1.2  martin 
    105  1.2  martin DISKLABEL_NO_ONDISK_VERIFY	usually undefined
    106  1.2  martin 
    107  1.2  martin If defined, do not verify the presence of on-disk disklabels before
    108  1.2  martin offering the disklabel partitioning scheme. This allows ports to use
    109  1.3   isaki kernel translation for the disklabel ioctls (e.g. x68k uses Human68k
    110  1.2  martin partitions this way).
    111  1.4  martin 
    112  1.4  martin 
    113  1.4  martin HAVE_GPT_BOOT			defined if the architecture can boot from GPT
    114  1.4  martin 
    115  1.6  martin HAVE_EFI_BOOT			defined if the architecture may be able
    116  1.6  martin 				to boot from an EFI partition
    117  1.6  martin 
    118  1.4  martin NO_DISKLABEL_BOOT		defined if the architecture can NOT boot
    119  1.4  martin 				from a disklabel partitioned disk
    120  1.8  martin 
    121  1.8  martin MD_DISKLABEL_PART_INDEX_CHECK	usually undefined
    122  1.8  martin 
    123  1.8  martin 				if defined evaluates to a boolean attribute
    124  1.8  martin 				which is passed a struct disklabel, an integer
    125  1.8  martin 				index and a const struct disk_part_info*.
    126  1.8  martin 				The result qualifies the given new partition
    127  1.8  martin 				to take the disklabel l_partition entry
    128  1.8  martin 				with the given index. Used for example
    129  1.8  martin 				in luna68k to move the FFSv1 boot partition
    130  1.8  martin 				(which would otherwise end up as partition 'a')
    131  1.8  martin 				to a partition past RAW_PART (so 'd' on luna68k)
    132