Loading fastboot/engine.c +12 −1 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ char *mkmsg(const char *fmt, ...) #define OP_NOTICE 4 #define OP_FORMAT 5 #define OP_DOWNLOAD_SPARSE 6 #define OP_COMMAND_IGNORE_FAIL 7 typedef struct Action Action; Loading Loading @@ -374,6 +375,8 @@ int fb_format(Action *a, usb_handle *usb, int skip_if_not_supported) // Following piece of code is similar to fb_queue_flash() but executes // actions directly without queuing snprintf(cmd, sizeof(cmd), "preflash:%s", partition); fb_command(usb, cmd); /* Ignore status */ fprintf(stderr, "sending '%s' (%lli KB)...\n", partition, image.image_size/1024); status = fb_download_data(usb, image.buffer, image.image_size); if (status) goto cleanup; Loading Loading @@ -402,6 +405,8 @@ void fb_queue_flash(const char *ptn, void *data, unsigned sz) { Action *a; a = queue_action(OP_COMMAND_IGNORE_FAIL, "preflash:%s", ptn); a->msg = mkmsg("prep for '%s' (%d KB)", ptn, sz / 1024); a = queue_action(OP_DOWNLOAD, ""); a->data = data; a->size = sz; Loading @@ -415,6 +420,8 @@ void fb_queue_flash_sparse(const char *ptn, struct sparse_file *s, unsigned sz) { Action *a; a = queue_action(OP_COMMAND_IGNORE_FAIL, "preflash:%s", ptn); a->msg = mkmsg("prep for sparse '%s' (%d KB)", ptn, sz / 1024); a = queue_action(OP_DOWNLOAD_SPARSE, ""); a->data = s; a->size = 0; Loading Loading @@ -575,7 +582,9 @@ void fb_queue_command(const char *cmd, const char *msg) void fb_queue_download(const char *name, void *data, unsigned size) { Action *a = queue_action(OP_DOWNLOAD, ""); Action *a; a = queue_action(OP_COMMAND_IGNORE_FAIL, "preflash:"); a = queue_action(OP_DOWNLOAD, ""); a->data = data; a->size = size; a->msg = mkmsg("downloading '%s'", name); Loading Loading @@ -614,6 +623,8 @@ int fb_execute_queue(usb_handle *usb) status = fb_command(usb, a->cmd); status = a->func(a, status, status ? fb_get_error() : ""); if (status) break; } else if (a->op == OP_COMMAND_IGNORE_FAIL) { fb_command(usb, a->cmd); /* Ignore status */ } else if (a->op == OP_QUERY) { status = fb_command_response(usb, a->cmd, resp); status = a->func(a, status, status ? fb_get_error() : resp); Loading fastboot/fastboot_protocol.txt +9 −9 Original line number Diff line number Diff line FastBoot Version 0.4 FastBoot Version 0.4++ ---------------------- The fastboot protocol is a mechanism for communicating with bootloaders Loading Loading @@ -67,10 +67,6 @@ Transport and Framing Example Session --------------- Host: "getvar:version" request version variable Client: "OKAY0.4" return version "0.4" Host: "getvar:nonexistant" request some undefined variable Client: "OKAY" return value "" Loading Loading @@ -123,6 +119,11 @@ Command Reference "flash:%s" Write the previously downloaded image to the named partition (if possible). "preflash:%s" Optionally prepare for a download + flash. E.g. flash directly during download. To deal with a failed "flash" followed by a "boot", we send "preflash:". "erase:%s" Erase the indicated partition (clear to 0xFFs) "boot" The previously downloaded data is a boot.img Loading @@ -140,7 +141,9 @@ Command Reference "powerdown" Power off the device. * Note about sparse files Large files can be split up using libsparse, and sent to the bootloader as repeated chunks of "download:%08x" + "flash:%s". Client Variables ---------------- Loading @@ -151,9 +154,6 @@ on it. The various currently defined names are: version Version of FastBoot protocol supported. It should be "0.3" for this document. version-bootloader Version string for the Bootloader. version-baseband Version string of the Baseband Software Loading Loading
fastboot/engine.c +12 −1 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ char *mkmsg(const char *fmt, ...) #define OP_NOTICE 4 #define OP_FORMAT 5 #define OP_DOWNLOAD_SPARSE 6 #define OP_COMMAND_IGNORE_FAIL 7 typedef struct Action Action; Loading Loading @@ -374,6 +375,8 @@ int fb_format(Action *a, usb_handle *usb, int skip_if_not_supported) // Following piece of code is similar to fb_queue_flash() but executes // actions directly without queuing snprintf(cmd, sizeof(cmd), "preflash:%s", partition); fb_command(usb, cmd); /* Ignore status */ fprintf(stderr, "sending '%s' (%lli KB)...\n", partition, image.image_size/1024); status = fb_download_data(usb, image.buffer, image.image_size); if (status) goto cleanup; Loading Loading @@ -402,6 +405,8 @@ void fb_queue_flash(const char *ptn, void *data, unsigned sz) { Action *a; a = queue_action(OP_COMMAND_IGNORE_FAIL, "preflash:%s", ptn); a->msg = mkmsg("prep for '%s' (%d KB)", ptn, sz / 1024); a = queue_action(OP_DOWNLOAD, ""); a->data = data; a->size = sz; Loading @@ -415,6 +420,8 @@ void fb_queue_flash_sparse(const char *ptn, struct sparse_file *s, unsigned sz) { Action *a; a = queue_action(OP_COMMAND_IGNORE_FAIL, "preflash:%s", ptn); a->msg = mkmsg("prep for sparse '%s' (%d KB)", ptn, sz / 1024); a = queue_action(OP_DOWNLOAD_SPARSE, ""); a->data = s; a->size = 0; Loading Loading @@ -575,7 +582,9 @@ void fb_queue_command(const char *cmd, const char *msg) void fb_queue_download(const char *name, void *data, unsigned size) { Action *a = queue_action(OP_DOWNLOAD, ""); Action *a; a = queue_action(OP_COMMAND_IGNORE_FAIL, "preflash:"); a = queue_action(OP_DOWNLOAD, ""); a->data = data; a->size = size; a->msg = mkmsg("downloading '%s'", name); Loading Loading @@ -614,6 +623,8 @@ int fb_execute_queue(usb_handle *usb) status = fb_command(usb, a->cmd); status = a->func(a, status, status ? fb_get_error() : ""); if (status) break; } else if (a->op == OP_COMMAND_IGNORE_FAIL) { fb_command(usb, a->cmd); /* Ignore status */ } else if (a->op == OP_QUERY) { status = fb_command_response(usb, a->cmd, resp); status = a->func(a, status, status ? fb_get_error() : resp); Loading
fastboot/fastboot_protocol.txt +9 −9 Original line number Diff line number Diff line FastBoot Version 0.4 FastBoot Version 0.4++ ---------------------- The fastboot protocol is a mechanism for communicating with bootloaders Loading Loading @@ -67,10 +67,6 @@ Transport and Framing Example Session --------------- Host: "getvar:version" request version variable Client: "OKAY0.4" return version "0.4" Host: "getvar:nonexistant" request some undefined variable Client: "OKAY" return value "" Loading Loading @@ -123,6 +119,11 @@ Command Reference "flash:%s" Write the previously downloaded image to the named partition (if possible). "preflash:%s" Optionally prepare for a download + flash. E.g. flash directly during download. To deal with a failed "flash" followed by a "boot", we send "preflash:". "erase:%s" Erase the indicated partition (clear to 0xFFs) "boot" The previously downloaded data is a boot.img Loading @@ -140,7 +141,9 @@ Command Reference "powerdown" Power off the device. * Note about sparse files Large files can be split up using libsparse, and sent to the bootloader as repeated chunks of "download:%08x" + "flash:%s". Client Variables ---------------- Loading @@ -151,9 +154,6 @@ on it. The various currently defined names are: version Version of FastBoot protocol supported. It should be "0.3" for this document. version-bootloader Version string for the Bootloader. version-baseband Version string of the Baseband Software Loading