summaryrefslogtreecommitdiff
path: root/rbutil
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2007-02-10 20:09:23 +0000
committerDave Chapman <dave@dchapman.com>2007-02-10 20:09:23 +0000
commita6d68bd7409b3f54de8e02ec37e369167f55a50c (patch)
treec7475f07d5122ec09e38009bd1977c0274baf14b /rbutil
parent955afed1b74793a3f06f98f3c259ec98f26a0b82 (diff)
Changes to aid incorporation into rbutil, based on part of FS #6643 from Dominik Wenger. Move display_partinfo() function into main.c (where it belongs) and export get_parttype() function from ipodpatcher.c. Also add a targetname variable to struct ipod_t to enable bootloader URLs to be constructed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12264 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/ipodpatcher/ipodio.h1
-rw-r--r--rbutil/ipodpatcher/ipodpatcher.c27
-rw-r--r--rbutil/ipodpatcher/ipodpatcher.h2
-rw-r--r--rbutil/ipodpatcher/main.c20
4 files changed, 30 insertions, 20 deletions
diff --git a/rbutil/ipodpatcher/ipodio.h b/rbutil/ipodpatcher/ipodio.h
index d0641faa2b..71cafc56f2 100644
--- a/rbutil/ipodpatcher/ipodio.h
+++ b/rbutil/ipodpatcher/ipodio.h
@@ -70,6 +70,7 @@ struct ipod_t {
int modelnum;
char* modelname;
char* modelstr;
+ char* targetname;
int macpod;
#ifdef WITH_BOOTOBJS
unsigned char* bootloader;
diff --git a/rbutil/ipodpatcher/ipodpatcher.c b/rbutil/ipodpatcher/ipodpatcher.c
index 6c60bae38d..6fcf0c8c27 100644
--- a/rbutil/ipodpatcher/ipodpatcher.c
+++ b/rbutil/ipodpatcher/ipodpatcher.c
@@ -158,25 +158,6 @@ void int2be(unsigned int val, unsigned char* addr)
((long)array[pos] | ((long)array[pos+1] << 8 ) |\
((long)array[pos+2] << 16 ) | ((long)array[pos+3] << 24 ))
-void display_partinfo(struct ipod_t* ipod)
-{
- int i;
- double sectors_per_MB = (1024.0*1024.0)/ipod->sector_size;
-
- printf("[INFO] Part Start Sector End Sector Size (MB) Type\n");
- for ( i = 0; i < 4; i++ ) {
- if (ipod->pinfo[i].start != 0) {
- printf("[INFO] %d %10ld %10ld %10.1f %s (0x%02x)\n",
- i,
- ipod->pinfo[i].start,
- ipod->pinfo[i].start+ipod->pinfo[i].size-1,
- ipod->pinfo[i].size/sectors_per_MB,
- get_parttype(ipod->pinfo[i].type),
- ipod->pinfo[i].type);
- }
- }
-}
-
int read_partinfo(struct ipod_t* ipod, int silent)
{
int i;
@@ -1127,6 +1108,7 @@ int getmodel(struct ipod_t* ipod, int ipod_version)
ipod->modelstr="3rd Generation";
ipod->modelnum = 7;
ipod->modelname = "ip3g";
+ ipod->targetname = "ipod3g";
#ifdef WITH_BOOTOBJS
ipod->bootloader = ipod3g;
ipod->bootloader_len = LEN_ipod3g;
@@ -1136,6 +1118,7 @@ int getmodel(struct ipod_t* ipod, int ipod_version)
ipod->modelstr="1st Generation Mini";
ipod->modelnum = 9;
ipod->modelname = "mini";
+ ipod->targetname = "ipodmini";
#ifdef WITH_BOOTOBJS
ipod->bootloader = ipodmini;
ipod->bootloader_len = LEN_ipodmini;
@@ -1145,6 +1128,7 @@ int getmodel(struct ipod_t* ipod, int ipod_version)
ipod->modelstr="4th Generation";
ipod->modelnum = 8;
ipod->modelname = "ip4g";
+ ipod->targetname = "ipod4g";
#ifdef WITH_BOOTOBJS
ipod->bootloader = ipod4g;
ipod->bootloader_len = LEN_ipod4g;
@@ -1154,6 +1138,7 @@ int getmodel(struct ipod_t* ipod, int ipod_version)
ipod->modelstr="Photo/Color";
ipod->modelnum = 3;
ipod->modelname = "ipco";
+ ipod->targetname = "ipodcolor";
#ifdef WITH_BOOTOBJS
ipod->bootloader = ipodcolor;
ipod->bootloader_len = LEN_ipodcolor;
@@ -1163,6 +1148,7 @@ int getmodel(struct ipod_t* ipod, int ipod_version)
ipod->modelstr="2nd Generation Mini";
ipod->modelnum = 11;
ipod->modelname = "mn2g";
+ ipod->targetname = "ipodmini2g";
#ifdef WITH_BOOTOBJS
ipod->bootloader = ipodmini2g;
ipod->bootloader_len = LEN_ipodmini2g;
@@ -1172,6 +1158,7 @@ int getmodel(struct ipod_t* ipod, int ipod_version)
ipod->modelstr="1st Generation Nano";
ipod->modelnum = 4;
ipod->modelname = "nano";
+ ipod->targetname = "ipodnano";
#ifdef WITH_BOOTOBJS
ipod->bootloader = ipodnano;
ipod->bootloader_len = LEN_ipodnano;
@@ -1181,6 +1168,7 @@ int getmodel(struct ipod_t* ipod, int ipod_version)
ipod->modelstr="Video (aka 5th Generation)";
ipod->modelnum = 5;
ipod->modelname = "ipvd";
+ ipod->targetname = "ipodvideo";
#ifdef WITH_BOOTOBJS
ipod->bootloader = ipodvideo;
ipod->bootloader_len = LEN_ipodvideo;
@@ -1189,6 +1177,7 @@ int getmodel(struct ipod_t* ipod, int ipod_version)
default:
ipod->modelname = NULL;
ipod->modelnum = 0;
+ ipod->targetname = NULL;
#ifdef WITH_BOOTOBJS
ipod->bootloader = NULL;
ipod->bootloader_len = 0;
diff --git a/rbutil/ipodpatcher/ipodpatcher.h b/rbutil/ipodpatcher/ipodpatcher.h
index c533f4c2dc..4c1eee58af 100644
--- a/rbutil/ipodpatcher/ipodpatcher.h
+++ b/rbutil/ipodpatcher/ipodpatcher.h
@@ -33,7 +33,7 @@ extern unsigned char* sectorbuf;
#define FILETYPE_INTERNAL 2
#endif
-void display_partinfo(struct ipod_t* ipod);
+char* get_parttype(int pt);
int read_partinfo(struct ipod_t* ipod, int silent);
int read_partition(struct ipod_t* ipod, int outfile);
int write_partition(struct ipod_t* ipod, int infile);
diff --git a/rbutil/ipodpatcher/main.c b/rbutil/ipodpatcher/main.c
index d183b9bc52..476aeff9d2 100644
--- a/rbutil/ipodpatcher/main.c
+++ b/rbutil/ipodpatcher/main.c
@@ -102,6 +102,26 @@ void print_usage(void)
#endif
}
+void display_partinfo(struct ipod_t* ipod)
+{
+ int i;
+ double sectors_per_MB = (1024.0*1024.0)/ipod->sector_size;
+
+ printf("[INFO] Part Start Sector End Sector Size (MB) Type\n");
+ for ( i = 0; i < 4; i++ ) {
+ if (ipod->pinfo[i].start != 0) {
+ printf("[INFO] %d %10ld %10ld %10.1f %s (0x%02x)\n",
+ i,
+ ipod->pinfo[i].start,
+ ipod->pinfo[i].start+ipod->pinfo[i].size-1,
+ ipod->pinfo[i].size/sectors_per_MB,
+ get_parttype(ipod->pinfo[i].type),
+ ipod->pinfo[i].type);
+ }
+ }
+}
+
+
int main(int argc, char* argv[])
{
#ifdef WITH_BOOTOBJS