Skip to content
Snippets Groups Projects
Commit 74322201 authored by Rob Herring's avatar Rob Herring Committed by Tom Rini
Browse files

fastboot: allow retrieving fastboot variables from env


Some boards need to expose device specific variable through fastboot
(to adpat the flashing script depending on hardware revision for
example).

Provide a way to expose custom fastboot variables. Note that all
variables meant to be exposed through fastboot should be be prefixed
with 'fastboot.', the variable should not exceed 32 bytes (including
the prefix and the trailing '\0') and the variable content should
fit in the response buffer (60 bytes excluding the 'OKAY' prefix and
the trailing '\0').

Signed-off-by: default avatarRob Herring <rob.herring@linaro.org>
[Boris Brezillon: add a commit message]
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>

Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: default avatarSteve Rae <srae@broadcom.com>
parent b745e828
No related branches found
No related tags found
No related merge requests found
......@@ -413,8 +413,16 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
else
strcpy(response, "FAILValue not set");
} else {
printf("WARNING: unknown variable: %s\n", cmd);
strcpy(response, "FAILVariable not implemented");
char envstr[32];
snprintf(envstr, sizeof(envstr) - 1, "fastboot.%s", cmd);
s = getenv(envstr);
if (s) {
strncat(response, s, chars_left);
} else {
printf("WARNING: unknown variable: %s\n", cmd);
strcpy(response, "FAILVariable not implemented");
}
}
fastboot_tx_write_str(response);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment