svn commit: trunk/busybox: modutils scripts

vda at busybox.net vda at busybox.net
Sun Jun 1 21:51:30 PDT 2008


Author: vda
Date: 2008-06-01 21:51:29 -0700 (Sun, 01 Jun 2008)
New Revision: 22176

Log:
Reinstate CONFIG_CROSS_COMPILE_PREFIX



Modified:
   trunk/busybox/Config.in
   trunk/busybox/Makefile
   trunk/busybox/modutils/insmod.c
   trunk/busybox/scripts/Makefile.IMA


Changeset:
Modified: trunk/busybox/Config.in
===================================================================
--- trunk/busybox/Config.in	2008-06-01 22:36:39 UTC (rev 22175)
+++ trunk/busybox/Config.in	2008-06-02 04:51:29 UTC (rev 22176)
@@ -363,6 +363,16 @@
 	  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'

Modified: trunk/busybox/Makefile
===================================================================
--- trunk/busybox/Makefile	2008-06-01 22:36:39 UTC (rev 22175)
+++ trunk/busybox/Makefile	2008-06-02 04:51:29 UTC (rev 22176)
@@ -142,17 +142,6 @@
 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,9 +161,34 @@
 # 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)
 

Modified: trunk/busybox/modutils/insmod.c
===================================================================
--- trunk/busybox/modutils/insmod.c	2008-06-01 22:36:39 UTC (rev 22175)
+++ trunk/busybox/modutils/insmod.c	2008-06-02 04:51:29 UTC (rev 22176)
@@ -452,7 +452,7 @@
 /* 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 @@
 	 * 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;
 	}
 

Modified: trunk/busybox/scripts/Makefile.IMA
===================================================================
--- trunk/busybox/scripts/Makefile.IMA	2008-06-01 22:36:39 UTC (rev 22175)
+++ trunk/busybox/scripts/Makefile.IMA	2008-06-02 04:51:29 UTC (rev 22176)
@@ -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 @@
 
 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 @@
 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



More information about the busybox-cvs mailing list