I found the following scheme very convenient...
I produce system.map files of form
MAP_FILE=System.map.$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)build$(BUILD_NUM)
You can easily comment this out and use
MAP_FILE=System.map
to get the default behavior
I assume boot/arch/i386/zImage and vmlinux are the same kernels if I do
make; make zImage
I then move the map file into /, zip it and have a script which runs out
of rc.local which figures out which map file to unzip and install in
/zSystem.map
I found it very aggravating to have mismatched maps and kernels
running...
I also made a seperate target to make the map, that can easily be
backed out...(mostly for debugging...)
I also think instead of building vmlinuz and zImage, it may be a good
idea to build vmlinuz.build# and force removal by hand
(or have this be an easily configurable behavior...)
Comments? I'm doing some kernel hacking and I want a little ore
sanity...
--- Makefile 1995/08/26 20:00:16 1.1
+++ Makefile 1995/08/26 20:00:17
@@ -2,6 +2,8 @@
PATCHLEVEL = 3
SUBLEVEL = 20
+BUILD_NUM=$(shell cat .version)
+MAP_FILE=System.map.$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)build$(BUILD_NUM)
ARCH = i386
.EXPORT_ALL_VARIABLES:
@@ -118,13 +120,19 @@
boot: vmlinux
@$(MAKE) -C arch/$(ARCH)/boot
-vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
+vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs $(MAP_FILE)
$(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
$(ARCHIVES) \
$(FILESYSTEMS) \
$(DRIVERS) \
$(LIBS) -o vmlinux
- $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | sort > System.map
+
+map: $(MAP_FILE)
+
+ifdef MAP_FILE
+$(MAP_FILE):
+ $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | sort > $(MAP_FILE)
+endif
symlinks:
rm -f include/asm
getmap script:
#! /bin/bash
version=$(uname -a | cut -f 3 -d ' ')
patch=$(uname -a | cut -f 4 -d ' '| sed 's/\#/build/' )
#echo $version $patch
mapfile="System.map.$version$patch".gz
if [ -e /System.map ]; then
rm /System.map
fi
if [ -e $mapfile ]; then
echo using $mapfile for system map
zcat /$mapfile >/zSystem.map
else
echo Cannot find $mapfile, no system map
fi
marty leisner@sdsp.mc.xerox.com
Member of the League for Programming Freedom (http://www.lpf.org)
Any sufficiently advanced technology is indistinguishable from magic
Arthur C. Clarke, The Lost Worlds of 2001