]> git.ozlabs.org Git - petitboot/commit
discover/grub2: Allow unset and invalid defaults
authorJeremy Kerr <jk@ozlabs.org>
Thu, 11 Dec 2014 01:42:58 +0000 (09:42 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 11 Dec 2014 07:11:42 +0000 (15:11 +0800)
commite330e3f5adf78d3ba77217995a4bc3cd1fd16f4c
tree5fe430243b363f991692f5e0929a5cf9a270fa88
parent9c33c54f7b431074a7d0daddce34140044aaadf6
discover/grub2: Allow unset and invalid defaults

If the default environment variable is unset or invalid (i.e.,
references a non-existent boot option), then GRUB2 will fallback to the
first boot option present. This is preventing petitboot from autobooting
where no default is explicitly set, or is stale.

This change adds this fallback behaviour to petitboot. Because we don't
know if the first option will be a default at parse time (as no other
options matched the default env var), we need to keep options in a list,
and register them with the discover server once the parse is complete.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/grub2/grub2.h
discover/grub2/script.c
test/parser/Makefile.am
test/parser/test-grub2-implicit-default-invalid.c [new file with mode: 0644]
test/parser/test-grub2-implicit-default-unset.c [new file with mode: 0644]