From: Yinghai Lu <yinghai@kernel.org>
To: "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
Cyrill Gorcunov <gorcunov@openvz.org>,
Pekka Enberg <penberg@cs.helsinki.fi>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/2] x86: more early console output from compressed/misc.c
Date: Mon, 02 Aug 2010 00:14:52 -0700 [thread overview]
Message-ID: <4C56706C.6040407@kernel.org> (raw)
In-Reply-To: <4C56701B.1030000@kernel.org>
will get
|Decompressing Linux... Parsing ELF... done.
|Booting the kernel.
in serial console.
reuse code from arch/x86/boot/
and we can use printf if needed
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/boot/compressed/misc.c | 60 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 59 insertions(+), 1 deletion(-)
Index: linux-2.6/arch/x86/boot/compressed/misc.c
===================================================================
--- linux-2.6.orig/arch/x86/boot/compressed/misc.c
+++ linux-2.6/arch/x86/boot/compressed/misc.c
@@ -125,12 +125,14 @@ static void error(char *m);
*/
static struct boot_params *real_mode; /* Pointer to real-mode data */
static int quiet;
+static int debug;
void *memset(void *s, int c, size_t n);
void *memcpy(void *dest, const void *src, size_t n);
static void __putstr(int, const char *);
#define putstr(__x) __putstr(0, __x)
+#define puts(__x) __putstr(0, __x)
#ifdef CONFIG_X86_64
#define memptr long
@@ -145,6 +147,9 @@ static char *vidmem;
static int vidport;
static int lines, cols;
+#include "../string.c"
+#include "../printf.c"
+
#ifdef CONFIG_KERNEL_GZIP
#include "../../../../lib/decompress_inflate.c"
#endif
@@ -161,6 +166,27 @@ static int lines, cols;
#include "../../../../lib/decompress_unlzo.c"
#endif
+static unsigned long fs;
+static inline void set_fs(unsigned long seg)
+{
+ fs = seg << 4; /* shift it back */
+}
+typedef unsigned long addr_t;
+static inline char rdfs8(addr_t addr)
+{
+ return *((char *)(fs + addr));
+}
+#include "../cmdline.c"
+int cmdline_find_option(const char *option, char *buffer, int bufsize)
+{
+ return __cmdline_find_option(real_mode->hdr.cmd_line_ptr, option, buffer, bufsize);
+}
+int cmdline_find_option_bool(const char *option)
+{
+ return __cmdline_find_option_bool(real_mode->hdr.cmd_line_ptr, option);
+}
+#include "../early_serial_console.c"
+
static void scroll(void)
{
int i;
@@ -170,6 +196,16 @@ static void scroll(void)
vidmem[i] = ' ';
}
+static void serial_putchar(int ch)
+{
+ unsigned timeout = 0xffff;
+
+ while ((inb(early_serial_base + LSR) & XMTRDY) == 0 && --timeout)
+ cpu_relax();
+
+ outb(ch, early_serial_base + TXR);
+}
+
static void __putstr(int error, const char *s)
{
int x, y, pos;
@@ -179,6 +215,14 @@ static void __putstr(int error, const ch
if (!error)
return;
#endif
+ if (early_serial_base) {
+ const char *str = s;
+ while (*str) {
+ if (*str == '\n')
+ serial_putchar('\r');
+ serial_putchar(*str++);
+ }
+ }
if (real_mode->screen_info.orig_video_mode == 0 &&
lines == 0 && cols == 0)
@@ -305,8 +349,12 @@ asmlinkage void decompress_kernel(void *
{
real_mode = rmode;
- if (real_mode->hdr.loadflags & QUIET_FLAG)
+ if (cmdline_find_option_bool("quiet"))
quiet = 1;
+ if (cmdline_find_option_bool("debug"))
+ debug = 1;
+
+ console_init();
if (real_mode->screen_info.orig_video_mode == 7) {
vidmem = (char *) 0xb0000;
@@ -322,6 +370,16 @@ asmlinkage void decompress_kernel(void *
free_mem_ptr = heap; /* Heap */
free_mem_end_ptr = heap + BOOT_HEAP_SIZE;
+ if (debug) {
+ putstr("decompress_kernel:\n");
+ printf(" input: [0x%lx-0x%lx], output: 0x%lx, heap: [0x%lx-0x%lx]\n",
+ (unsigned long)input_data,
+ (unsigned long)input_data + input_len - 1,
+ (unsigned long)output,
+ (unsigned long)heap,
+ (unsigned long)heap + BOOT_HEAP_SIZE - 1);
+ }
+
if ((unsigned long)output & (MIN_KERNEL_ALIGN - 1))
error("Destination address inappropriately aligned");
#ifdef CONFIG_X86_64
next prev parent reply other threads:[~2010-08-02 7:17 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-02 7:13 [PATCH 1/2] x86, setup: reorgize the early_console_setup Yinghai Lu
2010-08-02 7:14 ` Yinghai Lu [this message]
2010-08-02 7:16 ` H. Peter Anvin
2010-08-02 8:24 ` [PATCH -v2 " Yinghai Lu
2010-08-02 8:26 ` [PATCH -v2 2/2] x86: more early console output from compressed/misc.c Yinghai Lu
2010-08-02 9:17 ` [PATCH -v3 1/2] x86, setup: reorgize the early_console_setup Yinghai Lu
2010-08-02 9:18 ` [PATCH -v3 2/2] x86: more early console output from compressed/misc.c Yinghai Lu
2010-08-02 17:49 ` Cyrill Gorcunov
2010-08-02 18:38 ` H. Peter Anvin
2010-08-02 18:54 ` Cyrill Gorcunov
2010-08-02 18:58 ` H. Peter Anvin
2010-08-02 19:35 ` Yinghai Lu
2010-08-02 20:38 ` H. Peter Anvin
2010-08-02 20:59 ` H. Peter Anvin
2010-08-02 21:08 ` H. Peter Anvin
2010-08-02 21:22 ` Yinghai Lu
2010-08-02 21:27 ` H. Peter Anvin
2010-08-02 21:36 ` Yinghai Lu
2010-08-02 22:30 ` Yinghai Lu
2010-08-02 22:46 ` H. Peter Anvin
2010-08-02 22:51 ` Yinghai Lu
2010-08-02 23:21 ` Yinghai Lu
2010-08-03 4:10 ` [tip:x86/setup] x86, setup: move isdigit.h to ctype.h, header files on top tip-bot for H. Peter Anvin
2010-08-03 3:30 ` [tip:x86/setup] x86, setup: Allow global variables and functions in the decompressor tip-bot for H. Peter Anvin
2010-08-02 17:43 ` [PATCH -v3 1/2] x86, setup: reorgize the early_console_setup Cyrill Gorcunov
2010-08-02 19:15 ` Yinghai Lu
2010-08-03 3:31 ` [tip:x86/setup] x86, setup: reorganize the early console setup tip-bot for Yinghai Lu
2010-08-02 7:18 ` [PATCH 1/2] x86, setup: reorgize the early_console_setup H. Peter Anvin
2010-08-02 15:09 ` Cyrill Gorcunov
2010-08-02 19:23 ` Yinghai Lu
2010-08-02 20:17 ` Cyrill Gorcunov
2010-08-02 20:30 ` Yinghai Lu
2010-08-02 20:36 ` Cyrill Gorcunov
2010-08-03 7:14 ` [PATCH -v3] x86: Setup early console as early as possible Yinghai Lu
2010-08-03 9:06 ` Andrew Morton
2010-08-03 9:09 ` Yinghai Lu
2010-08-03 10:14 ` Yinghai Lu
2010-08-03 15:07 ` Cyrill Gorcunov
2010-08-02 17:56 ` [PATCH 1/2] x86, setup: reorgize the early_console_setup Thiago Farina
2010-08-02 18:00 ` Thiago Farina
2010-08-02 18:27 ` H. Peter Anvin
2010-08-02 19:09 ` Thiago Farina
2010-08-02 20:33 ` H. Peter Anvin
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=4C56706C.6040407@kernel.org \
--to=yinghai@kernel.org \
--cc=gorcunov@openvz.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=penberg@cs.helsinki.fi \
--cc=tglx@linutronix.de \
/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