提交 43137cc2 编写于 作者: M MikeBeaton

OpenLinuxBoot: Updates:

- Add support for .contentFlavour and .contentDetails
- Add LINUX_BOOT_ADD_RW flag
- Add flags+= and flags-=
- Fixed entry name disambiguation when LINUX_BOOT_USE_LATEST is unset
上级 20c4a965
......@@ -6,6 +6,10 @@ OpenCore Changelog
- Allow gain to track OS volume on old macOS without `SystemAudioVolumeDB`
- Fixed crash on no mouse support when verifying password
- Fixed AppleInternal CSR bit being set with `ProvideCustomSlide` enabled
- Added support for `.contentFlavour` and `.contentDetails` files for boot entry protocol entries including OpenLinuxBoot
- Added `LINUX_BOOT_ADD_RW` flag to OpenLinuxBoot to support EndeavourOS
- Added `flags+=` and `flags-=` arguments to OpenLinuxBoot to simplify setting driver flags if needed
- Fixed OpenLinuxBoot entry name disambiguation when `LINUX_BOOT_USE_LATEST` flag is clear
#### v0.7.7
- Fixed rare crash caused by register corruption in the entry point
......
ddf7e70ade11252845abf9bcf1654d47
0a5f00c225c3bc5a7e0a5a57143640f7
......@@ -3279,7 +3279,7 @@ the default boot entry choice will remain changed until the next manual reconfig
\item Within OpenShell, use \texttt{bcfg boot dump} to display the NVRAM boot options and then use \texttt{bcfg boot rm \#}
(where \texttt{\#} is the number of the OpenCore boot entry) to remove the OpenCore entry
\end{itemize}
It is alteratively possible to start OpenShell directly from the OpenCore boot menu, if you have
It is alternatively possible to start OpenShell directly from the OpenCore boot menu, if you have
a working configured OpenCore for the system. In that case, and if OpenCore has \texttt{RequestBootVarRouting} enabled, it will be
necessary to run the command \texttt{\textbackslash EFI\textbackslash OC\textbackslash Tools\textbackslash OpenControl.efi disable}
before using \texttt{bcfg}. (After \texttt{OpenControl disable}, it is necessary to either reboot or run \texttt{OpenControl restore},
......@@ -3342,12 +3342,13 @@ the default boot entry choice will remain changed until the next manual reconfig
OpenCore picker behaviour for that drive of selecting the appropriate icon depending
on whether the drive is internal or external. \medskip
\item \texttt{0x0002} --- \texttt{OC\_ATTR\_USE\_DISK\_LABEL\_FILE}, provides custom
\item \texttt{0x0002} --- \texttt{OC\_ATTR\_USE\_DISK\_LABEL\_FILE}, use custom
prerendered titles for boot entries from \texttt{.disk\_label} (\texttt{.disk\_label\_2x})
file next to the bootloader for all filesystems.
Prerendered labels can be generated via the \texttt{disklabel} utility or the \texttt{bless} command.
When disabled or missing, label text in (\texttt{.contentDetails}
or \texttt{.disk\_label.contentDetails}) will be rendered if present instead, otherwise
These labels can be generated via the \texttt{disklabel} utility or the
\texttt{bless -{}-folder \{FOLDER\_PATH\} -{}-label \{LABEL\_TEXT\}} command.
When prerendered labels are disabled or missing, use label text in \texttt{.contentDetails}
(or \texttt{.disk\_label.contentDetails}) file next to bootloader if present instead, otherwise
the entry name itself will be rendered.
\item \texttt{0x0004} --- \texttt{OC\_ATTR\_USE\_GENERIC\_LABEL\_IMAGE}, provides predefined
label images for boot entries without custom entries. This may however give less detail for
......@@ -3374,10 +3375,11 @@ the default boot entry choice will remain changed until the next manual reconfig
\begin{itemize}
\tightlist
\item For a Tool the value is read from \texttt{Flavour} field.
\item For an automatically discovered entry it is read from the \texttt{.contentFlavour}
\item For an automatically discovered entry, including for boot entry protocol entries such as those
generated by the OpenLinuxBoot driver, it is read from the \texttt{.contentFlavour}
file next to the bootloader, if present.
\item For a custom entry it is read from the \texttt{.contentFlavour} file next to the
bootloader if \texttt{Flavour} is \texttt{Auto}, otherwise specified via the \texttt{Flavour}
\item For a custom entry specified in the \texttt{Entries} section it is read from the \texttt{.contentFlavour} file next to the
bootloader if \texttt{Flavour} is \texttt{Auto}, otherwise it is specified via the \texttt{Flavour}
value itself.
\item If read flavour is \texttt{Auto} or there is no \texttt{.contentFlavour}, entry
flavour is chosen based on the entry type (e.g. Windows automatically gets Windows flavour).
......@@ -6347,19 +6349,32 @@ failure (typically halting with a black screen) of the Linux kernel, due to a fi
firmware released after 2017. When present and not mitigated by this quirk, this affects booting
via OpenCore with or without OpenLinuxBoot.
After installing OpenLinuxBoot, it is recommended to compare the Linux boot options (shown with \texttt{cat /proc/cmdline})
seen when booting via OpenLinuxBoot and via the distro's original bootloader. If the default bootloader
is GRUB, expect the options generated by OpenLinuxBoot not to
contain a \texttt{BOOT\_IMAGE=...} value where the GRUB options do, and to contain an
\texttt{initrd=...} value while the GRUB options do not.
All remaining options should match (option order does not matter) -- perhaps excluding less important graphics
handover options (such as in the Ubuntu example given in \texttt{autoopts} below). If they do not, it is recommended
to manually add the missing options, e.g. with \texttt{partuuidopts:\{partuuid\}+=\{opts\}} to target a specific
distro (or just with \texttt{autoopts+=\{opts\}}, which applies to all installed distros, if only one distro is in use).
After installing OpenLinuxBoot, it is recommended to compare the options shown in the OpenCore debug
log when booting (or attempting to boot) a given distro against the options seen using the shell command
\texttt{cat /proc/cmdline} when the same distro has been booted via its native bootloader.
In general (for safety and security of the running distro) these options should match, and if they do not
it is recommended to use the driver arguments below (in particular \texttt{LINUX\_BOOT\_ADD\_RO},
\texttt{LINUX\_BOOT\_ADD\_RW}, \texttt{partuuidopts} and \texttt{autoopts}) to modify the options as required.
Note however that the following differences are normal and do not need to be fixed:
\begin{itemize}
\tightlist
\item
If the default bootloader is GRUB then the options generated by OpenLinuxBoot will not contain a
\texttt{BOOT\_IMAGE=...} value where the GRUB options do, and will contain an \texttt{initrd=...}
value where the GRUB options do not.
\item
OpenLinuxBoot uses \texttt{PARTUUID} rather than filesystem \texttt{UUID} to identify the location
of \texttt{initrd}, this is by design as UEFI filesystem drivers do not make Linux filesystem
\texttt{UUID} values available.
\item
Less important graphics handover options (such as discussed in the Ubuntu example
given in \texttt{autoopts} below) will not match exactly, this is not important as long
as distro boots successfully.
\end{itemize}
If using OpenLinuxBoot with Secure Boot, users may wish to use the \texttt{shim-to-cert.tool} included in OpenCore
utilities, which can be used to extract the required public key to validate a distro's kernels directly, rather
than via shim. For non-GRUB distros, the required public key must be found by user research.
utilities, which can be used to extract the public key needed to boot a distro's kernels directly, as done when using OpenCore
with OpenLinuxBoot, rather than via GRUB shim. For non-GRUB distros, the required public key must be found by user research.
\subsubsection{Configuration}
......@@ -6415,13 +6430,24 @@ options for the driver may be specified in \texttt{UEFI/Drivers/Arguments}:
\emph{Note}: This option is recommended on all systems. \medskip
\item \texttt{0x00000400} (bit \texttt{10}) --- \texttt{LINUX\_BOOT\_ADD\_RO},
This option applies to autodetected Linux only (i.e. to Debian-style distrubutions, not to BLSpec and
Fedora-style distributions with \texttt{/loader/entries/*.conf} files).
Some distrubtions run a filesystem check on loading which requires the root
filesystem to initially be mounted read-only via the \texttt{ro} kernel option. Set this bit to add this
This option applies to autodetected Linux only (i.e. not to BLSpec or
Fedora-style distributions which have \texttt{/loader/entries/*.conf} files).
Some distributions run a filesystem check on loading which requires the root
filesystem to initially be mounted read-only via the \texttt{ro} kernel option, which requires this
option to be added to the autodetected options. Set this bit to add this
option on autodetected distros; should be harmless but very slightly slow down boot time (due to requried
remount as read-write) on distros which do not require it. To specify this option for specific
distros only, use \texttt{partuuidopts:\{partuuid\}+=ro} instead of this flag.
remount as read-write) on distros which do not require it.
When there are multiple distros and it is required to specify this option for specific distros only, use
\texttt{partuuidopts:\{partuuid\}+=ro} to manually add the option where required, instead of using this flag.
\item \texttt{0x00000800} (bit \texttt{11}) --- \texttt{LINUX\_BOOT\_ADD\_RW},
Like \texttt{LINUX\_BOOT\_ADD\_RO}, this option applies to autodetected Linux only. It is not
required for most distros (which usually require either \texttt{ro} or nothing to be added to
detected boot options), but is required on some Arch-derived distros, e.g. EndeavourOS.
When there are multiple distros and it is required to specify this option for specific distros only, use
\texttt{partuuidopts:\{partuuid\}+=rw} to manually add the option where required, instead of using this flag.
If this option and \texttt{LINUX\_BOOT\_ADD\_RO} are both specified, only this option is applied
and \texttt{LINUX\_BOOT\_ADD\_RO} is ignored.
\item \texttt{0x00002000} (bit \texttt{13}) --- \texttt{LINUX\_BOOT\_ALLOW\_CONF\_AUTO\_ROOT},
In some instances of \texttt{BootLoaderSpecByDefault} in combination with \texttt{ostree}, the
......@@ -6439,7 +6465,9 @@ options for the driver may be specified in \texttt{UEFI/Drivers/Arguments}:
\end{itemize} \medskip
Flag values can be specified in hexadecimal beginning with \texttt{0x} or in decimal,
e.g. \texttt{flags=0x80} or \texttt{flags=128}. \medskip
e.g. \texttt{flags=0x80} or \texttt{flags=128}. It is also possible to specify flags to
add or remove, using syntax such as \texttt{flags+=0xC000} to add all debugging
options or \texttt{flags-=0x400} to remove the \texttt{LINUX\_BOOT\_ADD\_RO} option. \medskip
\item \texttt{partuuidopts:\{partuuid\}[+]="\{options\}"} - Default: not set. \medskip
......
\documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL PreviousConfiguration.tex Tue Jan 11 11:01:53 2022
%DIF ADD ../Configuration.tex Sun Jan 16 09:31:35 2022
%DIF ADD ../Configuration.tex Fri Jan 21 10:22:04 2022
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
......@@ -3339,7 +3339,7 @@ the default boot entry choice will remain changed until the next manual reconfig
}\item \DIFadd{Within OpenShell, use }\texttt{\DIFadd{bcfg boot dump}} \DIFadd{to display the NVRAM boot options and then use }\texttt{\DIFadd{bcfg boot rm \#}}
\DIFadd{(where }\texttt{\DIFadd{\#}} \DIFadd{is the number of the OpenCore boot entry) to remove the OpenCore entry
}\end{itemize}
\DIFadd{It is alteratively possible to start OpenShell directly from the OpenCore boot menu, if you have
\DIFadd{It is alternatively possible to start OpenShell directly from the OpenCore boot menu, if you have
a working configured OpenCore for the system. In that case, and if OpenCore has }\texttt{\DIFadd{RequestBootVarRouting}} \DIFadd{enabled, it will be
necessary to run the command }\texttt{\DIFadd{\textbackslash EFI\textbackslash OC\textbackslash Tools\textbackslash OpenControl.efi disable}}
\DIFadd{before using }\texttt{\DIFadd{bcfg}}\DIFadd{. (After }\texttt{\DIFadd{OpenControl disable}}\DIFadd{, it is necessary to either reboot or run }\texttt{\DIFadd{OpenControl restore}}\DIFadd{,
......@@ -3403,12 +3403,13 @@ the default boot entry choice will remain changed until the next manual reconfig
OpenCore picker behaviour for that drive of selecting the appropriate icon depending
on whether the drive is internal or external. \medskip
\item \texttt{0x0002} --- \texttt{OC\_ATTR\_USE\_DISK\_LABEL\_FILE}, provides custom
\item \texttt{0x0002} --- \texttt{OC\_ATTR\_USE\_DISK\_LABEL\_FILE}, \DIFdelbegin \DIFdel{provides }\DIFdelend \DIFaddbegin \DIFadd{use }\DIFaddend custom
prerendered titles for boot entries from \texttt{.disk\_label} (\texttt{.disk\_label\_2x})
file next to the bootloader for all filesystems.
Prerendered labels can be generated via the \texttt{disklabel} utility or the \texttt{bless} command.
When disabled or missing, label text in (\texttt{.contentDetails}
or \texttt{.disk\_label.contentDetails}) will be rendered if present instead, otherwise
\DIFdelbegin \DIFdel{Prerendered }\DIFdelend \DIFaddbegin \DIFadd{These }\DIFaddend labels can be generated via the \texttt{disklabel} utility or the
\texttt{bless \DIFaddbegin \DIFadd{-}{}\DIFadd{-folder \{FOLDER\_PATH\} -}{}\DIFadd{-label \{LABEL\_TEXT\}}\DIFaddend } command.
When \DIFaddbegin \DIFadd{prerendered labels are }\DIFaddend disabled or missing, \DIFaddbegin \DIFadd{use }\DIFaddend label text in \DIFdelbegin \DIFdel{(}\DIFdelend \texttt{.contentDetails}
\DIFaddbegin \DIFadd{(}\DIFaddend or \texttt{.disk\_label.contentDetails}) \DIFdelbegin \DIFdel{will be rendered }\DIFdelend \DIFaddbegin \DIFadd{file next to bootloader }\DIFaddend if present instead, otherwise
the entry name itself will be rendered.
\item \texttt{0x0004} --- \texttt{OC\_ATTR\_USE\_GENERIC\_LABEL\_IMAGE}, provides predefined
label images for boot entries without custom entries. This may however give less detail for
......@@ -3435,10 +3436,11 @@ the default boot entry choice will remain changed until the next manual reconfig
\begin{itemize}
\tightlist
\item For a Tool the value is read from \texttt{Flavour} field.
\item For an automatically discovered entry it is read from the \texttt{.contentFlavour}
\item For an automatically discovered entry\DIFaddbegin \DIFadd{, including for boot entry protocol entries such as those
generated by the OpenLinuxBoot driver, }\DIFaddend it is read from the \texttt{.contentFlavour}
file next to the bootloader, if present.
\item For a custom entry it is read from the \texttt{.contentFlavour} file next to the
bootloader if \texttt{Flavour} is \texttt{Auto}, otherwise specified via the \texttt{Flavour}
\item For a custom entry \DIFaddbegin \DIFadd{specified in the }\texttt{\DIFadd{Entries}} \DIFadd{section }\DIFaddend it is read from the \texttt{.contentFlavour} file next to the
bootloader if \texttt{Flavour} is \texttt{Auto}, otherwise \DIFaddbegin \DIFadd{it is }\DIFaddend specified via the \texttt{Flavour}
value itself.
\item If read flavour is \texttt{Auto} or there is no \texttt{.contentFlavour}, entry
flavour is chosen based on the entry type (e.g. Windows automatically gets Windows flavour).
......@@ -6424,19 +6426,41 @@ failure (typically halting with a black screen) of the Linux kernel, due to a fi
firmware released after 2017. When present and not mitigated by this quirk, this affects booting
via OpenCore with or without OpenLinuxBoot.
After installing OpenLinuxBoot, it is recommended to compare the Linux boot options (shown with \texttt{cat /proc/cmdline})
seen when booting via OpenLinuxBoot and via the distro's original bootloader. If the default bootloader
is GRUB, expect the options generated by OpenLinuxBoot not to
contain a \texttt{BOOT\_IMAGE=...} value where the GRUB options do, and to contain an
\texttt{initrd=...} value while the GRUB options do not.
All remaining options should match (option order does not matter) -- perhaps excluding less important graphics
handover options (such as in the Ubuntu example given in \texttt{autoopts} below). If they do not, it is recommended
to manually add the missing options, e.g. with \texttt{partuuidopts:\{partuuid\}+=\{opts\}} to target a specific
distro (or just with \texttt{autoopts+=\{opts\}}, which applies to all installed distros, if only one distro is in use).
After installing OpenLinuxBoot, it is recommended to compare the \DIFdelbegin \DIFdel{Linux boot options (shown with }\texttt{\DIFdel{cat /proc/cmdline}}%DIFAUXCMD
\DIFdel{) seen when booting via OpenLinuxBoot and via the distro's original bootloader.
}\DIFdelend \DIFaddbegin \DIFadd{options shown in the OpenCore debug
log when booting (or attempting to boot) a given distro against the options seen using the shell command
}\texttt{\DIFadd{cat /proc/cmdline}} \DIFadd{when the same distro has been booted via its native bootloader.
In general (for safety and security of the running distro) these options should match, and if they do not
it is recommended to use the driver arguments below (in particular }\texttt{\DIFadd{LINUX\_BOOT\_ADD\_RO}}\DIFadd{,
}\texttt{\DIFadd{LINUX\_BOOT\_ADD\_RW}}\DIFadd{, }\texttt{\DIFadd{partuuidopts}} \DIFadd{and }\texttt{\DIFadd{autoopts}}\DIFadd{) to modify the options as required.
Note however that the following differences are normal and do not need to be fixed:
}\begin{itemize}
\tightlist
\item
\DIFaddend If the default bootloader is GRUB \DIFdelbegin \DIFdel{, expect }\DIFdelend \DIFaddbegin \DIFadd{then }\DIFaddend the options generated by OpenLinuxBoot \DIFdelbegin \DIFdel{not to
}\DIFdelend \DIFaddbegin \DIFadd{will not }\DIFaddend contain a
\texttt{BOOT\_IMAGE=...} value where the GRUB options do, and \DIFdelbegin \DIFdel{to }\DIFdelend \DIFaddbegin \DIFadd{will }\DIFaddend contain an \texttt{initrd=...}
value \DIFdelbegin \DIFdel{while }\DIFdelend \DIFaddbegin \DIFadd{where }\DIFaddend the GRUB options do not.
\DIFdelbegin \DIFdel{All remaining options should match (option order does not matter) -- perhaps excluding less }\DIFdelend \DIFaddbegin \item
\DIFadd{OpenLinuxBoot uses }\texttt{\DIFadd{PARTUUID}} \DIFadd{rather than filesystem }\texttt{\DIFadd{UUID}} \DIFadd{to identify the location
of }\texttt{\DIFadd{initrd}}\DIFadd{, this is by design as UEFI filesystem drivers do not make Linux filesystem
}\texttt{\DIFadd{UUID}} \DIFadd{values available.
}\item
\DIFadd{Less }\DIFaddend important graphics handover options (such as \DIFaddbegin \DIFadd{discussed }\DIFaddend in the Ubuntu example
given in \texttt{autoopts} below) \DIFdelbegin \DIFdel{. If they do not , it is recommended
to manually add the missing options, e.g. with }\texttt{\DIFdel{partuuidopts:\{partuuid\}+=\{opts\}}} %DIFAUXCMD
\DIFdel{to target a specific
distro (or just with }\texttt{\DIFdel{autoopts+=\{opts\}}}%DIFAUXCMD
\DIFdel{, which applies to all installed distros, if only one distro is in use).
}\DIFdelend \DIFaddbegin \DIFadd{will not match exactly, this is not important as long
as distro boots successfully.
}\end{itemize}
\DIFaddend
If using OpenLinuxBoot with Secure Boot, users may wish to use the \texttt{shim-to-cert.tool} included in OpenCore
utilities, which can be used to extract the required public key to validate a distro's kernels directly, rather
than via shim. For non-GRUB distros, the required public key must be found by user research.
utilities, which can be used to extract the \DIFdelbegin \DIFdel{required public key to validate }\DIFdelend \DIFaddbegin \DIFadd{public key needed to boot }\DIFaddend a distro's kernels directly, \DIFaddbegin \DIFadd{as done when using OpenCore
with OpenLinuxBoot, }\DIFaddend rather than via \DIFaddbegin \DIFadd{GRUB }\DIFaddend shim. For non-GRUB distros, the required public key must be found by user research.
\subsubsection{Configuration}
......@@ -6492,15 +6516,28 @@ options for the driver may be specified in \texttt{UEFI/Drivers/Arguments}:
\emph{Note}: This option is recommended on all systems. \medskip
\item \texttt{0x00000400} (bit \texttt{10}) --- \texttt{LINUX\_BOOT\_ADD\_RO},
This option applies to autodetected Linux only (i.e. to Debian-style distrubutions, not to BLSpec and
Fedora-style distributions with \texttt{/loader/entries/*.conf} files).
Some distrubtions run a filesystem check on loading which requires the root
filesystem to initially be mounted read-only via the \texttt{ro} kernel option. Set this bit to add this
This option applies to autodetected Linux only (i.e. \DIFdelbegin \DIFdel{to Debian-style distrubutions, }\DIFdelend not to BLSpec \DIFdelbegin \DIFdel{and
}\DIFdelend \DIFaddbegin \DIFadd{or
}\DIFaddend Fedora-style distributions \DIFdelbegin \DIFdel{with }\DIFdelend \DIFaddbegin \DIFadd{which have }\DIFaddend \texttt{/loader/entries/*.conf} files).
Some \DIFdelbegin \DIFdel{distrubtions }\DIFdelend \DIFaddbegin \DIFadd{distributions }\DIFaddend run a filesystem check on loading which requires the root
filesystem to initially be mounted read-only via the \texttt{ro} kernel option\DIFaddbegin \DIFadd{, which requires this
option to be added to the autodetected options}\DIFaddend . Set this bit to add this
option on autodetected distros; should be harmless but very slightly slow down boot time (due to requried
remount as read-write) on distros which do not require it. To specify this option for specific
distros only, use \texttt{partuuidopts:\{partuuid\}+=ro} instead of this flag.
remount as read-write) on distros which do not require it.
\DIFdelbegin \DIFdel{To }\DIFdelend \DIFaddbegin \DIFadd{When there are multiple distros and it is required to }\DIFaddend specify this option for specific distros only, use
\texttt{partuuidopts:\{partuuid\}+=ro} \DIFdelbegin \DIFdel{instead of }\DIFdelend \DIFaddbegin \DIFadd{to manually add the option where required, instead of using }\DIFaddend this flag.
\item \DIFaddbegin \texttt{\DIFadd{0x00000800}} \DIFadd{(bit }\texttt{\DIFadd{11}}\DIFadd{) --- }\texttt{\DIFadd{LINUX\_BOOT\_ADD\_RW}}\DIFadd{,
Like }\texttt{\DIFadd{LINUX\_BOOT\_ADD\_RO}}\DIFadd{, this option applies to autodetected Linux only. It is not
required for most distros (which usually require either }\texttt{\DIFadd{ro}} \DIFadd{or nothing to be added to
detected boot options), but is required on some Arch-derived distros, e.g. EndeavourOS.
When there are multiple distros and it is required to specify this option for specific distros only, use
}\texttt{\DIFadd{partuuidopts:\{partuuid\}+=rw}} \DIFadd{to manually add the option where required, instead of using this flag.
If this option and }\texttt{\DIFadd{LINUX\_BOOT\_ADD\_RO}} \DIFadd{are both specified, only this option is applied
and }\texttt{\DIFadd{LINUX\_BOOT\_ADD\_RO}} \DIFadd{is ignored.
}
\item \texttt{0x00002000} (bit \texttt{13}) --- \texttt{LINUX\_BOOT\_ALLOW\_CONF\_AUTO\_ROOT},
\item \DIFaddend \texttt{0x00002000} (bit \texttt{13}) --- \texttt{LINUX\_BOOT\_ALLOW\_CONF\_AUTO\_ROOT},
In some instances of \texttt{BootLoaderSpecByDefault} in combination with \texttt{ostree}, the
\texttt{/loader/entries/*.conf} files do not specify a required \texttt{root=...} kernel
option -- it is added by GRUB. If this bit is set and this situation is detected, then
......@@ -6516,7 +6553,9 @@ options for the driver may be specified in \texttt{UEFI/Drivers/Arguments}:
\end{itemize} \medskip
Flag values can be specified in hexadecimal beginning with \texttt{0x} or in decimal,
e.g. \texttt{flags=0x80} or \texttt{flags=128}. \medskip
e.g. \texttt{flags=0x80} or \texttt{flags=128}\DIFaddbegin \DIFadd{. It is also possible to specify flags to
add or remove, using syntax such as }\texttt{\DIFadd{flags+=0xC000}} \DIFadd{to add all debugging
options or }\texttt{\DIFadd{flags-=0x400}} \DIFadd{to remove the }\texttt{\DIFadd{LINUX\_BOOT\_ADD\_RO}} \DIFadd{option}\DIFaddend . \medskip
\item \texttt{partuuidopts:\{partuuid\}[+]="\{options\}"} - Default: not set. \medskip
......
......@@ -71,7 +71,6 @@ typedef struct OC_HOTKEY_CONTEXT_ OC_HOTKEY_CONTEXT;
#define OC_FLAVOUR_APPLE_FW "AppleRecv:Apple"
#define OC_FLAVOUR_APPLE_TIME_MACHINE "AppleTM:Apple"
#define OC_FLAVOUR_WINDOWS "Windows"
#define OC_FLAVOUR_OTHER_OS "Other"
/**
Predefined flavour ids.
......
......@@ -755,9 +755,6 @@ InternalDescribeBootEntry (
case OC_BOOT_WINDOWS:
ContentFlavour = AllocateCopyPool(sizeof (OC_FLAVOUR_WINDOWS), OC_FLAVOUR_WINDOWS);
break;
case OC_BOOT_EXTERNAL_OS:
ContentFlavour = AllocateCopyPool(sizeof (OC_FLAVOUR_OTHER_OS), OC_FLAVOUR_OTHER_OS);
break;
case OC_BOOT_UNKNOWN:
ContentFlavour = NULL;
break;
......
......@@ -674,10 +674,22 @@ InternalAddBootEntryFromCustomEntry (
return EFI_OUT_OF_RESOURCES;
}
//
// NOTE: It is not currently necessary/useful to apply .contentDetails around here because:
// a) Entries have user-specified names already.
// b) OpenLinuxBoot needs to read the label file early, when allowed by picker attributes,
// so it can be used for pretty name with kernel version appended when required.
// If any future boot entry protocol drivers do want .contentDetails applied for them, we will need
// to pass back an entry flag indicating whether .contentDetails has already been applied or not.
//
//
// Try to get content flavour from file.
// If enabled and present, .contentFlavour always overrides flavour from boot entry protocol,
// but is only applied to Entries if they have flavour Auto.
//
if (AsciiStrCmp (BootEntry->Flavour, OC_FLAVOUR_AUTO) == 0) {
if ((BootContext->PickerContext->PickerAttributes & OC_ATTR_USE_FLAVOUR_ICON) != 0
&& (IsBootEntryProtocol || AsciiStrCmp (BootEntry->Flavour, OC_FLAVOUR_AUTO) == 0)) {
Status = OcBootPolicyDevicePathToDirPath (
BootEntry->DevicePath,
&BootDirectoryName,
......@@ -695,9 +707,23 @@ InternalAddBootEntryFromCustomEntry (
ContentFlavour = InternalGetContentFlavour (SimpleFileSystem, BootDirectoryName, L".contentFlavour");
if (ContentFlavour != NULL) {
FreePool (BootEntry->Flavour);
BootEntry->Flavour = ContentFlavour;
//
// 'Auto' read from file means do not override.
//
if (AsciiStrCmp (ContentFlavour, OC_FLAVOUR_AUTO) == 0) {
FreePool (ContentFlavour);
} else {
if (BootEntry->Flavour != NULL) {
FreePool (BootEntry->Flavour);
}
BootEntry->Flavour = ContentFlavour;
}
}
//
// There is no need for the additional flavour fixup from BootEntryInfo.c, since type
// OC_BOOT_EXTERNAL_OS does not need fixing up, and already determines our voiceover.
//
}
FreePool (BootDirectoryName);
......
......@@ -47,6 +47,10 @@ STATIC
CHAR8
*mPrettyName;
STATIC
CHAR8
*mDiskLabel;
STATIC
OC_FLEX_ARRAY
*mEtcDefaultGrubOptions;
......@@ -93,13 +97,16 @@ ProcessVmlinuzFile (
return EFI_NOT_FOUND;
}
DEBUG (((gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Found %s...\n", FileInfo->FileName ));
DEBUG ((
(gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Found %s...\n",
FileInfo->FileName
));
if (VmlinuzFile == NULL) {
return EFI_OUT_OF_RESOURCES;
}
VmlinuzFile->FileName = AllocateCopyPool (StrSize (FileInfo->FileName), FileInfo->FileName);
if (VmlinuzFile->FileName == NULL) {
return EFI_OUT_OF_RESOURCES;
......@@ -123,12 +130,15 @@ CreateAsciiRelativePath (
{
UINTN Size;
Size = DirectoryPathLength + FilePathLength + 2;
Size = DirectoryPathLength + FilePathLength + 2;
*Dest = AllocatePool (Size);
if (*Dest == NULL) {
return EFI_OUT_OF_RESOURCES;
}
AsciiSPrint (*Dest, Size, "%s\\%s", DirectoryPath, FilePath);
return EFI_SUCCESS;
}
......@@ -178,16 +188,19 @@ AutodetectTitle (
mEtcOsReleaseOptions,
Index == 0 ? "PRETTY_NAME" : "NAME",
&mPrettyName
) &&
mPrettyName != NULL) {
)
&& mPrettyName != NULL) {
Found = TRUE;
break;
}
}
if (Found) {
DEBUG (((gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Found distro %a\n", mPrettyName));
DEBUG ((
(gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Found distro %a\n",
mPrettyName
));
} else {
DEBUG ((DEBUG_WARN, "LNX: Neither %a nor %a found in %s\n", "PRETTY_NAME", "NAME", OS_RELEASE_FILE));
}
......@@ -196,53 +209,82 @@ AutodetectTitle (
STATIC
EFI_STATUS
LoadEtcFiles (
LoadOsRelease (
IN CONST EFI_FILE_PROTOCOL *RootDirectory
)
{
EFI_STATUS Status;
Status = EFI_SUCCESS;
BOOLEAN ReadRequired;
mEtcOsReleaseOptions = NULL;
mEtcDefaultGrubOptions = NULL;
mEtcOsReleaseFileContents = NULL;
mEtcDefaultGrubFileContents = NULL;
mPrettyName = NULL;
ReadRequired = (mDiskLabel == NULL);
DEBUG_CODE_BEGIN ();
ReadRequired = TRUE;
DEBUG_CODE_END ();
//
// Load distro name from /etc/os-release.
//
mEtcOsReleaseFileContents = OcReadFileFromDirectory (RootDirectory, OS_RELEASE_FILE, NULL, 0);
if (mEtcOsReleaseFileContents == NULL) {
DEBUG ((DEBUG_WARN, "LNX: %s not found\n", OS_RELEASE_FILE));
} else {
DEBUG (((gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Reading %s\n", OS_RELEASE_FILE));
Status = OcParseVars (mEtcOsReleaseFileContents, &mEtcOsReleaseOptions, FALSE);
if (EFI_ERROR (Status)) {
FreePool (mEtcOsReleaseFileContents);
mEtcOsReleaseFileContents = NULL;
DEBUG ((DEBUG_WARN, "LNX: Cannot parse %s - %r\n", OS_RELEASE_FILE, Status));
return Status;
if (ReadRequired) {
mEtcOsReleaseFileContents = OcReadFileFromDirectory (RootDirectory, OS_RELEASE_FILE, NULL, 0);
if (mEtcOsReleaseFileContents == NULL) {
DEBUG ((DEBUG_WARN, "LNX: %s not found\n", OS_RELEASE_FILE));
} else {
DEBUG ((
(gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Reading %s\n",
OS_RELEASE_FILE
));
Status = OcParseVars (mEtcOsReleaseFileContents, &mEtcOsReleaseOptions, FALSE);
if (EFI_ERROR (Status)) {
FreePool (mEtcOsReleaseFileContents);
mEtcOsReleaseFileContents = NULL;
DEBUG ((DEBUG_WARN, "LNX: Cannot parse %s - %r\n", OS_RELEASE_FILE, Status));
return Status;
}
//
// Do this early to give a nicer log entry order: distro name from os-release is logged
// before reports about distro (e.g. before the error below if it is not GRUB-based).
//
AutodetectTitle ();
}
}
//
// Do this early purely to give a nicer log entry order - distro is named
// before reports about it (esp. e.g. error below if it is not GRUB-based).
//
AutodetectTitle ();
if (mDiskLabel != NULL) {
mPrettyName = mDiskLabel;
}
return EFI_SUCCESS;
}
STATIC
EFI_STATUS
LoadDefaultGrub (
IN CONST EFI_FILE_PROTOCOL *RootDirectory
)
{
EFI_STATUS Status;
mEtcDefaultGrubOptions = NULL;
mEtcDefaultGrubFileContents = NULL;
//
// Load kernel options from /etc/default/grub.
//
mEtcDefaultGrubFileContents = OcReadFileFromDirectory (RootDirectory, GRUB_DEFAULT_FILE, NULL, 0);
mEtcDefaultGrubFileContents = OcReadFileFromDirectory (RootDirectory, GRUB_DEFAULT_FILE, NULL, 0);
if (mEtcDefaultGrubFileContents == NULL) {
DEBUG ((DEBUG_INFO, "LNX: %s not found (bootloader is not GRUB?)\n", GRUB_DEFAULT_FILE));
} else {
DEBUG (((gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Reading %s\n", GRUB_DEFAULT_FILE));
DEBUG ((
(gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Reading %s\n",
GRUB_DEFAULT_FILE
));
Status = OcParseVars (mEtcDefaultGrubFileContents, &mEtcDefaultGrubOptions, FALSE);
if (EFI_ERROR (Status)) {
FreePool (mEtcDefaultGrubFileContents);
......@@ -255,6 +297,28 @@ LoadEtcFiles (
return EFI_SUCCESS;
}
STATIC
VOID
LoadAppleDiskLabel (
IN CONST EFI_FILE_PROTOCOL *VmlinuzDirectory
)
{
mDiskLabel = NULL;
if ((gPickerContext->PickerAttributes & OC_ATTR_USE_DISK_LABEL_FILE) != 0) {
mDiskLabel = OcReadFileFromDirectory (VmlinuzDirectory, L".contentDetails", NULL, 0);
if (mDiskLabel == NULL) {
mDiskLabel = OcReadFileFromDirectory (VmlinuzDirectory, L".disk_label.contentDetails", NULL, 0);
}
if (mDiskLabel == NULL) {
DEBUG ((DEBUG_INFO, "LNX: %s %s not present\n", L".contentDetails", L".disk_label.contentDetails"));
} else {
DEBUG ((DEBUG_INFO, "LNX: Found disk label '%a'\n", mDiskLabel));
}
}
}
STATIC
VOID
FreeEtcFiles (
......@@ -262,18 +326,25 @@ FreeEtcFiles (
)
{
//
// If non-null, refers to string inside mEtcOsReleaseFileContents
// If non-null, refers to string inside mEtcOsReleaseFileContents or copy of mDiskLabel.
//
mPrettyName = NULL;
if (mDiskLabel != NULL) {
FreePool (mDiskLabel);
mDiskLabel = NULL;
}
OcFlexArrayFree (&mEtcOsReleaseOptions);
if (mEtcOsReleaseFileContents != NULL) {
FreePool (mEtcOsReleaseFileContents);
mEtcOsReleaseFileContents = NULL;
}
OcFlexArrayFree (&mEtcDefaultGrubOptions);
if (mEtcDefaultGrubFileContents != NULL) {
FreePool (mEtcDefaultGrubFileContents);
mEtcDefaultGrubFileContents = NULL;
}
}
......@@ -296,7 +367,7 @@ InsertOption (
} else {
OptionsLength = AsciiStrLen (Value);
}
if (OptionsLength > 0) {
Option = OcFlexArrayInsertItem (Options, InsertIndex);
if (Option == NULL) {
......@@ -341,8 +412,11 @@ InsertRootOption (
{
CHAR8 **NewOption;
DEBUG (((gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Creating \"root=PARTUUID=%g\"\n", gPartuuid));
DEBUG ((
(gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Creating \"root=PARTUUID=%g\"\n",
gPartuuid
));
NewOption = OcFlexArrayInsertItem (Options, 0);
if (NewOption == NULL) {
......@@ -375,6 +449,7 @@ AutodetectBootOptions (
CHAR8 *GrubVarName;
BOOLEAN FoundOptions;
BOOLEAN PlusOpts;
CHAR8 *AddRxOption;
OptionCount = 0;
if (gParsedLoadOptions != NULL) {
......@@ -399,22 +474,28 @@ AutodetectBootOptions (
continue;
}
Status = StrToGuid (&Option->Unicode.Name[L_STR_LEN(L"partuuidopts:")], &Guid);
if (EFI_ERROR(Status)) {
Status = StrToGuid (&Option->Unicode.Name[L_STR_LEN (L"partuuidopts:")], &Guid);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "LNX: Cannot parse partuuid from %s - %r\n", Option->Unicode.Name, Status));
continue;
}
if (CompareMem (&gPartuuid, &Guid, sizeof (EFI_GUID)) != 0) {
DEBUG (((gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: No match partuuidopts:%g != %g\n", &Guid, &gPartuuid));
DEBUG ((
(gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: No match partuuidopts:%g != %g\n",
&Guid,
&gPartuuid
));
} else {
PlusOpts = OcUnicodeEndsWith (Option->Unicode.Name, L"+", FALSE);
DEBUG (((gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
DEBUG ((
(gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Using partuuidopts%a=\"%s\"\n",
PlusOpts ? "+" : "",
Option->Unicode.Value));
Option->Unicode.Value
));
Status = AddOption (Options, Option->Unicode.Value, TRUE);
if (EFI_ERROR (Status)) {
......@@ -444,8 +525,12 @@ AutodetectBootOptions (
continue;
}
DEBUG (((gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Using %s=\"%s\"\n", Option->Unicode.Name, Option->Unicode.Value));
DEBUG ((
(gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Using %s=\"%s\"\n",
Option->Unicode.Name,
Option->Unicode.Value
));
Status = AddOption (Options, Option->Unicode.Value, TRUE);
return Status;
......@@ -455,8 +540,12 @@ AutodetectBootOptions (
continue;
}
DEBUG (((gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Using %s=\"%s\"\n", Option->Unicode.Name, Option->Unicode.Value));
DEBUG ((
(gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Using %s=\"%s\"\n",
Option->Unicode.Name,
Option->Unicode.Value
));
Status = AddOption (Options, Option->Unicode.Value, TRUE);
if (EFI_ERROR (Status)) {
......@@ -494,11 +583,15 @@ AutodetectBootOptions (
mEtcDefaultGrubOptions,
GrubVarName,
&AsciiStrValue
) &&
AsciiStrValue != NULL) {
)
&& AsciiStrValue != NULL) {
DEBUG (((gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Using %a=\"%a\"\n", GrubVarName, AsciiStrValue));
DEBUG ((
(gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Using %a=\"%a\"\n",
GrubVarName,
AsciiStrValue
));
if (AsciiStrValue[0] != '\0') {
Status = InsertOption (InsertIndex, Options, AsciiStrValue, FALSE);
......@@ -552,10 +645,19 @@ AutodetectBootOptions (
}
InsertIndex = 1;
if ((gLinuxBootFlags & LINUX_BOOT_ADD_RO) != 0) {
DEBUG (((gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Adding \"ro\"\n"));
Status = InsertOption (InsertIndex, Options, "ro", FALSE);
AddRxOption = NULL;
if ((gLinuxBootFlags & LINUX_BOOT_ADD_RW) != 0) {
AddRxOption = "rw";
} else if ((gLinuxBootFlags & LINUX_BOOT_ADD_RO) != 0) {
AddRxOption = "ro";
}
if (AddRxOption != NULL) {
DEBUG ((
(gLinuxBootFlags & LINUX_BOOT_LOG_VERBOSE) == 0 ? DEBUG_VERBOSE : DEBUG_INFO,
"LNX: Adding \"%a\"\n",
AddRxOption
));
Status = InsertOption (InsertIndex, Options, AddRxOption, FALSE);
}
return Status;
......@@ -623,7 +725,13 @@ GenerateEntriesForVmlinuzFiles (
//
// Linux.
//
Status = CreateAsciiRelativePath (&Entry->Linux, DirectoryPath, DirectoryPathLength, VmlinuzFile->FileName, VmlinuzFile->StrLen);
Status = CreateAsciiRelativePath (
&Entry->Linux,
DirectoryPath,
DirectoryPathLength,
VmlinuzFile->FileName,
VmlinuzFile->StrLen
);
if (EFI_ERROR (Status)) {
return Status;
}
......@@ -637,7 +745,7 @@ GenerateEntriesForVmlinuzFiles (
}
//
// Use title from os-release file.
// Use title from .contentDetails or os-release file.
//
if (mPrettyName != NULL) {
Entry->Title = AllocateCopyPool (AsciiStrSize (mPrettyName), mPrettyName);
......@@ -660,7 +768,13 @@ GenerateEntriesForVmlinuzFiles (
if (Option == NULL) {
return EFI_OUT_OF_RESOURCES;
}
Status = CreateAsciiRelativePath (Option, DirectoryPath, DirectoryPathLength, InitrdMatch->FileName, InitrdMatch->StrLen);
Status = CreateAsciiRelativePath (
Option,
DirectoryPath,
DirectoryPathLength,
InitrdMatch->FileName,
InitrdMatch->StrLen
);
if (EFI_ERROR (Status)) {
return Status;
}
......@@ -718,14 +832,14 @@ InternalAutodetectLinux (
DEBUG ((DEBUG_WARN, "LNX: Does not appear to be root filesystem - %r\n", Status));
}
if (!EFI_ERROR (Status)){
if (!EFI_ERROR (Status)) {
mVmlinuzFiles = OcFlexArrayInit (sizeof (VMLINUZ_FILE), OcFlexArrayFreePointerItem);
if (mVmlinuzFiles == NULL) {
Status = EFI_OUT_OF_RESOURCES;
}
}
if (!EFI_ERROR (Status)){
if (!EFI_ERROR (Status)) {
mInitrdFiles = OcFlexArrayInit (sizeof (VMLINUZ_FILE), OcFlexArrayFreePointerItem);
if (mInitrdFiles == NULL) {
Status = EFI_OUT_OF_RESOURCES;
......@@ -735,20 +849,27 @@ InternalAutodetectLinux (
//
// Place vmlinuz* and init* files into arrays.
//
if (!EFI_ERROR (Status)){
if (!EFI_ERROR (Status)) {
Status = OcScanDirectory (VmlinuzDirectory, ProcessVmlinuzFile, NULL);
}
if (!EFI_ERROR (Status)) {
gLoaderEntries = OcFlexArrayInit (sizeof (LOADER_ENTRY), (OC_FLEX_ARRAY_FREE_ITEM) InternalFreeLoaderEntry);
gLoaderEntries = OcFlexArrayInit (
sizeof (LOADER_ENTRY),
(OC_FLEX_ARRAY_FREE_ITEM)InternalFreeLoaderEntry
);
if (gLoaderEntries == NULL) {
Status = EFI_OUT_OF_RESOURCES;
} else {
Status = LoadEtcFiles (RootDirectory);
LoadAppleDiskLabel (VmlinuzDirectory);
Status = LoadOsRelease (RootDirectory);
if (!EFI_ERROR (Status)) {
Status = LoadDefaultGrub (RootDirectory);
}
if (!EFI_ERROR (Status)) {
Status = GenerateEntriesForVmlinuzFiles (AUTODETECT_DIR);
}
FreeEtcFiles();
FreeEtcFiles ();
}
if (!EFI_ERROR (Status)) {
......@@ -784,7 +905,7 @@ AutodetectLinux (
EFI_STATUS Status;
Status = InternalAutodetectLinux (RootDirectory, Entries, NumEntries);
DEBUG ((
(EFI_ERROR (Status) && Status != EFI_NOT_FOUND) ? DEBUG_WARN : DEBUG_INFO,
"LNX: AutodetectLinux - %r\n",
......
......@@ -54,14 +54,19 @@
*/
#define LINUX_BOOT_USE_LATEST BIT9
/*
If set, add "ro" as initial option to all distros. Can be sepcified per
If set, add "ro" as initial option to all distros. Can be specified per
FS by using argument partuuidopts:{partuuid}+=ro instead.
*/
#define LINUX_BOOT_ADD_RO BIT10
/*
If set, add "rw" as initial option to all distros. Can be specified per
FS by using argument partuuidopts:{partuuid}+=rw instead.
*/
#define LINUX_BOOT_ADD_RW BIT11
/*
TODO: Both blspec-style and autodetect can make use of grub.cfg info if this flag is set.
*/
//#define LINUX_BOOT_ALLOW_PARSE_GRUB BIT11
//#define LINUX_BOOT_ALLOW_PARSE_GRUB BIT12
/*
Add root= option if missing in loader/entries *.conf options.
*/
......
......@@ -1163,9 +1163,9 @@ DoConvertLoaderEntriesToBootEntries (
PickerEntry->Auxiliary = Entry->OcAuxiliary;
PickerEntry->RealPath = TRUE;
PickerEntry->TextMode = FALSE;
PickerEntry->Tool = FALSE;
PickerEntry->RealPath = TRUE;
PickerEntry->TextMode = FALSE;
PickerEntry->Tool = FALSE;
}
if (EFI_ERROR (Status)) {
......@@ -1183,7 +1183,7 @@ DoConvertLoaderEntriesToBootEntries (
STATIC
EFI_STATUS
MakeUnique (
AppendVersion (
LOADER_ENTRY *Entry
)
{
......@@ -1210,7 +1210,7 @@ MakeUnique (
STATIC
EFI_STATUS
MakeAllUnique (
AppendVersions (
VOID
)
{
......@@ -1218,14 +1218,14 @@ MakeAllUnique (
UINTN Index;
LOADER_ENTRY *Entry;
if (gPickerContext->HideAuxiliary) {
if (gPickerContext->HideAuxiliary && (gLinuxBootFlags & LINUX_BOOT_USE_LATEST) != 0) {
return EFI_SUCCESS;
}
for (Index = 0; Index < gLoaderEntries->Count; Index++) {
Entry = OcFlexArrayItemAt (gLoaderEntries, Index);
Status = MakeUnique (Entry);
Status = AppendVersion (Entry);
if (EFI_ERROR (Status)) {
return Status;
}
......@@ -1374,12 +1374,13 @@ InternalConvertLoaderEntriesToBootEntries (
Status = ApplyDefaults (RootDirectory);
//
// Append version to titles when !HideAuxiliary.
// We previously implemented a pure-BLSpec process of disambiguating only if the
// title is ambiguous with others on the same partition, but this works better.
// Always append version to titles when !HideAuxiliary.
// We previously implemented a pure-BLSpec process of disambiguating by appending version
// only if the title is ambiguous with others on the same partition, but it is more natural
// to do it always.
//
if (!EFI_ERROR (Status)) {
Status = MakeAllUnique ();
Status = AppendVersions ();
}
//
......
......@@ -272,6 +272,8 @@ UefiMain (
{
EFI_STATUS Status;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
UINTN AddBootFlags;
UINTN RemoveBootFlags;
Status = gBS->HandleProtocol (
ImageHandle,
......@@ -285,7 +287,13 @@ UefiMain (
Status = OcParseLoadOptions (LoadedImage, &gParsedLoadOptions);
if (!EFI_ERROR (Status)) {
OcParsedVarsGetInt (gParsedLoadOptions, L"flags", &gLinuxBootFlags, TRUE);
AddBootFlags = 0;
RemoveBootFlags = 0;
OcParsedVarsGetInt (gParsedLoadOptions, L"flags", &gLinuxBootFlags, TRUE);
OcParsedVarsGetInt (gParsedLoadOptions, L"flags+", &AddBootFlags, TRUE);
OcParsedVarsGetInt (gParsedLoadOptions, L"flags-", &RemoveBootFlags, TRUE);
gLinuxBootFlags |= AddBootFlags;
gLinuxBootFlags &= ~RemoveBootFlags;
} else if (Status != EFI_NOT_FOUND) {
return Status;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册