Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+18 -91
+8 -15
arch/x86/boot/Makefile
··· 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 ··· 68 71 KBUILD_CFLAGS += $(call cc-option,-m32) 69 72 KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ 70 73 71 - $(obj)/zImage: asflags-y := $(SVGA_MODE) $(RAMDISK) 72 - $(obj)/bzImage: ccflags-y := -D__BIG_KERNEL__ 73 - $(obj)/bzImage: asflags-y := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__ 74 - $(obj)/bzImage: BUILDFLAGS := -b 74 + $(obj)/bzImage: asflags-y := $(SVGA_MODE) 75 75 76 76 quiet_cmd_image = BUILD $@ 77 - cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/setup.bin \ 78 - $(obj)/vmlinux.bin $(ROOT_DEV) > $@ 77 + cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin \ 78 + $(ROOT_DEV) > $@ 79 79 80 - $(obj)/zImage $(obj)/bzImage: $(obj)/setup.bin \ 81 - $(obj)/vmlinux.bin $(obj)/tools/build FORCE 80 + $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE 82 81 $(call if_changed,image) 83 82 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' 84 83
+9 -20
arch/x86/boot/header.S
··· 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 ··· 93 97 .section ".header", "a" 94 98 .globl hdr 95 99 hdr: 96 - setup_sects: .byte SETUPSECTS 100 + setup_sects: .byte 0 /* Filled in by build.c */ 97 101 root_flags: .word ROOT_RDONLY 98 - syssize: .long SYSSIZE 99 - ram_size: .word RAMDISK 102 + syssize: .long 0 /* Filled in by build.c */ 103 + ram_size: .word 0 /* Obsolete */ 100 104 vid_mode: .word SVGA_MODE 101 - root_dev: .word ROOT_DEV 105 + root_dev: .word 0 /* Filled in by build.c */ 102 106 boot_flag: .word 0xAA55 103 107 104 108 # offset 512, entry point ··· 119 123 # or else old loadlin-1.5 will fail) 120 124 .globl realmode_swtch 121 125 realmode_swtch: .word 0, 0 # default_switch, SETUPSEG 122 - start_sys_seg: .word SYSSEG 126 + start_sys_seg: .word SYSSEG # obsolete and meaningless, but just 127 + # in case something decided to "use" it 123 128 .word kernel_version-512 # pointing to kernel version string 124 129 # above section of header is compatible 125 130 # with loadlin-1.5 (header v1.5). Don't 126 131 # change it. 127 132 128 - type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin, 129 - # Bootlin, SYSLX, bootsect...) 133 + type_of_loader: .byte 0 # 0 means ancient bootloader, newer 134 + # bootloaders know to change this. 130 135 # See Documentation/i386/boot.txt for 131 136 # assigned ids 132 137 ··· 139 142 # space behind setup.S can be used for 140 143 # heap purposes. 141 144 # Only the loader knows what is free 142 - #ifndef __BIG_KERNEL__ 143 - .byte 0 144 - #else 145 145 .byte LOADED_HIGH 146 - #endif 147 146 148 147 setup_move_size: .word 0x8000 # size to move, when setup is not 149 148 # loaded at 0x90000. We will move setup ··· 150 157 151 158 code32_start: # here loaders can put a different 152 159 # start address for 32-bit code. 153 - #ifndef __BIG_KERNEL__ 154 - .long 0x1000 # 0x1000 = default for zImage 155 - #else 156 160 .long 0x100000 # 0x100000 = default for big kernel 157 - #endif 158 161 159 162 ramdisk_image: .long 0 # address of loaded ramdisk image 160 163 # Here the loader puts the 32-bit
-44
arch/x86/boot/pm.c
··· 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) ··· 105 146 { 106 147 /* Hook before leaving real mode, also disables interrupts */ 107 148 realmode_switch_hook(); 108 - 109 - /* Move the kernel/setup to their final resting places */ 110 - move_kernel_around(); 111 149 112 150 /* Enable the A20 gate */ 113 151 if (enable_a20()) {
+1 -8
arch/x86/boot/tools/build.c
··· 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 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) { ··· 211 216 die("Unable to mmap '%s': %m", argv[2]); 212 217 /* Number of 16-byte paragraphs, including space for a 4-byte CRC */ 213 218 sys_size = (sz + 15 + 4) / 16; 214 - if (!is_big_kernel && sys_size > DEF_SYSSIZE) 215 - die("System is too big. Try using bzImage or modules."); 216 219 217 220 /* Patch the setup code with the appropriate size parameters */ 218 221 buf[0x1f1] = setup_sectors-1;
-4
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 */