--- ps3-utils-2.3/ps3-flash-util.c	2008-10-31 18:18:11.000000000 -0400
+++ ps3-utils-2.3-new/ps3-flash-util.c	2008-11-04 22:26:49.000000000 -0500
@@ -118,6 +118,7 @@
 "SYNOPSIS\n"
 "     ps3-flash-util [-d, --device flash-dev] [-s, --show-settings]\n"
 "                    [-w, --write-image image-file]\n"
+"		     [-b, --backup-image iamge-file]\n"
 "                    [-g, --set-game-os | -o, --set-other-os]\n"
 "                    [-r, --set-raw | -z, --set-gzip] [-t, --game-time]\n"
 "                    [-T, --db-test] [-F, --db-format]\n"
@@ -137,6 +138,8 @@
 "             the OS area header with information for the new image.  This is\n"
 "             the option to use to write a new bootloader image to flash mem-\n"
 "             ory.  Use ’-’ for data on stdin.\n"
+"     -b, --backup-image image-file\n"
+"             Backup Other OS image from flash memory to image-file\n" 
 "     -g, --set-game-os\n"
 "             Set the system boot flag to Game OS.\n"
 "     -o, --set-other-os\n"
@@ -189,6 +192,7 @@
 	{"device",         required_argument, NULL, 'd'},
 	{"show-settings",  no_argument,       NULL, 's'},
 	{"write-image",    required_argument, NULL, 'w'},
+	{"backup-image",   required_argument, NULL, 'b'},
 	{"set-game-os",    no_argument,       NULL, 'g'},
 	{"set-other-os",   no_argument,       NULL, 'o'},
 	{"set-raw",        no_argument,       NULL, 'r'},
@@ -234,6 +238,7 @@
 	struct db_op_entry* db_op_list;
 	const char *device;
 	const char *image;
+	const char *backup_image;
 };
 
 static void show_settings(const struct os_area_header *h,
@@ -280,6 +285,42 @@
 	return result;
 }
 
+static int backup_image(FILE* dev, struct os_area_header* h, const char* image)
+{	
+#define BUF_SIZE 1024
+	int left, offset, size;
+	char buf[BUF_SIZE];
+
+	FILE* img = fopen(image, "w");
+	if (!img) {
+		DBG("%s:%d: fopen failed.\n", __func__,__LINE__);
+		perror(image);
+		return -1;
+	}
+
+	offset = 512*h->ldr_area_offset;
+	size = h->ldr_size;
+	if (offset>0)
+		if (fseek(dev,offset,SEEK_SET))
+			return -1;
+	left = size;	
+	while (left>=BUF_SIZE) {
+		if (fread(buf, BUF_SIZE, 1, dev)!=1)
+			return -1;	
+		if (fwrite(buf, BUF_SIZE, 1, img)!=1)
+			return -1;
+		left -= BUF_SIZE;
+	}
+        if (left>0) {
+		if (fread(buf,left,1,dev)!=1)	
+			return -1;
+		if (fwrite(buf,left,1,img)!=1)
+			return -1;
+	}
+				
+	return 0;
+}
+
 static void db_list_owners(void)
 {
 	char s[2048];
@@ -408,6 +449,10 @@
 			opts->image = optarg;
 			got_work++;
 			break;
+		case 'b':
+			opts->backup_image = optarg;
+			got_work++;
+			break;
 		case 'g':
 			opts->boot_other_os = opt_no;
 			got_work++;
@@ -662,6 +707,14 @@
 			exit(1);
 		}
 	}
+	
+	if (opts.backup_image) {
+		result = backup_image(dev,&header,opts.backup_image);
+		if (result) {
+			fprintf(stderr, "%s:%d: backup_image failed\n", __func__,__LINE__);
+			exit(1);
+		}
+	}
 
 	if (opts.compressed_image) {
 		result = os_area_set_ldr_format(&header, dev,
