merge in jb-mr2-release history after reset to jb-mr2-dev
diff --git a/adb/commandline.c b/adb/commandline.c
index a927423..27a1754 100644
--- a/adb/commandline.c
+++ b/adb/commandline.c
@@ -144,12 +144,15 @@
" adb bugreport - return all information from the device\n"
" that should be included in a bug report.\n"
"\n"
- " adb backup [-f <file>] [-apk|-noapk] [-shared|-noshared] [-all] [-system|-nosystem] [<packages...>]\n"
+ " adb backup [-f <file>] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|-nosystem] [<packages...>]\n"
" - write an archive of the device's data to <file>.\n"
" If no -f option is supplied then the data is written\n"
" to \"backup.ab\" in the current directory.\n"
" (-apk|-noapk enable/disable backup of the .apks themselves\n"
" in the archive; the default is noapk.)\n"
+ " (-obb|-noobb enable/disable backup of any installed apk expansion\n"
+ " (aka .obb) files associated with each application; the default\n"
+ " is noobb.)\n"
" (-shared|-noshared enable/disable backup of the device's\n"
" shared storage / SD card contents; the default is noshared.)\n"
" (-all means to back up all installed applications)\n"
diff --git a/adb/usb_vendors.c b/adb/usb_vendors.c
index 1c09b84..3a8e8fd 100644
--- a/adb/usb_vendors.c
+++ b/adb/usb_vendors.c
@@ -235,6 +235,7 @@
break;
}
}
+ fclose(f);
}
}
}
diff --git a/charger/charger.c b/charger/charger.c
index 353bdf0..66ddeaf 100644
--- a/charger/charger.c
+++ b/charger/charger.c
@@ -610,7 +610,7 @@
x = (gr_fb_width() - str_len_px) / 2;
if (y < 0)
y = (gr_fb_height() - char_height) / 2;
- gr_text(x, y, str);
+ gr_text(x, y, str, 0);
return y + char_height;
}
diff --git a/fastboot/bootimg.c b/fastboot/bootimg.c
index 9e0e45c..240784f 100644
--- a/fastboot/bootimg.c
+++ b/fastboot/bootimg.c
@@ -37,10 +37,10 @@
strcpy((char*) h->cmdline, cmdline);
}
-boot_img_hdr *mkbootimg(void *kernel, unsigned kernel_size,
- void *ramdisk, unsigned ramdisk_size,
- void *second, unsigned second_size,
- unsigned page_size, unsigned base,
+boot_img_hdr *mkbootimg(void *kernel, unsigned kernel_size, unsigned kernel_offset,
+ void *ramdisk, unsigned ramdisk_size, unsigned ramdisk_offset,
+ void *second, unsigned second_size, unsigned second_offset,
+ unsigned page_size, unsigned base, unsigned tags_offset,
unsigned *bootimg_size)
{
unsigned kernel_actual;
@@ -68,12 +68,15 @@
hdr->kernel_size = kernel_size;
hdr->ramdisk_size = ramdisk_size;
hdr->second_size = second_size;
- hdr->kernel_addr = base + 0x00008000;
- hdr->ramdisk_addr = base + 0x01000000;
- hdr->second_addr = base + 0x00F00000;
- hdr->tags_addr = base + 0x00000100;
+
+ hdr->kernel_addr = base + kernel_offset;
+ hdr->ramdisk_addr = base + ramdisk_offset;
+ hdr->second_addr = base + second_offset;
+ hdr->tags_addr = base + tags_offset;
+
hdr->page_size = page_size;
+
memcpy(hdr->magic + page_size,
kernel, kernel_size);
memcpy(hdr->magic + page_size + kernel_actual,
diff --git a/fastboot/fastboot.c b/fastboot/fastboot.c
index 3de6d7d..447b257 100644
--- a/fastboot/fastboot.c
+++ b/fastboot/fastboot.c
@@ -58,10 +58,10 @@
void bootimg_set_cmdline(boot_img_hdr *h, const char *cmdline);
-boot_img_hdr *mkbootimg(void *kernel, unsigned kernel_size,
- void *ramdisk, unsigned ramdisk_size,
- void *second, unsigned second_size,
- unsigned page_size, unsigned base,
+boot_img_hdr *mkbootimg(void *kernel, unsigned kernel_size, unsigned kernel_offset,
+ void *ramdisk, unsigned ramdisk_size, unsigned ramdisk_offset,
+ void *second, unsigned second_size, unsigned second_offset,
+ unsigned page_size, unsigned base, unsigned tags_offset,
unsigned *bootimg_size);
static usb_handle *usb = 0;
@@ -74,7 +74,13 @@
static int64_t sparse_limit = -1;
static int64_t target_sparse_limit = -1;
-static unsigned base_addr = 0x10000000;
+unsigned page_size = 2048;
+unsigned base_addr = 0x10000000;
+unsigned kernel_offset = 0x00008000;
+unsigned ramdisk_offset = 0x01000000;
+unsigned second_offset = 0x00f00000;
+unsigned tags_offset = 0x00000100;
+
void die(const char *fmt, ...)
{
@@ -186,11 +192,6 @@
}
#endif
-int match_fastboot(usb_ifc_info *info)
-{
- return match_fastboot_with_serial(info, serial);
-}
-
int match_fastboot_with_serial(usb_ifc_info *info, const char *local_serial)
{
if(!(vendor_id && (info->dev_vendor == vendor_id)) &&
@@ -217,6 +218,11 @@
return 0;
}
+int match_fastboot(usb_ifc_info *info)
+{
+ return match_fastboot_with_serial(info, serial);
+}
+
int list_devices_callback(usb_ifc_info *info)
{
if (match_fastboot_with_serial(info, NULL) == 0) {
@@ -297,14 +303,14 @@
" -p <product> specify product name\n"
" -c <cmdline> override kernel commandline\n"
" -i <vendor id> specify a custom USB vendor id\n"
- " -b <base_addr> specify a custom kernel base address\n"
+ " -b <base_addr> specify a custom kernel base address. default: 0x10000000\n"
" -n <page size> specify the nand page size. default: 2048\n"
" -S <size>[K|M|G] automatically sparse files greater than\n"
" size. 0 to disable\n"
);
}
-void *load_bootable_image(unsigned page_size, const char *kernel, const char *ramdisk,
+void *load_bootable_image(const char *kernel, const char *ramdisk,
unsigned *sz, const char *cmdline)
{
void *kdata = 0, *rdata = 0;
@@ -345,7 +351,10 @@
}
fprintf(stderr,"creating boot image...\n");
- bdata = mkbootimg(kdata, ksize, rdata, rsize, 0, 0, page_size, base_addr, &bsize);
+ bdata = mkbootimg(kdata, ksize, kernel_offset,
+ rdata, rsize, ramdisk_offset,
+ 0, 0, second_offset,
+ page_size, base_addr, tags_offset, &bsize);
if(bdata == 0) {
fprintf(stderr,"failed to create boot.img\n");
return 0;
@@ -806,53 +815,38 @@
int erase_first = 1;
void *data;
unsigned sz;
- unsigned page_size = 2048;
int status;
int c;
int r;
- const struct option longopts = { 0, 0, 0, 0 };
+ const struct option longopts[] = {
+ {"base", required_argument, 0, 'b'},
+ {"kernel_offset", required_argument, 0, 'k'},
+ {"page_size", required_argument, 0, 'n'},
+ {"ramdisk_offset", required_argument, 0, 'r'},
+ {"help", 0, 0, 'h'},
+ {0, 0, 0, 0}
+ };
serial = getenv("ANDROID_SERIAL");
while (1) {
- c = getopt_long(argc, argv, "wub:n:s:S:lp:c:i:m:h", &longopts, NULL);
+ int option_index = 0;
+ c = getopt_long(argc, argv, "wub:k:n:r:s:S:lp:c:i:m:h", longopts, NULL);
if (c < 0) {
break;
}
-
+ /* Alphabetical cases */
switch (c) {
- case 'w':
- wants_wipe = 1;
- break;
- case 'u':
- erase_first = 0;
- break;
case 'b':
base_addr = strtoul(optarg, 0, 16);
break;
- case 'n':
- page_size = (unsigned)strtoul(optarg, NULL, 0);
- if (!page_size) die("invalid page size");
- break;
- case 's':
- serial = optarg;
- break;
- case 'S':
- sparse_limit = parse_num(optarg);
- if (sparse_limit < 0) {
- die("invalid sparse limit");
- }
- break;
- case 'l':
- long_listing = 1;
- break;
- case 'p':
- product = optarg;
- break;
case 'c':
cmdline = optarg;
break;
+ case 'h':
+ usage();
+ return 1;
case 'i': {
char *endptr = NULL;
unsigned long val;
@@ -863,9 +857,37 @@
vendor_id = (unsigned short)val;
break;
}
- case 'h':
- usage();
- return 1;
+ case 'k':
+ kernel_offset = strtoul(optarg, 0, 16);
+ break;
+ case 'l':
+ long_listing = 1;
+ break;
+ case 'n':
+ page_size = (unsigned)strtoul(optarg, NULL, 0);
+ if (!page_size) die("invalid page size");
+ break;
+ case 'p':
+ product = optarg;
+ break;
+ case 'r':
+ ramdisk_offset = strtoul(optarg, 0, 16);
+ break;
+ case 's':
+ serial = optarg;
+ break;
+ case 'S':
+ sparse_limit = parse_num(optarg);
+ if (sparse_limit < 0) {
+ die("invalid sparse limit");
+ }
+ break;
+ case 'u':
+ erase_first = 0;
+ break;
+ case 'w':
+ wants_wipe = 1;
+ break;
case '?':
return 1;
default:
@@ -944,7 +966,7 @@
rname = argv[0];
skip(1);
}
- data = load_bootable_image(page_size, kname, rname, &sz, cmdline);
+ data = load_bootable_image(kname, rname, &sz, cmdline);
if (data == 0) return 1;
fb_queue_download("boot.img", data, sz);
fb_queue_command("boot", "booting");
@@ -975,7 +997,7 @@
} else {
skip(3);
}
- data = load_bootable_image(page_size, kname, rname, &sz, cmdline);
+ data = load_bootable_image(kname, rname, &sz, cmdline);
if (data == 0) die("cannot load bootable image");
fb_queue_flash(pname, data, sz);
} else if(!strcmp(*argv, "flashall")) {
diff --git a/init/init_parser.c b/init/init_parser.c
index beb9188..686640e 100644
--- a/init/init_parser.c
+++ b/init/init_parser.c
@@ -571,6 +571,7 @@
act = calloc(1, sizeof(*act));
act->name = name;
list_init(&act->commands);
+ list_init(&act->qlist);
cmd = calloc(1, sizeof(*cmd));
cmd->func = func;
@@ -583,7 +584,9 @@
void action_add_queue_tail(struct action *act)
{
- list_add_tail(&action_queue, &act->qlist);
+ if (list_empty(&act->qlist)) {
+ list_add_tail(&action_queue, &act->qlist);
+ }
}
struct action *action_remove_queue_head(void)
@@ -594,6 +597,7 @@
struct listnode *node = list_head(&action_queue);
struct action *act = node_to_item(node, struct action, qlist);
list_remove(node);
+ list_init(node);
return act;
}
}
@@ -825,6 +829,7 @@
act = calloc(1, sizeof(*act));
act->name = args[1];
list_init(&act->commands);
+ list_init(&act->qlist);
list_add_tail(&action_list, &act->alist);
/* XXX add to hash */
return act;