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 66 of file fdt_cmd.c.

66 {
67 struct fdt_options opts;
68 struct image *image = NULL;
69 char *name_uri;
70 int rc;
71
72 /* Parse options */
73 if ( ( rc = parse_options ( argc, argv, &fdt_cmd, &opts ) ) != 0 )
74 goto err_parse;
75
76 /* Parse name/URI string */
77 name_uri = argv[optind];
78
79 /* Acquire image, if applicable */
80 if ( name_uri && ( ( rc = imgacquire ( name_uri, opts.timeout,
81 opts.quiet, &image ) ) != 0 ) ){
82 goto err_image;
83 }
84
85 /* (Un)register as FDT */
86 if ( ( rc = imgfdt ( image ) ) != 0 )
87 goto err_fdt;
88
89 err_fdt:
90 err_image:
91 err_parse:
92 return rc;
93}
#define NULL
NULL pointer (VOID *).
Definition Base.h:321
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:56
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, int quiet, struct image **image)
Acquire an image.
Definition imgmgmt.c:148
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,
OPTION_DESC ( "quiet", 'q', no_argument,
struct fdt_options, quiet, parse_flag ),
}
void timeout(int)
@ required_argument
Option requires an argument.
Definition getopt.h:19
@ no_argument
Option does not take an argument.
Definition getopt.h:17
int parse_flag(char *text __unused, int *flag)
Parse flag.
Definition parseopt.c:227
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 48 of file fdt_cmd.c.

48 {
49 OPTION_DESC ( "timeout", 't', required_argument,
51 OPTION_DESC ( "quiet", 'q', no_argument,
52 struct fdt_options, quiet, parse_flag ),
53};

◆ 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:48
#define COMMAND_DESC(_struct, _options, _min_args, _max_args, _usage)
Construct command descriptor.
Definition parseopt.h:109

"fdt" command descriptor

Definition at line 56 of file fdt_cmd.c.

Referenced by fdt_exec(), and PROVIDE_REQUIRING_SYMBOL().