Remove old pieces.c and fpid.c code
This commit is contained in:
1 parent
29084d4acf
commit
70c09fb5b7
6 files changed
+23
-210
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
include ../config.mk
|
include ../config.mk
|
||||||
OBJ=main.o hexdump.o dump.o flash.o serial.o qmode.o
|
OBJ=main.o hexdump.o dump.o flash.o serial.o qmode.o
|
||||||
OBJ+=fpid.o query.o pieces.o utils.o console.o
|
OBJ+=query.o utils.o console.o
|
||||||
OBJ+=squeue/squeue.o
|
OBJ+=squeue/squeue.o
|
||||||
OBJ+=image.o fiasco.o device.o usb-device.o cold-flash.o
|
OBJ+=image.o fiasco.o device.o usb-device.o cold-flash.o
|
||||||
BIN=0xFFFF
|
BIN=0xFFFF
|
||||||
|
|||||||
+4
-4
@@ -583,11 +583,11 @@ int reverse_extract_pieces_n900(char *dir)
|
|||||||
rf_strip("nolo.bin");
|
rf_strip("nolo.bin");
|
||||||
} else printf("*** Ignoring strip\n");
|
} else printf("*** Ignoring strip\n");
|
||||||
|
|
||||||
printf("\nIdentifying extracted files...\n");
|
/* printf("\nIdentifying extracted files...\n");
|
||||||
printf("%s: xloader\n", fpid_file("xloader.bin"));
|
printf("%s: xloader\n", fpid_file("xloader.bin"));
|
||||||
printf("%s: config.bin\n", fpid_file("config.bin"));
|
printf("%s: config.bin\n", fpid_file("config.bin"));
|
||||||
printf("%s: nolo.bin\n", fpid_file("nolo.bin"));
|
printf("%s: nolo.bin\n", fpid_file("nolo.bin"));
|
||||||
printf("%s: rootfs.jffs2\n", fpid_file("rootfs.jffs2"));
|
printf("%s: rootfs.jffs2\n", fpid_file("rootfs.jffs2"));*/
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -630,13 +630,13 @@ int reverse_extract_pieces(char *dir)
|
|||||||
rf_strip("initfs.jffs2");
|
rf_strip("initfs.jffs2");
|
||||||
} else printf("*** Ignoring strip\n");
|
} else printf("*** Ignoring strip\n");
|
||||||
|
|
||||||
printf("\nIdentifying extracted files...\n");
|
/* printf("\nIdentifying extracted files...\n");
|
||||||
printf("%s: xloader\n", fpid_file("xloader.bin"));
|
printf("%s: xloader\n", fpid_file("xloader.bin"));
|
||||||
printf("%s: secondary.bin\n", fpid_file("secondary.bin"));
|
printf("%s: secondary.bin\n", fpid_file("secondary.bin"));
|
||||||
printf("%s: config.bin\n", fpid_file("config.bin"));
|
printf("%s: config.bin\n", fpid_file("config.bin"));
|
||||||
printf("%s: zImage\n", fpid_file("zImage"));
|
printf("%s: zImage\n", fpid_file("zImage"));
|
||||||
printf("%s: initfs.jffs2\n", fpid_file("initfs.jffs2"));
|
printf("%s: initfs.jffs2\n", fpid_file("initfs.jffs2"));
|
||||||
printf("%s: rootfs.jffs2\n", fpid_file("rootfs.jffs2"));
|
printf("%s: rootfs.jffs2\n", fpid_file("rootfs.jffs2"));*/
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
-107
@@ -1,107 +0,0 @@
|
|||||||
/*
|
|
||||||
* 0xFFFF - Open Free Fiasco Firmware Flasher
|
|
||||||
* Copyright (C) 2007 pancake <pancake@youterm.com>
|
|
||||||
* Copyright (C) 2012 Pali Rohár <pali.rohar@gmail.com>
|
|
||||||
*
|
|
||||||
* 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 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "main.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
/* global structs */
|
|
||||||
char *pieces[] = {
|
|
||||||
"xloader", // xloader.bin
|
|
||||||
"2nd", // 2nd.bin
|
|
||||||
"secondary", // secondary.bin
|
|
||||||
"kernel", // zImage
|
|
||||||
"initfs", // initfs
|
|
||||||
"rootfs", // rootfs
|
|
||||||
"omap-nand", // 8kB of food for the nand
|
|
||||||
"mmc", // raw eMMC image
|
|
||||||
"cmt-2nd", // cmt-2nd
|
|
||||||
"cmt-algo", // cmt-algo
|
|
||||||
"cmt-mcusw", // cmt-mcusw
|
|
||||||
"fiasco", // FIASCO IMAGE
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
long fpid_size(const char *filename)
|
|
||||||
{
|
|
||||||
long sz;
|
|
||||||
FILE *fd = fopen(filename, "r");
|
|
||||||
fseek(fd, 0, SEEK_END);
|
|
||||||
sz = ftell(fd);
|
|
||||||
fclose(fd);
|
|
||||||
return sz;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *fpid_file(const char *filename)
|
|
||||||
{
|
|
||||||
FILE *fd;
|
|
||||||
char buf[512];
|
|
||||||
unsigned char *b = (unsigned char *)&buf;
|
|
||||||
long size;
|
|
||||||
|
|
||||||
// 2nd : +0x34 = 2NDAPE
|
|
||||||
// secondary: +0x04 = NOLOScnd
|
|
||||||
// x-loader : +0x14 = X-LOADER
|
|
||||||
// xloader8 : +0x0c = NOLOXldr
|
|
||||||
// kernel : +0x00 = 0000 a0e1 0000 a0e1
|
|
||||||
// initfs : <2M...be sure with 3M 0x300000
|
|
||||||
|
|
||||||
fd = fopen(filename, "r");
|
|
||||||
if (fd == NULL) {
|
|
||||||
printf("Cannot open file '%s'\n", filename);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
fread(buf, 512, 1, fd);
|
|
||||||
fseek(fd, 0, SEEK_END);
|
|
||||||
size = ftell(fd);
|
|
||||||
fclose(fd);
|
|
||||||
|
|
||||||
if (!memcmp(b, "\xb4", 1))
|
|
||||||
return pieces[PIECE_FIASCO];
|
|
||||||
else
|
|
||||||
if (!memcmp(b+0x34, "2NDAPE", 6))
|
|
||||||
return pieces[PIECE_2ND];
|
|
||||||
else
|
|
||||||
if (!memcmp(b+0x04, "NOLOScnd", 8))
|
|
||||||
return pieces[PIECE_SECONDARY];
|
|
||||||
else
|
|
||||||
if (!memcmp(b+0x14, "X-LOADER", 8))
|
|
||||||
return pieces[PIECE_XLOADER];
|
|
||||||
else
|
|
||||||
if (!memcmp(b+0x0c, "NOLOXldr", 8))
|
|
||||||
return pieces[PIECE_XLOADER];
|
|
||||||
else
|
|
||||||
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
|
|
||||||
if (!memcmp(b+0x00, "\x85\x19", 2)) { //\x01\xe0", 4)) {
|
|
||||||
/*/ is jffs2 */
|
|
||||||
if (size < 0x300000)
|
|
||||||
return pieces[PIECE_INITFS];
|
|
||||||
return pieces[PIECE_ROOTFS];
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
+12
-12
@@ -217,7 +217,7 @@ void show_usage()
|
|||||||
" -V show 0xFFFF version information\n"
|
" -V show 0xFFFF version information\n"
|
||||||
" -x extract configuration entries from /dev/mtd1\n"
|
" -x extract configuration entries from /dev/mtd1\n"
|
||||||
"Pieces are: ");
|
"Pieces are: ");
|
||||||
for(i=0;pieces[i];i++) printf("%s ", pieces[i]); printf("\n");
|
// for(i=0;pieces[i];i++) printf("%s ", pieces[i]); printf("\n");
|
||||||
// serial port support is not yet done (cold flash is for flashing the 8kB nand)
|
// serial port support is not yet done (cold flash is for flashing the 8kB nand)
|
||||||
// TODO: commandline shell prompt for nolo comm
|
// TODO: commandline shell prompt for nolo comm
|
||||||
|
|
||||||
@@ -468,9 +468,9 @@ int main(int argc, char **argv)
|
|||||||
// case 'l':
|
// case 'l':
|
||||||
// list_valid_devices();
|
// list_valid_devices();
|
||||||
// return 0;
|
// return 0;
|
||||||
case 'p':
|
// case 'p':
|
||||||
add_piece(optarg);
|
// add_piece(optarg);
|
||||||
break;
|
// break;
|
||||||
case 'i':
|
case 'i':
|
||||||
info = 1;
|
info = 1;
|
||||||
break;
|
break;
|
||||||
@@ -492,13 +492,13 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
// case 'P':
|
// case 'P':
|
||||||
// return fiasco_pack(optind, argv);
|
// return fiasco_pack(optind, argv);
|
||||||
case 'I':
|
// case 'I':
|
||||||
type = fpid_file(optarg);
|
// type = fpid_file(optarg);
|
||||||
printf("%s: %s\n", type, optarg);
|
// printf("%s: %s\n", type, optarg);
|
||||||
// if (type && strcmp(type, "fiasco") == 0)
|
// if (type && strcmp(type, "fiasco") == 0)
|
||||||
// openfiasco(optarg, NULL, NULL, NULL, NULL, 1);
|
// openfiasco(optarg, NULL, NULL, NULL, NULL, 1);
|
||||||
identify = 1;
|
// identify = 1;
|
||||||
break;
|
// break;
|
||||||
case 'C':
|
case 'C':
|
||||||
return check_badblocks(optarg);
|
return check_badblocks(optarg);
|
||||||
case 'v':
|
case 'v':
|
||||||
@@ -526,7 +526,7 @@ int main(int argc, char **argv)
|
|||||||
if ( /*(fiasco_image == NULL)*/ 1
|
if ( /*(fiasco_image == NULL)*/ 1
|
||||||
&& (boot_cmdline == NULL)
|
&& (boot_cmdline == NULL)
|
||||||
&& (reverseto == NULL)
|
&& (reverseto == NULL)
|
||||||
&& (pcs_n == 0)
|
// && (pcs_n == 0)
|
||||||
&& (rd_flags == -1)
|
&& (rd_flags == -1)
|
||||||
&& (rd_mode == -1)
|
&& (rd_mode == -1)
|
||||||
&& (info == 0)
|
&& (info == 0)
|
||||||
@@ -567,7 +567,7 @@ int main(int argc, char **argv)
|
|||||||
// if (info)
|
// if (info)
|
||||||
cmd_info("");
|
cmd_info("");
|
||||||
|
|
||||||
if (pcs_n) {
|
/* if (pcs_n) {
|
||||||
char version[64];
|
char version[64];
|
||||||
// check_nolo_order();
|
// check_nolo_order();
|
||||||
get_sw_version();
|
get_sw_version();
|
||||||
@@ -586,7 +586,7 @@ int main(int argc, char **argv)
|
|||||||
printf("Flashing %s (%s)\n", pcs[c].type, pcs[c].name);
|
printf("Flashing %s (%s)\n", pcs[c].type, pcs[c].name);
|
||||||
// flash_image(pcs[c].name, pcs[c].type, pcs[c].device, pcs[c].hwrevs, pcs[c].version);
|
// flash_image(pcs[c].name, pcs[c].type, pcs[c].device, pcs[c].hwrevs, pcs[c].version);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (rd_mode != -1)
|
if (rd_mode != -1)
|
||||||
set_rd_mode(rd_mode);
|
set_rd_mode(rd_mode);
|
||||||
|
|||||||
+6
-6
@@ -27,8 +27,8 @@ int fiasco_read_image(char *file);
|
|||||||
extern struct usb_dev_handle *dev;
|
extern struct usb_dev_handle *dev;
|
||||||
unsigned long get_file_size(const char *file);
|
unsigned long get_file_size(const char *file);
|
||||||
void progressbar(unsigned long long part, unsigned long long total);
|
void progressbar(unsigned long long part, unsigned long long total);
|
||||||
const char *fpid_file(const char *filename);
|
//const char *fpid_file(const char *filename);
|
||||||
int add_piece(char *piece);
|
//int add_piece(char *piece);
|
||||||
void eprintf(const char *format, ...);
|
void eprintf(const char *format, ...);
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
@@ -62,13 +62,13 @@ extern int verbose;
|
|||||||
#define CMD_WRITE 64
|
#define CMD_WRITE 64
|
||||||
#define CMD_QUERY 192
|
#define CMD_QUERY 192
|
||||||
|
|
||||||
struct piece_t {
|
/*struct piece_t {
|
||||||
char *name;
|
char *name;
|
||||||
char *type;
|
char *type;
|
||||||
char *device;
|
char *device;
|
||||||
char *hwrevs;
|
char *hwrevs;
|
||||||
char *version;
|
char *version;
|
||||||
};
|
};*/
|
||||||
|
|
||||||
enum flash_mode {
|
enum flash_mode {
|
||||||
FLASH_COLD,
|
FLASH_COLD,
|
||||||
@@ -87,8 +87,8 @@ enum flash_mode {
|
|||||||
//#define SUPPORTED_DEVICES 10
|
//#define SUPPORTED_DEVICES 10
|
||||||
//extern struct devices supported_devices[SUPPORTED_DEVICES];
|
//extern struct devices supported_devices[SUPPORTED_DEVICES];
|
||||||
|
|
||||||
extern int pcs_n;
|
//extern int pcs_n;
|
||||||
extern struct piece_t pcs[10];
|
//extern struct piece_t pcs[10];
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PIECE_XLOADER = 0,
|
PIECE_XLOADER = 0,
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
* 0xFFFF - Open Free Fiasco Firmware Flasher
|
|
||||||
* Copyright (C) 2007 pancake <pancake@youterm.com>
|
|
||||||
*
|
|
||||||
* 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 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "main.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
int pcs_n = 0;
|
|
||||||
struct piece_t pcs[10];
|
|
||||||
|
|
||||||
int add_piece(char *piece)
|
|
||||||
{
|
|
||||||
int i,ok = 0;
|
|
||||||
char *file;
|
|
||||||
|
|
||||||
if (pcs_n==9) {
|
|
||||||
fprintf(stderr, "Oops...cannot add more pieces. no sense operation!\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
file = strchr(piece, '%');
|
|
||||||
if (file) {
|
|
||||||
file[0]='\0';
|
|
||||||
file = file + 1;
|
|
||||||
for(i=0;pieces[i];i++)
|
|
||||||
if (!strcmp(pieces[i], piece))
|
|
||||||
ok = 1;
|
|
||||||
if (!ok) {
|
|
||||||
printf("Invalid piece name.\n");
|
|
||||||
printf("Pieces: ");
|
|
||||||
for(i=0;pieces[i];i++)
|
|
||||||
printf("%s ", pieces[i]);
|
|
||||||
printf("\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
pcs[pcs_n].name = strdup(file);
|
|
||||||
pcs[pcs_n].type = strdup(piece);
|
|
||||||
pcs[pcs_n].device = NULL;
|
|
||||||
pcs[pcs_n].hwrevs = NULL;
|
|
||||||
pcs[pcs_n].version = NULL; // TODO version string not yet supported
|
|
||||||
} else {
|
|
||||||
/*/ autodetect piece type */
|
|
||||||
pcs[pcs_n].type = (char *)fpid_file(piece);
|
|
||||||
if (pcs[pcs_n].type == NULL) {
|
|
||||||
printf("Use -p [piece]:[file]\n");
|
|
||||||
printf("Pieces: ");
|
|
||||||
for(i=0;pieces[i];i++)
|
|
||||||
printf("%s ", pieces[i]);
|
|
||||||
printf("\n");
|
|
||||||
exit(1);
|
|
||||||
} else {
|
|
||||||
pcs[pcs_n].name = strdup(piece);
|
|
||||||
pcs[pcs_n].type = strdup(pcs[pcs_n].type);
|
|
||||||
pcs[pcs_n].device = NULL;
|
|
||||||
pcs[pcs_n].hwrevs = NULL;
|
|
||||||
pcs[pcs_n].version = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pcs_n++;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user