diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/boot/Makefile | 23 | ||||
-rw-r--r-- | arch/x86/boot/header.S | 29 | ||||
-rw-r--r-- | arch/x86/boot/pm.c | 44 | ||||
-rw-r--r-- | arch/x86/boot/tools/build.c | 9 | ||||
-rw-r--r-- | arch/x86/include/asm/boot.h | 4 |
5 files changed, 18 insertions, 91 deletions
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile index c70eff69a1fb..57a29fecf6bb 100644 --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile | |||
@@ -6,26 +6,23 @@ | |||
6 | # for more details. | 6 | # for more details. |
7 | # | 7 | # |
8 | # Copyright (C) 1994 by Linus Torvalds | 8 | # Copyright (C) 1994 by Linus Torvalds |
9 | # Changed by many, many contributors over the years. | ||
9 | # | 10 | # |
10 | 11 | ||
11 | # ROOT_DEV specifies the default root-device when making the image. | 12 | # ROOT_DEV specifies the default root-device when making the image. |
12 | # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case | 13 | # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case |
13 | # the default of FLOPPY is used by 'build'. | 14 | # the default of FLOPPY is used by 'build'. |
14 | 15 | ||
15 | ROOT_DEV := CURRENT | 16 | ROOT_DEV := CURRENT |
16 | 17 | ||
17 | # If you want to preset the SVGA mode, uncomment the next line and | 18 | # If you want to preset the SVGA mode, uncomment the next line and |
18 | # set SVGA_MODE to whatever number you want. | 19 | # set SVGA_MODE to whatever number you want. |
19 | # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode. | 20 | # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode. |
20 | # The number is the same as you would ordinarily press at bootup. | 21 | # The number is the same as you would ordinarily press at bootup. |
21 | 22 | ||
22 | SVGA_MODE := -DSVGA_MODE=NORMAL_VGA | 23 | SVGA_MODE := -DSVGA_MODE=NORMAL_VGA |
23 | 24 | ||
24 | # If you want the RAM disk device, define this to be the size in blocks. | 25 | targets := vmlinux.bin setup.bin setup.elf bzImage |
25 | |||
26 | #RAMDISK := -DRAMDISK=512 | ||
27 | |||
28 | targets := vmlinux.bin setup.bin setup.elf zImage bzImage | ||
29 | subdir- := compressed | 26 | subdir- := compressed |
30 | 27 | ||
31 | setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o | 28 | setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o |
@@ -71,17 +68,13 @@ KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ | |||
71 | KBUILD_CFLAGS += $(call cc-option,-m32) | 68 | KBUILD_CFLAGS += $(call cc-option,-m32) |
72 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ | 69 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ |
73 | 70 | ||
74 | $(obj)/zImage: asflags-y := $(SVGA_MODE) $(RAMDISK) | 71 | $(obj)/bzImage: asflags-y := $(SVGA_MODE) |
75 | $(obj)/bzImage: ccflags-y := -D__BIG_KERNEL__ | ||
76 | $(obj)/bzImage: asflags-y := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__ | ||
77 | $(obj)/bzImage: BUILDFLAGS := -b | ||
78 | 72 | ||
79 | quiet_cmd_image = BUILD $@ | 73 | quiet_cmd_image = BUILD $@ |
80 | cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/setup.bin \ | 74 | cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin \ |
81 | $(obj)/vmlinux.bin $(ROOT_DEV) > $@ | 75 | $(ROOT_DEV) > $@ |
82 | 76 | ||
83 | $(obj)/zImage $(obj)/bzImage: $(obj)/setup.bin \ | 77 | $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE |
84 | $(obj)/vmlinux.bin $(obj)/tools/build FORCE | ||
85 | $(call if_changed,image) | 78 | $(call if_changed,image) |
86 | @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' | 79 | @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' |
87 | 80 | ||
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S index 7ccff4884a23..5d84d1c74e4c 100644 --- a/arch/x86/boot/header.S +++ b/arch/x86/boot/header.S | |||
@@ -24,12 +24,8 @@ | |||
24 | #include "boot.h" | 24 | #include "boot.h" |
25 | #include "offsets.h" | 25 | #include "offsets.h" |
26 | 26 | ||
27 | SETUPSECTS = 4 /* default nr of setup-sectors */ | ||
28 | BOOTSEG = 0x07C0 /* original address of boot-sector */ | 27 | BOOTSEG = 0x07C0 /* original address of boot-sector */ |
29 | SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */ | 28 | SYSSEG = 0x1000 /* historical load address >> 4 */ |
30 | SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */ | ||
31 | /* to be loaded */ | ||
32 | ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */ | ||
33 | 29 | ||
34 | #ifndef SVGA_MODE | 30 | #ifndef SVGA_MODE |
35 | #define SVGA_MODE ASK_VGA | 31 | #define SVGA_MODE ASK_VGA |
@@ -97,12 +93,12 @@ bugger_off_msg: | |||
97 | .section ".header", "a" | 93 | .section ".header", "a" |
98 | .globl hdr | 94 | .globl hdr |
99 | hdr: | 95 | hdr: |
100 | setup_sects: .byte SETUPSECTS | 96 | setup_sects: .byte 0 /* Filled in by build.c */ |
101 | root_flags: .word ROOT_RDONLY | 97 | root_flags: .word ROOT_RDONLY |
102 | syssize: .long SYSSIZE | 98 | syssize: .long 0 /* Filled in by build.c */ |
103 | ram_size: .word RAMDISK | 99 | ram_size: .word 0 /* Obsolete */ |
104 | vid_mode: .word SVGA_MODE | 100 | vid_mode: .word SVGA_MODE |
105 | root_dev: .word ROOT_DEV | 101 | root_dev: .word 0 /* Filled in by build.c */ |
106 | boot_flag: .word 0xAA55 | 102 | boot_flag: .word 0xAA55 |
107 | 103 | ||
108 | # offset 512, entry point | 104 | # offset 512, entry point |
@@ -123,14 +119,15 @@ _start: | |||
123 | # or else old loadlin-1.5 will fail) | 119 | # or else old loadlin-1.5 will fail) |
124 | .globl realmode_swtch | 120 | .globl realmode_swtch |
125 | realmode_swtch: .word 0, 0 # default_switch, SETUPSEG | 121 | realmode_swtch: .word 0, 0 # default_switch, SETUPSEG |
126 | start_sys_seg: .word SYSSEG | 122 | start_sys_seg: .word SYSSEG # obsolete and meaningless, but just |
123 | # in case something decided to "use" it | ||
127 | .word kernel_version-512 # pointing to kernel version string | 124 | .word kernel_version-512 # pointing to kernel version string |
128 | # above section of header is compatible | 125 | # above section of header is compatible |
129 | # with loadlin-1.5 (header v1.5). Don't | 126 | # with loadlin-1.5 (header v1.5). Don't |
130 | # change it. | 127 | # change it. |
131 | 128 | ||
132 | type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin, | 129 | type_of_loader: .byte 0 # 0 means ancient bootloader, newer |
133 | # Bootlin, SYSLX, bootsect...) | 130 | # bootloaders know to change this. |
134 | # See Documentation/i386/boot.txt for | 131 | # See Documentation/i386/boot.txt for |
135 | # assigned ids | 132 | # assigned ids |
136 | 133 | ||
@@ -142,11 +139,7 @@ CAN_USE_HEAP = 0x80 # If set, the loader also has set | |||
142 | # space behind setup.S can be used for | 139 | # space behind setup.S can be used for |
143 | # heap purposes. | 140 | # heap purposes. |
144 | # Only the loader knows what is free | 141 | # Only the loader knows what is free |
145 | #ifndef __BIG_KERNEL__ | ||
146 | .byte 0 | ||
147 | #else | ||
148 | .byte LOADED_HIGH | 142 | .byte LOADED_HIGH |
149 | #endif | ||
150 | 143 | ||
151 | setup_move_size: .word 0x8000 # size to move, when setup is not | 144 | setup_move_size: .word 0x8000 # size to move, when setup is not |
152 | # loaded at 0x90000. We will move setup | 145 | # loaded at 0x90000. We will move setup |
@@ -157,11 +150,7 @@ setup_move_size: .word 0x8000 # size to move, when setup is not | |||
157 | 150 | ||
158 | code32_start: # here loaders can put a different | 151 | code32_start: # here loaders can put a different |
159 | # start address for 32-bit code. | 152 | # start address for 32-bit code. |
160 | #ifndef __BIG_KERNEL__ | ||
161 | .long 0x1000 # 0x1000 = default for zImage | ||
162 | #else | ||
163 | .long 0x100000 # 0x100000 = default for big kernel | 153 | .long 0x100000 # 0x100000 = default for big kernel |
164 | #endif | ||
165 | 154 | ||
166 | ramdisk_image: .long 0 # address of loaded ramdisk image | 155 | ramdisk_image: .long 0 # address of loaded ramdisk image |
167 | # Here the loader puts the 32-bit | 156 | # Here the loader puts the 32-bit |
diff --git a/arch/x86/boot/pm.c b/arch/x86/boot/pm.c index 85a1cd8a8ff8..8062f8915250 100644 --- a/arch/x86/boot/pm.c +++ b/arch/x86/boot/pm.c | |||
@@ -33,47 +33,6 @@ static void realmode_switch_hook(void) | |||
33 | } | 33 | } |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * A zImage kernel is loaded at 0x10000 but wants to run at 0x1000. | ||
37 | * A bzImage kernel is loaded and runs at 0x100000. | ||
38 | */ | ||
39 | static void move_kernel_around(void) | ||
40 | { | ||
41 | /* Note: rely on the compile-time option here rather than | ||
42 | the LOADED_HIGH flag. The Qemu kernel loader unconditionally | ||
43 | sets the loadflags to zero. */ | ||
44 | #ifndef __BIG_KERNEL__ | ||
45 | u16 dst_seg, src_seg; | ||
46 | u32 syssize; | ||
47 | |||
48 | dst_seg = 0x1000 >> 4; | ||
49 | src_seg = 0x10000 >> 4; | ||
50 | syssize = boot_params.hdr.syssize; /* Size in 16-byte paragraphs */ | ||
51 | |||
52 | while (syssize) { | ||
53 | int paras = (syssize >= 0x1000) ? 0x1000 : syssize; | ||
54 | int dwords = paras << 2; | ||
55 | |||
56 | asm volatile("pushw %%es ; " | ||
57 | "pushw %%ds ; " | ||
58 | "movw %1,%%es ; " | ||
59 | "movw %2,%%ds ; " | ||
60 | "xorw %%di,%%di ; " | ||
61 | "xorw %%si,%%si ; " | ||
62 | "rep;movsl ; " | ||
63 | "popw %%ds ; " | ||
64 | "popw %%es" | ||
65 | : "+c" (dwords) | ||
66 | : "r" (dst_seg), "r" (src_seg) | ||
67 | : "esi", "edi"); | ||
68 | |||
69 | syssize -= paras; | ||
70 | dst_seg += paras; | ||
71 | src_seg += paras; | ||
72 | } | ||
73 | #endif | ||
74 | } | ||
75 | |||
76 | /* | ||
77 | * Disable all interrupts at the legacy PIC. | 36 | * Disable all interrupts at the legacy PIC. |
78 | */ | 37 | */ |
79 | static void mask_all_interrupts(void) | 38 | static void mask_all_interrupts(void) |
@@ -147,9 +106,6 @@ void go_to_protected_mode(void) | |||
147 | /* Hook before leaving real mode, also disables interrupts */ | 106 | /* Hook before leaving real mode, also disables interrupts */ |
148 | realmode_switch_hook(); | 107 | realmode_switch_hook(); |
149 | 108 | ||
150 | /* Move the kernel/setup to their final resting places */ | ||
151 | move_kernel_around(); | ||
152 | |||
153 | /* Enable the A20 gate */ | 109 | /* Enable the A20 gate */ |
154 | if (enable_a20()) { | 110 | if (enable_a20()) { |
155 | puts("A20 gate not responding, unable to boot...\n"); | 111 | puts("A20 gate not responding, unable to boot...\n"); |
diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c index 44dc1923c0e3..ee3a4ea923ac 100644 --- a/arch/x86/boot/tools/build.c +++ b/arch/x86/boot/tools/build.c | |||
@@ -130,7 +130,7 @@ static void die(const char * str, ...) | |||
130 | 130 | ||
131 | static void usage(void) | 131 | static void usage(void) |
132 | { | 132 | { |
133 | die("Usage: build [-b] setup system [rootdev] [> image]"); | 133 | die("Usage: build setup system [rootdev] [> image]"); |
134 | } | 134 | } |
135 | 135 | ||
136 | int main(int argc, char ** argv) | 136 | int main(int argc, char ** argv) |
@@ -145,11 +145,6 @@ int main(int argc, char ** argv) | |||
145 | void *kernel; | 145 | void *kernel; |
146 | u32 crc = 0xffffffffUL; | 146 | u32 crc = 0xffffffffUL; |
147 | 147 | ||
148 | if (argc > 2 && !strcmp(argv[1], "-b")) | ||
149 | { | ||
150 | is_big_kernel = 1; | ||
151 | argc--, argv++; | ||
152 | } | ||
153 | if ((argc < 3) || (argc > 4)) | 148 | if ((argc < 3) || (argc > 4)) |
154 | usage(); | 149 | usage(); |
155 | if (argc > 3) { | 150 | if (argc > 3) { |
@@ -216,8 +211,6 @@ int main(int argc, char ** argv) | |||
216 | die("Unable to mmap '%s': %m", argv[2]); | 211 | die("Unable to mmap '%s': %m", argv[2]); |
217 | /* Number of 16-byte paragraphs, including space for a 4-byte CRC */ | 212 | /* Number of 16-byte paragraphs, including space for a 4-byte CRC */ |
218 | sys_size = (sz + 15 + 4) / 16; | 213 | sys_size = (sz + 15 + 4) / 16; |
219 | if (!is_big_kernel && sys_size > DEF_SYSSIZE) | ||
220 | die("System is too big. Try using bzImage or modules."); | ||
221 | 214 | ||
222 | /* Patch the setup code with the appropriate size parameters */ | 215 | /* Patch the setup code with the appropriate size parameters */ |
223 | buf[0x1f1] = setup_sectors-1; | 216 | buf[0x1f1] = setup_sectors-1; |
diff --git a/arch/x86/include/asm/boot.h b/arch/x86/include/asm/boot.h index 6526cf08b0e4..6ba23dd9fc92 100644 --- a/arch/x86/include/asm/boot.h +++ b/arch/x86/include/asm/boot.h | |||
@@ -1,10 +1,6 @@ | |||
1 | #ifndef _ASM_X86_BOOT_H | 1 | #ifndef _ASM_X86_BOOT_H |
2 | #define _ASM_X86_BOOT_H | 2 | #define _ASM_X86_BOOT_H |
3 | 3 | ||
4 | /* Don't touch these, unless you really know what you're doing. */ | ||
5 | #define DEF_SYSSEG 0x1000 | ||
6 | #define DEF_SYSSIZE 0x7F00 | ||
7 | |||
8 | /* Internal svga startup constants */ | 4 | /* Internal svga startup constants */ |
9 | #define NORMAL_VGA 0xffff /* 80x25 mode */ | 5 | #define NORMAL_VGA 0xffff /* 80x25 mode */ |
10 | #define EXTENDED_VGA 0xfffe /* 80x50 mode */ | 6 | #define EXTENDED_VGA 0xfffe /* 80x50 mode */ |