FreeCalypso > hg > freecalypso-sw
changeset 981:0feb3db6f097
fc-olddump written, compiles
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Thu, 10 Dec 2015 05:16:46 +0000 |
parents | a0879ce32d2c |
children | 461f7ee5f254 |
files | .hgignore rvinterf/etmsync/Makefile rvinterf/etmsync/olddump.c |
diffstat | 3 files changed, 62 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Thu Dec 10 04:28:52 2015 +0000 +++ b/.hgignore Thu Dec 10 05:16:46 2015 +0000 @@ -33,6 +33,7 @@ ^rvinterf/etmsync/fc-dspapidump$ ^rvinterf/etmsync/fc-fsio$ ^rvinterf/etmsync/fc-getpirimei$ +^rvinterf/etmsync/fc-olddump$ ^rvinterf/etmsync/fc-pirhackinit$ ^rvinterf/lowlevel/rvinterf$ ^rvinterf/lowlevel/rvtdump$
--- a/rvinterf/etmsync/Makefile Thu Dec 10 04:28:52 2015 +0000 +++ b/rvinterf/etmsync/Makefile Thu Dec 10 05:16:46 2015 +0000 @@ -1,6 +1,6 @@ CC= gcc CFLAGS= -O2 -I../include -PROGS= fc-dspapidump fc-fsio fc-getpirimei fc-pirhackinit +PROGS= fc-dspapidump fc-fsio fc-getpirimei fc-olddump fc-pirhackinit INSTBIN=/usr/local/bin DSPDUMP_OBJS= connect.o dspapidump.o interf.o launchrvif.o memops.o \ @@ -11,6 +11,8 @@ fswrite.o interf.o launchrvif.o memcmd.o memops.o rfcap.o \ stddirs.o symlink.o +OLDDUMP_OBJS= connect.o interf.o launchrvif.o memops.o olddump.o simplemain.o + PIRIMEI_OBJS= connect.o interf.o launchrvif.o memops.o pirimei.o \ pirimeimain.o simplemain.o @@ -25,6 +27,9 @@ fc-fsio: ${FSIO_OBJS} ${CC} ${CFLAGS} -o $@ ${FSIO_OBJS} +fc-olddump: ${OLDDUMP_OBJS} + ${CC} ${CFLAGS} -o $@ ${OLDDUMP_OBJS} + fc-getpirimei: ${PIRIMEI_OBJS} ${CC} ${CFLAGS} -o $@ ${PIRIMEI_OBJS} -lcrypto
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rvinterf/etmsync/olddump.c Thu Dec 10 05:16:46 2015 +0000 @@ -0,0 +1,55 @@ +/* + * This utility uses the old TM3 memory read command (in a synchronous manner + * using our etmsync infrastructure) to read the memory of a GSM device running + * a compatible fw version; it was written as an aid for reverse-engineering + * bootloader-locked Mot C139 fw versions. + */ + +#include <sys/types.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> +#include "tm3.h" +#include "localtypes.h" +#include "exitcodes.h" + +#define CHUNK_SIZE TM3_MEMREAD_MAX + +single_op_main(argc, argv) + char **argv; +{ + u32 addr, len, chunk; + char buf[CHUNK_SIZE]; + FILE *outf; + int rc; + + if (argc != 3) { + fprintf(stderr, + "usage: fc-olddump [options] start-addr dump-length binfile\n"); + exit(ERROR_USAGE); + } + addr = strtoul(argv[0], 0, 16); + len = strtoul(argv[1], 0, 16); + outf = fopen(argv[2], "w"); + if (!outf) { + perror(argv[2]); + exit(ERROR_UNIX); + } + while (len) { + chunk = len; + if (chunk > CHUNK_SIZE) + chunk = CHUNK_SIZE; + rc = do_memory_read_tm3(addr, buf, chunk); + if (rc) + exit(rc); + fwrite(buf, 1, chunk, outf); + putchar('.'); + fflush(stdout); + addr += chunk; + len += chunk; + } + putchar('\n'); + fclose(outf); + exit(0); +}