On Mon, Jul 24, 2023 at 6:07 PM <yashren.re...@gmail.com> wrote: > > I am developing a UEFI application which functions as a bootloader. It is > required to handle loading between two Linux kernels dependending on which > one failed last (A/B system). > Is there a way to detect if the kernel failed to load/start successfully from > the UEFI shell or application?
Sure, you can try and hope that it failed early enough to call EFI_BOOT_SERVICES.Exit(). But the amount of failure points after ExitBootServices() is staggeringly huge compared to before ExitBootServices (i.e in the efistub, when booting). >I read that there is a hand-over of control to the OS at some point and the OS >calls ExitBootService but I am not sure about how to retrieve this information >from the Shell? Does the return code get persisted in LastError variable? Seems like it, yes. > Also, do you know where in the Linux boot process the ExitBootService is > called? I'm trying to figure out what actual Linux boot failures I can detect > with the ExitBootService return code. 1) ExitBootServices != Exit. EFI_BOOT_SERVICES.Exit() serves as your exit "system call", EFI_BOOT_SERVICES.ExitBootServices() serves as the "remove EFI from being in my way" "system call". Please see the spec. 2) Probably anything that happens really early and hence is deeply uninteresting. But not much else AFAIK. (hopefully Ard can chime in here) > For instance, could I detect kernel panic? No. -- Pedro -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107185): https://edk2.groups.io/g/devel/message/107185 Mute This Topic: https://groups.io/mt/100333279/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-