From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OEV9e-0003E7-PJ for mharc-grub-devel@gnu.org; Tue, 18 May 2010 18:20:50 -0400 Received: from [140.186.70.92] (port=49923 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OEV9c-0003E1-41 for grub-devel@gnu.org; Tue, 18 May 2010 18:20:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OEV9a-0002By-3U for grub-devel@gnu.org; Tue, 18 May 2010 18:20:48 -0400 Received: from mail-ew0-f216.google.com ([209.85.219.216]:44582) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OEV9Z-0002Bi-RL for grub-devel@gnu.org; Tue, 18 May 2010 18:20:46 -0400 Received: by ewy8 with SMTP id 8so1875350ewy.8 for ; Tue, 18 May 2010 15:20:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type; bh=zfbHRiC3t7ZAL2PLQc8lS7sNCMEuPUNCHOKdRmJ0BOg=; b=Izstp9RoukFj79KolyF9mcIQ8Rq0d5sQb0TQ2PktlHMX45z9pFyedXbSyL0OFcXEkT DBgIE6k5czi6HhYkEzQ/cuAWvHD97euOZBOQvyfidbgewWbbKX0XkSl3hpAqsN+f9yw0 v5YRRB0qa+6kjMUWPD5gCHNd28qe1Jvoz055A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type; b=FtILtYjBZCbFhzL5BhHXUSZYIB9wTiszmFo0fN6VI4qgCqPstr3efDiytZougbmgHn 7ZrT+H3NavwqiZxGe+MkoJACy6vQnYLQZJAB0175Fn0CXjCCthCrF6AJCwnPegXc26df gPTdsMViKiD6PDkeRrHp6sAFMFWC8yIeXyRO8= Received: by 10.213.52.6 with SMTP id f6mr3071609ebg.51.1274221244642; Tue, 18 May 2010 15:20:44 -0700 (PDT) Received: from debian.bg45.phnet (gprs57.swisscom-mobile.ch [193.247.250.57]) by mx.google.com with ESMTPS id 13sm3292185ewy.1.2010.05.18.15.20.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 18 May 2010 15:20:44 -0700 (PDT) Message-ID: <4BF312B0.8020700@gmail.com> Date: Wed, 19 May 2010 00:20:32 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20091109) MIME-Version: 1.0 To: The development of GNU GRUB References: <4BF2DE4F.7070209@gmail.com> <4BF2F68E.8090906@gmail.com> In-Reply-To: <4BF2F68E.8090906@gmail.com> X-Enigmail-Version: 0.95.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig80AC1149474E69CC143BF702" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: Are BSD partitions not supported? X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2010 22:20:50 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig80AC1149474E69CC143BF702 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Vladimir '=CF=86-coder/phcoder' Serbinenko wrote: > C. P. Ghost wrote: > =20 >> 2010/5/18 Vladimir '=CF=86-coder/phcoder' Serbinenko : >> =20 >> =20 >>> C. P. Ghost wrote: >>> =20 >>> =20 >>>> On Sun, May 16, 2010 at 6:24 PM, C. P. Ghost wr= ote: >>>> >>>> =20 >>>> =20 >>>>> is support for BSD partitions (or maybe ufs2) broken in grub2 (1.98= )? >>>>> >>>>> =20 >>>>> =20 >>>> No replies so far? Could a developer *please* have a closer look >>>> at this? >>>> >>>> >>>> =20 >>>> =20 >>> Your mail is quite long and looks like a tech support request. If it = is >>> such it's not right mailing list. Use help-grub@gnu.org or IRC. If it= 's >>> a bug report please supply an image file which triggers bug. >>> BSD partitions are supported as long as part_msdos and part_bsd (not >>> necessary in release) are loaded. >>> =20 >>> =20 >> (2nd try, mailer swallowed the attachment) >> >> Thank you for replying. >> >> Of course, it is a bug report. The steps to create the image are >> very detailed and should be enough to reproduce the bug on a >> FreeBSD/amd64 system. >> >> Here's a 362k 7z-compressed image of a 25MB disk >> that contains one slice 's1' with a BSD partition 'a' and >> a UFS2 filesystem on it: >> >> http://www.cordula.ws/tempdir/bsddisk.7z >> >> Don't expect it to boot, because grub-install wasn't able >> to complete the task (grub-probe failed as in the long mail). >> The file system contains the /boot/grub/* files though: those >> were properly installed by grub-install. Just not the MBR. >> >> If I can provide more help, please do ask. :) >> >> =20 >> =20 > This bsdlabel has 2 strangenesses. First one is seen in your log: > > a: 497936 16 unused 0 0 > In other words for some strange reason it's declared as unused entry sl= ot. > Second one is that offsets are stored relative to host partition, not r= elative to disk start. While the first can be easily fixed by checking le= ngth instead of type, second one isproblematic since it would break all o= ther images (I've checked with FreeBSD andNetBSD images I had under my ha= nd). So we need areliable way to determine which way is used. I found few= differing bytes between your image and my FreeBSD image (specifically by= tes 0x(80)30-0x(80)3f) but nothing that would allow a reliable detection.= If you can find out the reason and a way of detecting this diskrepancy i= t will help > > =20 My first thought was to use 'c' partition to find this base but I dismissed it straight ahead because it's only a convention that 'c' covers the whole disk. But then I played with bsdlabel and found out that if I move 'c' partition FreeBSD itself is confused too. Since nobody would consider it a bug if GRUB doesn't recognise properly a partition not workable in FreeBSD itself I think we should go for consistent behaviour for the lack of anything better. Try the patch: =3D=3D=3D modified file 'include/grub/bsdlabel.h' --- include/grub/bsdlabel.h 2010-02-06 17:43:37 +0000 +++ include/grub/bsdlabel.h 2010-05-18 22:05:09 +0000 @@ -63,6 +63,8 @@ #define GRUB_PC_PARTITION_OPENBSD_TYPE_NTFS 18 #define GRUB_PC_PARTITION_OPENBSD_TYPE_RAID 19 =20 +#define GRUB_PC_PARTITION_BSD_LABEL_WHOLE_DISK_PARTITION 2 + /* The BSD partition entry. */ struct grub_partition_bsd_entry { =3D=3D=3D modified file 'partmap/bsdlabel.c' --- partmap/bsdlabel.c 2010-03-26 14:44:13 +0000 +++ partmap/bsdlabel.c 2010-05-18 22:13:37 +0000 @@ -37,9 +37,6 @@ grub_disk_addr_t delta =3D 0; unsigned pos; =20 - /* BSDLabel offsets are absolute even when it's embed inside partition. */ - delta =3D grub_partition_get_start (disk->partition); - /* Read the BSD label. */ if (grub_disk_read (disk, GRUB_PC_PARTITION_BSD_LABEL_SECTOR, 0, sizeof (label), &label)) @@ -49,15 +46,36 @@ if (label.magic !=3D grub_cpu_to_le32 (GRUB_PC_PARTITION_BSD_LABEL_MAG= IC)) return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature"); =20 + /* A kludge to determine a base of be.offset. */ + if (GRUB_PC_PARTITION_BSD_LABEL_WHOLE_DISK_PARTITION + < grub_cpu_to_le16 (label.num_partitions)) + { + struct grub_partition_bsd_entry whole_disk_be; + + pos =3D sizeof (label) + GRUB_PC_PARTITION_BSD_LABEL_SECTOR + * GRUB_DISK_SECTOR_SIZE + sizeof (struct grub_partition_bsd_entry) + * GRUB_PC_PARTITION_BSD_LABEL_WHOLE_DISK_PARTITION; + + if (grub_disk_read (disk, pos / GRUB_DISK_SECTOR_SIZE, + pos % GRUB_DISK_SECTOR_SIZE, sizeof (whole_disk_be), + &whole_disk_be)) + return grub_errno; + + delta =3D grub_le_to_cpu32 (whole_disk_be.offset); + } + pos =3D sizeof (label) + GRUB_PC_PARTITION_BSD_LABEL_SECTOR * GRUB_DISK_SECTOR_SIZE; =20 for (p.number =3D 0; p.number < grub_cpu_to_le16 (label.num_partitions); - p.number++) + p.number++, pos +=3D sizeof (struct grub_partition_bsd_entry)) { struct grub_partition_bsd_entry be; =20 + if (p.number =3D=3D GRUB_PC_PARTITION_BSD_LABEL_WHOLE_DISK_PARTITI= ON) + continue; + p.offset =3D pos / GRUB_DISK_SECTOR_SIZE; p.index =3D pos % GRUB_DISK_SECTOR_SIZE; =20 @@ -68,11 +86,9 @@ p.len =3D grub_le_to_cpu32 (be.size); p.partmap =3D &grub_bsdlabel_partition_map; =20 - if (be.fs_type !=3D GRUB_PC_PARTITION_BSD_TYPE_UNUSED) + if (p.len !=3D 0) if (hook (disk, &p)) return grub_errno; - - pos +=3D sizeof (struct grub_partition_bsd_entry); } =20 return GRUB_ERR_NONE; --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------enig80AC1149474E69CC143BF702 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iF4EAREKAAYFAkvzErYACgkQNak7dOguQgmXQwD7Bhpu0UTthNG7OSZBmAeOlACo BVj1U81vn8qWc1LdtRMA/3acaxt2Sw6BrPE/umbbnlXMbgUomFrXOzlrogVHrcSt =TN/i -----END PGP SIGNATURE----- --------------enig80AC1149474E69CC143BF702--