From 73f9bde9088f0bc447725fdb512a78034060dc9d Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sat, 13 Jun 2009 14:15:50 +0000 Subject: Make bin2c compile with VS2005 and move it to a separate folder as its getting used by different tools now. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21272 a1c6a512-1295-4272-9138-f99709370657 --- rbutil/sansapatcher/Makefile | 13 ++-- rbutil/sansapatcher/bin2c.c | 135 ---------------------------------------- rbutil/tools/Makefile | 25 ++++++++ rbutil/tools/bin2c.c | 143 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 173 insertions(+), 143 deletions(-) delete mode 100644 rbutil/sansapatcher/bin2c.c create mode 100644 rbutil/tools/Makefile create mode 100644 rbutil/tools/bin2c.c (limited to 'rbutil') diff --git a/rbutil/sansapatcher/Makefile b/rbutil/sansapatcher/Makefile index 9c5bec1bdf..98d3971b0e 100644 --- a/rbutil/sansapatcher/Makefile +++ b/rbutil/sansapatcher/Makefile @@ -42,14 +42,11 @@ sansapatcher-ppc: main.c sansapatcher.c sansaio-posix.c parttypes.h bootimg_c200 gcc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch ppc $(CFLAGS) -o sansapatcher-ppc main.c sansapatcher.c sansaio-posix.c bootimg_c200.c bootimg_e200.c strip sansapatcher-ppc -bin2c: bin2c.c - $(NATIVECC) $(CFLAGS) -o bin2c bin2c.c +bootimg_c200.c: firmware.mi4 ../tools/bin2c + ../tools/bin2c firmware.mi4 bootimg_c200 -bootimg_c200.c: firmware.mi4 bin2c - ./bin2c firmware.mi4 bootimg_c200 - -bootimg_e200.c: PP5022.mi4 bin2c - ./bin2c PP5022.mi4 bootimg_e200 +bootimg_e200.c: PP5022.mi4 ../tools/bin2c + ../tools/bin2c PP5022.mi4 bootimg_e200 clean: - rm -f sansapatcher.exe sansapatcher-mac sansapatcher-i386 sansapatcher-ppc sansapatcher bin2c bootimg_c200.c bootimg_c200.h bootimg_e200.c bootimg_e200.h *~ + rm -f sansapatcher.exe sansapatcher-mac sansapatcher-i386 sansapatcher-ppc sansapatcher bootimg_c200.c bootimg_c200.h bootimg_e200.c bootimg_e200.h *~ diff --git a/rbutil/sansapatcher/bin2c.c b/rbutil/sansapatcher/bin2c.c deleted file mode 100644 index 7b0606912b..0000000000 --- a/rbutil/sansapatcher/bin2c.c +++ /dev/null @@ -1,135 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2007 Dave Chapman - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -static off_t filesize(int fd) -{ - struct stat buf; - - fstat(fd,&buf); - return buf.st_size; -} - -static int write_cfile(const unsigned char* buf, off_t len, const char* cname) -{ - char filename[256]; - FILE* fp; - int i; - - snprintf(filename,256,"%s.c",cname); - - fp = fopen(filename,"w+"); - if (fp == NULL) { - fprintf(stderr,"Couldn't open %s\n",filename); - return -1; - } - - fprintf(fp,"/* Generated by bin2c */\n\n"); - fprintf(fp,"unsigned char %s[] = {",cname); - - for (i=0;i ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2007 Dave Chapman + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#if !defined(_MSC_VER) +#include +#else +#include +#define snprintf _snprintf +#define open _open +#define close _close +#define read _read +#endif + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +static off_t filesize(int fd) +{ + struct stat buf; + + fstat(fd,&buf); + return buf.st_size; +} + +static int write_cfile(const unsigned char* buf, off_t len, const char* cname) +{ + char filename[256]; + FILE* fp; + int i; + + snprintf(filename,256,"%s.c",cname); + + fp = fopen(filename,"w+"); + if (fp == NULL) { + fprintf(stderr,"Couldn't open %s\n",filename); + return -1; + } + + fprintf(fp,"/* Generated by bin2c */\n\n"); + fprintf(fp,"unsigned char %s[] = {",cname); + + for (i=0;i