From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jcph1-0007kw-TK for mharc-grub-devel@gnu.org; Sun, 24 May 2020 08:25:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcpgz-0007iv-NO for grub-devel@gnu.org; Sun, 24 May 2020 08:25:25 -0400 Received: from ionic.de ([87.98.244.45]:54171 helo=mail.ionic.de) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jcpgx-0004k2-UW for grub-devel@gnu.org; Sun, 24 May 2020 08:25:25 -0400 Received: from apgunner.local.home.ionic.de (home.ionic.de [217.92.117.31]) by mail.ionic.de (Postfix) with ESMTPSA id 9E2084F0BA16 for ; Sun, 24 May 2020 12:25:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=ionic.de; s=default; t=1590323122; bh=1ha2PTT78rpNuUzkszrA+21GXoUEWtdM8D01Ht+gqAQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=o0cFjxSxuoP6BGmqQjCzZZaDMYI8RxRY/tB1DlKIMa2myl/J21IAPFWukhnnVMGeB O1CZZ274ma/yEx8QJRbE/d848+nH3GUwDjzAEWKgIUAPx/n2GIdaiiofV3vsY9+ebJ 7PSnHaW8Kc9Jrs8c6PVi6M6pr37nG8erwFFh32FA= From: Mihai Moldovan To: The development of GNU GRUB Subject: [PATCH v2 4/7] grub-install: hook up --emu-512b to sector size autodetection in biosdisk Date: Sun, 24 May 2020 14:25:14 +0200 Message-Id: <20200524122517.5010-5-ionic@ionic.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200524122517.5010-1-ionic@ionic.de> References: <20200524122517.5010-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 12:25:25 -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 781ad3fc0..7aec83229 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