From 3a1053b29e5fb8109463259ee9dff3d8f4e4be5b Mon Sep 17 00:00:00 2001 From: pancake Date: Sun, 14 Dec 2008 03:05:19 +0100 Subject: * Oops missing up * Added fixups for make install/deinstall * HAVE_GUI is now enabled by default * New 'stop' button for goxf GUI * Fix lil bug in squeue.c * Initial .desktop icon for freedesktop environments (GNOME) --- 0xFFFF.desktop | 9 +++++++++ Makefile | 17 ++++++++++++----- README | 9 ++++++++- config.mk | 4 ++-- logotool/Makefile | 5 ++++- src/Makefile | 2 +- src/flash.c | 7 +++++++ src/fpid.c | 12 ++++++++---- src/gui/gui.gtkaml | 30 +++++++++++++----------------- src/main.c | 2 +- src/main.h | 1 + src/qmode.c | 2 +- 12 files changed, 67 insertions(+), 33 deletions(-) create mode 100644 0xFFFF.desktop diff --git a/0xFFFF.desktop b/0xFFFF.desktop new file mode 100644 index 0000000..03a3d0e --- /dev/null +++ b/0xFFFF.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=0xFFFF +Comment=Free flasher for the Nokia internet tablets +Exec=gnome-terminal -e goxf +Icon=gnome-terminal.png +Terminal=false +Type=Application +Categories=GTK;Application;Utility; diff --git a/Makefile b/Makefile index e5c6135..a8042d9 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ include config.mk PREFIX?=/usr/local +DESTDIR?= all: logot frontend cd src && ${MAKE} all @@ -10,6 +11,7 @@ frontend: static: logot cd libusb && ${MAKE} all cd src && ${MAKE} static + cd logotool && ${MAKE} static allusb: logot cd libusb && ${MAKE} all @@ -23,10 +25,15 @@ clean: cd logotool && ${MAKE} clean install: - cp src/0xFFFF ${PREFIX}/bin - -cp src/gui/goxf ${PREFIX}/bin - cp logotool/logotool ${PREFIX}/bin + mkdir -p ${DESTDIR}${PREFIX}/bin + mkdir -p ${DESTDIR}${PREFIX}/share/applications/ + cp src/0xFFFF ${DESTDIR}${PREFIX}/bin + -cp src/gui/goxf ${DESTDIR}${PREFIX}/bin + cp logotool/logotool ${DESTDIR}${PREFIX}/bin + cp 0xFFFF.desktop ${DESTDIR}${PREFIX}/share/applications/ deinstall: - rm -f ${PREFIX}/bin/0xFFFF - rm -f ${PREFIX}/bin/logotool + rm -f ${DESTDIR}${PREFIX}/bin/0xFFFF + rm -f ${DESTDIR}${PREFIX}/bin/logotool + rm -f ${DESTDIR}${PREFIX}/bin/goxf + rm ${DESTDIR}${PREFIX}/share/applications/0xFFFF.desktop diff --git a/README b/README index 4125cb8..4610bac 100644 --- a/README +++ b/README @@ -27,8 +27,15 @@ Feel free to join to the mailing list and visit the homepage for more info: 0xffff@lists.nopcode.org http://www.nopcode.org/0xFFFF +-----------8<--------------------------------------------------------------- -Have phun! +Build: + $ make + +To install: (by default is /usr/local) + $ make install PREFIX=/usr DESTDIR=/ + +Have phun! --pancake diff --git a/config.mk b/config.mk index 86af3cc..851d9f3 100644 --- a/config.mk +++ b/config.mk @@ -3,8 +3,8 @@ PREFIX=/usr # NetBSD stuff -CFLAGS+=-I/usr/pkg/include +CFLAGS+=-I/usr/pkg/include -O2 LDFLAGS+=-L/usr/pkg/lib -Wl,-R/usr/pkg/lib HAVE_USB=1 -HAVE_GUI=0 +HAVE_GUI=1 diff --git a/logotool/Makefile b/logotool/Makefile index 1c5d08d..a12d145 100644 --- a/logotool/Makefile +++ b/logotool/Makefile @@ -1,5 +1,5 @@ OBJ=logotool.o compress.o uncompress.o rgb2yuv.o -CFLAGS=-Wall -g +#CFLAGS=-Wall -g BIN=logotool all: ${BIN} @@ -7,5 +7,8 @@ all: ${BIN} ${BIN}: ${OBJ} ${CC} ${OBJ} -o logotool +static: ${BIN} + ${CC} -static ${OBJ} -o logotool + clean: rm -f ${OBJ} logotool diff --git a/src/Makefile b/src/Makefile index e8dbffa..2e8990d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -5,7 +5,7 @@ OBJ+=squeue/squeue.o BIN=0xFFFF #LIBS=`${HAVE_USB} && echo -- '-lusb'` LIBS=`if [ "${HAVE_USB}" = 1 ]; then echo '-lusb'; fi` -CFLAGS+=-DVERSION=\"${VERSION}\" -Wall -g -I . +CFLAGS+=-DVERSION=\"${VERSION}\" -Wall -I . CFLAGS+=-pedantic -std=c99 -DHAVE_USB=${HAVE_USB} USBOBJ=../libusb/error.o ../libusb/usb.o ../libusb/descriptors.o USBOBJ+=../libusb/linux.o ## XXX not portable diff --git a/src/flash.c b/src/flash.c index 94c7f29..43c79bb 100644 --- a/src/flash.c +++ b/src/flash.c @@ -96,6 +96,13 @@ void flash_image(const char *filename, const char *piece, const char *version) printf("Piece type: %s\n", piece); } + if (piece != NULL) { + if (!strcmp(piece, "fiasco")) { + fiasco_flash(filename); + return; + } + } + if (version) vlen = strlen(version)+1; diff --git a/src/fpid.c b/src/fpid.c index c2340f8..f36b758 100644 --- a/src/fpid.c +++ b/src/fpid.c @@ -48,7 +48,6 @@ const char *fpid_file(const char *filename) FILE *fd; char buf[512]; unsigned char *b = (unsigned char *)&buf; - char *piece = NULL; long size; // 2nd : +0x34 = 2NDAPE @@ -80,10 +79,15 @@ const char *fpid_file(const char *filename) if (!memcmp(b+0x14, "X-LOADER", 8)) return pieces[PIECE_XLOADER]; else - if (!memcmp(b+0x0c, "NOLOXldr", 8)) // TODO: this is xloader800, not valid on 770? + if (!memcmp(b+0x0c, "NOLOXldr", 8)) return pieces[PIECE_XLOADER]; else - if (!memcmp(b+0x00, "\x00\x00\xa0\xe1\x00\x00\xa0\xe1", 8)) + if (!memcmp(b+4,"NOLOXldr",8)) + // TODO: this is xloader800, not valid on 770? + return pieces[PIECE_2ND]; + else + if (!memcmp(b+0x00, "\x00\x00\xa0\xe1\x00\x00\xa0\xe1", 8) + || (!memcmp(b, "\x21\x01\x01", 3))) return pieces[PIECE_KERNEL]; else // JFFS2 MAGIC @@ -94,5 +98,5 @@ const char *fpid_file(const char *filename) return pieces[PIECE_ROOTFS]; } - return piece; + return NULL; } diff --git a/src/gui/gui.gtkaml b/src/gui/gui.gtkaml index 43ba5ca..e5c9e97 100644 --- a/src/gui/gui.gtkaml +++ b/src/gui/gui.gtkaml @@ -12,8 +12,8 @@ xmlns:SQueues="SQueues" xmlns:class="http://gtkaml.org/0.2" class:name="MainWindow" - title="0xFFFF GUI" - delete-event="{OnWindow1DeleteEvent}"> + title="0xFFFF GUI"> + @@ -32,6 +32,7 @@ + @@ -58,6 +59,7 @@