[SeaBIOS] [PATCH 2/3] Sort IPLs according to their boot priority.
kevin at koconnor.net
Sun Dec 26 20:07:05 CET 2010
On Sun, Dec 26, 2010 at 05:33:24PM +0200, Gleb Natapov wrote:
> Signed-off-by: Gleb Natapov <gleb at redhat.com>
> src/boot.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++-----------
> 1 files changed, 63 insertions(+), 14 deletions(-)
> diff --git a/src/boot.c b/src/boot.c
> index 8a9246e..f93c1b3 100644
> --- a/src/boot.c
> +++ b/src/boot.c
> @@ -375,6 +375,41 @@ run_bcv(struct ipl_entry_s *ie)
> +/* Bubble sort! Should be good enough for 8 elements */
> +static void sort_ipls(struct ipl_entry_s *ipls, int iplscount)
There's a lot of boot re-ordering that can occur:
For internal hard drives, the drives are added to the BCV list in
sorted order based on drive type/cntl_id (add_bcv_internal). For
floppies and cdroms, the drive mapping is added in sorted order based
on drive type/cntl_id (add_ordered_drive). For floppies, the mapping
can be overridden by priority (patch 1). All BCVs and BEVs are then
sorted based on priority (patch 2). The boot menu allows one to
select a device, which can reorder the floppy mapping, reorder the
execution of the BCV list, and/or alter IPL.bootorder (boot_prep).
Finally, the BEV list is executed in the order given in IPL.bootorder
This seems complex - I think refactoring is called for.
I think we could replace the BCV list with a "bootable device list"
that holds all floppies, internal hard drives, cdroms, BEVs, BCVs,
ramdisks, and CBFS entries. Each entry added to this list would be
inserted in sorted order based on priority/type/cntl_id. The boot
menu would then show one entry per item in this list and allow a user
to override the boot - which would move the given item to the front of
the list. The code would then walk the list mapping drives, calling
BCVs, and adding items to the BEV list. The BEV list would only be
constructed after the boot menu - it would be created in the final
priority order (no need for IPL.bootorder).
I'll put together some patches to demonstrate what I'm thinking.
More information about the SeaBIOS