aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/boot
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/boot')
-rw-r--r--arch/x86/boot/Makefile7
-rw-r--r--arch/x86/boot/compressed/Makefile19
-rw-r--r--arch/x86/boot/compressed/aslr.c3
-rw-r--r--arch/x86/boot/compressed/early_serial_console.c4
-rw-r--r--arch/x86/boot/cpu.c68
5 files changed, 56 insertions, 45 deletions
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index dbe8dd2fe247..5b016e2498f3 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -35,19 +35,22 @@ setup-y += video-vesa.o
35setup-y += video-bios.o 35setup-y += video-bios.o
36 36
37targets += $(setup-y) 37targets += $(setup-y)
38hostprogs-y := mkcpustr tools/build 38hostprogs-y := tools/build
39hostprogs-$(CONFIG_X86_FEATURE_NAMES) += mkcpustr
39 40
40HOST_EXTRACFLAGS += -I$(srctree)/tools/include \ 41HOST_EXTRACFLAGS += -I$(srctree)/tools/include \
41 -include include/generated/autoconf.h \ 42 -include include/generated/autoconf.h \
42 -D__EXPORTED_HEADERS__ 43 -D__EXPORTED_HEADERS__
43 44
45ifdef CONFIG_X86_FEATURE_NAMES
44$(obj)/cpu.o: $(obj)/cpustr.h 46$(obj)/cpu.o: $(obj)/cpustr.h
45 47
46quiet_cmd_cpustr = CPUSTR $@ 48quiet_cmd_cpustr = CPUSTR $@
47 cmd_cpustr = $(obj)/mkcpustr > $@ 49 cmd_cpustr = $(obj)/mkcpustr > $@
48targets += cpustr.h 50targets += cpustr.h
49$(obj)/cpustr.h: $(obj)/mkcpustr FORCE 51$(obj)/cpustr.h: $(obj)/mkcpustr FORCE
50 $(call if_changed,cpustr) 52 $(call if_changed,cpustr)
53endif
51 54
52# --------------------------------------------------------------------------- 55# ---------------------------------------------------------------------------
53 56
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 7a801a310e37..20db5b3609de 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -26,18 +26,19 @@ LDFLAGS_vmlinux := -T
26hostprogs-y := mkpiggy 26hostprogs-y := mkpiggy
27HOST_EXTRACFLAGS += -I$(srctree)/tools/include 27HOST_EXTRACFLAGS += -I$(srctree)/tools/include
28 28
29VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \ 29vmlinux-objs-y := $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
30 $(obj)/string.o $(obj)/cmdline.o $(obj)/early_serial_console.o \ 30 $(obj)/string.o $(obj)/cmdline.o \
31 $(obj)/piggy.o $(obj)/cpuflags.o $(obj)/aslr.o 31 $(obj)/piggy.o $(obj)/cpuflags.o
32
33vmlinux-objs-$(CONFIG_EARLY_PRINTK) += $(obj)/early_serial_console.o
34vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/aslr.o
32 35
33$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone 36$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
34 37
35ifeq ($(CONFIG_EFI_STUB), y) 38vmlinux-objs-$(CONFIG_EFI_STUB) += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \
36 VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \ 39 $(objtree)/drivers/firmware/efi/libstub/lib.a
37 $(objtree)/drivers/firmware/efi/libstub/lib.a
38endif
39 40
40$(obj)/vmlinux: $(VMLINUX_OBJS) FORCE 41$(obj)/vmlinux: $(vmlinux-objs-y) FORCE
41 $(call if_changed,ld) 42 $(call if_changed,ld)
42 @: 43 @:
43 44
@@ -45,7 +46,7 @@ OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
45$(obj)/vmlinux.bin: vmlinux FORCE 46$(obj)/vmlinux.bin: vmlinux FORCE
46 $(call if_changed,objcopy) 47 $(call if_changed,objcopy)
47 48
48targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs 49targets += $(patsubst $(obj)/%,%,$(vmlinux-objs-y)) vmlinux.bin.all vmlinux.relocs
49 50
50CMD_RELOCS = arch/x86/tools/relocs 51CMD_RELOCS = arch/x86/tools/relocs
51quiet_cmd_relocs = RELOCS $@ 52quiet_cmd_relocs = RELOCS $@
diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c
index fc6091abedb7..913c999b0045 100644
--- a/arch/x86/boot/compressed/aslr.c
+++ b/arch/x86/boot/compressed/aslr.c
@@ -1,6 +1,5 @@
1#include "misc.h" 1#include "misc.h"
2 2
3#ifdef CONFIG_RANDOMIZE_BASE
4#include <asm/msr.h> 3#include <asm/msr.h>
5#include <asm/archrandom.h> 4#include <asm/archrandom.h>
6#include <asm/e820.h> 5#include <asm/e820.h>
@@ -320,5 +319,3 @@ unsigned char *choose_kernel_location(unsigned char *input,
320out: 319out:
321 return (unsigned char *)choice; 320 return (unsigned char *)choice;
322} 321}
323
324#endif /* CONFIG_RANDOMIZE_BASE */
diff --git a/arch/x86/boot/compressed/early_serial_console.c b/arch/x86/boot/compressed/early_serial_console.c
index d3d003cb5481..261e81fb9582 100644
--- a/arch/x86/boot/compressed/early_serial_console.c
+++ b/arch/x86/boot/compressed/early_serial_console.c
@@ -1,9 +1,5 @@
1#include "misc.h" 1#include "misc.h"
2 2
3#ifdef CONFIG_EARLY_PRINTK
4
5int early_serial_base; 3int early_serial_base;
6 4
7#include "../early_serial_console.c" 5#include "../early_serial_console.c"
8
9#endif
diff --git a/arch/x86/boot/cpu.c b/arch/x86/boot/cpu.c
index 6ec6bb6e9957..29207f69ae8c 100644
--- a/arch/x86/boot/cpu.c
+++ b/arch/x86/boot/cpu.c
@@ -16,7 +16,9 @@
16 */ 16 */
17 17
18#include "boot.h" 18#include "boot.h"
19#ifdef CONFIG_X86_FEATURE_NAMES
19#include "cpustr.h" 20#include "cpustr.h"
21#endif
20 22
21static char *cpu_name(int level) 23static char *cpu_name(int level)
22{ 24{
@@ -32,11 +34,48 @@ static char *cpu_name(int level)
32 } 34 }
33} 35}
34 36
37static void show_cap_strs(u32 *err_flags)
38{
39 int i, j;
40#ifdef CONFIG_X86_FEATURE_NAMES
41 const unsigned char *msg_strs = (const unsigned char *)x86_cap_strs;
42 for (i = 0; i < NCAPINTS; i++) {
43 u32 e = err_flags[i];
44 for (j = 0; j < 32; j++) {
45 if (msg_strs[0] < i ||
46 (msg_strs[0] == i && msg_strs[1] < j)) {
47 /* Skip to the next string */
48 msg_strs += 2;
49 while (*msg_strs++)
50 ;
51 }
52 if (e & 1) {
53 if (msg_strs[0] == i &&
54 msg_strs[1] == j &&
55 msg_strs[2])
56 printf("%s ", msg_strs+2);
57 else
58 printf("%d:%d ", i, j);
59 }
60 e >>= 1;
61 }
62 }
63#else
64 for (i = 0; i < NCAPINTS; i++) {
65 u32 e = err_flags[i];
66 for (j = 0; j < 32; j++) {
67 if (e & 1)
68 printf("%d:%d ", i, j);
69 e >>= 1;
70 }
71 }
72#endif
73}
74
35int validate_cpu(void) 75int validate_cpu(void)
36{ 76{
37 u32 *err_flags; 77 u32 *err_flags;
38 int cpu_level, req_level; 78 int cpu_level, req_level;
39 const unsigned char *msg_strs;
40 79
41 check_cpu(&cpu_level, &req_level, &err_flags); 80 check_cpu(&cpu_level, &req_level, &err_flags);
42 81
@@ -49,34 +88,9 @@ int validate_cpu(void)
49 } 88 }
50 89
51 if (err_flags) { 90 if (err_flags) {
52 int i, j;
53 puts("This kernel requires the following features " 91 puts("This kernel requires the following features "
54 "not present on the CPU:\n"); 92 "not present on the CPU:\n");
55 93 show_cap_strs(err_flags);
56 msg_strs = (const unsigned char *)x86_cap_strs;
57
58 for (i = 0; i < NCAPINTS; i++) {
59 u32 e = err_flags[i];
60
61 for (j = 0; j < 32; j++) {
62 if (msg_strs[0] < i ||
63 (msg_strs[0] == i && msg_strs[1] < j)) {
64 /* Skip to the next string */
65 msg_strs += 2;
66 while (*msg_strs++)
67 ;
68 }
69 if (e & 1) {
70 if (msg_strs[0] == i &&
71 msg_strs[1] == j &&
72 msg_strs[2])
73 printf("%s ", msg_strs+2);
74 else
75 printf("%d:%d ", i, j);
76 }
77 e >>= 1;
78 }
79 }
80 putchar('\n'); 94 putchar('\n');
81 return -1; 95 return -1;
82 } else { 96 } else {