* [PATCH 1/2 v3] Use structs instead of hardcoded offsets in x86 boot decompressor.
@ 2008-05-29 17:27 Kristian Høgsberg
2008-05-29 17:27 ` [PATCH 2/2] Honor 'quiet' command line option in real mode " Kristian Høgsberg
2008-05-29 18:48 ` [PATCH 1/2 v3] Use structs instead of hardcoded offsets in x86 " H. Peter Anvin
0 siblings, 2 replies; 8+ messages in thread
From: Kristian Høgsberg @ 2008-05-29 17:27 UTC (permalink / raw)
To: linux-kernel; +Cc: Kristian Høgsberg, H. Peter Anvin
Just a minor cleanup, making it easier to access the command line in
the following "Honor quiet in decompressor" patch.
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
---
Updated this one to be less intrusive; we just re-#define RM_SCREEN_INFO to
access the boot_params struct instead of using the hard-coded offset.
arch/x86/boot/compressed/misc.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 90456ce..102b68e 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -30,6 +30,7 @@
#include <asm/io.h>
#include <asm/page.h>
#include <asm/boot.h>
+#include <asm/bootparam.h>
/* WARNING!!
* This code is compiled with -fPIC and it is relocated dynamically
@@ -187,13 +188,8 @@ static void gzip_release(void **);
/*
* This is set up by the setup-routine at boot-time
*/
-static unsigned char *real_mode; /* Pointer to real-mode data */
-
-#define RM_EXT_MEM_K (*(unsigned short *)(real_mode + 0x2))
-#ifndef STANDARD_MEMORY_BIOS_CALL
-#define RM_ALT_MEM_K (*(unsigned long *)(real_mode + 0x1e0))
-#endif
-#define RM_SCREEN_INFO (*(struct screen_info *)(real_mode+0))
+static struct boot_params *real_mode; /* Pointer to real-mode data */
+#define RM_SCREEN_INFO (real_mode->screen_info)
extern unsigned char input_data[];
extern int input_len;
--
1.5.4.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] Honor 'quiet' command line option in real mode boot decompressor.
2008-05-29 17:27 [PATCH 1/2 v3] Use structs instead of hardcoded offsets in x86 boot decompressor Kristian Høgsberg
@ 2008-05-29 17:27 ` Kristian Høgsberg
2008-05-29 18:43 ` H. Peter Anvin
2008-05-29 18:48 ` [PATCH 1/2 v3] Use structs instead of hardcoded offsets in x86 " H. Peter Anvin
1 sibling, 1 reply; 8+ messages in thread
From: Kristian Høgsberg @ 2008-05-29 17:27 UTC (permalink / raw)
To: linux-kernel; +Cc: Kristian Høgsberg, H. Peter Anvin
[-- 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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] Honor 'quiet' command line option in real mode boot decompressor.
2008-05-29 17:27 ` [PATCH 2/2] Honor 'quiet' command line option in real mode " Kristian Høgsberg
@ 2008-05-29 18:43 ` H. Peter Anvin
2008-05-29 19:55 ` Kristian Høgsberg
0 siblings, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2008-05-29 18:43 UTC (permalink / raw)
To: Kristian Høgsberg; +Cc: linux-kernel
Kristian Høgsberg wrote:
> 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>
You know... we already have a command-line parser in the real-mode part
of the boot code, and it already extracts the "quiet" option: we should
be able to do this by passing a bit in "loadflags" (bit 5 suggested.)
This would have the additional benefit of making it really easy for
hypervisors that don't support writing to the screen at all to disable
those messages.
What do you think?
-hpa
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2 v3] Use structs instead of hardcoded offsets in x86 boot decompressor.
2008-05-29 17:27 [PATCH 1/2 v3] Use structs instead of hardcoded offsets in x86 boot decompressor Kristian Høgsberg
2008-05-29 17:27 ` [PATCH 2/2] Honor 'quiet' command line option in real mode " Kristian Høgsberg
@ 2008-05-29 18:48 ` H. Peter Anvin
2008-05-29 19:58 ` Kristian Høgsberg
1 sibling, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2008-05-29 18:48 UTC (permalink / raw)
To: Kristian Høgsberg; +Cc: linux-kernel
Kristian Høgsberg wrote:
>
> Updated this one to be less intrusive; we just re-#define RM_SCREEN_INFO to
> access the boot_params struct instead of using the hard-coded offset.
>
Any reason to leave it in as a macro at all, instead of just
s/RM_SCREEN_INFO/real_mode->screen_info/g?
We have already gotten rid of most of these macros in the primary kernel.
-hpa
P.S. Sorry for not giving you feedback sooner.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] Honor 'quiet' command line option in real mode boot decompressor.
2008-05-29 18:43 ` H. Peter Anvin
@ 2008-05-29 19:55 ` Kristian Høgsberg
2008-05-29 20:30 ` H. Peter Anvin
0 siblings, 1 reply; 8+ messages in thread
From: Kristian Høgsberg @ 2008-05-29 19:55 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: linux-kernel
On Thu, 2008-05-29 at 11:43 -0700, H. Peter Anvin wrote:
> Kristian Høgsberg wrote:
> > 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>
>
> You know... we already have a command-line parser in the real-mode part
> of the boot code, and it already extracts the "quiet" option: we should
> be able to do this by passing a bit in "loadflags" (bit 5 suggested.)
Hmm, as far as I understand the boot code, the decompressor consists of
just head_32/64.S and misc.c plus the #included inflate.c and the
compressed image in piggy.o. In this environment there is no command
line parser, it's only available once the image has been decompressed.
Or are you suggesting parsing the "quiet" option in the bootloader and
then setting the loadflags bit from there? That's certainly doable, and
I can update grub accordingly, but just parsing the command line seems
like a simple, more local fix. I don't have a strong preference,
though.
cheers,
Kristian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2 v3] Use structs instead of hardcoded offsets in x86 boot decompressor.
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
0 siblings, 0 replies; 8+ messages in thread
From: Kristian Høgsberg @ 2008-05-29 19:58 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: linux-kernel
On Thu, 2008-05-29 at 11:48 -0700, H. Peter Anvin wrote:
> Kristian Høgsberg wrote:
> >
> > Updated this one to be less intrusive; we just re-#define RM_SCREEN_INFO to
> > access the boot_params struct instead of using the hard-coded offset.
> >
>
> Any reason to leave it in as a macro at all, instead of just
> s/RM_SCREEN_INFO/real_mode->screen_info/g?
Only to keep the patch smaller. Accessing the struct directly is
definitely nicer, I'll do the sed job when I resubmit with the other
patch.
cheers,
Kristian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] Honor 'quiet' command line option in real mode boot decompressor.
2008-05-29 19:55 ` Kristian Høgsberg
@ 2008-05-29 20:30 ` H. Peter Anvin
2008-05-29 22:25 ` Kristian Høgsberg
0 siblings, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2008-05-29 20:30 UTC (permalink / raw)
To: Kristian Høgsberg; +Cc: linux-kernel
Kristian Høgsberg wrote:
>> You know... we already have a command-line parser in the real-mode part
>> of the boot code, and it already extracts the "quiet" option: we should
>> be able to do this by passing a bit in "loadflags" (bit 5 suggested.)
>
> Hmm, as far as I understand the boot code, the decompressor consists of
> just head_32/64.S and misc.c plus the #included inflate.c and the
> compressed image in piggy.o. In this environment there is no command
> line parser, it's only available once the image has been decompressed.
> Or are you suggesting parsing the "quiet" option in the bootloader and
> then setting the loadflags bit from there? That's certainly doable, and
> I can update grub accordingly, but just parsing the command line seems
> like a simple, more local fix. I don't have a strong preference,
> though.
I think you're missing something: the decompressor is the *second stage*
of the boot code; the first stage is the real-mode code (arch/x86/boot).
I'm suggesting passing the flag from the real-mode code to the
decompressor, not from the boot loader (in the common case.)
-hpa
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] Honor 'quiet' command line option in real mode boot decompressor.
2008-05-29 20:30 ` H. Peter Anvin
@ 2008-05-29 22:25 ` Kristian Høgsberg
0 siblings, 0 replies; 8+ messages in thread
From: Kristian Høgsberg @ 2008-05-29 22:25 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: linux-kernel
On Thu, 2008-05-29 at 13:30 -0700, H. Peter Anvin wrote:
> Kristian Høgsberg wrote:
> >> You know... we already have a command-line parser in the real-mode part
> >> of the boot code, and it already extracts the "quiet" option: we should
> >> be able to do this by passing a bit in "loadflags" (bit 5 suggested.)
> >
> > Hmm, as far as I understand the boot code, the decompressor consists of
> > just head_32/64.S and misc.c plus the #included inflate.c and the
> > compressed image in piggy.o. In this environment there is no command
> > line parser, it's only available once the image has been decompressed.
>
> > Or are you suggesting parsing the "quiet" option in the bootloader and
> > then setting the loadflags bit from there? That's certainly doable, and
> > I can update grub accordingly, but just parsing the command line seems
> > like a simple, more local fix. I don't have a strong preference,
> > though.
>
> I think you're missing something: the decompressor is the *second stage*
> of the boot code; the first stage is the real-mode code (arch/x86/boot).
> I'm suggesting passing the flag from the real-mode code to the
> decompressor, not from the boot loader (in the common case.)
Indeed, I had it the wrong way around. I like the bootflag approach,
updated patches coming up.
thanks,
Kristian
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-05-29 22:25 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-29 17:27 [PATCH 1/2 v3] Use structs instead of hardcoded offsets in x86 boot decompressor Kristian Høgsberg
2008-05-29 17:27 ` [PATCH 2/2] Honor 'quiet' command line option in real mode " Kristian Høgsberg
2008-05-29 18:43 ` 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
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.