Commit 72574bb3 authored by H. Peter Anvin's avatar H. Peter Anvin Committed by Linus Torvalds

[PATCH] bootsect removal

This is the "boot sector removal" patch for i386 updated for Linux
2.5.63-bk7.  The only change against the 2.5.59 version is that the
FDOPTS Makefile variable, which lets one create a floppy image with
arbitrary kernel options, has been merged from the x86-64 version, and
the comments have been updated.

The patch removes the in-kernel boot sector, which these days rarely
work correctly (it only supports up to 1 MB kernels, and only work on
legacy floppies -- not on IDE or USB devices, nor on any kind of
emulated devices like El Torito), replaces it with a placeholder stub,
and sets up the Makefile targets to create floppies or floppy images
using SYSLINUX.  The FDOPTS Makefile variable can be used to set
kernel command line options (thanks to a suggestion by Andi Kleen.)

Note that the same change has already been applied to the x86-64
architecture.  The last hunk of the patch corrects a comment in that
architecture.
parent 7deaf3b8
...@@ -92,7 +92,8 @@ AFLAGS += $(mflags-y) ...@@ -92,7 +92,8 @@ AFLAGS += $(mflags-y)
boot := arch/i386/boot boot := arch/i386/boot
.PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install .PHONY: zImage bzImage compressed zlilo bzlilo \
zdisk bzdisk fdimage fdimage144 fdimage288 install
all: bzImage all: bzImage
...@@ -110,8 +111,8 @@ zlilo bzlilo: vmlinux ...@@ -110,8 +111,8 @@ zlilo bzlilo: vmlinux
zdisk bzdisk: vmlinux zdisk bzdisk: vmlinux
$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zdisk $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zdisk
install: vmlinux install fdimage fdimage144 fdimage288: vmlinux
$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) install $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@
archclean: archclean:
$(Q)$(MAKE) $(clean)=arch/i386/boot $(Q)$(MAKE) $(clean)=arch/i386/boot
...@@ -122,5 +123,8 @@ define archhelp ...@@ -122,5 +123,8 @@ define archhelp
echo ' (your) ~/bin/installkernel or' echo ' (your) ~/bin/installkernel or'
echo ' (distribution) /sbin/installkernel or' echo ' (distribution) /sbin/installkernel or'
echo ' install to $$(INSTALL_PATH) and run lilo' echo ' install to $$(INSTALL_PATH) and run lilo'
echo ' bzdisk - Create a boot floppy in /dev/fd0'
echo ' fdimage - Create a boot floppy image'
endef endef
CLEAN_FILES += arch/$(ARCH)/boot/fdimage arch/$(ARCH)/boot/mtools.conf
...@@ -62,8 +62,36 @@ $(obj)/compressed/vmlinux: FORCE ...@@ -62,8 +62,36 @@ $(obj)/compressed/vmlinux: FORCE
$(Q)$(MAKE) -f scripts/Makefile.build obj=$(obj)/compressed \ $(Q)$(MAKE) -f scripts/Makefile.build obj=$(obj)/compressed \
IMAGE_OFFSET=$(IMAGE_OFFSET) $@ IMAGE_OFFSET=$(IMAGE_OFFSET) $@
zdisk: $(BOOTIMAGE) # Set this if you want to pass append arguments to the zdisk/fdimage kernel
dd bs=8192 if=$(BOOTIMAGE) of=/dev/fd0 FDARGS =
$(obj)/mtools.conf: $(obj)/mtools.conf.in
sed -e 's|@OBJ@|$(obj)|g' < $< > $@
# This requires write access to /dev/fd0
zdisk: $(BOOTIMAGE) $(obj)/mtools.conf
MTOOLSRC=$(src)/mtools.conf mformat a: ; sync
syslinux /dev/fd0 ; sync
echo 'default linux $(FDARGS)' | \
MTOOLSRC=$(src)/mtools.conf mcopy - a:syslinux.cfg
MTOOLSRC=$(src)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync
# These require being root or having syslinux 2.02 or higher installed
fdimage fdimage144: $(BOOTIMAGE) $(src)/mtools.conf
dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440
MTOOLSRC=$(src)/mtools.conf mformat v: ; sync
syslinux $(obj)/fdimage ; sync
echo 'default linux $(FDARGS)' | \
MTOOLSRC=$(src)/mtools.conf mcopy - v:syslinux.cfg
MTOOLSRC=$(src)/mtools.conf mcopy $(BOOTIMAGE) v:linux ; sync
fdimage288: $(BOOTIMAGE) $(src)/mtools.conf
dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880
MTOOLSRC=$(src)/mtools.conf mformat w: ; sync
syslinux $(obj)/fdimage ; sync
echo 'default linux $(FDARGS)' | \
MTOOLSRC=$(src)/mtools.conf mcopy - w:syslinux.cfg
MTOOLSRC=$(src)/mtools.conf mcopy $(BOOTIMAGE) w:linux ; sync
zlilo: $(BOOTIMAGE) zlilo: $(BOOTIMAGE)
if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi
......
This diff is collapsed.
#
# mtools configuration file for "make (b)zdisk"
#
# Actual floppy drive
drive a:
file="/dev/fd0"
# 1.44 MB floppy disk image
drive v:
file="@OBJ@/fdimage" cylinders=80 heads=2 sectors=18 filter
# 2.88 MB floppy disk image (mostly for virtual uses)
drive w:
file="@OBJ@/fdimage" cylinders=80 heads=2 sectors=36 filter
...@@ -150,13 +150,10 @@ int main(int argc, char ** argv) ...@@ -150,13 +150,10 @@ int main(int argc, char ** argv)
sz = sb.st_size; sz = sb.st_size;
fprintf (stderr, "System is %d kB\n", sz/1024); fprintf (stderr, "System is %d kB\n", sz/1024);
sys_size = (sz + 15) / 16; sys_size = (sz + 15) / 16;
/* 0x28000*16 = 2.5 MB, conservative estimate for the current maximum */ /* 0x40000*16 = 4.0 MB, reasonable estimate for the current maximum */
if (sys_size > (is_big_kernel ? 0x28000 : DEF_SYSSIZE)) if (sys_size > (is_big_kernel ? 0x40000 : DEF_SYSSIZE))
die("System is too big. Try using %smodules.", die("System is too big. Try using %smodules.",
is_big_kernel ? "" : "bzImage or "); is_big_kernel ? "" : "bzImage or ");
if (sys_size > 0xefff)
fprintf(stderr,"warning: kernel is too big for standalone boot "
"from floppy\n");
while (sz > 0) { while (sz > 0) {
int l, n; int l, n;
......
...@@ -73,7 +73,7 @@ zdisk: $(BOOTIMAGE) $(obj)/mtools.conf ...@@ -73,7 +73,7 @@ zdisk: $(BOOTIMAGE) $(obj)/mtools.conf
MTOOLSRC=$(src)/mtools.conf mcopy - a:syslinux.cfg MTOOLSRC=$(src)/mtools.conf mcopy - a:syslinux.cfg
MTOOLSRC=$(src)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync MTOOLSRC=$(src)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync
# These require being root or having syslinux run setuid # These require being root or having syslinux 2.02 or higher installed
fdimage fdimage144: $(BOOTIMAGE) $(src)/mtools.conf fdimage fdimage144: $(BOOTIMAGE) $(src)/mtools.conf
dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440 dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440
MTOOLSRC=$(src)/mtools.conf mformat v: ; sync MTOOLSRC=$(src)/mtools.conf mformat v: ; sync
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment