X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=include%2Fcli.h;h=4c39b9e2b1f17420fb9129907eb4cd319a5349e1;hb=2bfe4890856c94d939e193999dccdc75afc5c5bd;hp=5158976b8dd4db143acc766bb5c66e8eb646fcf0;hpb=c1bb2cd0b6a3d1b152be3686601234b3a363772b;p=oweals%2Fu-boot.git diff --git a/include/cli.h b/include/cli.h index 5158976b8d..4c39b9e2b1 100644 --- a/include/cli.h +++ b/include/cli.h @@ -30,6 +30,14 @@ void cli_simple_loop(void); */ int cli_simple_run_command(const char *cmd, int flag); +/** + * cli_simple_process_macros() - Expand $() and ${} format env. variables + * + * @param input Input string possible containing $() / ${} vars + * @param output Output string with $() / ${} vars expanded + */ +void cli_simple_process_macros(const char *input, char *output); + /** * cli_simple_run_command_list() - Execute a list of command * @@ -100,6 +108,39 @@ int cli_readline_into_buffer(const char *const prompt, char *buffer, */ int cli_simple_parse_line(char *line, char *argv[]); +#if CONFIG_IS_ENABLED(OF_CONTROL) +/** + * cli_process_fdt() - process the boot command from the FDT + * + * If bootcmmd is defined in the /config node of the FDT, we use that + * as the boot command. Further, if bootsecure is set to 1 (in the same + * node) then we return true, indicating that the command should be executed + * as securely as possible, avoiding the CLI parser. + * + * @cmdp: On entry, the command that will be executed if the FDT does + * not have a command. Returns the command to execute after + * checking the FDT. + * @return true to execute securely, else false + */ +bool cli_process_fdt(const char **cmdp); + +/** cli_secure_boot_cmd() - execute a command as securely as possible + * + * This avoids using the parser, thus executing the command with the + * smallest amount of code. Parameters are not supported. + */ +void cli_secure_boot_cmd(const char *cmd); +#else +static inline bool cli_process_fdt(const char **cmdp) +{ + return false; +} + +static inline void cli_secure_boot_cmd(const char *cmd) +{ +} +#endif /* CONFIG_OF_CONTROL */ + /** * Go into the command loop *