[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: making grub completely silent
From: |
Pádraig Brady |
Subject: |
Re: making grub completely silent |
Date: |
Fri, 09 Jun 2006 10:00:13 +0100 |
User-agent: |
Mozilla Thunderbird 1.0.8 (X11/20060502) |
Mario Emmenlauer wrote:
>
> Hello,
>
> this is a continued thread from address@hidden I have taken
> it here (thanks Jerome) where it seems to suit better.
>
> A short abstract:
> I'd like to have an option to make grub be less verbose.
> I was thinking about an numeric verbosity level that would
> control how 'severe' a message needs to be to be shown.
>
> I spent an hour thinking how to convince you that this will
> prove useful, and wrote a long and boring passage :-)
>
> The short essence is: why not? I'm creating an embedded device,
> and the message just bugs me. Other users might agree. Maybe
> not. But I would implement it myself, and unless you mind the
> ten to fifteen lines of extra code I hope you will think about
> taking it into grub? It would supersede the 'silent'-function,
> so it might even make some code redundant.
>
> I'm hoping for a discussion and for some guidance on how you
> would want it implemented.
For reference I did the attached diff
against grub1 to shut it up.
Pádraig.
diff -Naur -Naru grub-0.93/stage1/stage1.S grub-0.93-pb/stage1/stage1.S
--- grub-0.93/stage1/stage1.S 2002-09-08 01:58:08.000000000 +0000
+++ grub-0.93-pb/stage1/stage1.S 2005-08-15 07:14:25.000000000 +0000
@@ -30,7 +30,8 @@
#define ABS(x) (x-_start+0x7c00)
/* Print message string */
-#define MSG(x) movw $ABS(x), %si; call message
+#define MSG(x)
+#define MSGERR(x) movw $ABS(x), %si; call message
/* XXX: binutils-2.9.1.0.x doesn't produce a short opcode for this. */
#define MOV_MEM_TO_AL(x) .byte 0xa0; .word x
@@ -364,24 +365,24 @@
* BIOS Geometry translation error (past the end of the disk geometry!).
*/
geometry_error:
- MSG(geometry_error_string)
+ MSGERR(geometry_error_string)
jmp general_error
/*
* Disk probe failure.
*/
hd_probe_error:
- MSG(hd_probe_error_string)
+ MSGERR(hd_probe_error_string)
jmp general_error
/*
* Read error on the disk.
*/
read_error:
- MSG(read_error_string)
+ MSGERR(read_error_string)
general_error:
- MSG(general_error_string)
+ MSGERR(general_error_string)
/* go here when you need to stop the machine hard after an error condition */
stop: jmp stop
@@ -457,7 +458,7 @@
/*
* Floppy disk probe failure.
*/
- MSG(fd_probe_error_string)
+ MSGERR(fd_probe_error_string)
jmp general_error
fd_probe_error_string: .string "Floppy"
diff -Naur -Naru grub-0.93/stage2/char_io.c grub-0.93-pb/stage2/char_io.c
--- grub-0.93/stage2/char_io.c 2002-12-02 23:49:07.000000000 +0000
+++ grub-0.93-pb/stage2/char_io.c 2005-08-15 07:18:22.000000000 +0000
@@ -94,9 +94,9 @@
if (errnum > ERR_NONE && errnum < MAX_ERR_NUM)
#ifndef STAGE1_5
/* printf("\7\n %s\n", err_list[errnum]); */
- printf ("\nError %u: %s\n", errnum, err_list[errnum]);
+ grub_printf_error ("\nError %u: %s\n", errnum, err_list[errnum]);
#else /* STAGE1_5 */
- printf ("Error %u\n", errnum);
+ grub_printf_error ("Error %u\n", errnum);
#endif /* STAGE1_5 */
}
@@ -150,7 +150,7 @@
}
void
-grub_printf (const char *format,...)
+grub_printf_error (const char *format,...)
{
int *dataptr = (int *) &format;
char c, str[16];
diff -Naur -Naru grub-0.93/stage2/shared.h grub-0.93-pb/stage2/shared.h
--- grub-0.93/stage2/shared.h 2002-12-02 23:15:12.000000000 +0000
+++ grub-0.93-pb/stage2/shared.h 2005-08-15 07:14:25.000000000 +0000
@@ -362,6 +364,9 @@
#define strcpy grub_strcpy
#endif /* WITHOUT_LIBC_STUBS */
+#undef printf
+#define printf(x, ...)
+#define grub_printf(x, ...)
#ifndef ASM_FILE
/*
@@ -849,7 +854,7 @@
#endif
/* C library replacement functions with identical semantics. */
-void grub_printf (const char *format,...);
+void grub_printf_error (const char *format,...);
int grub_sprintf (char *buffer, const char *format, ...);
int grub_tolower (int c);
int grub_isspace (int c);
diff -Naur -Naru grub-0.93/stage2/start.S grub-0.93-pb/stage2/start.S
--- grub-0.93/stage2/start.S 2001-12-30 08:23:16.000000000 +0000
+++ grub-0.93-pb/stage2/start.S 2005-08-15 07:14:25.000000000 +0000
@@ -38,7 +38,8 @@
#endif /* STAGE1_5 */
/* Print message string */
-#define MSG(x) movw $ABS(x), %si; call message
+#define MSG(x)
+#define MSGERR(x) movw $ABS(x), %si; call message
.file "start.S"
@@ -323,17 +440,17 @@
* BIOS Geometry translation error (past the end of the disk geometry!).
*/
geometry_error:
- MSG(geometry_error_string)
+ MSGERR(geometry_error_string)
jmp general_error
/*
* Read error on the disk.
*/
read_error:
- MSG(read_error_string)
+ MSGERR(read_error_string)
general_error:
- MSG(general_error_string)
+ MSGERR(general_error_string)
/* go here when you need to stop the machine hard after an error condition */
stop: jmp stop