* [PATCH] Trim a few bytes from boot.img
@ 2010-02-10 11:40 Colin Watson
2010-02-16 11:53 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 1 reply; 3+ messages in thread
From: Colin Watson @ 2010-02-10 11:40 UTC (permalink / raw)
To: grub-devel; +Cc: Colin King
A while back, I was looking for eight extra bytes in boot.img so that I
could put a keyboard modifier check in there, allowing me to avoid
printing "GRUB loading" by default, which my boss^3 has been asking me
for, without crippling debugging in the process. I knew I could find a
few by shortening error messages (e.g. "Hard Disk" -> "HD"), but I asked
Colin King, one of our kernel hackers, if he could find a nicer
approach. He came up with a patch which I massaged a bit into this.
What do people think?
It seems as if it might be generally useful to have a bit of spare space
in here, although I would certainly appreciate it if people didn't use
it all at once. ;-)
2010-02-10 Colin King <colin.king@ubuntu.com>
2010-02-10 Colin Watson <cjwatson@ubuntu.com>
Shrink the pre-partition-table part of boot.img by eight bytes.
* boot/i386/pc/boot.S (ERR): New macro.
(chs_mode): Use ERR.
(geometry_error): Likewise.
(hd_probe_error): Remove. This is only used once, so we wrwite
it inline instead.
(read_error): Instead of printing read_error_string, just set up
%si and fall through to ...
(error_message): ... this new function, also used by ERR.
=== modified file 'boot/i386/pc/boot.S'
--- boot/i386/pc/boot.S 2010-01-03 22:05:07 +0000
+++ boot/i386/pc/boot.S 2010-02-10 11:32:08 +0000
@@ -27,6 +27,7 @@
/* Print message string */
#define MSG(x) movw $x, %si; call LOCAL(message)
+#define ERR(x) movw $x, %si; jmp LOCAL(error_message)
.file "boot.S"
@@ -233,7 +234,7 @@ LOCAL(chs_mode):
jz LOCAL(floppy_probe)
/* Nope, we definitely have a hard disk, and we're screwed. */
- jmp LOCAL(hd_probe_error)
+ ERR(hd_probe_error_string)
LOCAL(final_init):
/* set the mode to zero */
@@ -360,22 +361,15 @@ LOCAL(copy_buffer):
* BIOS Geometry translation error (past the end of the disk geometry!).
*/
LOCAL(geometry_error):
- MSG(geometry_error_string)
- jmp LOCAL(general_error)
-
-/*
- * Disk probe failure.
- */
-LOCAL(hd_probe_error):
- MSG(hd_probe_error_string)
- jmp LOCAL(general_error)
+ ERR(geometry_error_string)
/*
* Read error on the disk.
*/
LOCAL(read_error):
- MSG(read_error_string)
-
+ movw $read_error_string, %si
+LOCAL(error_message):
+ call LOCAL(message)
LOCAL(general_error):
MSG(general_error_string)
Thanks,
--
Colin Watson [cjwatson@ubuntu.com]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Trim a few bytes from boot.img
2010-02-10 11:40 [PATCH] Trim a few bytes from boot.img Colin Watson
@ 2010-02-16 11:53 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-02-22 12:53 ` Colin Watson
0 siblings, 1 reply; 3+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2010-02-16 11:53 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: Colin Watson, Colin King
[-- Attachment #1: Type: text/plain, Size: 2657 bytes --]
Colin Watson wrote:
> A while back, I was looking for eight extra bytes in boot.img so that I
> could put a keyboard modifier check in there, allowing me to avoid
> printing "GRUB loading" by default, which my boss^3 has been asking me
> for, without crippling debugging in the process. I knew I could find a
> few by shortening error messages (e.g. "Hard Disk" -> "HD"), but I asked
> Colin King, one of our kernel hackers, if he could find a nicer
> approach. He came up with a patch which I massaged a bit into this.
> What do people think?
>
> It seems as if it might be generally useful to have a bit of spare space
> in here, although I would certainly appreciate it if people didn't use
> it all at once. ;-)
>
Looks goo. Can you merge it into experimental?
> 2010-02-10 Colin King <colin.king@ubuntu.com>
> 2010-02-10 Colin Watson <cjwatson@ubuntu.com>
>
> Shrink the pre-partition-table part of boot.img by eight bytes.
>
> * boot/i386/pc/boot.S (ERR): New macro.
> (chs_mode): Use ERR.
> (geometry_error): Likewise.
> (hd_probe_error): Remove. This is only used once, so we wrwite
> it inline instead.
> (read_error): Instead of printing read_error_string, just set up
> %si and fall through to ...
> (error_message): ... this new function, also used by ERR.
>
> === modified file 'boot/i386/pc/boot.S'
> --- boot/i386/pc/boot.S 2010-01-03 22:05:07 +0000
> +++ boot/i386/pc/boot.S 2010-02-10 11:32:08 +0000
> @@ -27,6 +27,7 @@
>
> /* Print message string */
> #define MSG(x) movw $x, %si; call LOCAL(message)
> +#define ERR(x) movw $x, %si; jmp LOCAL(error_message)
>
> .file "boot.S"
>
> @@ -233,7 +234,7 @@ LOCAL(chs_mode):
> jz LOCAL(floppy_probe)
>
> /* Nope, we definitely have a hard disk, and we're screwed. */
> - jmp LOCAL(hd_probe_error)
> + ERR(hd_probe_error_string)
>
> LOCAL(final_init):
> /* set the mode to zero */
> @@ -360,22 +361,15 @@ LOCAL(copy_buffer):
> * BIOS Geometry translation error (past the end of the disk geometry!).
> */
> LOCAL(geometry_error):
> - MSG(geometry_error_string)
> - jmp LOCAL(general_error)
> -
> -/*
> - * Disk probe failure.
> - */
> -LOCAL(hd_probe_error):
> - MSG(hd_probe_error_string)
> - jmp LOCAL(general_error)
> + ERR(geometry_error_string)
>
> /*
> * Read error on the disk.
> */
> LOCAL(read_error):
> - MSG(read_error_string)
> -
> + movw $read_error_string, %si
> +LOCAL(error_message):
> + call LOCAL(message)
> LOCAL(general_error):
> MSG(general_error_string)
>
>
> Thanks,
>
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Trim a few bytes from boot.img
2010-02-16 11:53 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2010-02-22 12:53 ` Colin Watson
0 siblings, 0 replies; 3+ messages in thread
From: Colin Watson @ 2010-02-22 12:53 UTC (permalink / raw)
To: Vladimir 'φ-coder/phcoder' Serbinenko
Cc: The development of GNU GRUB, Colin King
On Tue, Feb 16, 2010 at 12:53:51PM +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> Colin Watson wrote:
> > A while back, I was looking for eight extra bytes in boot.img so that I
> > could put a keyboard modifier check in there, allowing me to avoid
> > printing "GRUB loading" by default, which my boss^3 has been asking me
> > for, without crippling debugging in the process. I knew I could find a
> > few by shortening error messages (e.g. "Hard Disk" -> "HD"), but I asked
> > Colin King, one of our kernel hackers, if he could find a nicer
> > approach. He came up with a patch which I massaged a bit into this.
> > What do people think?
> >
> > It seems as if it might be generally useful to have a bit of spare space
> > in here, although I would certainly appreciate it if people didn't use
> > it all at once. ;-)
>
> Looks goo. Can you merge it into experimental?
Done. It's /people/cjwatson/trim-boot-img as well.
Thanks,
--
Colin Watson [cjwatson@ubuntu.com]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-02-22 12:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-10 11:40 [PATCH] Trim a few bytes from boot.img Colin Watson
2010-02-16 11:53 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-02-22 12:53 ` Colin Watson
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.