Reinstate CONFIG_CROSS_COMPILE_PREFIX
authorDenis Vlasenko <vda.linux@googlemail.com>
Mon, 2 Jun 2008 04:51:29 +0000 (04:51 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Mon, 2 Jun 2008 04:51:29 +0000 (04:51 -0000)
Config.in
Makefile
modutils/insmod.c
scripts/Makefile.IMA

index 5ce642ff3907dcedd7405a39f446da1ad194bc7e..a991b8a810b07b7d45e4b4e0888aae662842a3b9 100644 (file)
--- a/Config.in
+++ b/Config.in
@@ -363,6 +363,16 @@ config LFS
          cp, mount, tar, and many others.  If you want to access files larger
          than 2 Gigabytes, enable this option.  Otherwise, leave it set to 'N'.
 
+config CROSS_COMPILER_PREFIX
+       string "Cross Compiler prefix"
+       default ""
+       help
+         If you want to build BusyBox with a cross compiler, then you
+         will need to set this to the cross-compiler prefix, for example,
+         "i386-uclibc-". Note that CROSS_COMPILE environment variable
+         or "make CROSS_COMPILE=xxx ..." will override this selection.
+         For native build leave it empty.
+
 endmenu
 
 menu 'Debugging Options'
index 9c1b49611c2ba50300341cd22da76ea89e5e5656..78c701ec059f9cd9fefbc8c1acb17b944ca96b38 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -142,17 +142,6 @@ VPATH              := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
 export srctree objtree VPATH TOPDIR
 
 
-# SUBARCH tells the usermode build what the underlying arch is.  That is set
-# first, and if a usermode build is happening, the "ARCH=um" on the command
-# line overrides the setting of ARCH below.  If a native build is happening,
-# then ARCH is assigned, getting whatever value it gets normally, and
-# SUBARCH is subsequently ignored.
-
-SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
-                                 -e s/arm.*/arm/ -e s/sa110/arm/ \
-                                 -e s/s390x/s390/ -e s/parisc64/parisc/ \
-                                 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
-
 # Cross compiling and selecting different set of gcc/bin-utils
 # ---------------------------------------------------------------------------
 #
@@ -172,8 +161,33 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
 # Default value for CROSS_COMPILE is not to prefix executables
 # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
 
-ARCH           ?= $(SUBARCH)
 CROSS_COMPILE  ?=
+# bbox: we may have CONFIG_CROSS_COMPILER_PREFIX in .config,
+# and it has not been included yet... thus using an awkward syntax.
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := $(shell grep ^CONFIG_CROSS_COMPILER_PREFIX .config 2>/dev/null)
+CROSS_COMPILE := $(subst CONFIG_CROSS_COMPILER_PREFIX=,,$(CROSS_COMPILE))
+CROSS_COMPILE := $(subst ",,$(CROSS_COMPILE))
+endif
+
+# SUBARCH tells the usermode build what the underlying arch is.  That is set
+# first, and if a usermode build is happening, the "ARCH=um" on the command
+# line overrides the setting of ARCH below.  If a native build is happening,
+# then ARCH is assigned, getting whatever value it gets normally, and
+# SUBARCH is subsequently ignored.
+
+ifneq ($(CROSS_COMPILE),)
+SUBARCH := $(shell echo $(CROSS_COMPILE) | cut -d- -f1)
+else
+SUBARCH := $(shell uname -m)
+endif
+SUBARCH := $(shell echo $(SUBARCH) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
+                                        -e s/arm.*/arm/ -e s/sa110/arm/ \
+                                        -e s/s390x/s390/ -e s/parisc64/parisc/ \
+                                        -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
+
+ARCH           ?= $(SUBARCH)
+$(warning ARCH=$(ARCH) SUBARCH=$(SUBARCH))
 
 # Architecture as present in compile.h
 UTS_MACHINE := $(ARCH)
index 3a8201febb398fda4c8361d49c96fc673c7c7125..f45a5946554ffada43a256bd6db83a68975a60b8 100644 (file)
@@ -452,7 +452,7 @@ enum {
 /* The system calls unchanged between 2.0 and 2.1.  */
 
 unsigned long create_module(const char *, size_t);
-int delete_module(const char *);
+int delete_module(const char *module, unsigned int flags);
 
 
 #endif /* module.h */
@@ -4141,18 +4141,18 @@ int insmod_main(int argc, char **argv)
         * now we can load them directly into the kernel memory
         */
        if (!obj_load_progbits(fp, f, (char*)m_addr)) {
-               delete_module(m_name);
+               delete_module(m_name, 0);
                goto out;
        }
 #endif
 
        if (!obj_relocate(f, m_addr)) {
-               delete_module(m_name);
+               delete_module(m_name, 0);
                goto out;
        }
 
        if (!new_init_module(m_name, f, m_size)) {
-               delete_module(m_name);
+               delete_module(m_name, 0);
                goto out;
        }
 
index 353a4ac1bc3e433b36cdbf88473d577041510fff..988c6a6d18afcfba082b2803b508737a2baf7b38 100644 (file)
@@ -1,4 +1,7 @@
 # This is completely unsupported.
+#
+# Uasge: make -f scripts/Makefile.IMA
+#
 # Fix COMBINED_COMPILE upstream (in the Kbuild) and propagate
 # the changes back
 srctree                := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
@@ -11,6 +14,24 @@ MAKEFLAGS += --include-dir=$(srctree)
 
 default: busybox
 
+include .config
+
+# Cross compiling and selecting different set of gcc/bin-utils
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := $(subst ",,$(CONFIG_CROSS_COMPILER_PREFIX))
+endif
+
+ifneq ($(CROSS_COMPILE),)
+SUBARCH := $(shell echo $(CROSS_COMPILE) | cut -d- -f1)
+else
+SUBARCH := $(shell uname -m)
+endif
+SUBARCH := $(shell echo $(SUBARCH) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
+                                         -e s/arm.*/arm/ -e s/sa110/arm/ \
+                                         -e s/s390x/s390/ -e s/parisc64/parisc/ \
+                                         -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
+ARCH ?= $(SUBARCH)
+
 ifndef HOSTCC
 HOSTCC = cc
 endif
@@ -27,19 +48,11 @@ OBJDUMP         = $(CROSS_COMPILE)objdump
 CFLAGS := $(CFLAGS)
 CPPFLAGS+= -D"KBUILD_STR(s)=\#s" #-Q
 
-include .config
 # We need some generic definitions
 include $(srctree)/scripts/Kbuild.include
 
 include Makefile.flags
 
-SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
-                                 -e s/arm.*/arm/ -e s/sa110/arm/ \
-                                 -e s/s390x/s390/ -e s/parisc64/parisc/ \
-                                 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
-ARCH ?= $(SUBARCH)
-
-# Cross compiling and selecting different set of gcc/bin-utils
 -include $(srctree)/arch/$(ARCH)/Makefile
 ifdef CONFIG_FEATURE_COMPRESS_USAGE
 usage_stuff = include/usage_compressed.h