From: "Grégoire Sutre" <gregoire.sutre@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: [PATCH] NetBSD boot disk info
Date: Sat, 20 Jul 2013 02:06:19 +0200 [thread overview]
Message-ID: <51E9D47B.4050406@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 289 bytes --]
Hi,
The attached patch improves knetbsd regarding boot disk info:
- the boot disk info is filled unconditionally,
- toplevel BSD disk labels are not ignored anymore.
This makes knetbsd's behavior closer to that of the NetBSD
native boot loader with respect to boot disk info.
Grégoire
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: netbsd-bootdisk.diff --]
[-- Type: text/x-patch; name="netbsd-bootdisk.diff", Size: 2183 bytes --]
=== modified file 'ChangeLog'
--- ChangeLog 2013-07-18 15:59:14 +0000
+++ ChangeLog 2013-07-19 22:51:04 +0000
@@ -1,3 +1,8 @@
+2013-07-20 Grégoire Sutre <gregoire.sutre@gmail.com>
+
+ * grub-core/loader/i386/bsd.c (grub_netbsd_add_boot_disk_and_wedge):
+ Always fill bootdisk info and improve check for NetBSD disklabel.
+
2013-07-18 Leif Lindholm <leif.lindholm@arm.com>
2013-07-18 Francesco Lavra <francescolavra.fl@gmail.com>
2013-07-18 Vladimir Serbinenko <phcoder@gmail.com>
=== modified file 'grub-core/loader/i386/bsd.c'
--- grub-core/loader/i386/bsd.c 2013-04-28 13:18:50 +0000
+++ grub-core/loader/i386/bsd.c 2013-07-19 22:44:12 +0000
@@ -1088,22 +1088,30 @@ grub_netbsd_add_boot_disk_and_wedge (voi
grub_bsd_add_meta (NETBSD_BTINFO_BOOTWEDGE, &biw, sizeof (biw));
}
- /* Fill bootdisk if this a NetBSD disk label. */
- if (part->partmap != NULL &&
- (grub_strcmp (part->partmap->name, "netbsd") == 0) &&
- buf.label.magic == grub_cpu_to_le32 (GRUB_PC_PARTITION_BSD_LABEL_MAGIC))
- {
- struct grub_netbsd_btinfo_bootdisk bid;
+ /* Fill bootdisk. */
+ {
+ struct grub_netbsd_btinfo_bootdisk bid;
- grub_memset (&bid, 0, sizeof (bid));
- bid.labelsector = partmapsector;
- bid.label.type = buf.label.type;
- bid.label.checksum = buf.label.checksum;
- memcpy (bid.label.packname, buf.label.packname, 16);
- bid.biosdev = biosdev;
- bid.partition = part->number;
- grub_bsd_add_meta (NETBSD_BTINFO_BOOTDISK, &bid, sizeof (bid));
- }
+ grub_memset (&bid, 0, sizeof (bid));
+ /* Check for a NetBSD disk label. */
+ if (part->partmap != NULL &&
+ (grub_strcmp (part->partmap->name, "netbsd") == 0 ||
+ (part->parent == NULL && grub_strcmp (part->partmap->name, "bsd") == 0)))
+ {
+ bid.labelsector = partmapsector;
+ bid.label.type = buf.label.type;
+ bid.label.checksum = buf.label.checksum;
+ memcpy (bid.label.packname, buf.label.packname, 16);
+ }
+ else
+ {
+ bid.labelsector = -1;
+ }
+ bid.biosdev = biosdev;
+ bid.partition = part->number;
+
+ grub_bsd_add_meta (NETBSD_BTINFO_BOOTDISK, &bid, sizeof (bid));
+ }
fail:
if (dev)
reply other threads:[~2013-07-20 0:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51E9D47B.4050406@gmail.com \
--to=gregoire.sutre@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).