From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OEna5-0005q4-PE for mharc-grub-devel@gnu.org; Wed, 19 May 2010 14:01:21 -0400 Received: from [140.186.70.92] (port=50868 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OEna3-0005o8-6k for grub-devel@gnu.org; Wed, 19 May 2010 14:01:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OEnZx-0005gW-Re for grub-devel@gnu.org; Wed, 19 May 2010 14:01:19 -0400 Received: from mail-ww0-f41.google.com ([74.125.82.41]:53244) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OEnZx-0005gL-JZ for grub-devel@gnu.org; Wed, 19 May 2010 14:01:13 -0400 Received: by wwb18 with SMTP id 18so150069wwb.0 for ; Wed, 19 May 2010 11:01:11 -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=wvS4BvaXrCaEHO3YsMxTdjAKITQUZy0hMcdybMUY5Jk=; b=HGMM/L7LWjsnb73PSTF/yPwZDxfnuIVk+IXwwqlu6czgU20voF12TTdH1OjPioX8H1 d72pz1fSYYkAIUwLmWdFBGOrJAdwOj+cNLRIvj68IrfnLk5SoiZSmVJn/h0zNucG1kvH vZn4Vh+Z08WlqMkNl9cVL3z7zlMW433hqZKiU= 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=NxwiRE4y2FO87wty7UclS/ZyQxlB/Q9pCo0FrDc1nXAElAZJ5bFiPrZOxH8D346EKn qmO5t9V8itIw9pS4qzIDurtJicbL/+jXUltGwDUvGsd7eW4roYc8ZAjZ40kE2JmlEwz+ djwH4wd7gcqvpDwcFwQiKqbNsyAHbkf4a9EfU= Received: by 10.216.88.143 with SMTP id a15mr3429209wef.46.1274292071778; Wed, 19 May 2010 11:01:11 -0700 (PDT) Received: from debian.bg45.phnet (gprs45.swisscom-mobile.ch [193.247.250.45]) by mx.google.com with ESMTPS id p10sm20874467gvf.7.2010.05.19.11.01.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 19 May 2010 11:01:10 -0700 (PDT) Message-ID: <4BF42759.1010503@gmail.com> Date: Wed, 19 May 2010 20:00:57 +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: X-Enigmail-Version: 0.95.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig3CD95983AC46F7D30BF65B65" 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: Wed, 19 May 2010 18:01:21 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig3CD95983AC46F7D30BF65B65 Content-Type: multipart/mixed; boundary="------------050406040602030409020304" This is a multi-part message in MIME format. --------------050406040602030409020304 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable C. P. Ghost wrote: > On Wed, May 19, 2010 at 12:06 AM, C. P. Ghost wrot= e: > =20 >> 2010/5/18 Vladimir '=CF=86-coder/phcoder' Serbinenko : >> =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 = slot. >>> =20 >> Ah, you're right! My mistake. I'll edit the type to "4.2BSD" >> and will try again. >> =20 > > Okay, first with the original non-patched 1.98 grub2 version, > after setting the type to 4.2BSD in bsdlabel: > > phenom# bsdlabel /dev/md5555s1 > # /dev/md5555s1: > 8 partitions: > # size offset fstype [fsize bsize bps/cpg] > a: 48116 16 4.2BSD 0 0 0 > c: 48132 0 unused 0 0 # "raw" part, d= on't edit > > phenom# newfs /dev/md5555s1a > /dev/md5555s1a: 23.5MB (48116 sectors) block size 16384, fragment size = 2048 > using 4 cylinder groups of 5.88MB, 376 blks, 768 inodes. > super-block backups (for fsck -b #) at: > 160, 12192, 24224, 36256 > > phenom# mount /dev/md5555s1a /mnt > > phenom# grub-install --root-directory=3D/mnt --modules=3Dufs2 /dev/md55= 55 > /usr/local/sbin/grub-probe: error: unknown filesystem. > Installation finished. No error reported. > > This copies /boot/grub/* to /mnt as before. Now, if I run qemu, I get > dropped into grub-rescue: > > % qemu -hda bsddisk.img > GRUB loading. > Welcome to GRUB! > > error: unknown filesystem. > Entering rescue mode... > grub rescue> _ > > grub rescue> insmod part_msdos > grub rescue> insmod part_bsd > error: unknown filesystem. > > Unfortunately, the patch doesn't apply cleanly (against the > bzr version): > > % patch -p0 < ../../patch-002 > Hmm... Looks like a unified diff to me... > The text leading up to this was: > -------------------------- > |--- partmap/bsdlabel.c 2010-03-26 14:44:13 +0000 > |+++ partmap/bsdlabel.c 2010-05-18 22:13:37 +0000 > -------------------------- > Patching file partmap/bsdlabel.c using Plan A... > Hunk #1 succeeded at 37 with fuzz 1. > Hunk #2 succeeded at 46. > Hunk #3 failed at 86. > 1 out of 3 hunks failed--saving rejects to partmap/bsdlabel.c.rej > Hmm... Ignoring the trailing garbage. > done > > % cat partmap/bsdlabel.c.rej > *************** > *** 68,78 **** > p.len =3D grub_le_to_cpu32 (be.size); > p.partmap =3D &grub_bsdlabel_partition_map; > > - if (be.fs_type !=3D GRUB_PC_PARTITION_BSD_TYPE_UNUSED) > if (hook (disk, &p)) > return grub_errno; > - > - pos +=3D sizeof (struct grub_partition_bsd_entry); > } > > return GRUB_ERR_NONE; > --- 86,94 ---- > p.len =3D grub_le_to_cpu32 (be.size); > p.partmap =3D &grub_bsdlabel_partition_map; > > + if (p.len !=3D 0) > if (hook (disk, &p)) > return grub_errno; > } > > return GRUB_ERR_NONE; > > Any idea? > > =20 Mailer. Now I attach it > Thanks, > -cpghost. > > =20 --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------050406040602030409020304 Content-Type: text/x-diff; name="bsdlabel.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="bsdlabel.diff" =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= =2E */ - 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; --------------050406040602030409020304-- --------------enig3CD95983AC46F7D30BF65B65 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 iF4EAREKAAYFAkv0J18ACgkQNak7dOguQgm59AD/SqN4UtwdYWR6IafouRyGs3aj 2wKWJsEpsluDV+TnAQEA/AxyOCNPtO9prDrYmXveHlsGpySJ6sKgtPVQ7LQMcFBn =F0gu -----END PGP SIGNATURE----- --------------enig3CD95983AC46F7D30BF65B65--