[FIX] 2.3.28 broke `make bzdisk'

Mikael Pettersson (mikpe@csd.uu.se)
Sat, 13 Nov 1999 16:07:14 +0100 (MET)


2.3.28 broke `make bzdisk' for i386. At boot, `Loading'
is displayed and then everything halts.

The cause is this patch to arch/i386/boot/Makefile:
===snip===
--- v2.3.27/linux/arch/i386/boot/Makefile Fri Oct 22 13:21:45 1999
+++ linux/arch/i386/boot/Makefile Thu Nov 11 19:11:18 1999
@@ -51,11 +51,11 @@
bootsect.s: bootsect.S Makefile $(BOOT_INCL)
$(CPP) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@

-bbootsect: bbootsect.o
- $(LD) -Ttext 0x0 -s -oformat binary $< -o $@
+bbootsect: bbootsect.o bsetup.o
+ $(LD) -Ttext 0x0 -R bsetup.o -s -oformat binary $< -o $@

bbootsect.o: bbootsect.s
- $(AS) --defsym bootsect_kludge=0x220 -o $@ $<
+ $(AS) -o $@ $<

bbootsect.s: bootsect.S Makefile $(BOOT_INCL)
$(CPP) -D__BIG_KERNEL__ -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
===snip===
This may look reasonable, but it contains a horrible bug.

bbootsect.o is 0x200 bytes. Immediately following it in the boot
image is bsetup.o, and bootsect_kludge is at offset 0x020 in bsetup.o.
Hence, the value for bootsect_kludge should be 0x220.

In 2.3.28, bootsect_kludge is left undefined in bbootsect.o.
But note the rule to build bbootsect:

+bbootsect: bbootsect.o bsetup.o
+ $(LD) -Ttext 0x0 -R bsetup.o -s -oformat binary $< -o $@

However, in bsetup.o the bootsect_kludge symbol has value 0x020,
NOT 0x220 as it should be in the final image. Ouch.

The patch below fixes this by linking bbootsect.o and bsetup.o to
a temporary .o file in which bootsect_kludge will have its correct
value, and by linking bbootsect against this file instead of bsetup.o.

/Mikael

--- linux-2.3.28/arch/i386/boot/Makefile.~1~ Sat Nov 13 13:55:19 1999
+++ linux-2.3.28/arch/i386/boot/Makefile Sat Nov 13 15:12:42 1999
@@ -51,8 +51,11 @@
bootsect.s: bootsect.S Makefile $(BOOT_INCL)
$(CPP) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@

-bbootsect: bbootsect.o bsetup.o
- $(LD) -Ttext 0x0 -R bsetup.o -s -oformat binary $< -o $@
+bbootsect: bbootsect.o bbootsect_kludge.o
+ $(LD) -Ttext 0x0 -R bbootsect_kludge.o -s -oformat binary $< -o $@
+
+bbootsect_kludge.o: bbootsect.o bsetup.o
+ $(LD) -r $^ -o $@

bbootsect.o: bbootsect.s
$(AS) -o $@ $<
@@ -84,4 +87,5 @@
rm -f tools/build
rm -f setup bootsect zImage compressed/vmlinux.out
rm -f bsetup bbootsect bzImage compressed/bvmlinux.out
+ rm -f bbootsect_kludge.o
@$(MAKE) -C compressed clean

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/