* [PATCH 2/2] Only print "Decompressing Linux" etc when 'noisy' is passed.
2008-05-23 21:59 [PATCH 1/2] Use structs instead of hardcoded offsets in x86 boot decompressor Kristian Høgsberg
@ 2008-05-23 21:59 ` Kristian Høgsberg
2008-05-23 22:42 ` Johannes Weiner
2008-05-24 9:25 ` Mikael Pettersson
0 siblings, 2 replies; 6+ messages in thread
From: Kristian Høgsberg @ 2008-05-23 21:59 UTC (permalink / raw)
To: linux-kernel; +Cc: Kristian Høgsberg
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
---
arch/x86/boot/compressed/misc.c | 30 +++++++++++++++++++++++++++---
1 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 0d03579..b7b5c1f 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 */
static struct screen_info *rm_screen_info; /* Pointer to real-mode data */
+static int noisy;
extern unsigned char input_data[];
extern int input_len;
@@ -391,7 +392,8 @@ static void parse_elf(void *output)
return;
}
- putstr("Parsing ELF... ");
+ if (noisy)
+ putstr("Parsing ELF... ");
phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum);
if (!phdrs)
@@ -419,11 +421,27 @@ 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)
{
+ char *cmdline;
+
real_mode = rmode;
if (rm_screen_info->orig_video_mode == 7) {
@@ -437,6 +455,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, "noisy"))
+ noisy = 1;
+
window = output; /* Output buffer (Normally at 1M) */
free_mem_ptr = heap; /* Heap */
free_mem_end_ptr = heap + BOOT_HEAP_SIZE;
@@ -461,9 +483,11 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
#endif
makecrc();
- putstr("\nDecompressing Linux... ");
+ if (noisy)
+ putstr("\nDecompressing Linux... ");
gunzip();
parse_elf(output);
- putstr("done.\nBooting the kernel.\n");
+ if (noisy)
+ putstr("done.\nBooting the kernel.\n");
return;
}
--
1.5.5.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] Only print "Decompressing Linux" etc when 'noisy' is passed.
2008-05-23 21:59 ` [PATCH 2/2] Only print "Decompressing Linux" etc when 'noisy' is passed Kristian Høgsberg
@ 2008-05-23 22:42 ` Johannes Weiner
2008-05-24 9:25 ` Mikael Pettersson
1 sibling, 0 replies; 6+ messages in thread
From: Johannes Weiner @ 2008-05-23 22:42 UTC (permalink / raw)
To: Kristian Høgsberg; +Cc: linux-kernel
Hi,
Kristian Høgsberg <krh@redhat.com> writes:
> Signed-off-by: Kristian Høgsberg <krh@redhat.com>
> ---
> arch/x86/boot/compressed/misc.c | 30 +++++++++++++++++++++++++++---
> 1 files changed, 27 insertions(+), 3 deletions(-)
Isn't that a bit much code to potentially suppress three lines of
output?
Hannes
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] Only print "Decompressing Linux" etc when 'noisy' is passed.
2008-05-23 21:59 ` [PATCH 2/2] Only print "Decompressing Linux" etc when 'noisy' is passed Kristian Høgsberg
2008-05-23 22:42 ` Johannes Weiner
@ 2008-05-24 9:25 ` Mikael Pettersson
2008-05-24 18:07 ` Diego Calleja
1 sibling, 1 reply; 6+ messages in thread
From: Mikael Pettersson @ 2008-05-24 9:25 UTC (permalink / raw)
To: Kristian Høgsberg; +Cc: linux-kernel
=?utf-8?q?Kristian=20H=C3=B8gsberg?= writes:
> Signed-off-by: Kristian Høgsberg <krh@redhat.com>
> ---
> arch/x86/boot/compressed/misc.c | 30 +++++++++++++++++++++++++++---
> 1 files changed, 27 insertions(+), 3 deletions(-)
How is this an improvement? What bug does it fix?
Is there any evidence that these messages are harmful
for end-users?
All this accomplishes is to make early boot failures harder
to debug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] Only print "Decompressing Linux" etc when 'noisy' is passed.
2008-05-24 9:25 ` Mikael Pettersson
@ 2008-05-24 18:07 ` Diego Calleja
0 siblings, 0 replies; 6+ messages in thread
From: Diego Calleja @ 2008-05-24 18:07 UTC (permalink / raw)
To: Mikael Pettersson; +Cc: Kristian Høgsberg, linux-kernel
El Sat, 24 May 2008 11:25:38 +0200, Mikael Pettersson <mikpe@it.uu.se> escribió:
> All this accomplishes is to make early boot failures harder
> to debug.
And there's already a parameter to switch the verbosity of printk - 'quiet'
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] Only print "Decompressing Linux" etc when 'noisy' is passed.
@ 2008-05-24 19:28 devzero
2008-05-25 3:41 ` Kristian Høgsberg
0 siblings, 1 reply; 6+ messages in thread
From: devzero @ 2008-05-24 19:28 UTC (permalink / raw)
To: krh; +Cc: linux-kernel
what about using "quiet" here instead ?
quiet is already the parameter to suppress boot messages, so introducing another one doesn`t make sense, imho.
the early boot commandline parser was extended some time ago to support boolean options, see:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=32d0b9898029b7b3c7f161d31f57c4831d9049eb
this may shrink your patch , see example in arch/x86/boot/edd.c
be_quiet = cmdline_find_option_bool("quiet");
....
if (!be_quiet)
printf("Probing EDD (edd=off to disable)... ");
roland
List: linux-kernel
Subject: [PATCH 2/2] Only print "Decompressing Linux" etc when 'noisy' is passed.
From: Kristian HÞgsberg <krh () redhat ! com>
Date: 2008-05-23 21:59:28
Message-ID: 1211579968-15227-2-git-send-email-krh () redhat ! com
[Download message RAW]
Signed-off-by: Kristian HÞgsberg <krh@redhat.com>
---
arch/x86/boot/compressed/misc.c | 30 +++++++++++++++++++++++++++---
1 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 0d03579..b7b5c1f 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 */
static struct screen_info *rm_screen_info; /* Pointer to real-mode data */
+static int noisy;
extern unsigned char input_data[];
extern int input_len;
@@ -391,7 +392,8 @@ static void parse_elf(void *output)
return;
}
- putstr("Parsing ELF... ");
+ if (noisy)
+ putstr("Parsing ELF... ");
phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum);
if (!phdrs)
@@ -419,11 +421,27 @@ 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)
{
+ char *cmdline;
+
real_mode = rmode;
if (rm_screen_info->orig_video_mode == 7) {
@@ -437,6 +455,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, "noisy"))
+ noisy = 1;
+
window = output; /* Output buffer (Normally at 1M) */
free_mem_ptr = heap; /* Heap */
free_mem_end_ptr = heap + BOOT_HEAP_SIZE;
@@ -461,9 +483,11 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
#endif
makecrc();
- putstr("\nDecompressing Linux... ");
+ if (noisy)
+ putstr("\nDecompressing Linux... ");
gunzip();
parse_elf(output);
- putstr("done.\nBooting the kernel.\n");
+ if (noisy)
+ putstr("done.\nBooting the kernel.\n");
return;
}
--
1.5.5.1
_______________________________________________________________________
EINE FÜR ALLE: die kostenlose WEB.DE-Plattform für Freunde und Deine
Homepage mit eigenem Namen. Jetzt starten! http://unddu.de/?kid=kid@mf2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] Only print "Decompressing Linux" etc when 'noisy' is passed.
2008-05-24 19:28 [PATCH 2/2] Only print "Decompressing Linux" etc when 'noisy' is passed devzero
@ 2008-05-25 3:41 ` Kristian Høgsberg
0 siblings, 0 replies; 6+ messages in thread
From: Kristian Høgsberg @ 2008-05-25 3:41 UTC (permalink / raw)
To: devzero; +Cc: krh, linux-kernel
On Sat, May 24, 2008 at 09:28:21PM +0200, devzero@web.de wrote:
> what about using "quiet" here instead ?
>
> quiet is already the parameter to suppress boot messages, so introducing another one doesn`t make sense, imho.
I agree, and I wasn't looking to introduce a new parameter, I meant to
reuse 'debug'. That is already used for increasing the log level
(see init/main.c). Also, as it is, the decompressor already prints
error messages if something goes wrong, so there's not much point in
printing the debug spew. I think it makes sense to default to not
print it.
> the early boot commandline parser was extended some time ago to support boolean options, see:
>
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=32d0b9898029b7b3c7f161d31f57c4831d9049eb
>
> this may shrink your patch , see example in arch/x86/boot/edd.c
Unfortunately, that doesn't help me. This code is run before the kernel
is decompressed and the only functions available are the ones in misc.c.
And I know the strnstr approach isn't quite smart enough the handle quoted
parameters and similar, but I think it strikes a good balance.
I'll send an updated patch that looks for 'debug' instead of 'noisy'.
thanks,
Kristian
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-05-25 3:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-24 19:28 [PATCH 2/2] Only print "Decompressing Linux" etc when 'noisy' is passed devzero
2008-05-25 3:41 ` Kristian Høgsberg
-- strict thread matches above, loose matches on Subject: below --
2008-05-23 21:59 [PATCH 1/2] Use structs instead of hardcoded offsets in x86 boot decompressor Kristian Høgsberg
2008-05-23 21:59 ` [PATCH 2/2] Only print "Decompressing Linux" etc when 'noisy' is passed Kristian Høgsberg
2008-05-23 22:42 ` Johannes Weiner
2008-05-24 9:25 ` Mikael Pettersson
2008-05-24 18:07 ` Diego Calleja
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox