From 9f3b9ebfdcebcfc9d202a9e2aa155278c83776f0 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 22 Nov 2018 04:21:11 +0100 Subject: doc: explain how to support a bootloader --- perl-install/bootloader.pm | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'perl-install/bootloader.pm') diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 215e70f42..71d50eaa6 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -33,6 +33,50 @@ Example of usage: (...) bootloader::action($bootloader, 'write', $all_hds); +A particular bootloader is handled in separate typical functions that can be called by action() by /sbin/bootloader-config: + + +=head1 VFS aka how to support a bootloader + +Most of the code is generic. + +A particular bootloader implementation/support is done through a couple functions: + +=over 4 + +=item * read_FOOBAR() + +read the config file(s) of the FOOBAR bootloader, returning a $bootloader object + +=item * install_FOOBAR($bootloader, $all_hds) + +usually call write_FOOBAR() & install_raw_FOOBAR() if existing, aka: + +=over 4 + +=item * updating config files + +=item * then reinstalling the bootloader + +=back + +=item * install_raw_FOOBAR() + +Optionnal: Low level installation of the stage1 of the bootloader, usually embedding it in MBR or on ESP, ... (eg: running lilo or /boot/grub*/install.sh) + +=item * write_FOOBAR($bootloader, $all_hds) + +update the config files, ie when a kernel was installed or removed. +when_config_changed_FOOBAR() is called right after in case something is needed when config is done (eg: lilo needs to be reinstalled) + +=item * when_config_changed_FOOBAR() + +Run needed action when config has changed or when initrds were regenerated, ... +Usually nothing for intelligent bootloaders such as grub-legacy or grub2. +But eg: lilo needs to rewrite its stage1 (thus it needs to rerun lilo). + +=back + =head1 Functions =over @@ -2419,6 +2463,8 @@ Calls the C<$action> function with @para parameters: If needed, the function name will be resolved to call a boot loader specific function (eg: for LILO/GRUB/...) +This Swiss army knife function is heavily used by eg /sbin/bootloader-config + =cut sub action { -- cgit v1.2.1