NetBSD/usr.sbin/sysinst
martin 8f65adda90 When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.
2020-10-09 18:33:00 +00:00
..
arch Add a heuristic to detect and properly mark EFI system partitions 2020-10-05 12:28:45 +00:00
aout2elf.c Rework internal data structures and "interfaces to user interface" functions 2019-06-12 06:20:17 +00:00
bsddisklabel.c When MD code requests a reserved area (at the start of the disk) 2020-10-09 18:33:00 +00:00
checkrc.c Fix memory leak (found by MKSANITIZER=yes build). 2019-08-18 11:11:48 +00:00
configmenu.c Make sure all menus have a translatable exit option (or none at all). 2019-11-16 20:26:59 +00:00
defs.h When MD code requests a reserved area (at the start of the disk) 2020-10-09 18:33:00 +00:00
defsizes.h Rework internal data structures and "interfaces to user interface" functions 2019-06-12 06:20:17 +00:00
disklabel.c PR 55384: detangle pm->ptstart from the "install" flag (selecting a 2020-10-03 18:54:18 +00:00
disks_lfs.c
disks.c PR 55379: avoid creating bogus /etc/fstab lines for /dev/cd* if no 2020-09-28 18:51:34 +00:00
endian.h
factor.c
geom.c refactor disk ioctl stuff to make it smaller. 2019-06-21 21:54:39 +00:00
gpt_uuid.c Rework internal data structures and "interfaces to user interface" functions 2019-06-12 06:20:17 +00:00
gpt.c PR 55384: detangle pm->ptstart from the "install" flag (selecting a 2020-10-03 18:54:18 +00:00
install.c Keep a list of all partition tables from which we have deleted partitions 2020-09-22 16:18:54 +00:00
label.c When MD code requests a reserved area (at the start of the disk) 2020-10-09 18:33:00 +00:00
main.c s/ be be / be / 2020-08-19 02:19:06 +00:00
Makefile Remove port-acorn26 2018-01-24 09:04:40 +00:00
Makefile.inc Separate devicetree .dts -> .dtb building from kernel builds. They are now 2020-05-18 21:19:34 +00:00
mbr.c PR 55384: detangle pm->ptstart from the "install" flag (selecting a 2020-10-03 18:54:18 +00:00
mbr.h Don't depend on common symbol definitions. 2020-04-22 23:43:12 +00:00
menus.mi Fix support for non-512-byte/sector disks again after I broke it when 2020-01-27 21:21:21 +00:00
menus.pm Finish conversion of extended partitioning parts to new abstract 2020-01-09 13:22:30 +00:00
msg_cmp.sh Typo, also fix copy & pasted license 2019-06-11 15:31:19 +00:00
msg_xlat.sh
msg.mbr.de Rework internal data structures and "interfaces to user interface" functions 2019-06-12 06:20:17 +00:00
msg.mbr.en Rework internal data structures and "interfaces to user interface" functions 2019-06-12 06:20:17 +00:00
msg.mbr.es Rework internal data structures and "interfaces to user interface" functions 2019-06-12 06:20:17 +00:00
msg.mbr.fr Rework internal data structures and "interfaces to user interface" functions 2019-06-12 06:20:17 +00:00
msg.mbr.pl Rework internal data structures and "interfaces to user interface" functions 2019-06-12 06:20:17 +00:00
msg.mi.de Separate devicetree .dts -> .dtb building from kernel builds. They are now 2020-05-18 21:19:34 +00:00
msg.mi.en it's "its" 2020-05-26 15:20:45 +00:00
msg.mi.es it's "its" 2020-05-26 15:20:45 +00:00
msg.mi.fr Fix display of timezone selection menu 2020-09-27 17:36:40 +00:00
msg.mi.pl Separate devicetree .dts -> .dtb building from kernel builds. They are now 2020-05-18 21:19:34 +00:00
msg.pm.de Finish conversion of extended partitioning parts to new abstract 2020-01-09 13:22:30 +00:00
msg.pm.en Finish conversion of extended partitioning parts to new abstract 2020-01-09 13:22:30 +00:00
msg.pm.es Finish conversion of extended partitioning parts to new abstract 2020-01-09 13:22:30 +00:00
msg.pm.fr Finish conversion of extended partitioning parts to new abstract 2020-01-09 13:22:30 +00:00
msg.pm.pl Finish conversion of extended partitioning parts to new abstract 2020-01-09 13:22:30 +00:00
net.c Use a few strlcpy() instead of strncpy() for network ioctl structs. 2020-01-27 21:30:17 +00:00
part_edit.c When MD code requests a reserved area (at the start of the disk) 2020-10-09 18:33:00 +00:00
partitions.c PR 55378: do not assume RAW_PART to be either 2 or 3 2020-09-28 18:40:23 +00:00
partitions.h PR 55384: detangle pm->ptstart from the "install" flag (selecting a 2020-10-03 18:54:18 +00:00
partman.c Deal with partitioning schemes having no inner counterpart. 2020-02-06 11:55:18 +00:00
README.md_defs Add a heuristic to detect and properly mark EFI system partitions 2020-10-05 12:28:45 +00:00
run.c Make sure all menus have a translatable exit option (or none at all). 2019-11-16 20:26:59 +00:00
sizemultname.c Fix support for non-512-byte/sector disks again after I broke it when 2020-01-27 21:21:21 +00:00
SPELLING.en
sysinst.8 Remove note that has been incorrect for a while. 2020-03-06 20:07:26 +00:00
target.c If there is no current partitioning manager assume we are editing the 2020-09-27 17:51:48 +00:00
TODO
txtwalk.c Fix copy&pasto in previous - from kre. 2020-02-06 19:53:10 +00:00
txtwalk.h Support upgrade of systems using NAME= syntax in /etc/fstab. 2019-08-07 10:08:04 +00:00
unif.awk
upgrade.c Make re-install sets also work for an explicit selected root wedge 2020-02-06 19:50:04 +00:00
util.c Fix display of timezone selection menu 2020-09-27 17:36:40 +00:00
wskbd.c Do not try to change the keyboard layout if we are not running on the 2019-12-13 12:05:11 +00:00

/* $NetBSD: README.md_defs,v 1.6 2020/10/05 12:28:45 martin Exp $ */

The following is trying to document the most important machine dependent
defines used in the sysinst code.


If HAVE_GPT is true, the MD code may limit the space used for the
GPT at the beginning of the disk to allow e.g. a bootloader
being added after it (see evbarm on allwinner SoCs, u-boot is
copied at 8k into the image).

/* Size limit for the initial GPT part, in bytes */
#define	MD_GPT_INITIAL_SIZE		(8*1024)


The default installation description is created as a static array using
lots of conditionals. It may be overriden / replaced in the MD code
(see below), an example for that is arch/i386/md.c when we have been
booted from UEFI firmware.

Name		Value / example		Description
PART_BOOT	(8*MEG) (undefined)	if defined, a boot partition
					of this size (in bytes, rounded)
					will be part of the default partition
					suggestions. Must be compile time
					const! Use MD_PART_DEFAULTS if
					runtime adjustment is needed.
PART_BOOT_MOUNT	"/boot" (undefined)	Add boot partition to fstab for
					this mount point
PART_BOOT_TYPE	FS_BSDFS		Kind of filesystem used
PART_BOOT_SUBT	MBR_PTYPE_FAT12		File system specific sub type


The boot partition is always inserted at the front of the suggested default
partitions, to cope with firmwares that may not be able to load from the
whole disk.

If multiple boot partitions are required (see ofppc, where various schemes
are supported, depending on exact model), the variables above can all be
repeated with _BOOT1_ or _BOOT2_ name instead of _BOOT_.


ATTENTION:
	PART_BOOT	is in BYTE (not MB), while most other sizes
			(DEFROOTSIZE, DEFSWAP, ...) are in MB!


The following macros provide optional MD hooks:

MD_PART_DEFAULTS	may be undefined

used like:

	void MD_PART_DEFAULTS(struct pm_dev*, struct part_usage_info*,
	    size_t num_usage_infos),

Called before any of the partition usage defaults is ever used, can be used
to adjust e.g. partition sizes to actual system requirements (align boot
partition with cylindersize), or (since it is a macro and all params are
by references) to completely swap the defaults (e.g. EFI vs. biosboot).
If swapping, make sure allocation and num_usage_infos stays consistent,
old allocation is done by calloc(3), use free(3) to release.


MD_NEED_BOOTBLOCK	may be undefined

used like:

	bool MD_NEED_BOOTBLOCK(struct install_partition_desc *install)

returns true if this setup needs boot blocks. Used for example on x86
when UEFI installs do not need any bootblocks, but BIOS ones do.

MD_MAY_SWAP_TO		may be undefined

used  like:

	bool MD_MAY_SWAP_TO(const char *disk_name)

returns true if the disk is usable as a swap device. Typical implementation
in utils.c:may_swap_if_not_sdmmc.

MD_SET_EXTRACT_FINALIZE	may be undefined

used like:

	int MD_SET_EXTRACT_FINALIZE(int update)

extracts any additional parts of the distribution. Returns an error code
if something fails.


HAVE_PLAIN_DISKLABEL_BOOT	may be undefined, only used on architectures
				that have MBR as primary with disklabel as
				secondary partitioning scheme (RAW_PART == 3)

used like:

	bool HAVE_PLAIN_DISKLABEL_BOOT(const char *disk)

returns true if the disk could be made bootable with only a disklabel
(and no MBR).


DISKLABEL_NO_ONDISK_VERIFY	usually undefined

If defined, do not verify the presence of on-disk disklabels before
offering the disklabel partitioning scheme. This allows ports to use
kernel translation for the disklabel ioctls (e.g. x68k uses Human68k
partitions this way).


HAVE_GPT_BOOT			defined if the architecture can boot from GPT

HAVE_EFI_BOOT			defined if the architecture may be able
				to boot from an EFI partition

NO_DISKLABEL_BOOT		defined if the architecture can NOT boot
				from a disklabel partitioned disk