iPXE
fdt_cmd.c File Reference

Flattened Device Tree commands. More...

#include <getopt.h>
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
#include <usr/imgmgmt.h>
#include <usr/fdtmgmt.h>

Go to the source code of this file.

Data Structures

struct  fdt_options
 "fdt" options More...

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
static int fdt_exec (int argc, char **argv)
 The "fdt" command.
 COMMAND (fdt, fdt_exec)
 Flattened Device Tree commands.

Variables

static struct option_descriptor fdt_opts []
 "fdt" option list
static struct command_descriptor fdt_cmd
 "fdt" command descriptor

Detailed Description

Flattened Device Tree commands.

Definition in file fdt_cmd.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ fdt_exec()

int fdt_exec ( int argc,
char ** argv )
static

The "fdt" command.

Parameters
argcArgument count
argvArgument list
Return values
rcReturn status code

Definition at line 62 of file fdt_cmd.c.

62 {
63 struct fdt_options opts;
64 struct image *image = NULL;
65 char *name_uri;
66 int rc;
67
68 /* Parse options */
69 if ( ( rc = parse_options ( argc, argv, &fdt_cmd, &opts ) ) != 0 )
70 goto err_parse;
71
72 /* Parse name/URI string */
73 name_uri = argv[optind];
74
75 /* Acquire image, if applicable */
76 if ( name_uri && ( ( rc = imgacquire ( name_uri, opts.timeout,
77 &image ) ) != 0 ) ) {
78 goto err_image;
79 }
80
81 /* (Un)register as FDT */
82 if ( ( rc = imgfdt ( image ) ) != 0 )
83 goto err_fdt;
84
85 err_fdt:
86 err_image:
87 err_parse:
88 return rc;
89}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
static union @024010030001061367220137227263210031030210157031 opts
"cert<xxx>" option list
static struct command_descriptor fdt_cmd
"fdt" command descriptor
Definition fdt_cmd.c:52
int imgfdt(struct image *image)
Apply flattened device tree image.
Definition fdtmgmt.c:42
int optind
Current option index.
Definition getopt.c:52
int imgacquire(const char *name_uri, unsigned long timeout, struct image **image)
Acquire an image.
Definition imgmgmt.c:143
int parse_options(int argc, char **argv, struct command_descriptor *cmd, void *opts)
Parse command-line options.
Definition parseopt.c:485
"fdt" options
Definition fdt_cmd.c:40
An executable image.
Definition image.h:24

References fdt_cmd, imgacquire(), imgfdt(), NULL, optind, opts, parse_options(), and rc.

Referenced by COMMAND().

◆ COMMAND()

COMMAND ( fdt ,
fdt_exec  )

Flattened Device Tree commands.

References fdt_exec().

Variable Documentation

◆ fdt_opts

struct option_descriptor fdt_opts[]
static
Initial value:
= {
OPTION_DESC ( "timeout", 't', required_argument,
}
void timeout(int)
@ required_argument
Option requires an argument.
Definition getopt.h:19
int parse_timeout(char *text, unsigned long *value)
Parse timeout value (in ms)
Definition parseopt.c:115
#define OPTION_DESC(_longopt, _shortopt, _has_arg, _struct, _field, _parse)
Construct option descriptor.
Definition parseopt.h:68

"fdt" option list

Definition at line 46 of file fdt_cmd.c.

46 {
47 OPTION_DESC ( "timeout", 't', required_argument,
49};

◆ fdt_cmd

struct command_descriptor fdt_cmd
static
Initial value:
=
COMMAND_DESC ( struct fdt_options, fdt_opts, 0, 1, "[<uri>]" )
static struct option_descriptor fdt_opts[]
"fdt" option list
Definition fdt_cmd.c:46
#define COMMAND_DESC(_struct, _options, _min_args, _max_args, _usage)
Construct command descriptor.
Definition parseopt.h:109

"fdt" command descriptor

Definition at line 52 of file fdt_cmd.c.

Referenced by fdt_exec(), and PROVIDE_REQUIRING_SYMBOL().