grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] split floppy support off biosdisk


From: Bean
Subject: Re: [RFC] split floppy support off biosdisk
Date: Tue, 17 Jun 2008 10:03:15 +0800

On Tue, Jun 17, 2008 at 5:31 AM, Robert Millan <address@hidden> wrote:
> On Mon, Jun 16, 2008 at 08:37:43PM +0800, Bean wrote:
>>
>> But do we really need those space ?
>
> The typical use case where space is a PITA is boot an LVM system without a
> separate /boot partition.  There we don't have the ressort of using a
> blocklist (which is already bad), so embedding core.img is mandatory, but
> at the same time, we have to load lvm.mod in (possibly raid.mod as well),
> and then you see where I'm going...
>
> For example, with current CVS:
>
> $ ./grub-mkimage -d . biosdisk pc ext2 lvm -o /tmp/core.img && du -b 
> /tmp/core.img
> 30511   /tmp/core.img
>
> $ ./grub-mkimage -d . biosdisk pc ext2 lvm raid -o /tmp/core.img && du -b 
> /tmp/core.img
> 32940   /tmp/core.img
>
> The first is close to the limit (32256 B) and the second surpasses it, so
> boot from LVM on RAID with DOS label and ext2 is a use case we can't support
> right now.

I run some tests on the your situation:

Current CVS:

/grub-mkimage -d . biosdisk pc ext2 lvm raid -o c1.img && du -b c1.img
32735   c1.img

Then I comment out the lzo compression in grub-mkimage with this patch:

diff --git a/util/i386/pc/grub-mkimage.c b/util/i386/pc/grub-mkimage.c
index 189ec4e..cb069ec 100644
--- a/util/i386/pc/grub-mkimage.c
+++ b/util/i386/pc/grub-mkimage.c
@@ -59,9 +59,11 @@ compress_kernel (char *kernel_img, size_t kernel_size,
   *core_img = xmalloc (kernel_size + kernel_size / 64 + 16 + 3);
   wrkmem = xmalloc (LZO1X_999_MEM_COMPRESS);

-  memcpy (*core_img, kernel_img, GRUB_KERNEL_MACHINE_RAW_SIZE);
+  //memcpy (*core_img, kernel_img, GRUB_KERNEL_MACHINE_RAW_SIZE);
+  memcpy (*core_img, kernel_img, kernel_size);

   grub_util_info ("compressing the core image");
+/*
   if (lzo1x_999_compress ((const lzo_byte *) (kernel_img
                                              + GRUB_KERNEL_MACHINE_RAW_SIZE),
                          kernel_size - GRUB_KERNEL_MACHINE_RAW_SIZE,
@@ -70,10 +72,12 @@ compress_kernel (char *kernel_img, size_t kernel_size,
                          &size, wrkmem)
       != LZO_E_OK)
     grub_util_error ("cannot compress the kernel image");
-
+*/
   free (wrkmem);

-  *core_size = (size_t) size + GRUB_KERNEL_MACHINE_RAW_SIZE;
+  //*core_size = (size_t) size + GRUB_KERNEL_MACHINE_RAW_SIZE;
+
+  *core_size = kernel_size;
 }

 static void

/grub-mkimage -d . biosdisk pc ext2 lvm raid -o c2.img && du -b c2.img
55572   c2.img

Finally, I use lzma to compress it:

lzma c2.img && du -b c2.img.lzma
26737   c2.img.lzma

The decompresser is about 2K, we should also exclude the uncompressed
part at the beginning of kernel, but there is still plenty room left.

>
>> I think lzo is working fine, we
>> should avoid switching unless there is a good reason to do so.
>
> ISTR Okuji didn't like it;  can't remember why.

He is concerned about compression ratio, but doesn't mind in the end:

http://lists.gnu.org/archive/html/grub-devel/2007-12/msg00120.html

-- 
Bean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]