From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OEopK-0003wY-RB for mharc-grub-devel@gnu.org; Wed, 19 May 2010 15:21:11 -0400 Received: from [140.186.70.92] (port=52192 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OEopF-0003tn-QZ for grub-devel@gnu.org; Wed, 19 May 2010 15:21:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OEopD-0001Sl-A7 for grub-devel@gnu.org; Wed, 19 May 2010 15:21:05 -0400 Received: from mail-ww0-f41.google.com ([74.125.82.41]:44753) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OEopD-0001Sh-3E for grub-devel@gnu.org; Wed, 19 May 2010 15:21:03 -0400 Received: by wwb18 with SMTP id 18so220309wwb.0 for ; Wed, 19 May 2010 12:21:02 -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=1KAka5l/G2Y+IVKDY7Yd94Pxq5UYOqj+OkK+a/4ez18=; b=PH0tWu1QAjfsmSWoY3Fol2TMZGChBWDwxnEOlPbfDKPJVMIu8X/zIQyOFxLOA2DNXG VMmRDwJO+LepN0gyouj4m30A0JxEEKiMJAS9rmUIOWZwe/5ylySmx2dQ8M8JplZ8ovIr N85odLF8C6aL3GPuR2Y6WWCMq4wbMPhZL14aY= 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=sUuGx/Ny1Vi6gv9I4zgbtkvc35RGtW7jujOMG6UueGdjxpCa2d/WUEgeG4VRkP5Y1n 2+tN2dcZNFLLyn0FSVWzJC4lwWxNwYNw1JE/nDwsT/gmHatrsa343zMtY2yYv3yl7nN/ 5pVvzVfdbdk6fKXMFWJaM0ZLmulhHrnR9EWrE= Received: by 10.227.152.137 with SMTP id g9mr8184566wbw.8.1274296862027; Wed, 19 May 2010 12:21:02 -0700 (PDT) Received: from debian.bg45.phnet (gprs45.swisscom-mobile.ch [193.247.250.45]) by mx.google.com with ESMTPS id g11sm20921972gve.18.2010.05.19.12.20.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 19 May 2010 12:21:01 -0700 (PDT) Message-ID: <4BF43A0A.80801@gmail.com> Date: Wed, 19 May 2010 21:20:42 +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> <4BF42759.1010503@gmail.com> <4BF43302.6080106@gmail.com> In-Reply-To: X-Enigmail-Version: 0.95.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enigDDD2BDFBCA54B5D3C9F93B7A" 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 19:21:07 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDDD2BDFBCA54B5D3C9F93B7A Content-Type: multipart/mixed; boundary="------------070206070009020406020509" This is a multi-part message in MIME format. --------------070206070009020406020509 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable C. P. Ghost wrote: > 2010/5/19 Vladimir '=CF=86-coder/phcoder' Serbinenko : > =20 >>> /usr/local/bin/gcc44 -o kernel.img kernel_img-kern_i386_pc_startup.o >>> kernel_img-kern_i386_misc.o kernel_img-kern_main.o >>> kernel_img-kern_device.o kernel_img-kern_disk.o kernel_img-kern_dl.o >>> kernel_img-kern_file.o kernel_img-kern_fs.o kernel_img-kern_err.o >>> kernel_img-kern_misc.o kernel_img-kern_mm.o kernel_img-kern_term.o >>> kernel_img-kern_rescue_parser.o kernel_img-kern_rescue_reader.o >>> kernel_img-kern_time.o kernel_img-kern_list.o >>> kernel_img-kern_handler.o kernel_img-kern_command.o >>> kernel_img-kern_corecmd.o kernel_img-kern___target_cpu__dl.o >>> kernel_img-kern_i386_pc_init.o kernel_img-kern_i386_pc_mmap.o >>> kernel_img-kern_parser.o kernel_img-kern_partition.o >>> kernel_img-kern_i386_tsc.o kernel_img-kern_i386_pit.o >>> kernel_img-kern_generic_rtc_get_time_ms.o >>> kernel_img-kern_generic_millisleep.o kernel_img-kern_env.o >>> kernel_img-term_i386_pc_console.o kernel_img-term_i386_vga_common.o >>> kernel_img-symlist.o -nostdlib -static-libgcc -m32 >>> -Wl,--build-id=3Dnone -lgcc -nostdlib -Wl,-N -Wl,-Ttext,0x8200 -mrt= d >>> -mregparm=3D3 >>> /usr/local/bin/ld: skipping incompatible >>> /usr/local/lib/gcc44/gcc/x86_64-portbld-freebsd8.0/4.4.4/libgcc.a whe= n >>> searching for -lgcc >>> /usr/local/bin/ld: skipping incompatible /usr/lib/libgcc.a when >>> searching for -lgcc >>> /usr/local/bin/ld: cannot find -lgcc >>> collect2: ld returned 1 exit status >>> gmake: *** [kernel.img] Error 1 >>> >>> =20 >> Normally you need 32-bit libgcc. As a test build you can just remove >> -lgcc but this isn't supported. >> =20 > > Ah, okay. If I remove -lgcc manually, everything compiles. > > This is what I get now (after reformatting the partition with newfs): > > phenom# grub-install --root-directory=3D/mnt --modules=3Dufs2 /dev/md55= 55 > /usr/local/sbin/grub-setup: warn: Your embedding area is unusually > small. core.img won't fit in it.. > /usr/local/sbin/grub-setup: warn: Embedding is not possible. GRUB can > only be installed in this setup by using blocklists. However, > blocklists are UNRELIABLE and their use is discouraged.. > /usr/local/sbin/grub-setup: error: if you really want blocklists, use -= -force. > > Using --force: > > phenom# grub-install --force --root-directory=3D/mnt --modules=3Dufs2 /= dev/md5555 > /usr/local/sbin/grub-setup: warn: Your embedding area is unusually > small. core.img won't fit in it.. > /usr/local/sbin/grub-setup: warn: Embedding is not possible. GRUB can > only be installed in this setup by using blocklists. However, > blocklists are UNRELIABLE and their use is discouraged.. > Installation finished. No error reported. > > If I boot now with qemu: > > % qemu -hda bsddisk.img > GRUB loading... > Welcome to GRUB! > > error: no such partition. > Entering rescue mode... > grub rescue> _ > > I compressed the image again: here it is now: > > http://www.cordula.ws/tempdir/bsddisk_2.7z > > -cpghost. > > =20 --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------070206070009020406020509 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 'kern/i386/pc/init.c' --- kern/i386/pc/init.c 2010-02-06 23:52:31 +0000 +++ kern/i386/pc/init.c 2010-05-19 19:19:18 +0000 @@ -75,8 +75,8 @@ ptr +=3D grub_strlen (ptr); =20 if (grub_install_bsd_part >=3D 0) - grub_snprintf (ptr, sizeof (dev) - (ptr - dev), ",%c", - grub_install_bsd_part + 'a'); + grub_snprintf (ptr, sizeof (dev) - (ptr - dev), ",%u", + grub_install_bsd_part + 1); ptr +=3D grub_strlen (ptr); } =20 =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; --------------070206070009020406020509-- --------------enigDDD2BDFBCA54B5D3C9F93B7A 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 iF4EAREKAAYFAkv0OhMACgkQNak7dOguQgncSQEAvrRqhWUeKmBQS+uanjx4Rsng mFA3cI1wQFiBM/Y1uWkA/1MgD2YMzlvXSIKf+hEcnPc4VO2g9sNqJkKXJxTNIK2Q =yn3y -----END PGP SIGNATURE----- --------------enigDDD2BDFBCA54B5D3C9F93B7A--