From nobody Fri Dec 19 04:51:09 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD6FECA0EC3 for ; Tue, 12 Sep 2023 09:02:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233513AbjILJCg (ORCPT ); Tue, 12 Sep 2023 05:02:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233625AbjILJBp (ORCPT ); Tue, 12 Sep 2023 05:01:45 -0400 Received: from mail-wr1-x449.google.com (mail-wr1-x449.google.com [IPv6:2a00:1450:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14F5BA9 for ; Tue, 12 Sep 2023 02:01:41 -0700 (PDT) Received: by mail-wr1-x449.google.com with SMTP id ffacd0b85a97d-2f2981b8364so3555178f8f.1 for ; Tue, 12 Sep 2023 02:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694509299; x=1695114099; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=AlDjqAuNn+SPHq8xKGkJiI8M+/8xOHIEwhHGCoqKsJ8=; b=kMlJmNURDQo7xhbIwQc0RneC9X1i4R3TrAWMz2IXJLGphXOIKDmLIpTVo0AVFlDMbO 5KqG+ZW8HDUSdzG4I2Yc0hmBEJLDF2fOSLgnKrBpdMEiA6AAZTqqCmcitcC4lO7I+sRX ACwedzFZ3fqHq98/RURoYsTKIUhnmWxc0XO/N0WyxH7kbor3Ni3eO5GOthkvEfcgXlvZ bZipmYiCFtXUCTyATwUnnTgAQIisAeCyNOFBZZ2GgIZYH8O5MGb7A5to91bwHNA7yU9/ Z1h9H7E+ZbgZ89cdszj6tiHoZVMnk8ELvMmdDi36hwiYmT1EX/MmCOWNR87qQPxgV5Hy BoFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694509299; x=1695114099; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AlDjqAuNn+SPHq8xKGkJiI8M+/8xOHIEwhHGCoqKsJ8=; b=lCbWHPilbO6H7eJexppzR2lzTC9EQcy/MhD8tUCZ0toLmTmFPKzUTvfo34o+MnPHlr gVlMSufKd+Img4Lfr4xinimWQ38BjzfOGb3XNrTRKpWLEcrBmWfzfc888a8YEV69XBy0 wije+NUdvByXPP5ICrW0IWXIW9aiGN+fk9k20apHuIVKd3On6ulV2pY4L9jV4Euuj8de iJp3+tVfLxa9DnpWdfCVe51md8fe0bvPPXZKh1umKsOHZ+5RMfvQbXEPpNZhfY2Hjxih 0cMB3QIaTFOPDjonuYw/srgyJSFUjYnbGW8V2B8KfinXiAIk8v5edVUJ0N8BJ4uQfnaD nrwQ== X-Gm-Message-State: AOJu0YzJEg4Yml91VHRTEoJluapAp5dYrthAijxlZISgpxpX/4BVE60M sqI9wXsDhIWvBSyJZMjSLBe7f3MU X-Google-Smtp-Source: AGHT+IEFlFIMLNCJvhtnVvKAf+9hxBg4ZXdihbvjUd2emNqt13lwsGioEe+khkAhcvYcB47WAdv3/g67 X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a5d:6ace:0:b0:313:eb28:602 with SMTP id u14-20020a5d6ace000000b00313eb280602mr133683wrw.13.1694509299606; Tue, 12 Sep 2023 02:01:39 -0700 (PDT) Date: Tue, 12 Sep 2023 09:00:57 +0000 In-Reply-To: <20230912090051.4014114-17-ardb@google.com> Mime-Version: 1.0 References: <20230912090051.4014114-17-ardb@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=1808; i=ardb@kernel.org; h=from:subject; bh=AfG+aUI7K/0L+mw64Lzpmg/Sf5R/K8tGxwHtjeLluJ0=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIZVB4/QE0Se3uP0dg7Nfrdy/Q4lfxrhW8IHbVubuDr/VW vFXEl90lLIwiHEwyIopsgjM/vtu5+mJUrXOs2Rh5rAygQxh4OIUgIlsvcvwz/LLsTYr7cDyzLIg 0cN80ifDzpWsE96YJv9m9YRTL7Xy2xj+KSzWt4rY92el6NI5v49OUtwQsn/JjyM279tyjhjpmG+ pZwQA X-Mailer: git-send-email 2.42.0.283.g2d96d420d3-goog Message-ID: <20230912090051.4014114-23-ardb@google.com> Subject: [PATCH v2 06/15] x86/boot: Drop redundant code setting the root device From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel , Evgeniy Baskov , Borislav Petkov , Dave Hansen , Ingo Molnar , Thomas Gleixner , Peter Jones , Matthew Garrett , Gerd Hoffmann , Kees Cook , "H. Peter Anvin" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel The root device defaults to 0,0 and is no longer configurable at build time [0], so there is no need for the build tool to ever write to this field. [0] 079f85e624189292 ("x86, build: Do not set the root_dev field in bzImage= ") This change has no impact on the resulting bzImage binary. Signed-off-by: Ard Biesheuvel --- arch/x86/boot/header.S | 2 +- arch/x86/boot/tools/build.c | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S index a87d9133384b..6059f87b159d 100644 --- a/arch/x86/boot/header.S +++ b/arch/x86/boot/header.S @@ -236,7 +236,7 @@ root_flags: .word ROOT_RDONLY syssize: .long 0 /* Filled in by build.c */ ram_size: .word 0 /* Obsolete */ vid_mode: .word SVGA_MODE -root_dev: .word 0 /* Filled in by build.c */ +root_dev: .word 0 /* Default to major/minor 0/0 */ boot_flag: .word 0xAA55 =20 # offset 512, entry point diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c index 0354c223e354..efa4e9c7d713 100644 --- a/arch/x86/boot/tools/build.c +++ b/arch/x86/boot/tools/build.c @@ -40,10 +40,6 @@ typedef unsigned char u8; typedef unsigned short u16; typedef unsigned int u32; =20 -#define DEFAULT_MAJOR_ROOT 0 -#define DEFAULT_MINOR_ROOT 0 -#define DEFAULT_ROOT_DEV (DEFAULT_MAJOR_ROOT << 8 | DEFAULT_MINOR_ROOT) - /* Minimal number of setup sectors */ #define SETUP_SECT_MIN 5 #define SETUP_SECT_MAX 64 @@ -399,9 +395,6 @@ int main(int argc, char ** argv) =20 update_pecoff_setup_and_reloc(i); =20 - /* Set the default root device */ - put_unaligned_le16(DEFAULT_ROOT_DEV, &buf[508]); - /* Open and stat the kernel file */ fd =3D open(argv[2], O_RDONLY); if (fd < 0) --=20 2.42.0.283.g2d96d420d3-goog