Skip to contentSkip to conversation

making grub completely silent

DISCUSSION Mario Emmenlauer 2 participants 2 messages Jun 9, 2006 4 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 87k67txs3j.wl%[email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 873bef8g0g.wl%[email protected]

#4 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

this is a continued thread from [email protected]. 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.

Cheers,
Mario Emmenlauer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEiMbLzxGsM4+WvrURAiLtAJwLAhCdCT8NMX2eGoQSgOToBGIKSwCfXLsj 9Euwpt9o6u5o6Ddh7DVtwz0=
=Ia7B
-----END PGP SIGNATURE-----

#5 lore raw
Quoted 21 lines · Mario Emmenlauer

Hello,

this is a continued thread from [email protected]. 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.

Quoted 2 lines

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.

stage1/stage1.S +7 -6
diff -Naur -Naru grub-0.93/stage1/stage1.S grub-0.93-pb/stage1/stage1.S
@@ -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"
stage2/char_io.c +3 -3
diff -Naur -Naru grub-0.93/stage2/char_io.c grub-0.93-pb/stage2/char_io.c
@@ -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];
stage2/shared.h +4 -1
diff -Naur -Naru grub-0.93/stage2/shared.h grub-0.93-pb/stage2/shared.h
@@ -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);
stage2/start.S +5 -4
diff -Naur -Naru grub-0.93/stage2/start.S grub-0.93-pb/stage2/start.S
@@ -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