diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-26 16:09:11 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-26 16:09:11 -0400 |
| commit | 3d72b105b09e69fbe76135fcee3e1710684b2d4a (patch) | |
| tree | baaca0352fbf905d01262cb67b3675a9f8a46fad | |
| parent | 79071638ce655c1f78a50d05c7dae0ad04a3e92a (diff) | |
| parent | c5e5c42a68be66cb87573e5c2fcce6f1b5d82bd5 (diff) | |
Merge branch 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86/boot changes from Ingo Molnar:
"Kernel image size reduction and assorted fixes and other small
improvements."
* 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86, doc: Assign a bootloader ID for "Minimal Linux Bootloader"
x86, boot: Exclude cmdline.c if you can't use it
x86, boot: Exclude early_serial_console.c if can't use it.
x86, boot: Removed unused debug flag and set code
x86, boot: Switch output functions from command-line flags to conditional compilation
x86, boot: Changed error putstr path to match new debug_putstr format
x86, boot: Wrap debug printing in a new debug_putstr function
x86, boot: Removed quiet flag and switched quiet output to debug flag
| -rw-r--r-- | Documentation/x86/boot.txt | 5 | ||||
| -rw-r--r-- | arch/x86/boot/compressed/cmdline.c | 4 | ||||
| -rw-r--r-- | arch/x86/boot/compressed/early_serial_console.c | 4 | ||||
| -rw-r--r-- | arch/x86/boot/compressed/misc.c | 31 | ||||
| -rw-r--r-- | arch/x86/boot/compressed/misc.h | 27 |
5 files changed, 44 insertions, 27 deletions
diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt index 7c3a8801b7ce..473b32fd544e 100644 --- a/Documentation/x86/boot.txt +++ b/Documentation/x86/boot.txt | |||
| @@ -363,7 +363,8 @@ Protocol: 2.00+ | |||
| 363 | ext_loader_type <- 0x05 | 363 | ext_loader_type <- 0x05 |
| 364 | ext_loader_ver <- 0x23 | 364 | ext_loader_ver <- 0x23 |
| 365 | 365 | ||
| 366 | Assigned boot loader ids: | 366 | Assigned boot loader ids (hexadecimal): |
| 367 | |||
| 367 | 0 LILO (0x00 reserved for pre-2.00 bootloader) | 368 | 0 LILO (0x00 reserved for pre-2.00 bootloader) |
| 368 | 1 Loadlin | 369 | 1 Loadlin |
| 369 | 2 bootsect-loader (0x20, all other values reserved) | 370 | 2 bootsect-loader (0x20, all other values reserved) |
| @@ -378,6 +379,8 @@ Protocol: 2.00+ | |||
| 378 | C Arcturus Networks uCbootloader | 379 | C Arcturus Networks uCbootloader |
| 379 | E Extended (see ext_loader_type) | 380 | E Extended (see ext_loader_type) |
| 380 | F Special (0xFF = undefined) | 381 | F Special (0xFF = undefined) |
| 382 | 10 Reserved | ||
| 383 | 11 Minimal Linux Bootloader <http://sebastian-plotz.blogspot.de> | ||
| 381 | 384 | ||
| 382 | Please contact <hpa@zytor.com> if you need a bootloader ID | 385 | Please contact <hpa@zytor.com> if you need a bootloader ID |
| 383 | value assigned. | 386 | value assigned. |
diff --git a/arch/x86/boot/compressed/cmdline.c b/arch/x86/boot/compressed/cmdline.c index cb62f786990d..10f6b1178c68 100644 --- a/arch/x86/boot/compressed/cmdline.c +++ b/arch/x86/boot/compressed/cmdline.c | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | #include "misc.h" | 1 | #include "misc.h" |
| 2 | 2 | ||
| 3 | #ifdef CONFIG_EARLY_PRINTK | ||
| 4 | |||
| 3 | static unsigned long fs; | 5 | static unsigned long fs; |
| 4 | static inline void set_fs(unsigned long seg) | 6 | static inline void set_fs(unsigned long seg) |
| 5 | { | 7 | { |
| @@ -19,3 +21,5 @@ int cmdline_find_option_bool(const char *option) | |||
| 19 | { | 21 | { |
| 20 | return __cmdline_find_option_bool(real_mode->hdr.cmd_line_ptr, option); | 22 | return __cmdline_find_option_bool(real_mode->hdr.cmd_line_ptr, option); |
| 21 | } | 23 | } |
| 24 | |||
| 25 | #endif | ||
diff --git a/arch/x86/boot/compressed/early_serial_console.c b/arch/x86/boot/compressed/early_serial_console.c index 261e81fb9582..d3d003cb5481 100644 --- a/arch/x86/boot/compressed/early_serial_console.c +++ b/arch/x86/boot/compressed/early_serial_console.c | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | #include "misc.h" | 1 | #include "misc.h" |
| 2 | 2 | ||
| 3 | #ifdef CONFIG_EARLY_PRINTK | ||
| 4 | |||
| 3 | int early_serial_base; | 5 | int early_serial_base; |
| 4 | 6 | ||
| 5 | #include "../early_serial_console.c" | 7 | #include "../early_serial_console.c" |
| 8 | |||
| 9 | #endif | ||
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index 7116dcba0c9e..88f7ff6da404 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c | |||
| @@ -108,8 +108,6 @@ static void error(char *m); | |||
| 108 | * This is set up by the setup-routine at boot-time | 108 | * This is set up by the setup-routine at boot-time |
| 109 | */ | 109 | */ |
| 110 | struct boot_params *real_mode; /* Pointer to real-mode data */ | 110 | struct boot_params *real_mode; /* Pointer to real-mode data */ |
| 111 | static int quiet; | ||
| 112 | static int debug; | ||
| 113 | 111 | ||
| 114 | void *memset(void *s, int c, size_t n); | 112 | void *memset(void *s, int c, size_t n); |
| 115 | void *memcpy(void *dest, const void *src, size_t n); | 113 | void *memcpy(void *dest, const void *src, size_t n); |
| @@ -170,15 +168,11 @@ static void serial_putchar(int ch) | |||
| 170 | outb(ch, early_serial_base + TXR); | 168 | outb(ch, early_serial_base + TXR); |
| 171 | } | 169 | } |
| 172 | 170 | ||
| 173 | void __putstr(int error, const char *s) | 171 | void __putstr(const char *s) |
| 174 | { | 172 | { |
| 175 | int x, y, pos; | 173 | int x, y, pos; |
| 176 | char c; | 174 | char c; |
| 177 | 175 | ||
| 178 | #ifndef CONFIG_X86_VERBOSE_BOOTUP | ||
| 179 | if (!error) | ||
| 180 | return; | ||
| 181 | #endif | ||
| 182 | if (early_serial_base) { | 176 | if (early_serial_base) { |
| 183 | const char *str = s; | 177 | const char *str = s; |
| 184 | while (*str) { | 178 | while (*str) { |
| @@ -265,9 +259,9 @@ void *memcpy(void *dest, const void *src, size_t n) | |||
| 265 | 259 | ||
| 266 | static void error(char *x) | 260 | static void error(char *x) |
| 267 | { | 261 | { |
| 268 | __putstr(1, "\n\n"); | 262 | error_putstr("\n\n"); |
| 269 | __putstr(1, x); | 263 | error_putstr(x); |
| 270 | __putstr(1, "\n\n -- System halted"); | 264 | error_putstr("\n\n -- System halted"); |
| 271 | 265 | ||
| 272 | while (1) | 266 | while (1) |
| 273 | asm("hlt"); | 267 | asm("hlt"); |
| @@ -294,8 +288,7 @@ static void parse_elf(void *output) | |||
| 294 | return; | 288 | return; |
| 295 | } | 289 | } |
| 296 | 290 | ||
| 297 | if (!quiet) | 291 | debug_putstr("Parsing ELF... "); |
| 298 | putstr("Parsing ELF... "); | ||
| 299 | 292 | ||
| 300 | phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum); | 293 | phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum); |
| 301 | if (!phdrs) | 294 | if (!phdrs) |
| @@ -332,11 +325,6 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap, | |||
| 332 | { | 325 | { |
| 333 | real_mode = rmode; | 326 | real_mode = rmode; |
| 334 | 327 | ||
| 335 | if (cmdline_find_option_bool("quiet")) | ||
| 336 | quiet = 1; | ||
| 337 | if (cmdline_find_option_bool("debug")) | ||
| 338 | debug = 1; | ||
| 339 | |||
| 340 | if (real_mode->screen_info.orig_video_mode == 7) { | 328 | if (real_mode->screen_info.orig_video_mode == 7) { |
| 341 | vidmem = (char *) 0xb0000; | 329 | vidmem = (char *) 0xb0000; |
| 342 | vidport = 0x3b4; | 330 | vidport = 0x3b4; |
| @@ -349,8 +337,7 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap, | |||
| 349 | cols = real_mode->screen_info.orig_video_cols; | 337 | cols = real_mode->screen_info.orig_video_cols; |
| 350 | 338 | ||
| 351 | console_init(); | 339 | console_init(); |
| 352 | if (debug) | 340 | debug_putstr("early console in decompress_kernel\n"); |
| 353 | putstr("early console in decompress_kernel\n"); | ||
| 354 | 341 | ||
| 355 | free_mem_ptr = heap; /* Heap */ | 342 | free_mem_ptr = heap; /* Heap */ |
| 356 | free_mem_end_ptr = heap + BOOT_HEAP_SIZE; | 343 | free_mem_end_ptr = heap + BOOT_HEAP_SIZE; |
| @@ -369,11 +356,9 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap, | |||
| 369 | error("Wrong destination address"); | 356 | error("Wrong destination address"); |
| 370 | #endif | 357 | #endif |
| 371 | 358 | ||
| 372 | if (!quiet) | 359 | debug_putstr("\nDecompressing Linux... "); |
| 373 | putstr("\nDecompressing Linux... "); | ||
| 374 | decompress(input_data, input_len, NULL, NULL, output, NULL, error); | 360 | decompress(input_data, input_len, NULL, NULL, output, NULL, error); |
| 375 | parse_elf(output); | 361 | parse_elf(output); |
| 376 | if (!quiet) | 362 | debug_putstr("done.\nBooting the kernel.\n"); |
| 377 | putstr("done.\nBooting the kernel.\n"); | ||
| 378 | return; | 363 | return; |
| 379 | } | 364 | } |
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h index 3f19c81a6203..0e6dc0ee0eea 100644 --- a/arch/x86/boot/compressed/misc.h +++ b/arch/x86/boot/compressed/misc.h | |||
| @@ -24,9 +24,21 @@ | |||
| 24 | 24 | ||
| 25 | /* misc.c */ | 25 | /* misc.c */ |
| 26 | extern struct boot_params *real_mode; /* Pointer to real-mode data */ | 26 | extern struct boot_params *real_mode; /* Pointer to real-mode data */ |
| 27 | void __putstr(int error, const char *s); | 27 | void __putstr(const char *s); |
| 28 | #define putstr(__x) __putstr(0, __x) | 28 | #define error_putstr(__x) __putstr(__x) |
| 29 | #define puts(__x) __putstr(0, __x) | 29 | |
| 30 | #ifdef CONFIG_X86_VERBOSE_BOOTUP | ||
| 31 | |||
| 32 | #define debug_putstr(__x) __putstr(__x) | ||
| 33 | |||
| 34 | #else | ||
| 35 | |||
| 36 | static inline void debug_putstr(const char *s) | ||
| 37 | { } | ||
| 38 | |||
| 39 | #endif | ||
| 40 | |||
| 41 | #ifdef CONFIG_EARLY_PRINTK | ||
| 30 | 42 | ||
| 31 | /* cmdline.c */ | 43 | /* cmdline.c */ |
| 32 | int cmdline_find_option(const char *option, char *buffer, int bufsize); | 44 | int cmdline_find_option(const char *option, char *buffer, int bufsize); |
| @@ -36,4 +48,13 @@ int cmdline_find_option_bool(const char *option); | |||
| 36 | extern int early_serial_base; | 48 | extern int early_serial_base; |
| 37 | void console_init(void); | 49 | void console_init(void); |
| 38 | 50 | ||
| 51 | #else | ||
| 52 | |||
| 53 | /* early_serial_console.c */ | ||
| 54 | static const int early_serial_base; | ||
| 55 | static inline void console_init(void) | ||
| 56 | { } | ||
| 57 | |||
| 58 | #endif | ||
| 59 | |||
| 39 | #endif | 60 | #endif |
