From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E5C3C47094 for ; Mon, 7 Jun 2021 17:52:37 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A35B060E0B for ; Mon, 7 Jun 2021 17:52:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A35B060E0B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2686982B30; Mon, 7 Jun 2021 19:52:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jiw10vqm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1DBAD82CEE; Mon, 7 Jun 2021 19:52:33 +0200 (CEST) Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E266982AE5 for ; Mon, 7 Jun 2021 19:52:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=matwey.kornilov@gmail.com Received: by mail-qv1-xf2a.google.com with SMTP id q6so9338298qvb.2 for ; Mon, 07 Jun 2021 10:52:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=l7cC8J+wyHnuO7I7tVTPdq96i31yFnbv4OBKZtKTUM4=; b=jiw10vqmOuykwc4PhKJC0kk1vOmEFF465xCPMYHlHgeu7s+iok+tbmQbMUbioxzhIu /4iaAanfZOnUnG5Wk8vBx3qlNTCtOOTIjzgfQPDzXcZufd7QO/vly0mLEu9CNqHm/4T+ JZq+NPHxerVp7LAQzAEihj5fnHpCp1hfIn2m24pJYuOL1qV+lovfm3r6jwIm9xRg8kZw REytMk0ytP7nevViml5q7hzlroAWY4bXS2u3Ty60aZupY477+CVSseGayYMto0E0HfhJ C8k5ESPCOQJUSIBGbkmytuI6J7N78AsG4Ns7ii0hZnVzdpbKq6/NWH2tavkBs4PMPduo kWnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=l7cC8J+wyHnuO7I7tVTPdq96i31yFnbv4OBKZtKTUM4=; b=Y4yvcuPqhgf60qkF4zItEnt25A7meD2eGDb0+Io7QDK1kMgio9l4F4zCM8zuVlYVoF aJllNQummwg95Lu0O+GGRD80e2YPttkSDq4J45LhAmHEJsV+hewH6qEz3iAX6GvIgjtl hR9dkTqIHLf5G+YPHm6mMNHOL67rZYO9ttaKC5ZAfcfF91p10AjcO/fHPbNWZPEjjHWL oPdRZE9y8XItfMLgT6cui6VWtGgra8a6Lv5C3WGmgoAvwLHwbjFSJdzrBeucgxUEDXxJ F+txAECLGhATZdzn3C5elAp2hMzjYMsrTYST3PlnNUjyN1xXMMknpRyvEn9DV0cZrEHB F+ig== X-Gm-Message-State: AOAM533+HAb47tJ57wQYHPO/D3wymEX0+7lpmdnMDCSZObo+3PepD+o0 lXr8bEmZm7s3ujA7Lyqc9YC5aew8hbxkCfKlKoI= X-Google-Smtp-Source: ABdhPJwlm0bH9n1PvVXPODq27tGbqXQua9uexP2H2LM8w51kNpGPyzWF5k1oisoskYW+ndqFgq5KRFy+H0HmMLth4Vw= X-Received: by 2002:a0c:f582:: with SMTP id k2mr15612172qvm.51.1623088348648; Mon, 07 Jun 2021 10:52:28 -0700 (PDT) MIME-Version: 1.0 References: <5e1f6595-3371-8d56-ebfa-916d10b5aad4@gmx.de> <8d847043-ab5d-a627-ed71-5f8829bcad8c@gmx.de> <6683bdcc-d83b-de80-b0b2-4d0b8df268f0@gmx.de> In-Reply-To: <6683bdcc-d83b-de80-b0b2-4d0b8df268f0@gmx.de> From: "Matwey V. Kornilov" Date: Mon, 7 Jun 2021 20:51:47 +0300 Message-ID: Subject: Re: BISECTED f3866909e350 ("distro_bootcmd: call EFI bootmgr even without having /EFI/boot") To: Heinrich Schuchardt Cc: michael@walle.cc, U-Boot Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean =D0=B2=D1=81, 6 =D0=B8=D1=8E=D0=BD. 2021 =D0=B3. =D0=B2 19:47, Heinrich Sch= uchardt : > > On 6/6/21 6:21 PM, Heinrich Schuchardt wrote: > > On 6/6/21 5:42 PM, Matwey V. Kornilov wrote: > >> =D0=B2=D1=81, 6 =D0=B8=D1=8E=D0=BD. 2021 =D0=B3. =D0=B2 18:20, Heinric= h Schuchardt : > >>> > >>> On 6/6/21 4:37 PM, Matwey V. Kornilov wrote: > >>>> Hi, > >>>> > >>>> I've found that > >>>> > >>>> f3866909e350 ("distro_bootcmd: call EFI bootmgr even without having > >>>> /EFI/boot") > >>>> > >>>> breaks running EFI application from USB device on BeagleBone Black > >>>> (am335x) device. > >>>> > >>>> With this patch I see the following: > >>>> > >>>> Booting /efi\boot\bootarm.efi > >>>> Welcome to GRUB! > >>>> > >>>> data abort > >>>> pc : [<9ce0b6d0>] lr : [<9ffab7c7>] > >>>> reloc pc : [<7d69d6d0>] lr : [<8083d7c7>] > >>>> sp : 9df44e28 ip : 9ffdfe90 fp : 00000003 > >>>> r10: 9ffe3300 r9 : 00000000 r8 : 9df6fe88 > >>>> r7 : 00000000 r6 : 9ce5da08 r5 : 9ce571f8 r4 : 9ce2c040 > >>>> r3 : 00000000 r2 : 00000001 r1 : 9ce56598 r0 : 00000000 > >>>> Flags: NzCv IRQs off FIQs on Mode SVC_32 > >>>> Code: e3500000 0a000015 e590000c eb00f96e (e5d03000) > >>> > UEFI image [0x9ce46000:0x9cf28fff] '/efi\boot\bootarm.efi' > >>> > Resetting CPU ... > >>> > >>> Hello Matwey, > >>> > >>> thank you for reporting the issue. > >>> > >>> $ echo 'Code: e3500000 0a000015 e590000c eb00f96e (e5d03000)' | > >>> CROSS_COMPILE=3Darm-linux-gnueabihf- ARCH=3Darm scripts/decodecode > >>> > >>> Code: e3500000 0a000015 e590000c eb00f96e (e5d03000) > >>> All code > >>> =3D=3D=3D=3D=3D=3D=3D=3D > >>> 0: e3500000 cmp r0, #0 > >>> 4: 0a000015 beq 0x60 > >>> 8: e590000c ldr r0, [r0, #12] > >>> c: eb00f96e bl 0x3e5cc > >>> 10:* e5d03000 ldrb r3, [r0] <-- trappin= g > >>> instruction > >>> > >>> Code starting with the faulting instruction > >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > >>> 0: e5d03000 ldrb r3, [r0] > >>> > >>> Looking at the disassembly above we see that reading memory location > >>> NULL fails. > >>> > >>> We need to find out where the exception occurs. The code position is > >>> neither in bootarm.efi nor in U-Boot (9ce0b6d0 is lower than the load > >>> position of bootarm.efi, so it is below the relocated U-Boot code). > >>> > >>> Please, add the following line at the start of grub.cfg to get more > >>> output from GRUB: > >>> > >>> debug=3Dall > >> > >> This doesn't provide any additional output from GRUB :( > >> > >>> > >>> When building U-Boot, please, add > >>> > >>> #define DEBUG 1 > >>> > >>> in lib/efi_loader/efi_disk.c and lib/efi_loader_file.c a line before > >>> #include . > >> > >> > >> This doesn't provide much output as well: > >> > >> Scanning disk mmc@48060000.blk... > >> EFI: Call: efi_install_multiple_protocol_interfaces( &handle, > >> &efi_guid_device_path, diskobj->dp, &efi_block_io_guid, &diskobj->ops, > >> NULL) > >> EFI: 0 returned by efi_install_multiple_protocol_interfaces( &handle, > >> &efi_guid_device_path, diskobj->dp, &efi_block_io_guid, &diskobj->ops, > >> NULL) > >> ** Unrecognized filesystem type ** > >> Scanning disk mmc@481d8000.blk... > >> EFI: Call: efi_install_multiple_protocol_interfaces( &handle, > >> &efi_guid_device_path, diskobj->dp, &efi_block_io_guid, &diskobj->ops, > >> NULL) > >> EFI: 0 returned by efi_install_multiple_protocol_interfaces( &handle, > >> &efi_guid_device_path, diskobj->dp, &efi_block_io_guid, &diskobj->ops, > >> NULL) > >> EFI: Call: efi_install_multiple_protocol_interfaces( &handle, > >> &efi_guid_device_path, diskobj->dp, &efi_block_io_guid, &diskobj->ops, > >> NULL) > >> EFI: 0 returned by efi_install_multiple_protocol_interfaces( &handle, > >> &efi_guid_device_path, diskobj->dp, &efi_block_io_guid, &diskobj->ops, > >> NULL) > >> Found 3 disks > > > > This implies that GRUB is crashing before even accessing the file syste= m > > (including grub.cfg). > > > > On an OrangePi PC I deleted /boot.scr and moved grubarm.efi to > > /EFI/boot/bootarm.efi. It boots without problem. > > > > What version of GRUB are you using? > > How were you booting before updating U-Boot? > > What version of U-Boot are you using where the error occurs? > > Why do you have grub in /EFI/boot/bootarm.efi and not in a distro > > specific path, e.g. /EFI/debian/grubarm.efi? /EFI/boot is typically onl= y > > used by installers. > > > > If the boot manager is started by distroboot it may not have an > > appropriate device path. It tries to load the file given by environment > > variable $fdtfile from the boot device. > > > > From the U-Boot console could you, please, try: > > > > 1) > > load usb 0:1 $kernel_addr_r EFI/boot/bootarm.efi > > bootefi bootmgr > > > > > > 2) > > load usb 0:1 $kernel_addr_r EFI/boot/bootarm.efi > > load usb 0:2 $fdt_addr_r dtb > > bootefi bootmgr $fdt_addr_r > > > > where you need to replace dtb by the correct device tree file and adjus= t > > the partition numbers. > > > > Best regards > > > > Heinrich > > To catch the earlier EFI API calls you can add > > #define DEBUG 1 > > to lib/efi_loader/efi_boottime.c Welcome to GRUB! EFI: Entry efi_locate_handle_ext(2, 9042a9de-23dc-4a38-96fb-7aded080516a, 00000000, 9df40dfc, 9ce2d660) EFI: Exit: efi_locate_handle_ext: 14 EFI: Entry efi_open_protocol(9df5f298, 5b1b31a1-9562-11d2-8e3f-00a0c969723b, 9df40e14, 9df5f298, 00000000, 0x2) EFI: Exit: efi_open_protocol: 0 EFI: Entry efi_open_protocol(00000000, 09576e91-6d3f-11d2-8e39-00a0c969723b, 9df40e14, 9df5f298, 00000000, 0x2) EFI: Exit: efi_open_protocol: 2 data abort pc : [<9ce076d0>] lr : [<9ffa85b3>] reloc pc : [<7d69d6d0>] lr : [<8083e5b3>] sp : 9df40e28 ip : 00000000 fp : 00000003 r10: 9ffe2df8 r9 : 00000000 r8 : 9df5f298 r7 : 00000000 r6 : 9ce59a08 r5 : 9ce531f8 r4 : 9ce28040 r3 : 00000000 r2 : 9ffeb328 r1 : 00000000 r0 : 00000000 Flags: NzCv IRQs off FIQs on Mode SVC_32 Code: e3500000 0a000015 e590000c eb00f96e (e5d03000) UEFI image [0x9ce42000:0x9cf24fff] '/efi\boot\bootarm.efi' Resetting CPU ... > > Best regards > > Heinrich > > --=20 With best regards, Matwey V. Kornilov