Commit 5e47c478b0b69bc9bc3ba544e4b1ca3268f98fef

Authored by H. Peter Anvin
1 parent 78b020d035

x86: remove zImage support

Impact: obsolete feature removal

The zImage kernel format has been functionally unused for a very long
time.  It is just barely possible to build a modern kernel that still
fits within the zImage size limit, but it is highly unlikely that
anyone ever uses it.  Furthermore, although it is still supported by
most bootloaders, it has been at best poorly tested (or not tested at
all); some bootloaders are even known to not support zImage at all and
not having even noticed.

Also remove some really obsolete constants that no longer have any
meaning.

LKML-Reference: <49B703D4.1000008@zytor.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>

Showing 5 changed files with 18 additions and 91 deletions Side-by-side Diff

arch/x86/boot/Makefile
... ... @@ -6,26 +6,23 @@
6 6 # for more details.
7 7 #
8 8 # Copyright (C) 1994 by Linus Torvalds
  9 +# Changed by many, many contributors over the years.
9 10 #
10 11  
11 12 # ROOT_DEV specifies the default root-device when making the image.
12 13 # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
13 14 # the default of FLOPPY is used by 'build'.
14 15  
15   -ROOT_DEV := CURRENT
  16 +ROOT_DEV := CURRENT
16 17  
17 18 # If you want to preset the SVGA mode, uncomment the next line and
18 19 # set SVGA_MODE to whatever number you want.
19 20 # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
20 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   -
26   -#RAMDISK := -DRAMDISK=512
27   -
28   -targets := vmlinux.bin setup.bin setup.elf zImage bzImage
  25 +targets := vmlinux.bin setup.bin setup.elf bzImage
29 26 subdir- := compressed
30 27  
31 28 setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o
32 29  
33 30  
... ... @@ -71,17 +68,13 @@
71 68 KBUILD_CFLAGS += $(call cc-option,-m32)
72 69 KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
73 70  
74   -$(obj)/zImage: asflags-y := $(SVGA_MODE) $(RAMDISK)
75   -$(obj)/bzImage: ccflags-y := -D__BIG_KERNEL__
76   -$(obj)/bzImage: asflags-y := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__
77   -$(obj)/bzImage: BUILDFLAGS := -b
  71 +$(obj)/bzImage: asflags-y := $(SVGA_MODE)
78 72  
79 73 quiet_cmd_image = BUILD $@
80   -cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/setup.bin \
81   - $(obj)/vmlinux.bin $(ROOT_DEV) > $@
  74 +cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin \
  75 + $(ROOT_DEV) > $@
82 76  
83   -$(obj)/zImage $(obj)/bzImage: $(obj)/setup.bin \
84   - $(obj)/vmlinux.bin $(obj)/tools/build FORCE
  77 +$(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE
85 78 $(call if_changed,image)
86 79 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
87 80  
arch/x86/boot/header.S
... ... @@ -24,12 +24,8 @@
24 24 #include "boot.h"
25 25 #include "offsets.h"
26 26  
27   -SETUPSECTS = 4 /* default nr of setup-sectors */
28 27 BOOTSEG = 0x07C0 /* original address of boot-sector */
29   -SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */
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" */
  28 +SYSSEG = 0x1000 /* historical load address >> 4 */
33 29  
34 30 #ifndef SVGA_MODE
35 31 #define SVGA_MODE ASK_VGA
36 32  
37 33  
... ... @@ -97,12 +93,12 @@
97 93 .section ".header", "a"
98 94 .globl hdr
99 95 hdr:
100   -setup_sects: .byte SETUPSECTS
  96 +setup_sects: .byte 0 /* Filled in by build.c */
101 97 root_flags: .word ROOT_RDONLY
102   -syssize: .long SYSSIZE
103   -ram_size: .word RAMDISK
  98 +syssize: .long 0 /* Filled in by build.c */
  99 +ram_size: .word 0 /* Obsolete */
104 100 vid_mode: .word SVGA_MODE
105   -root_dev: .word ROOT_DEV
  101 +root_dev: .word 0 /* Filled in by build.c */
106 102 boot_flag: .word 0xAA55
107 103  
108 104 # offset 512, entry point
109 105  
... ... @@ -123,14 +119,15 @@
123 119 # or else old loadlin-1.5 will fail)
124 120 .globl realmode_swtch
125 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 124 .word kernel_version-512 # pointing to kernel version string
128 125 # above section of header is compatible
129 126 # with loadlin-1.5 (header v1.5). Don't
130 127 # change it.
131 128  
132   -type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin,
133   - # Bootlin, SYSLX, bootsect...)
  129 +type_of_loader: .byte 0 # 0 means ancient bootloader, newer
  130 + # bootloaders know to change this.
134 131 # See Documentation/i386/boot.txt for
135 132 # assigned ids
136 133  
137 134  
... ... @@ -142,11 +139,7 @@
142 139 # space behind setup.S can be used for
143 140 # heap purposes.
144 141 # Only the loader knows what is free
145   -#ifndef __BIG_KERNEL__
146   - .byte 0
147   -#else
148 142 .byte LOADED_HIGH
149   -#endif
150 143  
151 144 setup_move_size: .word 0x8000 # size to move, when setup is not
152 145 # loaded at 0x90000. We will move setup
153 146  
... ... @@ -157,11 +150,7 @@
157 150  
158 151 code32_start: # here loaders can put a different
159 152 # start address for 32-bit code.
160   -#ifndef __BIG_KERNEL__
161   - .long 0x1000 # 0x1000 = default for zImage
162   -#else
163 153 .long 0x100000 # 0x100000 = default for big kernel
164   -#endif
165 154  
166 155 ramdisk_image: .long 0 # address of loaded ramdisk image
167 156 # Here the loader puts the 32-bit
... ... @@ -33,47 +33,6 @@
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 36 * Disable all interrupts at the legacy PIC.
78 37 */
79 38 static void mask_all_interrupts(void)
... ... @@ -146,9 +105,6 @@
146 105 {
147 106 /* Hook before leaving real mode, also disables interrupts */
148 107 realmode_switch_hook();
149   -
150   - /* Move the kernel/setup to their final resting places */
151   - move_kernel_around();
152 108  
153 109 /* Enable the A20 gate */
154 110 if (enable_a20()) {
arch/x86/boot/tools/build.c
... ... @@ -130,7 +130,7 @@
130 130  
131 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 136 int main(int argc, char ** argv)
... ... @@ -145,11 +145,6 @@
145 145 void *kernel;
146 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 148 if ((argc < 3) || (argc > 4))
154 149 usage();
155 150 if (argc > 3) {
... ... @@ -216,8 +211,6 @@
216 211 die("Unable to mmap '%s': %m", argv[2]);
217 212 /* Number of 16-byte paragraphs, including space for a 4-byte CRC */
218 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 215 /* Patch the setup code with the appropriate size parameters */
223 216 buf[0x1f1] = setup_sectors-1;
arch/x86/include/asm/boot.h
1 1 #ifndef _ASM_X86_BOOT_H
2 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 4 /* Internal svga startup constants */
9 5 #define NORMAL_VGA 0xffff /* 80x25 mode */
10 6 #define EXTENDED_VGA 0xfffe /* 80x50 mode */