Commit b748febd authored by Pete Zaitcev's avatar Pete Zaitcev Committed by David S. Miller

[sparc] Stalingrad for kbuild army.

parent be8ce16f
BTFIXUP
-------
To build new kernels you have to issue "make image". The ready kernel
in ELF format is placed in arch/sparc/boot/image. Explanation is below.
BTFIXUP is a unique feature of Linux/sparc among other architectures,
developed by Jakub Jelinek (I think... Obviously David S. Miller took
part, too). It allows to boot the same kernel at different
sub-architectures, such as sun4c, sun4m, sun4d, where SunOS uses
different kernels. This feature is convinient for people who you move
disks between boxes and for distrution builders.
To function, BTFIXUP must link the kernel "in the draft" first,
analyze the result, write a special stub code based on that, and
build the final kernel with the stub (btfix.o).
Kai Germaschewski improved the build system of the kernel in the 2.5 series
significantly. Unfortunately, the traditional way of running the draft
linking from architecture specific Makefile before the actual linking
by generic Makefile is nearly impossible to support properly in the
new build system. Therefore, the way we integrate BTFIXUP with the
build system was changed in 2.5.40. Now, generic Makefile performs
the draft linking and stores the result in file vmlinux. Architecture
specific post-processing invokes BTFIXUP machinery and final linking
in the same way as other architectures do bootstraps.
Implications of that change are as follows.
1. Hackers must type "make image" now, instead of just "make", in the same
way as s390 people do now. It is analogous to "make bzImage" on i386.
This does NOT affect sparc64, you continue to use "make" to build sparc64
kernels.
2. vmlinux is not the final kernel, so RPM builders have to adjust
their spec files (if they delivered vmlinux for debugging).
System.map generated for vmlinux is still valid.
3. Scripts that produce a.out images have to be changed. First, if they
invoke make, they have to use "make image". Second, they have to pick up
the new kernel in arch/sparc/boot/image instead of vmlinux.
4. Since we are compliant with Kai's build system now, make -j is permitted.
-- Pete Zaitcev
zaitcev@yahoo.com
...@@ -31,21 +31,22 @@ CFLAGS := $(CFLAGS) -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 ...@@ -31,21 +31,22 @@ CFLAGS := $(CFLAGS) -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
endif endif
#LDFLAGS_vmlinux = -N -Ttext 0xf0004000 #LDFLAGS_vmlinux = -N -Ttext 0xf0004000
# Since 2.5.40, the first stage is left not btfix-ed.
# Actual linking is done with "make image".
LDFLAGS_vmlinux = -r
HEAD := arch/sparc/kernel/head.o arch/sparc/kernel/init_task.o HEAD := arch/sparc/kernel/head.o arch/sparc/kernel/init_task.o
core-y += arch/sparc/kernel/ arch/sparc/mm/ arch/sparc/math-emu/ core-y += arch/sparc/kernel/ arch/sparc/mm/ arch/sparc/math-emu/
libs-y += arch/sparc/prom/ arch/sparc/lib/ libs-y += arch/sparc/prom/ arch/sparc/lib/
# This one has to come last
SUBDIRS += arch/sparc/boot
CORE_FILES_NO_BTFIX := $(addsuffix built-in.o,$(core-y))
CORE_FILES += arch/sparc/boot/btfix.o
# Export what is needed by arch/sparc/boot/Makefile # Export what is needed by arch/sparc/boot/Makefile
export CORE_FILES_NO_BTFIX export CORE_FILES
export INIT export INIT
image: vmlinux
$(MAKE) -C arch/sparc/boot image
archclean: archclean:
rm -f $(TOPDIR)/vmlinux.aout rm -f $(TOPDIR)/vmlinux.aout
-$(MAKE) -C arch/sparc/boot clean -$(MAKE) -C arch/sparc/boot clean
......
...@@ -20,25 +20,23 @@ btfixupprep: btfixupprep.c ...@@ -20,25 +20,23 @@ btfixupprep: btfixupprep.c
$(HOSTCC) $(HOSTCFLAGS) -o btfixupprep btfixupprep.c $(HOSTCC) $(HOSTCFLAGS) -o btfixupprep btfixupprep.c
clean: clean:
rm -f btfixupprep piggyback tftpboot.img btfix.o btfix.s rm -f btfixupprep piggyback tftpboot.img btfix.o btfix.s image
#BTOBJS := $(HEAD) init/main.o init/version.o
BTOBJS := $(HEAD) $(INIT) BTOBJS := $(HEAD) $(INIT)
BTLIBS := $(CORE_FILES_NO_BTFIX) $(LIBS) \ BTLIBS := $(CORE_FILES) $(LIBS) \
$(DRIVERS) $(NETWORKS) $(DRIVERS) $(NETWORKS)
# I wanted to make this depend upon BTOBJS so that a parallel # Actual linking
# build would work, but this fails because $(HEAD) cannot work image: btfix.o
# properly as it will cause head.o to be built with the implicit $(LD) $(LDFLAGS) -T ../vmlinux.lds.s \
# rules not the ones in kernel/Makefile. Someone please fix. --DaveM $(patsubst %,$(TOPDIR)/%,$(BTOBJS)) \
vmlinux.o: FORCE
$(LD) $(LDFLAGS) -r $(patsubst %,$(TOPDIR)/%,$(BTOBJS)) \
--start-group \ --start-group \
$(patsubst %,$(TOPDIR)/%,$(BTLIBS)) \ $(patsubst %,$(TOPDIR)/%,$(BTLIBS)) \
--end-group -o vmlinux.o btfix.o \
--end-group -o image
btfix.s: btfixupprep vmlinux.o btfix.s: btfixupprep $(TOPDIR)/vmlinux
$(OBJDUMP) -x vmlinux.o | ./btfixupprep > btfix.s $(OBJDUMP) -x $(TOPDIR)/vmlinux | ./btfixupprep > btfix.s
btfix.o: btfix.s btfix.o: btfix.s
$(CC) -c -o btfix.o btfix.s $(CC) -c -o btfix.o btfix.s
......
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