Commit 2becf2fd authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linux-isdn.bkbits.net/linux-2.5.make

into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
parents 7b66a268 260b4179
...@@ -162,22 +162,21 @@ PERL = perl ...@@ -162,22 +162,21 @@ PERL = perl
MODFLAGS = -DMODULE MODFLAGS = -DMODULE
CFLAGS_MODULE = $(MODFLAGS) CFLAGS_MODULE = $(MODFLAGS)
AFLAGS_MODULE = $(MODFLAGS) AFLAGS_MODULE = $(MODFLAGS)
LDFLAGS_MODULE = -r
CFLAGS_KERNEL = CFLAGS_KERNEL =
AFLAGS_KERNEL = AFLAGS_KERNEL =
NOSTDINC_FLAGS = -nostdinc -iwithprefix include NOSTDINC_FLAGS = -nostdinc -iwithprefix include
CPPFLAGS := -D__KERNEL__ -Iinclude CPPFLAGS := -D__KERNEL__ -Iinclude
CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \ CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
-fno-strict-aliasing -fno-common -fno-strict-aliasing -fno-common
ifndef CONFIG_FRAME_POINTER
CFLAGS += -fomit-frame-pointer
endif
AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS) AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \ export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
CONFIG_SHELL TOPDIR HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ CONFIG_SHELL TOPDIR HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \ CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
HOSTCXX HOSTCXXFLAGS LDFLAGS_BLOB HOSTCXX HOSTCXXFLAGS LDFLAGS_BLOB LDFLAGS_MODULE
export CPPFLAGS NOSTDINC_FLAGS OBJCOPYFLAGS LDFLAGS export CPPFLAGS NOSTDINC_FLAGS OBJCOPYFLAGS LDFLAGS
export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
...@@ -203,7 +202,7 @@ scripts/docproc scripts/fixdep scripts/split-include : scripts ; ...@@ -203,7 +202,7 @@ scripts/docproc scripts/fixdep scripts/split-include : scripts ;
.PHONY: scripts .PHONY: scripts
scripts: scripts:
+@$(Q)$(MAKE) -f scripts/Makefile.build obj=scripts $(Q)$(MAKE) -f scripts/Makefile.build obj=scripts
# Objects we will link into vmlinux / subdirs we need to visit # Objects we will link into vmlinux / subdirs we need to visit
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -260,6 +259,10 @@ ifdef CONFIG_MODULES ...@@ -260,6 +259,10 @@ ifdef CONFIG_MODULES
export EXPORT_FLAGS := -DEXPORT_SYMTAB export EXPORT_FLAGS := -DEXPORT_SYMTAB
endif endif
ifndef CONFIG_FRAME_POINTER
CFLAGS += -fomit-frame-pointer
endif
# #
# INSTALL_PATH specifies where to place the updated kernel and system map # INSTALL_PATH specifies where to place the updated kernel and system map
# images. Uncomment if you want to place them anywhere other than root. # images. Uncomment if you want to place them anywhere other than root.
...@@ -351,12 +354,12 @@ ifdef CONFIG_KALLSYMS ...@@ -351,12 +354,12 @@ ifdef CONFIG_KALLSYMS
kallsyms.o := .tmp_kallsyms2.o kallsyms.o := .tmp_kallsyms2.o
quiet_cmd_kallsyms = KSYM $@ quiet_cmd_kallsyms = KSYM $@
cmd_kallsyms = sh $(KALLSYMS) $< $@ cmd_kallsyms = $(NM) -n $< | scripts/kallsyms > $@
.tmp_kallsyms1.o: .tmp_vmlinux1 .tmp_kallsyms1.o .tmp_kallsyms2.o: %.o: %.S scripts FORCE
$(call cmd,kallsyms) $(call if_changed_dep,as_o_S)
.tmp_kallsyms2.o: .tmp_vmlinux2 .tmp_kallsyms%.S: .tmp_vmlinux%
$(call cmd,kallsyms) $(call cmd,kallsyms)
.tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/vmlinux.lds.s FORCE .tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/vmlinux.lds.s FORCE
...@@ -435,7 +438,7 @@ include/config/MARKER: scripts/split-include include/linux/autoconf.h ...@@ -435,7 +438,7 @@ include/config/MARKER: scripts/split-include include/linux/autoconf.h
# with it and forgot to run make oldconfig # with it and forgot to run make oldconfig
include/linux/autoconf.h: .config include/linux/autoconf.h: .config
+@$(call descend,scripts/kconfig,scripts/kconfig/conf) $(Q)$(MAKE) -f scripts/Makefile.build obj=scripts/kconfig scripts/kconfig/conf
./scripts/kconfig/conf -s arch/$(ARCH)/Kconfig ./scripts/kconfig/conf -s arch/$(ARCH)/Kconfig
# Generate some files # Generate some files
...@@ -542,7 +545,7 @@ _modinst_: ...@@ -542,7 +545,7 @@ _modinst_:
.PHONY: $(patsubst %, _modinst_%, $(SUBDIRS)) .PHONY: $(patsubst %, _modinst_%, $(SUBDIRS))
$(patsubst %, _modinst_%, $(SUBDIRS)) : $(patsubst %, _modinst_%, $(SUBDIRS)) :
$(Q)$(MAKE) -f scripts/Makefile.modinst obj=$(patsubst _modinst_%,%,$@) $(Q)$(MAKE) -rR -f scripts/Makefile.modinst obj=$(patsubst _modinst_%,%,$@)
else # CONFIG_MODULES else # CONFIG_MODULES
# Modules not configured # Modules not configured
...@@ -639,13 +642,13 @@ ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),) ...@@ -639,13 +642,13 @@ ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
make_with_config make_with_config
scripts/kconfig/conf scripts/kconfig/mconf scripts/kconfig/qconf: scripts/fixdep FORCE scripts/kconfig/conf scripts/kconfig/mconf scripts/kconfig/qconf: scripts/fixdep FORCE
+@$(call descend,scripts/kconfig,$@) $(Q)$(MAKE) -f scripts/Makefile.build obj=scripts/kconfig $@
xconfig: scripts/kconfig/qconf xconfig: scripts/kconfig/qconf
./scripts/kconfig/qconf arch/$(ARCH)/Kconfig ./scripts/kconfig/qconf arch/$(ARCH)/Kconfig
menuconfig: scripts/kconfig/mconf menuconfig: scripts/kconfig/mconf
$(Q)$(MAKE) -f scripts/Makefile.build obj=scripts lxdialog $(Q)$(MAKE) -f scripts/Makefile.build obj=scripts/lxdialog
./scripts/kconfig/mconf arch/$(ARCH)/Kconfig ./scripts/kconfig/mconf arch/$(ARCH)/Kconfig
config: scripts/kconfig/conf config: scripts/kconfig/conf
...@@ -708,8 +711,9 @@ cmd_rmclean = rm -f $(CLEAN_FILES) ...@@ -708,8 +711,9 @@ cmd_rmclean = rm -f $(CLEAN_FILES)
clean: archclean $(addprefix _clean_,$(clean-dirs)) clean: archclean $(addprefix _clean_,$(clean-dirs))
$(call cmd,rmclean) $(call cmd,rmclean)
@find . $(RCS_FIND_IGNORE) \ @find . $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '.*.cmd' -o -name '.*.d' \ \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
-o -name '.*.tmp' \) -type f -print | xargs rm -f -o -name '.*.d' -o -name '.*.tmp' \) -type f \
-print | xargs rm -f
# mrproper - delete configuration + modules + core files # mrproper - delete configuration + modules + core files
# #
...@@ -827,7 +831,7 @@ else # ifneq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),) ...@@ -827,7 +831,7 @@ else # ifneq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
# =========================================================================== # ===========================================================================
%:: FORCE %:: FORCE
$(MAKE) $@ $(Q)$(MAKE) $@
endif # ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),) endif # ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
endif # ifdef include_config endif # ifdef include_config
...@@ -841,6 +845,9 @@ a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS) \ ...@@ -841,6 +845,9 @@ a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS) \
quiet_cmd_as_s_S = CPP $@ quiet_cmd_as_s_S = CPP $@
cmd_as_s_S = $(CPP) $(a_flags) -o $@ $< cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
quiet_cmd_as_o_S = AS $@
cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
# read all saved command lines # read all saved command lines
targets := $(wildcard $(sort $(targets))) targets := $(wildcard $(sort $(targets)))
...@@ -888,6 +895,6 @@ endef ...@@ -888,6 +895,6 @@ endef
# $(call descend,<dir>,<target>) # $(call descend,<dir>,<target>)
# Recursively call a sub-make in <dir> with target <target> # Recursively call a sub-make in <dir> with target <target>
descend = $(Q)$(MAKE) -f scripts/Makefile.build obj=$(1) $(2) descend =$(Q)$(MAKE) -f scripts/Makefile.build obj=$(1) $(2)
FORCE: FORCE:
...@@ -66,7 +66,7 @@ drivers-$(CONFIG_OPROFILE) += arch/i386/oprofile/ ...@@ -66,7 +66,7 @@ drivers-$(CONFIG_OPROFILE) += arch/i386/oprofile/
CFLAGS += -Iarch/i386/$(MACHINE) CFLAGS += -Iarch/i386/$(MACHINE)
AFLAGS += -Iarch/i386/$(MACHINE) AFLAGS += -Iarch/i386/$(MACHINE)
makeboot = $(call descend,arch/i386/boot,$(1)) makeboot =$(Q)$(MAKE) -f scripts/Makefile.build obj=arch/i386/boot $(1)
.PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \ .PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \
clean archclean archmrproper clean archclean archmrproper
...@@ -77,20 +77,20 @@ BOOTIMAGE=arch/i386/boot/bzImage ...@@ -77,20 +77,20 @@ BOOTIMAGE=arch/i386/boot/bzImage
zImage zlilo zdisk: BOOTIMAGE=arch/i386/boot/zImage zImage zlilo zdisk: BOOTIMAGE=arch/i386/boot/zImage
zImage bzImage: vmlinux zImage bzImage: vmlinux
+@$(call makeboot,$(BOOTIMAGE)) $(call makeboot,$(BOOTIMAGE))
compressed: zImage compressed: zImage
zlilo bzlilo: vmlinux zlilo bzlilo: vmlinux
+@$(call makeboot,BOOTIMAGE=$(BOOTIMAGE) zlilo) $(call makeboot,BOOTIMAGE=$(BOOTIMAGE) zlilo)
zdisk bzdisk: vmlinux zdisk bzdisk: vmlinux
+@$(call makeboot,BOOTIMAGE=$(BOOTIMAGE) zdisk) $(call makeboot,BOOTIMAGE=$(BOOTIMAGE) zdisk)
install: vmlinux install: vmlinux
+@$(call makeboot,BOOTIMAGE=$(BOOTIMAGE) install) $(call makeboot,BOOTIMAGE=$(BOOTIMAGE) install)
archclean: archclean:
@$(MAKE) -f scripts/Makefile.clean obj=arch/i386/boot $(Q)$(MAKE) -f scripts/Makefile.clean obj=arch/i386/boot
archmrproper: archmrproper:
...@@ -32,12 +32,6 @@ subdir- := compressed ...@@ -32,12 +32,6 @@ subdir- := compressed
host-progs := tools/build host-progs := tools/build
# Default
boot: bzImage
include $(TOPDIR)/Rules.make
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
$(obj)/zImage: IMAGE_OFFSET := 0x1000 $(obj)/zImage: IMAGE_OFFSET := 0x1000
...@@ -53,6 +47,7 @@ cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \ ...@@ -53,6 +47,7 @@ cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \
$(obj)/zImage $(obj)/bzImage: $(obj)/bootsect $(obj)/setup \ $(obj)/zImage $(obj)/bzImage: $(obj)/bootsect $(obj)/setup \
$(obj)/vmlinux.bin $(obj)/tools/build FORCE $(obj)/vmlinux.bin $(obj)/tools/build FORCE
$(call if_changed,image) $(call if_changed,image)
@echo 'Kernel: $@ is ready'
$(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
$(call if_changed,objcopy) $(call if_changed,objcopy)
...@@ -64,9 +59,8 @@ $(obj)/setup $(obj)/bootsect: %: %.o FORCE ...@@ -64,9 +59,8 @@ $(obj)/setup $(obj)/bootsect: %: %.o FORCE
$(call if_changed,ld) $(call if_changed,ld)
$(obj)/compressed/vmlinux: FORCE $(obj)/compressed/vmlinux: FORCE
+@$(call descend,$(obj)/compressed,IMAGE_OFFSET=$(IMAGE_OFFSET) \ $(Q)$(MAKE) -f scripts/Makefile.build obj=$(obj)/compressed \
$(obj)/compressed/vmlinux) IMAGE_OFFSET=$(IMAGE_OFFSET) $@
zdisk: $(BOOTIMAGE) zdisk: $(BOOTIMAGE)
dd bs=8192 if=$(BOOTIMAGE) of=/dev/fd0 dd bs=8192 if=$(BOOTIMAGE) of=/dev/fd0
......
...@@ -13,6 +13,7 @@ LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32 ...@@ -13,6 +13,7 @@ LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32
$(obj)/vmlinux: $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE $(obj)/vmlinux: $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE
$(call if_changed,ld) $(call if_changed,ld)
@:
$(obj)/vmlinux.bin: vmlinux FORCE $(obj)/vmlinux.bin: vmlinux FORCE
$(call if_changed,objcopy) $(call if_changed,objcopy)
......
# #
# Makefile for misc devices that really don't fit anywhere else. # Makefile for misc devices that really don't fit anywhere else.
# #
obj- := misc.o # Dummy rule to force built-in.o to be made
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
...@@ -45,14 +45,11 @@ const char *kallsyms_lookup(unsigned long addr, ...@@ -45,14 +45,11 @@ const char *kallsyms_lookup(unsigned long addr,
for (i = 0; i < best; i++) for (i = 0; i < best; i++)
name += strlen(name)+1; name += strlen(name)+1;
/* Base symbol size on next symbol, but beware aliases. */ /* Base symbol size on next symbol. */
if (best + 1 < kallsyms_num_syms)
symbol_end = kallsyms_addresses[best + 1];
else
symbol_end = (unsigned long)_etext; symbol_end = (unsigned long)_etext;
for (i = best+1; i < kallsyms_num_syms; i++) {
if (kallsyms_addresses[i] != kallsyms_addresses[best]){
symbol_end = kallsyms_addresses[i];
break;
}
}
*symbolsize = symbol_end - kallsyms_addresses[best]; *symbolsize = symbol_end - kallsyms_addresses[best];
*modname = NULL; *modname = NULL;
......
...@@ -8,31 +8,11 @@ ...@@ -8,31 +8,11 @@
# docproc: Preprocess .tmpl file in order to generate .sgml documentation # docproc: Preprocess .tmpl file in order to generate .sgml documentation
# conmakehash: Create arrays for initializing the kernel console tables # conmakehash: Create arrays for initializing the kernel console tables
EXTRA_TARGETS := fixdep split-include docproc conmakehash host-progs := fixdep split-include conmakehash docproc kallsyms
build-targets := $(host-progs)
# Let clean descend into subdirs
subdir- := lxdialog kconfig subdir- := lxdialog kconfig
# Yikes. We need to build this stuff here even if the user only wants
# modules.
KBUILD_BUILTIN := 1
# The following temporary rule will make sure that people's
# trees get updated to the right permissions, since patch(1)
# can't do it
# ---------------------------------------------------------------------------
host-progs := fixdep split-include conmakehash docproc
include $(TOPDIR)/Rules.make
# ---------------------------------------------------------------------------
# Targets hardcoded and wellknow in top-level makefile
.PHONY: lxdialog
lxdialog:
$(call descend,scripts/lxdialog,)
# fixdep is needed to compile other host programs # fixdep is needed to compile other host programs
$(obj)/split-include $(obj)/docproc \ $(addprefix $(obj)/,$(filter-out fixdep,$(host-progs))): $(obj)/fixdep
$(obj)/conmakehash lxdialog: $(obj)/fixdep
...@@ -40,12 +40,14 @@ endif ...@@ -40,12 +40,14 @@ endif
ifdef L_TARGET ifdef L_TARGET
L_TARGET := $(obj)/$(L_TARGET) L_TARGET := $(obj)/$(L_TARGET)
else else
ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-)),)
O_TARGET := $(obj)/built-in.o O_TARGET := $(obj)/built-in.o
endif endif
endif
__build: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS)) \ __build: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS)) \
$(if $(KBUILD_MODULES),$(obj-m)) \ $(if $(KBUILD_MODULES),$(obj-m:.o=.ko)) \
$(subdir-ym) $(subdir-ym) $(build-targets)
@: @:
# Compile C sources (.c) # Compile C sources (.c)
...@@ -103,7 +105,9 @@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< ...@@ -103,7 +105,9 @@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
$(call if_changed_dep,cc_o_c) $(call if_changed_dep,cc_o_c)
quiet_cmd_cc_lst_c = MKLST $@ quiet_cmd_cc_lst_c = MKLST $@
cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && sh scripts/makelst $*.o System.map $(OBJDUMP) > $@ cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \
$(CONFIG_SHELL) $(src)/scripts/makelst $*.o \
System.map $(OBJDUMP) > $@
%.lst: %.c FORCE %.lst: %.c FORCE
$(call if_changed_dep,cc_lst_c) $(call if_changed_dep,cc_lst_c)
...@@ -116,9 +120,6 @@ modkern_aflags := $(AFLAGS_KERNEL) ...@@ -116,9 +120,6 @@ modkern_aflags := $(AFLAGS_KERNEL)
$(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE) $(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE)
$(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE) $(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE)
a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
quiet_cmd_as_s_S = CPP $(quiet_modtag) $@ quiet_cmd_as_s_S = CPP $(quiet_modtag) $@
cmd_as_s_S = $(CPP) $(a_flags) -o $@ $< cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
...@@ -171,21 +172,29 @@ endif ...@@ -171,21 +172,29 @@ endif
# #
# Rule to link composite objects # Rule to link composite objects
# #
quiet_cmd_link_multi-y = LD $@
cmd_link_multi-y = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.o=-objs))) $($(subst $(obj)/,,$(@:.o=-y)))),$^)
quiet_cmd_link_multi = LD $(quiet_modtag) $@ quiet_cmd_link_multi-m = LD [M] $@
cmd_link_multi = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.o=-objs))) $($(subst $(obj)/,,$(@:.o=-y)))),$^) cmd_link_multi-m = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.ko=-objs))) $($(subst $(obj)/,,$(@:.ko=-y)))),$^)
quiet_cmd_link_single-m = LD [M] $@
cmd_link_single-m = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $<
# We would rather have a list of rules like # We would rather have a list of rules like
# foo.o: $(foo-objs) # foo.o: $(foo-objs)
# but that's not so easy, so we rather make all composite objects depend # but that's not so easy, so we rather make all composite objects depend
# on the set of all their parts # on the set of all their parts
$(multi-used-y) : %.o: $(multi-objs-y) FORCE $(multi-used-y) : %.o: $(multi-objs-y) FORCE
$(call if_changed,link_multi) $(call if_changed,link_multi-y)
$(multi-used-m:.o=.ko) : %.ko: $(multi-objs-m) FORCE
$(call if_changed,link_multi-m)
$(multi-used-m) : %.o: $(multi-objs-m) FORCE $(single-used-m:.o=.ko) : %.ko: %.o FORCE
$(call if_changed,link_multi) $(call if_changed,link_single-m)
targets += $(multi-used-y) $(multi-used-m) targets += $(multi-used-y) $(multi-used-m:.o=.ko) $(single-used-m:.o=.ko)
# Compile programs on the host # Compile programs on the host
# =========================================================================== # ===========================================================================
...@@ -217,9 +226,7 @@ targets += $(multi-used-y) $(multi-used-m) ...@@ -217,9 +226,7 @@ targets += $(multi-used-y) $(multi-used-m)
# Create executable from a single .c file # Create executable from a single .c file
# host-csingle -> Executable # host-csingle -> Executable
quiet_cmd_host-csingle = HOSTCC $@ quiet_cmd_host-csingle = HOSTCC $@
cmd_host-csingle = $(HOSTCC) -Wp,-MD,$(depfile) \ cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(HOST_LOADLIBES) -o $@ $<
$(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
$(HOST_LOADLIBES) -o $@ $<
$(host-csingle): %: %.c FORCE $(host-csingle): %: %.c FORCE
$(call if_changed_dep,host-csingle) $(call if_changed_dep,host-csingle)
...@@ -235,9 +242,7 @@ $(host-cmulti): %: $(host-cobjs) $(host-cshlib) FORCE ...@@ -235,9 +242,7 @@ $(host-cmulti): %: $(host-cobjs) $(host-cshlib) FORCE
# Create .o file from a single .c file # Create .o file from a single .c file
# host-cobjs -> .o # host-cobjs -> .o
quiet_cmd_host-cobjs = HOSTCC $@ quiet_cmd_host-cobjs = HOSTCC $@
cmd_host-cobjs = $(HOSTCC) -Wp,-MD,$(depfile) \ cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $<
$(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
$(HOSTCFLAGS_$(@F)) -c -o $@ $<
$(host-cobjs): %.o: %.c FORCE $(host-cobjs): %.o: %.c FORCE
$(call if_changed_dep,host-cobjs) $(call if_changed_dep,host-cobjs)
...@@ -253,18 +258,14 @@ $(host-cxxmulti): %: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE ...@@ -253,18 +258,14 @@ $(host-cxxmulti): %: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE
# Create .o file from a single .cc (C++) file # Create .o file from a single .cc (C++) file
quiet_cmd_host-cxxobjs = HOSTCXX $@ quiet_cmd_host-cxxobjs = HOSTCXX $@
cmd_host-cxxobjs = $(HOSTCXX) -Wp,-MD,$(depfile) \ cmd_host-cxxobjs = $(HOSTCXX) $(hostcxx_flags) -c -o $@ $<
$(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
$(HOSTCXXFLAGS_$(@F)) -c -o $@ $<
$(host-cxxobjs): %.o: %.cc FORCE $(host-cxxobjs): %.o: %.cc FORCE
$(call if_changed_dep,host-cxxobjs) $(call if_changed_dep,host-cxxobjs)
# Compile .c file, create position independent .o file # Compile .c file, create position independent .o file
# host-cshobjs -> .o # host-cshobjs -> .o
quiet_cmd_host-cshobjs = HOSTCC -fPIC $@ quiet_cmd_host-cshobjs = HOSTCC -fPIC $@
cmd_host-cshobjs = $(HOSTCC) -Wp,-MD,$(depfile) -fPIC\ cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $<
$(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
$(HOSTCFLAGS_$(@F)) -c -o $@ $<
$(host-cshobjs): %.o: %.c FORCE $(host-cshobjs): %.o: %.c FORCE
$(call if_changed_dep,host-cshobjs) $(call if_changed_dep,host-cshobjs)
......
...@@ -43,6 +43,7 @@ __obj-m = $(filter-out export.o,$(obj-m)) ...@@ -43,6 +43,7 @@ __obj-m = $(filter-out export.o,$(obj-m))
multi-used-y := $(sort $(foreach m,$(__obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) multi-used-y := $(sort $(foreach m,$(__obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
multi-used-m := $(sort $(foreach m,$(__obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) multi-used-m := $(sort $(foreach m,$(__obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
multi-used := $(multi-used-y) $(multi-used-m) multi-used := $(multi-used-y) $(multi-used-m)
single-used-m := $(filter-out $(multi-used-m),$(obj-m))
# Build list of the parts of our composite objects, our composite # Build list of the parts of our composite objects, our composite
# objects depend on those (obviously) # objects depend on those (obviously)
...@@ -92,12 +93,14 @@ host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) ...@@ -92,12 +93,14 @@ host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs))))
# Add subdir path # Add subdir path
EXTRA_TARGETS := $(addprefix $(obj)/,$(EXTRA_TARGETS)) EXTRA_TARGETS := $(addprefix $(obj)/,$(EXTRA_TARGETS))
build-targets := $(addprefix $(obj)/,$(build-targets))
obj-y := $(addprefix $(obj)/,$(obj-y)) obj-y := $(addprefix $(obj)/,$(obj-y))
obj-m := $(addprefix $(obj)/,$(obj-m)) obj-m := $(addprefix $(obj)/,$(obj-m))
export-objs := $(addprefix $(obj)/,$(export-objs)) export-objs := $(addprefix $(obj)/,$(export-objs))
subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y))
real-objs-y := $(addprefix $(obj)/,$(real-objs-y)) real-objs-y := $(addprefix $(obj)/,$(real-objs-y))
real-objs-m := $(addprefix $(obj)/,$(real-objs-m)) real-objs-m := $(addprefix $(obj)/,$(real-objs-m))
single-used-m := $(addprefix $(obj)/,$(single-used-m))
multi-used-y := $(addprefix $(obj)/,$(multi-used-y)) multi-used-y := $(addprefix $(obj)/,$(multi-used-y))
multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) multi-used-m := $(addprefix $(obj)/,$(multi-used-m))
multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y)) multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y))
...@@ -128,6 +131,12 @@ modname_flags = $(if $(filter 1,$(words $(modname))),-DKBUILD_MODNAME=$(subst $ ...@@ -128,6 +131,12 @@ modname_flags = $(if $(filter 1,$(words $(modname))),-DKBUILD_MODNAME=$(subst $
c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \ c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \ $(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \
$(basename_flags) $(modname_flags) $(export_flags) $(basename_flags) $(modname_flags) $(export_flags)
a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS)\
$(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
hostc_flags = -Wp,-MD,$(depfile) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS)\
$(HOSTCFLAGS_$(*F).o)
hostcxx_flags = -Wp,-MD,$(depfile) $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS)\
$(HOSTCXXFLAGS_$(*F).o)
# Finds the multi-part object the current object will be linked into # Finds the multi-part object the current object will be linked into
modname-multi = $(sort $(foreach m,$(multi-used),\ modname-multi = $(sort $(foreach m,$(multi-used),\
...@@ -139,7 +148,7 @@ modname-multi = $(sort $(foreach m,$(multi-used),\ ...@@ -139,7 +148,7 @@ modname-multi = $(sort $(foreach m,$(multi-used),\
quiet_cmd_shipped = SHIPPED $@ quiet_cmd_shipped = SHIPPED $@
cmd_shipped = cat $< > $@ cmd_shipped = cat $< > $@
%:: %_shipped $(obj)/%:: $(src)/%_shipped
$(call cmd,shipped) $(call cmd,shipped)
# Commands useful for building a boot image # Commands useful for building a boot image
...@@ -236,4 +245,4 @@ endef ...@@ -236,4 +245,4 @@ endef
# $(call descend,<dir>,<target>) # $(call descend,<dir>,<target>)
# Recursively call a sub-make in <dir> with target <target> # Recursively call a sub-make in <dir> with target <target>
descend = $(Q)$(MAKE) -f scripts/Makefile.build obj=$(1) $(2) descend =$(Q)$(MAKE) -f scripts/Makefile.build obj=$(1) $(2)
...@@ -15,12 +15,12 @@ include scripts/Makefile.lib ...@@ -15,12 +15,12 @@ include scripts/Makefile.lib
# ========================================================================== # ==========================================================================
quiet_cmd_modules_install = INSTALL $(obj-m) quiet_cmd_modules_install = INSTALL $(obj-m:.o=.ko)
cmd_modules_install = mkdir -p $(MODLIB)/kernel && \ cmd_modules_install = mkdir -p $(MODLIB)/kernel && \
cp $(obj-m) $(MODLIB)/kernel/ cp $(obj-m:.o=.ko) $(MODLIB)/kernel/
modules_install: $(subdir-ym) modules_install: $(subdir-ym)
ifneq ($(obj-m),) ifneq ($(obj-m:.o=.ko),)
$(call cmd,modules_install) $(call cmd,modules_install)
else else
@: @:
......
#! /bin/sh
# Written by Rusty Russell <rusty@rustcorp.com.au> 2002.
if [ $# -ne 2 ]; then
echo Usage: kallsyms vmlinux objfile >&2
echo Adds a .kallsyms section containing symbol info.
exit 1
fi
set -e
# Clean up on exit.
trap "rm -f kallsyms.map kallsyms.c $2" 0
# Takes nm output from $1, produces a .c file on standard output.
encode_symbols()
{
# First take addresses.
echo "unsigned long kallsyms_addresses[] = {"
sed 's/^[ ]*\([A-Fa-f0-9]*\).*/0x\1UL,/' < $1
echo "};"
# Now output size.
echo "unsigned long kallsyms_num_syms = `wc -l < $1`;"
# Now output names.
echo "char kallsyms_names[] = ";
sed 's/^[ ]*[A-Fa-f0-9]*[ ]*.[ ]\(.*\)/"\1\\0"/' < $1
echo ";"
}
# FIXME: Use System.map as input, and regenerate each time in Makefile.
$NM -n $1 | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > kallsyms.map
encode_symbols kallsyms.map > kallsyms.c
$CC $CFLAGS -c -o $2 kallsyms.c
trap "rm -f kallsyms.map kallsyms.c" 0
exit 0
/* Generate assembler source containing symbol information
*
* Copyright 2002 by Kai Germaschewski
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
* Usage: nm -n vmlinux | scripts/kallsyms > symbols.S
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct sym_entry {
unsigned long long addr;
char type;
char *sym;
};
static struct sym_entry *table;
static int size, cnt;
static unsigned long long _stext, _etext;
static void
usage(void)
{
fprintf(stderr, "Usage: kallsyms < in.map > out.S\n");
exit(1);
}
static int
read_symbol(FILE *in, struct sym_entry *s)
{
char str[500];
int rc;
rc = fscanf(in, "%llx %c %499s\n", &s->addr, &s->type, str);
if (rc != 3) {
if (rc != EOF) {
/* skip line */
fgets(str, 500, in);
}
return -1;
}
s->sym = strdup(str);
return 0;
}
static int
symbol_valid(struct sym_entry *s)
{
if (s->addr < _stext)
return 0;
if (s->addr > _etext)
return 0;
if (strstr(s->sym, "_compiled."))
return 0;
return 1;
}
static void
read_map(FILE *in)
{
int i;
while (!feof(in)) {
if (cnt >= size) {
size += 10000;
table = realloc(table, sizeof(*table) * size);
if (!table) {
fprintf(stderr, "out of memory\n");
exit (1);
}
}
if (read_symbol(in, &table[cnt]) == 0)
cnt++;
}
for (i = 0; i < cnt; i++) {
if (strcmp(table[i].sym, "_stext") == 0)
_stext = table[i].addr;
if (strcmp(table[i].sym, "_etext") == 0)
_etext = table[i].addr;
}
}
static void
write_src(void)
{
unsigned long long last_addr;
int i, valid = 0;
printf(".data\n");
printf(".globl kallsyms_addresses\n");
printf("\t.align 8\n");
printf("kallsyms_addresses:\n");
for (i = 0, last_addr = 0; i < cnt; i++) {
if (!symbol_valid(&table[i]))
continue;
if (table[i].addr == last_addr)
continue;
printf("\t.long\t%#llx\n", table[i].addr);
valid++;
last_addr = table[i].addr;
}
printf("\n");
printf(".globl kallsyms_num_syms\n");
printf("\t.align 8\n");
printf("\t.long\t%d\n", valid);
printf("\n");
printf(".globl kallsyms_names\n");
printf(".data\n");
printf("\t.align 8\n");
printf("kallsyms_names:\n");
for (i = 0, last_addr = 0; i < cnt; i++) {
if (!symbol_valid(&table[i]))
continue;
if (table[i].addr == last_addr)
continue;
printf("\t.string\t\"%s\"\n", table[i].sym);
last_addr = table[i].addr;
}
printf("\n");
}
int
main(int argc, char **argv)
{
if (argc != 1)
usage();
read_map(stdin);
write_src();
return 0;
}
...@@ -16,18 +16,14 @@ endif ...@@ -16,18 +16,14 @@ endif
endif endif
host-progs := lxdialog host-progs := lxdialog
build-targets := $(host-progs)
lxdialog-objs := checklist.o menubox.o textbox.o yesno.o inputbox.o \ lxdialog-objs := checklist.o menubox.o textbox.o yesno.o inputbox.o \
util.o lxdialog.o msgbox.o util.o lxdialog.o msgbox.o
EXTRA_TARGETS := lxdialog
first_rule: ncurses first_rule: ncurses
include $(TOPDIR)/Rules.make
.PHONY: ncurses .PHONY: ncurses
ncurses: ncurses:
@echo "main() {}" > lxtemp.c @echo "main() {}" > lxtemp.c
@if $(HOSTCC) lxtemp.c $(HOST_LOADLIBES); then \ @if $(HOSTCC) lxtemp.c $(HOST_LOADLIBES); then \
......
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