From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: Are BSD partitions not supported?
Date: Wed, 19 May 2010 21:20:42 +0200 [thread overview]
Message-ID: <4BF43A0A.80801@gmail.com> (raw)
In-Reply-To: <AANLkTikfVzzQnIUyOKr6SqAuanrDSB_uoHV-3aWLBz8e@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 3129 bytes --]
C. P. Ghost wrote:
> 2010/5/19 Vladimir 'φ-coder/phcoder' Serbinenko <phcoder@gmail.com>:
>
>>> /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=none -lgcc -nostdlib -Wl,-N -Wl,-Ttext,0x8200 -mrtd
>>> -mregparm=3
>>> /usr/local/bin/ld: skipping incompatible
>>> /usr/local/lib/gcc44/gcc/x86_64-portbld-freebsd8.0/4.4.4/libgcc.a when
>>> 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
>>>
>>>
>> Normally you need 32-bit libgcc. As a test build you can just remove
>> -lgcc but this isn't supported.
>>
>
> 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=/mnt --modules=ufs2 /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..
> /usr/local/sbin/grub-setup: error: if you really want blocklists, use --force.
>
> Using --force:
>
> phenom# grub-install --force --root-directory=/mnt --modules=ufs2 /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.
>
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: bsdlabel.diff --]
[-- Type: text/x-diff; name="bsdlabel.diff", Size: 3064 bytes --]
=== 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
+#define GRUB_PC_PARTITION_BSD_LABEL_WHOLE_DISK_PARTITION 2
+
/* The BSD partition entry. */
struct grub_partition_bsd_entry
{
=== 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 += grub_strlen (ptr);
if (grub_install_bsd_part >= 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 += grub_strlen (ptr);
}
=== 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 = 0;
unsigned pos;
- /* BSDLabel offsets are absolute even when it's embed inside partition. */
- delta = 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 != grub_cpu_to_le32 (GRUB_PC_PARTITION_BSD_LABEL_MAGIC))
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
+ /* 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 = 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 = grub_le_to_cpu32 (whole_disk_be.offset);
+ }
+
pos = sizeof (label) + GRUB_PC_PARTITION_BSD_LABEL_SECTOR
* GRUB_DISK_SECTOR_SIZE;
for (p.number = 0;
p.number < grub_cpu_to_le16 (label.num_partitions);
- p.number++)
+ p.number++, pos += sizeof (struct grub_partition_bsd_entry))
{
struct grub_partition_bsd_entry be;
+ if (p.number == GRUB_PC_PARTITION_BSD_LABEL_WHOLE_DISK_PARTITION)
+ continue;
+
p.offset = pos / GRUB_DISK_SECTOR_SIZE;
p.index = pos % GRUB_DISK_SECTOR_SIZE;
@@ -68,11 +86,9 @@
p.len = grub_le_to_cpu32 (be.size);
p.partmap = &grub_bsdlabel_partition_map;
- if (be.fs_type != GRUB_PC_PARTITION_BSD_TYPE_UNUSED)
+ if (p.len != 0)
if (hook (disk, &p))
return grub_errno;
-
- pos += sizeof (struct grub_partition_bsd_entry);
}
return GRUB_ERR_NONE;
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]
next prev parent reply other threads:[~2010-05-19 19:21 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-16 16:24 Are BSD partitions not supported? C. P. Ghost
2010-05-18 18:08 ` C. P. Ghost
2010-05-18 18:37 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-05-18 19:33 ` C. P. Ghost
2010-05-18 20:20 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-05-18 22:06 ` C. P. Ghost
2010-05-19 17:49 ` C. P. Ghost
2010-05-19 18:00 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-05-19 18:33 ` C. P. Ghost
2010-05-19 18:40 ` C. P. Ghost
2010-05-19 18:50 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-05-19 18:54 ` Navdeep Parhar
2010-05-19 19:20 ` C. P. Ghost
2010-05-19 19:12 ` C. P. Ghost
2010-05-19 19:20 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2010-05-19 19:41 ` C. P. Ghost
2010-05-20 16:19 ` C. P. Ghost
2010-05-23 9:50 ` Grégoire Sutre
2010-05-23 15:44 ` C. P. Ghost
2010-05-24 0:56 ` Grégoire Sutre
2010-05-24 16:50 ` C. P. Ghost
2010-05-31 21:16 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-06-01 10:34 ` Grégoire Sutre
2010-06-01 11:21 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-06-06 17:05 ` Grégoire Sutre
2010-05-19 18:48 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-05-18 22:20 ` Vladimir 'φ-coder/phcoder' Serbinenko
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=4BF43A0A.80801@gmail.com \
--to=phcoder@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.