mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kristian Høgsberg" <krh@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: "Kristian Høgsberg" <krh@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>
Subject: [PATCH 2/2] Honor 'quiet' command line option in real mode boot decompressor.
Date: Thu, 29 May 2008 13:27:12 -0400	[thread overview]
Message-ID: <1212082032-6167-2-git-send-email-krh@redhat.com> (raw)
In-Reply-To: <1212082032-6167-1-git-send-email-krh@redhat.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2795 bytes --]

This patch lets the early real mode decompressor parse the kernel
command line and look for the 'quiet' option.  When 'quiet' is passed
we suppress the "Decompressing Linux... Parsing ELF... done." messages.

This is in line with how the rest of the kernel suppresses informational
debug spew when quiet is given.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>

---

Ok, I flipped the default on this patch since turning off those
important messages by default is apparently quite controversial.
With this patch we still print the decompression status messages, but
if quiet is seen on the kernel command we suppress them.

 arch/x86/boot/compressed/misc.c |   31 ++++++++++++++++++++++++++++---
 1 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 102b68e..b548379 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -190,6 +190,7 @@ static void gzip_release(void **);
  */
 static struct boot_params *real_mode;		/* Pointer to real-mode data */
 #define RM_SCREEN_INFO (real_mode->screen_info)
+static int quiet;
 
 extern unsigned char input_data[];
 extern int input_len;
@@ -391,7 +392,8 @@ static void parse_elf(void *output)
 		return;
 	}
 
-	putstr("Parsing ELF... ");
+	if (!quiet)
+		putstr("Parsing ELF... ");
 
 	phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum);
 	if (!phdrs)
@@ -419,11 +421,28 @@ static void parse_elf(void *output)
 	}
 }
 
+static const char *strnstr(const char *string, int len, const char *s)
+{
+	int i, j;
+
+	for (i = 0; i < len; i++) {
+		for (j = 0; i + j < len && s[j]; j++)
+			if (string[i + j] != s[j])
+				break;
+		if (s[j] == '\0')
+			return string + i;
+	}
+
+	return NULL;
+}
+
 asmlinkage void decompress_kernel(void *rmode, memptr heap,
 				  unsigned char *input_data,
 				  unsigned long input_len,
 				  unsigned char *output)
 {
+	const char * cmdline;  
+
 	real_mode = rmode;
 
 	if (RM_SCREEN_INFO.orig_video_mode == 7) {
@@ -437,6 +456,10 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
 	lines = RM_SCREEN_INFO.orig_video_lines;
 	cols = RM_SCREEN_INFO.orig_video_cols;
 
+	cmdline = (char *) real_mode->hdr.cmd_line_ptr;
+	if (strnstr(cmdline, real_mode->hdr.cmdline_size, "quiet"))
+		quiet = 1;
+
 	window = output;		/* Output buffer (Normally at 1M) */
 	free_mem_ptr     = heap;	/* Heap */
 	free_mem_end_ptr = heap + BOOT_HEAP_SIZE;
@@ -461,9 +484,11 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
 #endif
 
 	makecrc();
-	putstr("\nDecompressing Linux... ");
+	if (!quiet)
+		putstr("\nDecompressing Linux... ");
 	gunzip();
 	parse_elf(output);
-	putstr("done.\nBooting the kernel.\n");
+	if (!quiet)
+		putstr("done.\nBooting the kernel.\n");
 	return;
 }
-- 
1.5.4.5


  reply	other threads:[~2008-05-29 17:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-29 17:27 [PATCH 1/2 v3] Use structs instead of hardcoded offsets in x86 " Kristian Høgsberg
2008-05-29 17:27 ` Kristian Høgsberg [this message]
2008-05-29 18:43   ` [PATCH 2/2] Honor 'quiet' command line option in real mode " H. Peter Anvin
2008-05-29 19:55     ` Kristian Høgsberg
2008-05-29 20:30       ` H. Peter Anvin
2008-05-29 22:25         ` Kristian Høgsberg
2008-05-29 18:48 ` [PATCH 1/2 v3] Use structs instead of hardcoded offsets in x86 " H. Peter Anvin
2008-05-29 19:58   ` Kristian Høgsberg

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=1212082032-6167-2-git-send-email-krh@redhat.com \
    --to=krh@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®