summaryrefslogtreecommitdiffstats
path: root/fastboot
diff options
context:
space:
mode:
authorJocelyn Bohr <bohr@google.com>2017-01-26 19:20:53 -0800
committerJocelyn Bohr <bohr@google.com>2017-04-26 11:08:41 -0700
commit98cc28316866e554f6fcb2c2e4f96ca09d98130f (patch)
treeb476d75dc0a9c462c421065d029daae333346251 /fastboot
parent5fe07acd07e596af5c305432648567320781a785 (diff)
downloadcore-98cc28316866e554f6fcb2c2e4f96ca09d98130f.tar.gz
core-98cc28316866e554f6fcb2c2e4f96ca09d98130f.tar.bz2
core-98cc28316866e554f6fcb2c2e4f96ca09d98130f.zip
fastboot: Add 'stage' command
(cherry-picked from internal nyc-iot-dev to AOSP) New user-level command usage: * fastboot stage <infile> Sends the contents of <infile> to the device to stage for use in the next command. This enables OEM commands to use data downloaded from host to device. Bug: 35811075 Test: Manual test on imx6ul Change-Id: I483a18f9f4205d3289ee524656b9d741b16e9fe6 (cherry-picked from commit 001c75c6c0fe6a70a1db2a65253ab3c43ec17d46)
Diffstat (limited to 'fastboot')
-rw-r--r--fastboot/engine.cpp9
-rw-r--r--fastboot/fastboot.cpp13
-rw-r--r--fastboot/fastboot.h1
3 files changed, 23 insertions, 0 deletions
diff --git a/fastboot/engine.cpp b/fastboot/engine.cpp
index bf887c9e9..4cf89ca85 100644
--- a/fastboot/engine.cpp
+++ b/fastboot/engine.cpp
@@ -332,6 +332,15 @@ void fb_queue_download(const char *name, void *data, uint32_t size)
a->msg = mkmsg("downloading '%s'", name);
}
+void fb_queue_download_fd(const char *name, int fd, uint32_t sz)
+{
+ Action *a;
+ a = queue_action(OP_DOWNLOAD_FD, "");
+ a->fd = fd;
+ a->size = sz;
+ a->msg = mkmsg("sending '%s' (%d KB)", name, sz / 1024);
+}
+
void fb_queue_notice(const char *notice)
{
Action *a = queue_action(OP_NOTICE, "");
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 3b524ac3c..e5ba93a59 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -371,6 +371,10 @@ static void usage() {
" continue Continue with autoboot.\n"
" reboot [bootloader|emergency] Reboot device [into bootloader or emergency mode].\n"
" reboot-bootloader Reboot device into bootloader.\n"
+ " oem <parameter1> ... <parameterN> Executes oem specific command.\n"
+ " stage <infile> Sends contents of <infile> to stage for\n"
+ " the next command. Supported only on\n"
+ " Android Things devices.\n"
" help Show this help message.\n"
"\n"
"options:\n"
@@ -1806,6 +1810,15 @@ int main(int argc, char **argv)
}
fb_set_active(slot.c_str());
skip(2);
+ } else if(!strcmp(*argv, "stage")) {
+ require(2);
+ std::string infile(argv[1]);
+ skip(2);
+ struct fastboot_buffer buf;
+ if (!load_buf(transport, infile.c_str(), &buf) || buf.type != FB_BUFFER_FD) {
+ die("cannot load '%s'", infile.c_str());
+ }
+ fb_queue_download_fd(infile.c_str(), buf.fd, buf.sz);
} else if(!strcmp(*argv, "oem")) {
argc = do_oem_command(argc, argv);
} else if(!strcmp(*argv, "flashing")) {
diff --git a/fastboot/fastboot.h b/fastboot/fastboot.h
index 3f9527055..5e9dba948 100644
--- a/fastboot/fastboot.h
+++ b/fastboot/fastboot.h
@@ -64,6 +64,7 @@ void fb_queue_query_save(const char *var, char *dest, uint32_t dest_size);
void fb_queue_reboot(void);
void fb_queue_command(const char *cmd, const char *msg);
void fb_queue_download(const char *name, void *data, uint32_t size);
+void fb_queue_download_fd(const char *name, int fd, uint32_t sz);
void fb_queue_notice(const char *notice);
void fb_queue_wait_for_disconnect(void);
int64_t fb_execute_queue(Transport* transport);