From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jcp2I-0006Tv-2Y for mharc-grub-devel@gnu.org; Sun, 24 May 2020 07:43:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcp2H-0006Td-11 for grub-devel@gnu.org; Sun, 24 May 2020 07:43:21 -0400 Received: from ionic.de ([87.98.244.45]:49937 helo=mail.ionic.de) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jcp2F-0005ru-PN for grub-devel@gnu.org; Sun, 24 May 2020 07:43:20 -0400 Received: from apgunner.local.home.ionic.de (home.ionic.de [217.92.117.31]) by mail.ionic.de (Postfix) with ESMTPSA id AD8094F0BA14 for ; Sun, 24 May 2020 11:43:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=ionic.de; s=default; t=1590320596; bh=JNjtWanAc2JMcUeeggbt7vw0AqtnNTmMo5YcS7ePUuI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ofGcRyMiee/cYlgdwgHzesbZZnRZ9X6jTuzcJDeyOYsHAtZtlCc/8OdtA5NinP1kf FZBbiizslNThTuTmz2Ko4JzjSSB/agkE+WLE0wMCrYqrI301vkkaEVFKC10V3MDO0X vxGM22mrFOaZELQmhTnLeG9dY357ENAPstXjC/Jg= From: Mihai Moldovan To: The development of GNU GRUB Subject: [PATCH 4/7] grub-install: hook up --emu-512b to sector size autodetection in biosdisk Date: Sun, 24 May 2020 13:43:05 +0200 Message-Id: <20200524114308.1009-5-ionic@ionic.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200524114308.1009-1-ionic@ionic.de> References: <20200524114308.1009-1-ionic@ionic.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=87.98.244.45; envelope-from=ionic@ionic.de; helo=mail.ionic.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/24 07:43:16 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2020 11:43:21 -0000 Chances are that if you need the native-sector-addressing-with-512-bytes-lengths feature, you will also need grub to autodetect the native sector size later on. --- util/grub-install.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/util/grub-install.c b/util/grub-install.c index 57ef3ef33..89e80907c 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -1362,6 +1362,32 @@ main (int argc, char *argv[]) fprintf (load_cfg_f, "set debug='%s'\n", debug_image); } + + if (emu_512b) + { + switch (platform) + { + case GRUB_INSTALL_PLATFORM_I386_PC: + if (!load_cfg_f) + { + load_cfg_f = grub_util_fopen (load_cfg, "wb"); + } + have_load_cfg = 1; + /* + * Exporting this variable would be nice, but the export command + * is not part of the rescue shell, so that won't work. + */ + fprintf (load_cfg_f, + "set biosdisk_autodetect_sector_size='1'\n"); + break; + default: + grub_util_error ("%s", _("native-sector-addressing with " + "512-bytes length emulation is not " + "supported on your platform")); + break; + } + } + char *prefix_drive = NULL; char *install_drive = NULL; -- 2.25.1