From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 92396D80419 for ; Mon, 24 Jul 2023 17:28:43 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=tvrVtYe/G3K1YV6QIIMK6UrRUpPUKyMxlFCH5D4EHrA=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:X-Gm-Message-State:X-Google-Smtp-Source:X-Received:MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1690219722; v=1; b=ijNyieUYi/SQ+iFQ6vJ5vrVbOCdSG55gE6adDH0uFmSLgKqFW6vWaBBvrn+JHsuxJ/J9jcGp gC1H8hFhUpWAIzIBKEU8+PgBLDBGHXg6HK6U++UE+eeHLawkoD9l5dE9Kzyc+riQ5tz0fq94a6g 79VVu8Q8XAwl/uTYwY0GYavE= X-Received: by 127.0.0.2 with SMTP id WxXcYY7687511xpE47qFmzZA; Mon, 24 Jul 2023 10:28:42 -0700 X-Received: from mail-vs1-f43.google.com (mail-vs1-f43.google.com [209.85.217.43]) by mx.groups.io with SMTP id smtpd.web11.301.1690219721357607466 for ; Mon, 24 Jul 2023 10:28:41 -0700 X-Received: by mail-vs1-f43.google.com with SMTP id ada2fe7eead31-4435508cff9so1461295137.0 for ; Mon, 24 Jul 2023 10:28:41 -0700 (PDT) X-Gm-Message-State: DQskADIyUDa8E7XydWmNkQ5Ox7686176AA= X-Google-Smtp-Source: APBJJlEfhPpYvhRjK0a9VmfFqf4nJxHgVHZ8AGQY0OFoJhXWryp15dVSwO3pTbdg5dH47X1KEdXAECnyd+08kl0uHP0= X-Received: by 2002:a67:e952:0:b0:443:538b:cd27 with SMTP id p18-20020a67e952000000b00443538bcd27mr3120510vso.9.1690219720170; Mon, 24 Jul 2023 10:28:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Pedro Falcato" Date: Mon, 24 Jul 2023 18:28:29 +0100 Message-ID: Subject: Re: [edk2-devel] Detecting Linux boot failure from UEFI shell (BootServices) To: devel@edk2.groups.io, yashren.reddi@gmail.com, Ard Biesheuvel Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pedro.falcato@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=ijNyieUY; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) On Mon, Jul 24, 2023 at 6:07=E2=80=AFPM 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 th= e OS calls ExitBootService but I am not sure about how to retrieve this inf= ormation from the Shell? Does the return code get persisted in LastError va= riable? 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 dete= ct with the ExitBootService return code. 1) ExitBootServices !=3D 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. --=20 Pedro -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- 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/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-