diff -urN busybox-0.60.3/Makefile busybox/Makefile --- busybox-0.60.3/Makefile 2002-04-27 03:43:00.000000000 -0500 +++ busybox/Makefile 2002-08-22 10:18:57.000000000 -0500 @@ -84,9 +84,14 @@ # If you are running a cross compiler, you may want to set this # to something more interesting, like "powerpc-linux-". CROSS = -CC = $(CROSS)gcc -AR = $(CROSS)ar +#CC = $(CROSS)gcc +#AR = $(CROSS)ar STRIP = $(CROSS)strip +FLTFLAGS += -s 20000 + +# Because Config.h is always imported as part of Busybox, we set it +# up so that we can use a copy of it that gets modified +CONFIG_H=config.h # To compile vs uClibc, just use the compiler wrapper built by uClibc... # Everything should compile and work as expected these days... @@ -165,9 +170,10 @@ LDFLAGS += -Wl,-warn-common STRIPCMD = /bin/true -Since_we_are_debugging else - CFLAGS += $(WARNINGS) $(OPTIMIZATION) -fomit-frame-pointer -D_GNU_SOURCE - LDFLAGS += -s -Wl,-warn-common - STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment + CFLAGS += $(WARNINGS) $(OPTIMIZATION) -g -fomit-frame-pointer -D_GNU_SOURCE + LDFLAGS += -g -Wl,-warn-common +# STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment + STRIPCMD = /bin/true endif ifeq ($(strip $(DOSTATIC)),true) LDFLAGS += --static @@ -202,7 +208,7 @@ #endif # We need to set APPLET_SOURCES to something like -# $(shell busybox.sh Config.h) +# $(shell busybox.sh $(CONFIG_H)) # but in a manner that works with VPATH and BB_SRC_DIR. # Possible ways to approach this: # @@ -224,7 +230,7 @@ # This is option 3: # #APPLET_SOURCES = $(shell \ -# echo -e 'all: busybox.sh Config.h\n\t@ $$(SHELL) $$^ $$(BB_SRC_DIR)' >slist.mk; \ +# echo -e 'all: busybox.sh $(CONFIG_H)\n\t@ $$(SHELL) $$^ $$(BB_SRC_DIR)' >slist.mk; \ # make -f slist.mk VPATH=$(VPATH) BB_SRC_DIR=$(BB_SRC_DIR) \ #) # And option 4: @@ -234,6 +240,7 @@ CFLAGS += $(CROSS_CFLAGS) CFLAGS += -DBB_VER='"$(VERSION)"' CFLAGS += -DBB_BT='"$(BUILDTIME)"' +CFLAGS += -DCONFIG_H='"$(CONFIG_H)"' ifdef BB_INIT_SCRIPT CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"' endif @@ -296,9 +303,14 @@ .EXPORT_ALL_VARIABLES: -all: applet_source_list busybox busybox.links doc +all: + $(MAKE) build-config + $(MAKE) applet_source_list + $(MAKE) busybox + $(MAKE) busybox.links + $(MAKE) doc -applet_source_list: busybox.sh Config.h +applet_source_list: busybox.sh $(CONFIG_H) (echo -n "APPLET_SOURCES := "; CC="$(CC)" BB_SRC_DIR="$(BB_SRC_DIR)" $(SHELL) $^) > $@ doc: olddoc @@ -357,31 +369,31 @@ busybox: $(PWD_LIB) $(LIBBB_LIB) $(OBJECTS) - $(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBBB_LIB) $(PWD_LIB) $(LIBRARIES) + $(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBBB_LIB) $(PWD_LIB) $(LIBRARIES) $(LDLIBS) $(LIBM) $(STRIPCMD) $(PROG) # Without VPATH, rule expands to "/bin/sh busybox.mkll Config.h applets.h" # but with VPATH, some or all of those file names are resolved to the # directories in which they live. -busybox.links: busybox.mkll Config.h applets.h +busybox.links: busybox.mkll $(CONFIG_H) applets.h - $(SHELL) $^ >$@ nfsmount.o cmdedit.o: %.o: %.h ash.o hush.o lash.o msh.o: cmdedit.h -$(OBJECTS): %.o: %.c Config.h busybox.h applets.h Makefile +$(OBJECTS): %.o: %.c $(CONFIG_H) busybox.h applets.h Makefile ifeq ($(strip $(BB_SRC_DIR)),) $(CC) $(CFLAGS) -I. $(patsubst %,-I%,$(subst :, ,$(BB_SRC_DIR))) -c $< -o $*.o else $(CC) $(CFLAGS) -I- -I. $(patsubst %,-I%,$(subst :, ,$(BB_SRC_DIR))) -c $< -o $*.o endif -$(PWD_OBJS): %.o: %.c Config.h busybox.h applets.h Makefile +$(PWD_OBJS): %.o: %.c $(CONFIG_H) busybox.h applets.h Makefile ifneq ($(strip $(BB_SRC_DIR)),) -mkdir -p $(PWD_GRP) endif $(CC) $(CFLAGS) $(PWD_CFLAGS) -c $< -o $*.o -$(LIBBB_OBJS): %.o: %.c Config.h busybox.h applets.h Makefile libbb/libbb.h +$(LIBBB_OBJS): %.o: %.c $(CONFIG_H) busybox.h applets.h Makefile libbb/libbb.h ifneq ($(strip $(BB_SRC_DIR)),) -mkdir -p $(LIBBB) endif @@ -423,10 +435,15 @@ - rm -f docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html docs/BusyBox.html - rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \ docs/busybox.pdf docs/busybox.html - - rm -f multibuild.log Config.h.orig *.gdb *.elf + - rm -f multibuild.log $(CONFIG_H).orig *.gdb *.elf - rm -rf docs/busybox _install libpwd.a libbb.a pod2htm* - rm -f busybox busybox.links libbb/loop.h *~ slist.mk core applet_source_list - - find -name \*.o -exec rm -f {} \; + - find . -name \*.o -exec rm -f {} \; + - rm -f *.gdb *.elf + - rm -f $(CONFIG_H)- +ifneq ($(CONFIG_H),Config.h) + - rm -f $(CONFIG_H) +endif distclean: clean - cd tests && $(MAKE) distclean @@ -465,3 +482,41 @@ .PHONY: tags tags: ctags -R . + +.PHONY: syslog-install +syslog-install: + $(ROMFSINST) -e CONFIG_USER_BUSYBOX_SYSLOGD -s /var/tmp/log /dev/log + +ifdef CONFIG_UCLINUX +romfs: install-romfs.sh busybox.links syslog-install + cp $(PROG) $(ROMFSDIR)/bin/$(PROG) + $(SHELL) $< $(ROMFSDIR)/bin/ +else +romfs: install.sh busybox.links syslog-install + $(SHELL) $< $(ROMFSDIR) +endif + +# Neat rule to build a new config.h and overwrite if it is different +# This avoids bulk busybox builds. +# We also trash any existing busybox setup in the romfs bin +build-config $(CONFIG_H): build-config.awk + if [ -f "$$ROMFSDIR/bin/busybox" ]; then \ + inode=`ls -i $$ROMFSDIR/bin/busybox | awk '{print $$1}'`; \ + ls -i "$$ROMFSDIR/bin" | grep "^ *$$inode" | awk '{print $$2}' | \ + sed "s:^:$$ROMFSDIR/bin/:" | env -i xargs rm -f; \ + fi + awk -f build-config.awk Config.h >Config.temp + if cmp -s Config.temp $(CONFIG_H) ; \ + then \ + rm -f Config.temp ; \ + else \ + mv -f $(CONFIG_H) $(CONFIG_H)- ; \ + mv -f Config.temp $(CONFIG_H) ; \ + rm -f applet_source_list ; \ + make applet_source_list ; \ + fi + +ifeq ($(strip $(CONFIG_COLDFIRE)),y) +insmod.o: insmod.c + $(CC) $(CFLAGS:-Os=-O2) -c insmod.c +endif diff -urN busybox-0.60.3/build-config.awk busybox/build-config.awk --- busybox-0.60.3/build-config.awk 1969-12-31 18:00:00.000000000 -0600 +++ busybox/build-config.awk 2002-08-22 10:18:57.000000000 -0500 @@ -0,0 +1,17 @@ +( /^#define BB_/ && ! /^#define BB_FEATURE/ ) || +( /^\/\/#define BB_/ && ! /^\/\/#define BB_FEATURE/ ) { + envname = "CONFIG_USER_BUSYBOX_" substr($2, 4) + envval = ENVIRON[envname] + $1 = (envval == "y") ? "#define" : "//#define" + print $0 +} +/^#define BB_FEATURE/ || +/^\/\/#define BB_FEATURE/ { + envname = "CONFIG_USER_BUSYBOX_" substr($2, 12) + envval = ENVIRON[envname] + $1 = (envval == "y") ? "#define" : "//#define" + print $0 +} +! ( /^#define BB_/ || /^\/\/#define BB_/ ) { + print +} diff -urN busybox-0.60.3/busybox.h busybox/busybox.h --- busybox-0.60.3/busybox.h 2002-03-15 20:11:46.000000000 -0600 +++ busybox/busybox.h 2002-08-22 10:18:57.000000000 -0500 @@ -24,7 +24,7 @@ #ifndef _BB_INTERNAL_H_ #define _BB_INTERNAL_H_ 1 -#include "Config.h" +#include CONFIG_H #include #include @@ -39,6 +39,9 @@ #include +#ifdef EMBED +#include +#endif enum Location { _BB_DIR_ROOT = 0, diff -urN busybox-0.60.3/install-romfs.sh busybox/install-romfs.sh --- busybox-0.60.3/install-romfs.sh 1969-12-31 18:00:00.000000000 -0600 +++ busybox/install-romfs.sh 2002-08-22 10:18:57.000000000 -0500 @@ -0,0 +1,33 @@ +#!/bin/sh +# Version of the install script for Lineo's SecurEdge tree. +# We avoid replacing utilities that already exist even if busybox has them +# compiled in. We also force absolutely everything to be placed in /bin +# instead of all over the place. + +export LC_ALL=POSIX +export LC_CTYPE=POSIX + +prefix=$1 +if [ "$prefix" = "" ]; then + echo "No installation directory, aborting." + exit 1; +fi +bb_path="$prefix"busybox +h=`sort busybox.links | uniq` + +for i in $h ; do + app=`basename $i` + if [ \! -f $prefix$app ] + then + echo " $prefix$app -> $bb_path" + if [ "$CONFIG_JFFS_FS" = "" ]; then + ln $bb_path $prefix$app || exit 1 + else + ln -s busybox $prefix$app || exit 1 + fi + else + echo " $prefix$app already exists" + fi +done + +exit 0