diff options
Diffstat (limited to 'c/src/lib/libbsp/i386/pc386')
-rw-r--r-- | c/src/lib/libbsp/i386/pc386/tools/Makefile.am | 20 | ||||
-rw-r--r-- | c/src/lib/libbsp/i386/pc386/tools/Makefile.in | 66 | ||||
-rw-r--r-- | c/src/lib/libbsp/i386/pc386/tools/bin2boot.c | 9 | ||||
-rw-r--r-- | c/src/lib/libbsp/i386/pc386/tools/binpatch.c | 168 | ||||
-rw-r--r-- | c/src/lib/libbsp/i386/pc386/tools/configure | 124 | ||||
-rw-r--r-- | c/src/lib/libbsp/i386/pc386/tools/configure.in | 3 |
6 files changed, 148 insertions, 242 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/tools/Makefile.am b/c/src/lib/libbsp/i386/pc386/tools/Makefile.am index 35c8285fc7..f5c023de4b 100644 --- a/c/src/lib/libbsp/i386/pc386/tools/Makefile.am +++ b/c/src/lib/libbsp/i386/pc386/tools/Makefile.am @@ -8,18 +8,20 @@ ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal EXTRA_DIST = Spec.doc noinst_PROGRAMS = \ -bin2boot \ -binpatch +bin2boot bin2boot_SOURCES = bin2boot.c -binpatch_SOURCES = binpatch.c -# HACK: install into build-tree -preinstall: install-exec-local +PREINSTALL_DIRS=$(PROJECT_ROOT)/pc386/build-tools +PREINSTALL_FILES = $(PROJECT_ROOT)/pc386/build-tools/bin2boot + +$(PREINSTALL_DIRS): + $(mkinstalldirs) $@ -install-exec-local: $(PROGRAMS) - $(mkinstalldirs) $(PROJECT_ROOT)/pc386/build-tools - $(INSTALL_PROGRAM) bin2boot $(PROJECT_ROOT)/pc386/build-tools - $(INSTALL_PROGRAM) binpatch $(PROJECT_ROOT)/pc386/build-tools +$(PROJECT_ROOT)/pc386/build-tools/bin2boot: bin2boot + $(INSTALL_PROGRAM) $< $@ + +# HACK: install into build-tree +all-local: $(PREINSTALL_DIRS) $(PREINSTALL_FILES) include $(top_srcdir)/../../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/i386/pc386/tools/Makefile.in b/c/src/lib/libbsp/i386/pc386/tools/Makefile.in index a003c6fd50..16e15579d6 100644 --- a/c/src/lib/libbsp/i386/pc386/tools/Makefile.in +++ b/c/src/lib/libbsp/i386/pc386/tools/Makefile.in @@ -69,6 +69,7 @@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ CC = @CC@ +EXEEXT = @EXEEXT@ INSTALL_CHANGE = @INSTALL_CHANGE@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -91,14 +92,17 @@ ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal EXTRA_DIST = Spec.doc -noinst_PROGRAMS = bin2boot binpatch +noinst_PROGRAMS = bin2boot bin2boot_SOURCES = bin2boot.c -binpatch_SOURCES = binpatch.c + +PREINSTALL_DIRS = $(PROJECT_ROOT)/pc386/build-tools +PREINSTALL_FILES = $(PROJECT_ROOT)/pc386/build-tools/bin2boot ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../../../../mkinstalldirs CONFIG_CLEAN_FILES = +noinst_PROGRAMS = bin2boot$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) @@ -110,10 +114,6 @@ bin2boot_OBJECTS = bin2boot.o bin2boot_LDADD = $(LDADD) bin2boot_DEPENDENCIES = bin2boot_LDFLAGS = -binpatch_OBJECTS = binpatch.o -binpatch_LDADD = $(LDADD) -binpatch_DEPENDENCIES = -binpatch_LDFLAGS = CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -125,9 +125,9 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best -DEP_FILES = .deps/bin2boot.P .deps/binpatch.P -SOURCES = $(bin2boot_SOURCES) $(binpatch_SOURCES) -OBJECTS = $(bin2boot_OBJECTS) $(binpatch_OBJECTS) +DEP_FILES = .deps/bin2boot.P +SOURCES = $(bin2boot_SOURCES) +OBJECTS = $(bin2boot_OBJECTS) all: all-redirect .SUFFIXES: @@ -172,14 +172,10 @@ distclean-compile: maintainer-clean-compile: -bin2boot: $(bin2boot_OBJECTS) $(bin2boot_DEPENDENCIES) - @rm -f bin2boot +bin2boot$(EXEEXT): $(bin2boot_OBJECTS) $(bin2boot_DEPENDENCIES) + @rm -f bin2boot$(EXEEXT) $(LINK) $(bin2boot_LDFLAGS) $(bin2boot_OBJECTS) $(bin2boot_LDADD) $(LIBS) -binpatch: $(binpatch_OBJECTS) $(binpatch_DEPENDENCIES) - @rm -f binpatch - $(LINK) $(binpatch_LDFLAGS) $(binpatch_OBJECTS) $(binpatch_LDADD) $(LIBS) - tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) @@ -302,7 +298,7 @@ check-am: all-am check: check-am installcheck-am: installcheck: installcheck-am -install-exec-am: install-exec-local +install-exec-am: install-exec: install-exec-am install-data-am: @@ -313,7 +309,7 @@ install-am: all-am install: install-am uninstall-am: uninstall: uninstall-am -all-am: Makefile $(PROGRAMS) +all-am: Makefile $(PROGRAMS) all-local all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install @@ -361,46 +357,34 @@ mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile tags mostlyclean-tags distclean-tags \ clean-tags maintainer-clean-tags distdir mostlyclean-depend \ distclean-depend clean-depend maintainer-clean-depend info-am info \ -dvi-am dvi check check-am installcheck-am installcheck \ -install-exec-local install-exec-am install-exec install-data-am \ -install-data install-am install uninstall-am uninstall all-redirect \ -all-am all installdirs mostlyclean-generic distclean-generic \ -clean-generic maintainer-clean-generic clean mostlyclean distclean \ -maintainer-clean +dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-local all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean -# HACK: install into build-tree -preinstall: install-exec-local +$(PREINSTALL_DIRS): + $(mkinstalldirs) $@ + +$(PROJECT_ROOT)/pc386/build-tools/bin2boot: bin2boot + $(INSTALL_PROGRAM) $< $@ -install-exec-local: $(PROGRAMS) - $(mkinstalldirs) $(PROJECT_ROOT)/pc386/build-tools - $(INSTALL_PROGRAM) bin2boot $(PROJECT_ROOT)/pc386/build-tools - $(INSTALL_PROGRAM) binpatch $(PROJECT_ROOT)/pc386/build-tools +# HACK: install into build-tree +all-local: $(PREINSTALL_DIRS) $(PREINSTALL_FILES) debug-am: debug: debug-am .PHONY: debug debug-am -debug_install-am: -debug_install: debug_install-am -.PHONY: debug_install debug_install-am - profile-am: profile: profile-am .PHONY: profile profile-am -profile_install-am: -profile_install: profile_install-am -.PHONY: profile_install profile_install-am - preinstall-am: preinstall: preinstall-am .PHONY: preinstall preinstall-am -clobber-am: -clobber: clobber-am -.PHONY: clobber clobber-am - depend-am: depend: depend-am .PHONY: depend depend-am diff --git a/c/src/lib/libbsp/i386/pc386/tools/bin2boot.c b/c/src/lib/libbsp/i386/pc386/tools/bin2boot.c index 170452c232..af614e10e2 100644 --- a/c/src/lib/libbsp/i386/pc386/tools/bin2boot.c +++ b/c/src/lib/libbsp/i386/pc386/tools/bin2boot.c @@ -403,12 +403,3 @@ writeHeader: return 0; } - - - - - - - - - diff --git a/c/src/lib/libbsp/i386/pc386/tools/binpatch.c b/c/src/lib/libbsp/i386/pc386/tools/binpatch.c deleted file mode 100644 index ab0900702a..0000000000 --- a/c/src/lib/libbsp/i386/pc386/tools/binpatch.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * $Id$ - */ - - -#include <stdio.h> -#include <stdlib.h> - -/* - * This function will patch binary file - */ - - -static char buf[512]; - -static void -usage(void) -{ - printf("usage: binpatch [-h] <ofile> <ifile> <reloc> <off> <byte0> " - "[<byte1> [<byte2> [<byte3>]]]\n"); - printf("this function patches binary file at specified offset with\n"); - printf("up to 4 bytes provided on command line \n"); - printf("-h - prints this message\n\n"); - printf("<ofile> - output file\n"); - printf("<ifile> - input ifile\n"); - printf("<reloc> - relocation address of image\n"); - printf("<off> - offset of patch, offset in file is at off - reloc\n"); - printf("<byte0> - byte 0 of patch\n"); - printf("<byte1> - byte 1 of patch\n"); - printf("<byte2> - byte 1 of patch\n"); - printf("<byte3> - byte 1 of patch\n"); - - return; -} - -int -main(int argc, char **argv) -{ - int c; - FILE *ofp, *ifp; - char patch[4], *end; - int patchLen, tmp, i, off, cnt, patched, len, reloc; - - - /* parse command line options */ - while ((c = getopt(argc, argv, "h")) >= 0) - { - switch (c) - { - case 'h': - usage(); - return 0; - default: - usage(); - return 1; - } - } - - if(argc < 6) - { - usage(); - return 1; - } - - /* Let us get offset in file */ - reloc = strtol(argv[3], &end, 0); - if(end == argv[3] || off < 0) - { - fprintf(stderr, "bad reloc value %s\n", argv[3]); - return 1; - } - - off = strtol(argv[4], &end, 0); - if(end == argv[4] || off < 0 || off < reloc) - { - fprintf(stderr, "bad offset value %s\n", argv[4]); - return 1; - } - - off -= reloc; - - /* Let us get patch */ - patchLen = argc - 5; - - for(i=0; i<patchLen; i++) - { - tmp = strtol(argv[5+i], &end, 0); - - if(end == argv[4+i] || tmp < 0 || tmp > 0xff) - { - fprintf(stderr, "bad byte value %s\n", argv[5+i]); - return 1; - } - patch[i] = tmp; - } - - ifp = fopen(argv[2], "r"); - if(ifp == NULL) - { - fprintf(stderr, "unable to open file %s\n", argv[2]); - return 1; - } - - ofp = fopen(argv[1], "w"); - if(ofp == NULL) - { - fprintf(stderr, "unable to open file %s\n", argv[1]); - return 1; - } - - cnt = 0; - patched = 0; - for(;;) - { - len = fread(buf, 1, sizeof(buf), ifp); - - if(len == 0) - { - break; - } - - if(cnt <= off && (cnt + len) > off) - { - /* Perform patch */ - for(i=0; i<patchLen && (off+i)<(cnt+len); i++) - { - buf[off-cnt+i] = patch[i]; - } - patched = 1; - } - else if(cnt > off && cnt < (off + patchLen)) - { - /* Perform patch */ - for(i=cnt-off; i<patchLen; i++) - { - buf[off-cnt+i] = patch[i]; - } - patched = 1; - } - - fwrite(buf, 1, len, ofp); - - cnt += len; - } - - fclose(ifp); - fclose(ofp); - - if(!patched) - { - fprintf(stderr, "warning: offset is beyond input file length\n"); - fprintf(stderr, " no patch is performed\n"); - } - - return 0; -} - - - - - - - - - - - - diff --git a/c/src/lib/libbsp/i386/pc386/tools/configure b/c/src/lib/libbsp/i386/pc386/tools/configure index c3c9011f64..6d439a5f9a 100644 --- a/c/src/lib/libbsp/i386/pc386/tools/configure +++ b/c/src/lib/libbsp/i386/pc386/tools/configure @@ -937,11 +937,106 @@ fi MAINT=$MAINTAINER_MODE_TRUE +echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 +echo "configure:942: checking for Cygwin environment" >&5 +if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 947 "configure" +#include "confdefs.h" + +int main() { + +#ifndef __CYGWIN__ +#define __CYGWIN__ __CYGWIN32__ +#endif +return __CYGWIN__; +; return 0; } +EOF +if { (eval echo configure:958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_cygwin=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_cygwin=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_cygwin" 1>&6 +CYGWIN= +test "$ac_cv_cygwin" = yes && CYGWIN=yes +echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 +echo "configure:975: checking for mingw32 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 980 "configure" +#include "confdefs.h" + +int main() { +return __MINGW32__; +; return 0; } +EOF +if { (eval echo configure:987: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_mingw32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_mingw32=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_mingw32" 1>&6 +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes + + +echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +echo "configure:1006: checking for executable suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$CYGWIN" = yes || test "$MINGW32" = yes; then + ac_cv_exeext=.exe +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= + if { (eval echo configure:1016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj) ;; + *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } + fi + rm -f conftest* + test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +fi +fi + +EXEEXT="" +test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +echo "$ac_t""${ac_cv_exeext}" 1>&6 +ac_exeext=$EXEEXT + # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:945: checking for $ac_word" >&5 +echo "configure:1040: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -971,7 +1066,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:975: checking for $ac_word" >&5 +echo "configure:1070: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1022,7 +1117,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1026: checking for $ac_word" >&5 +echo "configure:1121: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1054,7 +1149,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1058: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1153: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1065,12 +1160,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1069 "configure" +#line 1164 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1169: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1096,12 +1191,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1100: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1195: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1105: checking whether we are using GNU C" >&5 +echo "configure:1200: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1110,7 +1205,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1114: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1209: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1129,7 +1224,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1133: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1228: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1161,15 +1256,15 @@ else fi -for ac_func in strtol strtoul +for ac_func in strtoul do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1168: checking for $ac_func" >&5 +echo "configure:1263: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1173 "configure" +#line 1268 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1192,7 +1287,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1291: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1433,6 +1528,7 @@ s%@SET_MAKE@%$SET_MAKE%g s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g s%@MAINT@%$MAINT%g +s%@EXEEXT@%$EXEEXT%g s%@CC@%$CC%g s%@PROJECT_ROOT@%$PROJECT_ROOT%g s%@RTEMS_ROOT@%$RTEMS_ROOT%g diff --git a/c/src/lib/libbsp/i386/pc386/tools/configure.in b/c/src/lib/libbsp/i386/pc386/tools/configure.in index 4ac349b8d2..6a8920bcd1 100644 --- a/c/src/lib/libbsp/i386/pc386/tools/configure.in +++ b/c/src/lib/libbsp/i386/pc386/tools/configure.in @@ -10,10 +10,11 @@ RTEMS_CANONICAL_TARGET_CPU AM_INIT_AUTOMAKE(rtems-lib-libbsp-i386-pc386-tools,$RTEMS_VERSION,no) AM_MAINTAINER_MODE +AC_EXEEXT AC_PROG_CC -AC_CHECK_FUNCS(strtol strtoul) +AC_CHECK_FUNCS(strtoul) RTEMS_PROJECT_ROOT RTEMS_TOOLPATHS |