Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1oU31c-0003ze-6p for mharc-grub-devel@gnu.org; Fri, 02 Sep 2022 05:31:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oU31X-0003yZ-1T for grub-devel@gnu.org; Fri, 02 Sep 2022 05:31:40 -0400 Received: from smtp-relay-internal-0.canonical.com ([185.125.188.122]:52396) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oU31R-0001b7-Jy for grub-devel@gnu.org; Fri, 02 Sep 2022 05:31:37 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 4999E3F466 for ; Fri, 2 Sep 2022 09:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1662111088; bh=WVUugh/C0TYzTFvQwS7qJtZcZXXaEznYmdRPhdXeefk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=gAReFInk/82wWXZlTnkvfZyscnkeTrIVfeLyicTE0yhmwYy1NuaB+4M1UYSAIY7uj W+r/UZvGJbVhbsVNfJ5JK02oANiBDfvxVtSh/ary2vDCJTAG+GTUClWFhQXC71omyR pJggE33Uc3N8xKz+f5KvTj7LJBJvHB+N9Otu0TGpAQ8/munmyXzlQJhqypvcIEvqD7 SkW+NWk6gtue4JYFscObm28YjOvKHytDsQdP2WLY9WJqt4c/1lm89mb9L8huxMtyvX pYxKL6lQkQVyC1yF6K6Zh0DYFwGBexUSMgb8MjdYD2oDbFBrdO0z9x3hyr87uEZQvm Hu9IRxbcf+1uw== Received: by mail-wm1-f71.google.com with SMTP id n7-20020a1c2707000000b003a638356355so928975wmn.2 for ; Fri, 02 Sep 2022 02:31:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=WVUugh/C0TYzTFvQwS7qJtZcZXXaEznYmdRPhdXeefk=; b=D9VH/x6JN4iHIy00zPFezWzCk4VXfMW//7+W6KAaL1j1rIf1y9X9CNU7qqcebi9QuD nlaiFNDEupEW+Nl6lcIEIEs9lHV+UM1QnazmCNzJzp1oDP35WlnjKQQv/ds66EhZ4S80 kRkNgf1f+WDvupneM69U5o6AWvOFYxBGGv2E8MkS279HkXhUEZOyJ/PJtseoJeF9++bB nWIL/88x5AoGn9lWGolLyQhBDVERhVdfl8BaZuUqH6Kma1s3MGRLKvnzUgNx07wx8KhH O/tKSw6KQ2xfGY6pIEwTBqP1UvOvyRp6LcM6p+2wjU5oB1QmVuzRpJG7Bgcid9ipnNuN +TPg== X-Gm-Message-State: ACgBeo33XBGK5UWJbXhbEN6F1HSSvZC3/wuuvKXjrC66VxEFktNTJxGf kLfWK659AO9sLLV9I94tI5a2sXnenDSVmlwlzq/Bh04dL77h4QSB+5VtrHmdiS1TTnln4mmRjHC 7Zi8wi12JP8BjA9YboadJ4jfPmYfA X-Received: by 2002:a5d:47a4:0:b0:226:e547:b602 with SMTP id 4-20020a5d47a4000000b00226e547b602mr9680350wrb.406.1662111087981; Fri, 02 Sep 2022 02:31:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR77G8bGVczYEwsYx00elhYy2+Vf67MARI7OY10igIogLNICMMHrjRHnz5RiQ7qOx6DlwX6nPQ== X-Received: by 2002:a5d:47a4:0:b0:226:e547:b602 with SMTP id 4-20020a5d47a4000000b00226e547b602mr9680327wrb.406.1662111087674; Fri, 02 Sep 2022 02:31:27 -0700 (PDT) Received: from [192.168.123.67] (ip-084-118-157-002.um23.pools.vodafone-ip.de. [84.118.157.2]) by smtp.gmail.com with ESMTPSA id r11-20020a5d498b000000b0022546f469e1sm1050450wrq.28.2022.09.02.02.31.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Sep 2022 02:31:27 -0700 (PDT) Message-ID: <4b1bbd7f-1c99-3844-4e7e-b70bcbb632ef@canonical.com> Date: Fri, 2 Sep 2022 11:31:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH v3 0/8] linux: implement LoadFile2 initrd loading Content-Language: en-US To: Ard Biesheuvel , grub-devel@gnu.org Cc: Daniel Kiper , Leif Lindholm , Nikita Ermakov , Atish Patra , Huacai Chen , dann frazier , Julian Andres Klode References: <20220818145135.2208251-1-ardb@kernel.org> From: Heinrich Schuchardt In-Reply-To: <20220818145135.2208251-1-ardb@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=185.125.188.122; envelope-from=heinrich.schuchardt@canonical.com; helo=smtp-relay-internal-0.canonical.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2022 09:31:40 -0000 On 8/18/22 16:51, Ard Biesheuvel wrote: > This implements the LoadFile2 initrd loading protocol, which is > essentially a callback interface into the bootloader to load the initrd > data into a caller provided buffer. This means the bootloader no longer > has to contain any policy regarding where to load the initrd (which > differs between architectures and kernel versions) and no longer has to > manipulate arch specific data structures such as DT or struct bootparams > to inform the OS where the initrd resides in memory. This is especially > relevant for the upcoming LoongArch support, which does not use either > DT or struct bootparams, and would have to rely on the initrd= command > line interface, which is deprecated and of limited utility [0]. > > Sample output from booting a recent Linux/arm64 kernel: > > grub> insmod part_msdos > grub> linux (hd0,msdos1)/Image > grub> initrd (hd0,msdos1)/initrd.img > grub> boot > EFI stub: Booting Linux Kernel... > EFI stub: EFI_RNG_PROTOCOL unavailable, KASLR will be disabled > EFI stub: Generating empty DTB > EFI stub: Loaded initrd from LINUX_EFI_INITRD_MEDIA_GUID device path > EFI stub: Exiting boot services and installing virtual address map... > [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x411fd070] > > This is mostly a resend of my original v2 [1], although I did > cherry-pick Nikita's version of the first patch, which incorporates > Heinrich's suggestion to simply drop the argv[] argument from > grub_initrd_load(). I also included the patch I sent out the other day > to remove the pointless header magic number check, and included a fix > for the PXE boot issue reported by dann [2]. > > Changes since v2: > - incorporate some ancient feedback from Daniel that I never saw until > today. (this is why I am sending two versions of the same series on > the same day - apologies for the spam) > > [0] The initrd= command line loader can only access files that reside on > the same volume as the loaded image, which means GRUB would have to > present this volume abstraction in order to serve the initrd file. > Another reason why this method is problematic is generic EFI zboot, > which is being added to Linux, and which calls loadimage on another, > embedded PE/COFF image which would also need to expose this volume > abstraction. > > [1] https://lists.gnu.org/archive/html/grub-devel/2020-10/msg00124.html > [2] https://lists.gnu.org/archive/html/grub-devel/2022-04/msg00055.html How about https://lists.gnu.org/archive/html/grub-devel/2021-10/msg00209.html? I guess Atish's patches shall be rebased upon this series here. loader: Move arm64 linux loader to common code RISC-V: Update image header RISC-V: Use common linux loader Best regards Heinrich > > Cc: Daniel Kiper > Cc: Leif Lindholm > Cc: Nikita Ermakov > Cc: Atish Patra > Cc: Huacai Chen > Cc: Heinrich Schuchardt > Cc: dann frazier > Cc: Julian Andres Klode > > Ard Biesheuvel (7): > efi: move MS-DOS stub out of generic PE header definition > arm64/linux: Remove magic number header field check > linux/arm: unify ARM/arm64 vs Xen PE/COFF header handling > linux/arm: account for COFF headers appearing at unexpected offsets > efi/efinet: Don't close connections at fini_hw() time > efi: implement LoadFile2 initrd loading protocol for Linux > linux: ignore FDT unless we need to modify it > > Nikita Ermakov (1): > loader: drop argv[] argument in grub_initrd_load() > > grub-core/commands/efi/lsefi.c | 1 + > grub-core/kern/efi/efi.c | 5 +- > grub-core/loader/arm/linux.c | 2 +- > grub-core/loader/arm64/linux.c | 175 +++++++++++++++++--- > grub-core/loader/arm64/xen_boot.c | 23 +-- > grub-core/loader/efi/fdt.c | 7 +- > grub-core/loader/i386/linux.c | 2 +- > grub-core/loader/i386/pc/linux.c | 2 +- > grub-core/loader/i386/xen.c | 3 +- > grub-core/loader/ia64/efi/linux.c | 2 +- > grub-core/loader/linux.c | 4 +- > grub-core/loader/mips/linux.c | 2 +- > grub-core/loader/powerpc/ieee1275/linux.c | 2 +- > grub-core/loader/sparc64/ieee1275/linux.c | 2 +- > grub-core/net/drivers/efi/efinet.c | 10 +- > grub-core/net/net.c | 2 +- > include/grub/arm/linux.h | 7 +- > include/grub/arm64/linux.h | 5 +- > include/grub/efi/api.h | 40 +++++ > include/grub/efi/efi.h | 4 +- > include/grub/efi/pe32.h | 5 +- > include/grub/linux.h | 2 +- > include/grub/net.h | 3 +- > 23 files changed, 245 insertions(+), 65 deletions(-) >