Skip to contentSkip to conversation

cmd: remove NET and CMD_NET dependency for CMD_PXE

PATCH New Patrice Chotard 2 participants 13 messages Nov 25, 2019 – Dec 6, 2019

lore
Share & tools
lore
#0 lore raw

v3 cover cmd: remove NET and CMD_NET dependency for CMD_PXE

It allows to use sysboot command on board which have no NET support.

Currently, sysboot command can't be used if CMD_NET and NET flags are not set, while sysboot allows to load extlinux.conf file from local filesystem, so it doesn't need to depend of CMD_NET and NET flags.

- Move from_env() from pxe.c to nvedit.c.
- As sysboot and pxe commands are sharing piece of code, put this common code into a new file pxe_utils.c.
- Extract sysboot command's code outside pxe.c and create a new sysboot.c file.
- Fix some checkpatch issues.

Patrice Chotard (6):
cmd: Migrate from_env() from pxe.c to nvedit.c
cmd: Prepare sysboot command independence
cmd: sysboot: Create a sysboot command dedicated file
cmd: pxe_utils: Fix checkpatch WARNING/CHECK
cmd: sysboot: Fix checkpatch WARNING/CHECK
cmd: pxe: Fix checkpatch WARNING/CHECK

 Kconfig         |    1 +
 cmd/Kconfig     |    6 +
 cmd/Makefile    |    3 +-
 cmd/nvedit.c    |   17 +
 cmd/pxe.c       | 1730 ++---------------------------------------------
 cmd/pxe_utils.c | 1413 ++++++++++++++++++++++++++++++++++++++
 cmd/pxe_utils.h |   90 +++
 cmd/sysboot.c   |  134 ++++
 include/env.h   |   10 +
 9 files changed, 1726 insertions(+), 1678 deletions(-)
 create mode 100644 cmd/pxe_utils.c
 create mode 100644 cmd/pxe_utils.h
 create mode 100644 cmd/sysboot.c
Signature · 1 line
2.17.1
#1 lore raw

PATCH v3 1/6 cmd: Migrate from_env() from pxe.c to nvedit.c

Migrate from_env() from pxe.c to nvedit.c as it's not pxe specific.

---

 cmd/nvedit.c  | 17 +++++++++++++++++
 cmd/pxe.c     | 17 -----------------
 include/env.h | 10 ++++++++++
 3 files changed, 27 insertions(+), 17 deletions(-)
cmd/nvedit.c +17 -0
index 99a3bc57b1..979def9c9c 100644
@@ -680,6 +680,23 @@ char *env_get(const char *name)
 	return NULL;
 }
 
+/*
+ * Like env_get, but prints an error if envvar isn't defined in the
+ * environment.  It always returns what env_get does, so it can be used in
+ * place of env_get without changing error handling otherwise.
+ */
+char *from_env(const char *envvar)
+{
+	char *ret;
+
+	ret = env_get(envvar);
+
+	if (!ret)
+		printf("missing environment variable: %s\n", envvar);
+
+	return ret;
+}
+
 /*
  * Look up variable from environment for restricted C runtime env.
  */
cmd/pxe.c +0 -17
index 2059975446..2665c4f88d 100644
@@ -37,23 +37,6 @@ const char *pxe_default_paths[] = {
 
 static bool is_pxe;
 
-/*
- * Like env_get, but prints an error if envvar isn't defined in the
- * environment.  It always returns what env_get does, so it can be used in
- * place of env_get without changing error handling otherwise.
- */
-static char *from_env(const char *envvar)
-{
-	char *ret;
-
-	ret = env_get(envvar);
-
-	if (!ret)
-		printf("missing environment variable: %s\n", envvar);
-
-	return ret;
-}
-
 #ifdef CONFIG_CMD_NET
 /*
  * Convert an ethaddr from the environment to the format used by pxelinux
include/env.h +10 -0
index b72239f6a5..d6c2d751d6 100644
@@ -113,6 +113,16 @@ int env_match(unsigned char *name, int index);
  */
 char *env_get(const char *varname);
 
+/*
+ * Like env_get, but prints an error if envvar isn't defined in the
+ * environment.  It always returns what env_get does, so it can be used in
+ * place of env_get without changing error handling otherwise.
+ *
+ * @varname:	Variable to look up
+ * @return value of variable, or NULL if not found
+ */
+char *from_env(const char *envvar);
+
 /**
  * env_get_f() - Look up the value of an environment variable (early)
  *
Signature · 1 line
2.17.1
#2 lore raw

PATCH v3 1/6 cmd: Migrate from_env() from pxe.c to nvedit.c

Quoted 3 lines · Patrice Chotard

Migrate from_env() from pxe.c to nvedit.c as it's not pxe specific.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191206/25c23a2d/attachment.sig>
#3 lore raw

PATCH v3 2/6 cmd: Prepare sysboot command independence

In reply to Patrice Chotard

As sysboot and pxe commands are sharing piece of code, migrate this common code into a new file pxe_utils.c to prepare sysboot command code extraction from pxe.c

---

 cmd/Makefile    |    2 +-
 cmd/pxe.c       | 1478 +----------------------------------------------
 cmd/pxe_utils.c | 1414 +++++++++++++++++++++++++++++++++++++++++++++
 cmd/pxe_utils.h |   90 +++
 4 files changed, 1507 insertions(+), 1477 deletions(-)
 create mode 100644 cmd/pxe_utils.c
 create mode 100644 cmd/pxe_utils.h
cmd/Makefile +1 -1
index 2d723ea0f0..723b461e0d 100644
@@ -108,7 +108,7 @@ ifdef CONFIG_PCI
 obj-$(CONFIG_CMD_PCI) += pci.o
 endif
 obj-$(CONFIG_CMD_PINMUX) += pinmux.o
-obj-$(CONFIG_CMD_PXE) += pxe.o
+obj-$(CONFIG_CMD_PXE) += pxe.o pxe_utils.o
 obj-$(CONFIG_CMD_WOL) += wol.o
 obj-$(CONFIG_CMD_QFW) += qfw.o
 obj-$(CONFIG_CMD_READ) += read.o
cmd/pxe.c +2 -1476

1,508 lines not on this page · raw message

cmd/pxe_utils.c new file +1414 -0

1,414 lines not on this page · raw message

cmd/pxe_utils.h new file +90 -0

70 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#4 lore raw

PATCH v3 2/6 cmd: Prepare sysboot command independence

Quoted 5 lines · Patrice Chotard

As sysboot and pxe commands are sharing piece of code, migrate this common code into a new file pxe_utils.c to prepare sysboot command code extraction from pxe.c

With a little function shuffling to reduce the size growth (due to how gcc optimizes things) of the now shared functions:

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191206/d5861c51/attachment.sig>
#5 lore raw

PATCH v3 3/6 cmd: sysboot: Create a sysboot command dedicated file

In reply to Patrice Chotard

Extract all sysboot command related code from pxe.c to new sysboot.c Update Kconfig to insure that DISTRO_DEFAULT select new CMD_SYSBOOT command.

---

 Kconfig       |   1 +
 cmd/Kconfig   |   6 +++
 cmd/Makefile  |   1 +
 cmd/pxe.c     | 132 ------------------------------------------------
 cmd/sysboot.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 143 insertions(+), 132 deletions(-)
 create mode 100644 cmd/sysboot.c
Kconfig +1 -0
index cda4f58ff7..0a1643f7d6 100644
@@ -88,6 +88,7 @@ config DISTRO_DEFAULTS
 	select CMD_PART if PARTITIONS
 	select CMD_PING if CMD_NET
 	select CMD_PXE if NET
+	select CMD_SYSBOOT
 	select ENV_VARS_UBOOT_CONFIG
 	select HUSH_PARSER
 	select SUPPORT_RAW_INITRD
cmd/Kconfig +6 -0
index cf982ff65e..23634a7818 100644
@@ -1667,6 +1667,12 @@ config CMD_SOUND
 	     sound init   - set up sound system
 	     sound play   - play a sound
 
+config CMD_SYSBOOT
+	bool "sysboot"
+	select MENU
+	help
+	  Boot image via local extlinux.conf file
+
 config CMD_QFW
 	bool "qfw"
 	select QFW
cmd/Makefile +1 -0
index 723b461e0d..3d3ed184fd 100644
@@ -127,6 +127,7 @@ obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
 obj-$(CONFIG_CMD_SPI) += spi.o
 obj-$(CONFIG_CMD_STRINGS) += strings.o
 obj-$(CONFIG_CMD_SMC) += smccc.o
+obj-$(CONFIG_CMD_SYSBOOT) += sysboot.o pxe_utils.o
 obj-$(CONFIG_CMD_TERMINAL) += terminal.o
 obj-$(CONFIG_CMD_TIME) += time.o
 obj-$(CONFIG_CMD_TRACE) += trace.o
cmd/pxe.c +0 -132

147 lines not on this page · raw message

cmd/sysboot.c new file +135 -0

135 lines not on this page · raw message

Signature · 1 line
2.17.1
#6 lore raw

PATCH v3 3/6 cmd: sysboot: Create a sysboot command dedicated file

Quoted 5 lines · Patrice Chotard

Extract all sysboot command related code from pxe.c to new sysboot.c Update Kconfig to insure that DISTRO_DEFAULT select new CMD_SYSBOOT command.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191206/2895bf0b/attachment.sig>
#7 lore raw

PATCH v3 4/6 cmd: pxe_utils: Fix checkpatch WARNING/CHECK

In reply to Patrice Chotard

Fix checkpatch WARNING and CHECK issues

---

 cmd/pxe_utils.c | 93 ++++++++++++++++++++++++-------------------------
 1 file changed, 46 insertions(+), 47 deletions(-)
cmd/pxe_utils.c +46 -47
index c318f98417..86a669fa79 100644
@@ -78,14 +78,14 @@ static int get_bootfile_path(const char *file_path, char *bootfile_path,
 
 	last_slash = strrchr(bootfile, '/');
 
-	if (last_slash == NULL				)
+	if (!last_slash)
 		goto ret;
 
 	path_len = (last_slash - bootfile) + 1;
 
 	if (bootfile_path_size < path_len) {
 		printf("bootfile_path too small. (%zd < %zd)\n",
-				bootfile_path_size, path_len);
+		       bootfile_path_size, path_len);
 
 		return -1;
 	}
@@ -109,10 +109,10 @@ int (*do_getfile)(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr);
  * Returns 1 for success, or < 0 on error.
  */
 static int get_relfile(cmd_tbl_t *cmdtp, const char *file_path,
-	unsigned long file_addr)
+		       unsigned long file_addr)
 {
 	size_t path_len;
-	char relfile[MAX_TFTP_PATH_LEN+1];
+	char relfile[MAX_TFTP_PATH_LEN + 1];
 	char addr_buf[18];
 	int err;
 
@@ -125,9 +125,7 @@ static int get_relfile(cmd_tbl_t *cmdtp, const char *file_path,
 	path_len += strlen(relfile);
 
 	if (path_len > MAX_TFTP_PATH_LEN) {
-		printf("Base path too long (%s%s)\n",
-					relfile,
-					file_path);
+		printf("Base path too long (%s%s)\n", relfile, file_path);
 
 		return -ENAMETOOLONG;
 	}
@@ -149,7 +147,7 @@ static int get_relfile(cmd_tbl_t *cmdtp, const char *file_path,
  * Returns 1 on success, or < 0 for error.
  */
 int get_pxe_file(cmd_tbl_t *cmdtp, const char *file_path,
-	unsigned long file_addr)
+		 unsigned long file_addr)
 {
 	unsigned long config_file_size;
 	char *tftp_filesize;
@@ -182,7 +180,6 @@ int get_pxe_file(cmd_tbl_t *cmdtp, const char *file_path,
 
 #define PXELINUX_DIR "pxelinux.cfg/"
 
-
 /*
  * Retrieves a file in the 'pxelinux.cfg' folder. Since this uses get_pxe_file
  * to do the hard work, the location of the 'pxelinux.cfg' folder is generated
@@ -191,14 +188,14 @@ int get_pxe_file(cmd_tbl_t *cmdtp, const char *file_path,
  * Returns 1 on success or < 0 on error.
  */
 int get_pxelinux_path(cmd_tbl_t *cmdtp, const char *file,
-	unsigned long pxefile_addr_r)
+		      unsigned long pxefile_addr_r)
 {
 	size_t base_len = strlen(PXELINUX_DIR);
-	char path[MAX_TFTP_PATH_LEN+1];
+	char path[MAX_TFTP_PATH_LEN + 1];
 
 	if (base_len + strlen(file) > MAX_TFTP_PATH_LEN) {
 		printf("path (%s%s) too long, skipping\n",
-				PXELINUX_DIR, file);
+		       PXELINUX_DIR, file);
 		return -ENAMETOOLONG;
 	}
 
@@ -276,7 +273,8 @@ int pxe_ipaddr_paths(cmd_tbl_t *cmdtp, unsigned long pxefile_addr_r)
  *
  * Returns 1 on success or < 0 on error.
  */
-static int get_relfile_envaddr(cmd_tbl_t *cmdtp, const char *file_path, const char *envaddr_name)
+static int get_relfile_envaddr(cmd_tbl_t *cmdtp, const char *file_path,
+			       const char *envaddr_name)
 {
 	unsigned long file_addr;
 	char *envaddr;
@@ -427,16 +425,16 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 		return 0;
 	}
 
-	if (label->kernel == NULL) {
+	if (!label->kernel) {
 		printf("No kernel given, skipping %s\n",
-				label->name);
+		       label->name);
 		return 1;
 	}
 
 	if (label->initrd) {
 		if (get_relfile_envaddr(cmdtp, label->initrd, "ramdisk_addr_r") < 0) {
 			printf("Skipping %s for failure retrieving initrd\n",
-					label->name);
+			       label->name);
 			return 1;
 		}
 
@@ -448,7 +446,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 
 	if (get_relfile_envaddr(cmdtp, label->kernel, "kernel_addr_r") < 0) {
 		printf("Skipping %s for failure retrieving kernel\n",
-				label->name);
+		       label->name);
 		return 1;
 	}
 
@@ -461,6 +459,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 #ifdef CONFIG_CMD_NET
 	if (label->ipappend & 0x2) {
 		int err;
+
 		strcpy(mac_str, " BOOTIF=");
 		err = format_mac_pxe(mac_str + 8, sizeof(mac_str) - 8);
 		if (err < 0)
@@ -479,17 +478,17 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 			       strlen(ip_str), strlen(mac_str),
 			       sizeof(bootargs));
 			return 1;
-		} else {
-			if (label->append)
-				strncpy(bootargs, label->append,
-					sizeof(bootargs));
-			strcat(bootargs, ip_str);
-			strcat(bootargs, mac_str);
-
-			cli_simple_process_macros(bootargs, finalbootargs);
-			env_set("bootargs", finalbootargs);
-			printf("append: %s\n", finalbootargs);
 		}
+
+		if (label->append)
+			strncpy(bootargs, label->append, sizeof(bootargs));
+
+		strcat(bootargs, ip_str);
+		strcat(bootargs, mac_str);
+
+		cli_simple_process_macros(bootargs, finalbootargs);
+		env_set("bootargs", finalbootargs);
+		printf("append: %s\n", finalbootargs);
 	}
 
 	bootm_argv[1] = env_get("kernel_addr_r");
@@ -573,11 +572,13 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 		}
 
 		if (fdtfile) {
-			int err = get_relfile_envaddr(cmdtp, fdtfile, "fdt_addr_r");
+			int err = get_relfile_envaddr(cmdtp, fdtfile,
+						      "fdt_addr_r");
+
 			free(fdtfilefree);
 			if (err < 0) {
 				printf("Skipping %s for failure retrieving fdt\n",
-						label->name);
+				       label->name);
 				goto cleanup;
 			}
 		} else {
@@ -720,7 +721,8 @@ static char *get_string(char **p, struct token *t, char delim, int lower)
 	 * e is incremented until we find the ending delimiter, or a NUL byte
 	 * is reached. Then, we take e - b to find the length of the token.
 	 */
-	b = e = *p;
+	b = *p;
+	e = *p;
 
 	while (*e) {
 		if ((delim == ' ' && isspace(*e)) || delim == *e)
@@ -880,7 +882,7 @@ static int parse_integer(char **c, int *dst)
 }
 
 static int parse_pxefile_top(cmd_tbl_t *cmdtp, char *p, unsigned long base,
-	struct pxe_menu *cfg, int nest_level);
+			     struct pxe_menu *cfg, int nest_level);
 
 /*
  * Parse an include statement, and retrieve and parse the file it mentions.
@@ -891,7 +893,7 @@ static int parse_pxefile_top(cmd_tbl_t *cmdtp, char *p, unsigned long base,
  * incremented here.
  */
 static int handle_include(cmd_tbl_t *cmdtp, char **c, unsigned long base,
-				struct pxe_menu *cfg, int nest_level)
+			  struct pxe_menu *cfg, int nest_level)
 {
 	char *include_path;
 	char *s = *c;
@@ -902,8 +904,7 @@ static int handle_include(cmd_tbl_t *cmdtp, char **c, unsigned long base,
 	err = parse_sliteral(c, &include_path);
 
 	if (err < 0) {
-		printf("Expected include path: %.*s\n",
-				 (int)(*c - s), s);
+		printf("Expected include path: %.*s\n", (int)(*c - s), s);
 		return err;
 	}
 
@@ -932,7 +933,7 @@ static int handle_include(cmd_tbl_t *cmdtp, char **c, unsigned long base,
  * a file it includes, 3 when parsing a file included by that file, and so on.
  */
 static int parse_menu(cmd_tbl_t *cmdtp, char **c, struct pxe_menu *cfg,
-				unsigned long base, int nest_level)
+		      unsigned long base, int nest_level)
 {
 	struct token t;
 	char *s = *c;
@@ -947,8 +948,7 @@ static int parse_menu(cmd_tbl_t *cmdtp, char **c, struct pxe_menu *cfg,
 		break;
 
 	case T_INCLUDE:
-		err = handle_include(cmdtp, c, base, cfg,
-						nest_level + 1);
+		err = handle_include(cmdtp, c, base, cfg, nest_level + 1);
 		break;
 
 	case T_BACKGROUND:
@@ -957,7 +957,7 @@ static int parse_menu(cmd_tbl_t *cmdtp, char **c, struct pxe_menu *cfg,
 
 	default:
 		printf("Ignoring malformed menu command: %.*s\n",
-				(int)(*c - s), s);
+		       (int)(*c - s), s);
 	}
 
 	if (err < 0)
@@ -972,7 +972,7 @@ static int parse_menu(cmd_tbl_t *cmdtp, char **c, struct pxe_menu *cfg,
  * Handles parsing a 'menu line' when we're parsing a label.
  */
 static int parse_label_menu(char **c, struct pxe_menu *cfg,
-				struct pxe_label *label)
+			    struct pxe_label *label)
 {
 	struct token t;
 	char *s;
@@ -995,7 +995,7 @@ static int parse_label_menu(char **c, struct pxe_menu *cfg,
 		break;
 	default:
 		printf("Ignoring malformed menu command: %.*s\n",
-				(int)(*c - s), s);
+		       (int)(*c - s), s);
 	}
 
 	eol_or_eof(c);
@@ -1146,7 +1146,7 @@ static int parse_label(char **c, struct pxe_menu *cfg)
  * Returns 1 on success, < 0 on error.
  */
 static int parse_pxefile_top(cmd_tbl_t *cmdtp, char *p, unsigned long base,
-				struct pxe_menu *cfg, int nest_level)
+			     struct pxe_menu *cfg, int nest_level)
 {
 	struct token t;
 	char *s, *b, *label_name;
@@ -1169,8 +1169,8 @@ static int parse_pxefile_top(cmd_tbl_t *cmdtp, char *p, unsigned long base,
 		case T_MENU:
 			cfg->prompt = 1;
 			err = parse_menu(cmdtp, &p, cfg,
-				base + ALIGN(strlen(b) + 1, 4),
-				nest_level);
+					 base + ALIGN(strlen(b) + 1, 4),
+					 nest_level);
 			break;
 
 		case T_TIMEOUT:
@@ -1196,8 +1196,8 @@ static int parse_pxefile_top(cmd_tbl_t *cmdtp, char *p, unsigned long base,
 
 		case T_INCLUDE:
 			err = handle_include(cmdtp, &p,
-				base + ALIGN(strlen(b), 4), cfg,
-				nest_level + 1);
+					     base + ALIGN(strlen(b), 4), cfg,
+					     nest_level + 1);
 			break;
 
 		case T_PROMPT:
@@ -1212,7 +1212,7 @@ static int parse_pxefile_top(cmd_tbl_t *cmdtp, char *p, unsigned long base,
 
 		default:
 			printf("Ignoring unknown command: %.*s\n",
-							(int)(p - s), s);
+			       (int)(p - s), s);
 			eol_or_eof(&p);
 		}
 
@@ -1313,7 +1313,6 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)
 		if (cfg->default_label &&
 		    (strcmp(label->name, cfg->default_label) == 0))
 			default_num = label->num;
-
 	}
 
 	/*
Signature · 1 line
2.17.1
#8 lore raw

PATCH v3 4/6 cmd: pxe_utils: Fix checkpatch WARNING/CHECK

Quoted 3 lines · Patrice Chotard

Fix checkpatch WARNING and CHECK issues

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191206/be5bfd23/attachment.sig>
#9 lore raw

PATCH v3 5/6 cmd: sysboot: Fix checkpatch WARNING/CHECK

In reply to Patrice Chotard

Fix checkpatch WARNING and CHECK issues

---

 cmd/sysboot.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)
cmd/sysboot.c +12 -13
index 965799a1cb..793d67d2f5 100644
@@ -79,20 +79,20 @@ static int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		pxefile_addr_str = argv[4];
 	}
 
-	if (argc < 6)
+	if (argc < 6) {
 		filename = env_get("bootfile");
-	else {
+	} else {
 		filename = argv[5];
 		env_set("bootfile", filename);
 	}
 
-	if (strstr(argv[3], "ext2"))
+	if (strstr(argv[3], "ext2")) {
 		do_getfile = do_get_ext2;
-	else if (strstr(argv[3], "fat"))
+	} else if (strstr(argv[3], "fat")) {
 		do_getfile = do_get_fat;
-	else if (strstr(argv[3], "any"))
+	} else if (strstr(argv[3], "any")) {
 		do_getfile = do_get_any;
-	else {
+	} else {
 		printf("Invalid filesystem: %s\n", argv[3]);
 		return 1;
 	}
@@ -111,7 +111,7 @@ static int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	cfg = parse_pxefile(cmdtp, pxefile_addr_r);
 
-	if (cfg == NULL) {
+	if (!cfg) {
 		printf("Error parsing config file\n");
 		return 1;
 	}
@@ -126,10 +126,9 @@ static int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	return 0;
 }
 
-U_BOOT_CMD(
-	sysboot, 7, 1, do_sysboot,
-	"command to get and boot from syslinux files",
-	"[-p] <interface> <dev[:part]> <ext2|fat|any> [addr] [filename]\n"
-	"    - load and parse syslinux menu file 'filename' from ext2, fat\n"
-	"      or any filesystem on 'dev' on 'interface' to address 'addr'"
+U_BOOT_CMD(sysboot, 7, 1, do_sysboot,
+	   "command to get and boot from syslinux files",
+	   "[-p] <interface> <dev[:part]> <ext2|fat|any> [addr] [filename]\n"
+	   "    - load and parse syslinux menu file 'filename' from ext2, fat\n"
+	   "      or any filesystem on 'dev' on 'interface' to address 'addr'"
 );
Signature · 1 line
2.17.1
#10 lore raw

PATCH v3 5/6 cmd: sysboot: Fix checkpatch WARNING/CHECK

Quoted 3 lines · Patrice Chotard

Fix checkpatch WARNING and CHECK issues

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191206/7b7f910f/attachment-0001.sig>
#11 lore raw

PATCH v3 6/6 cmd: pxe: Fix checkpatch WARNING/CHECK

In reply to Patrice Chotard

Fix checkpatch WARNING and CHECK issues

---

 cmd/pxe.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
cmd/pxe.c +6 -7
index 757e186d32..ca1e1b188b 100644
@@ -67,7 +67,7 @@ do_pxe_get(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return 1;
 
 	err = strict_strtoul(pxefile_addr_str, 16,
-				(unsigned long *)&pxefile_addr_r);
+			     (unsigned long *)&pxefile_addr_r);
 	if (err < 0)
 		return 1;
 
@@ -129,7 +129,7 @@ do_pxe_boot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	cfg = parse_pxefile(cmdtp, pxefile_addr_r);
 
-	if (cfg == NULL) {
+	if (!cfg) {
 		printf("Error parsing config file\n");
 		return 1;
 	}
@@ -169,10 +169,9 @@ static int do_pxe(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	return CMD_RET_USAGE;
 }
 
-U_BOOT_CMD(
-	pxe, 3, 1, do_pxe,
-	"commands to get and boot from pxe files",
-	"get - try to retrieve a pxe file using tftp\npxe "
-	"boot [pxefile_addr_r] - boot from the pxe file at pxefile_addr_r\n"
+U_BOOT_CMD(pxe, 3, 1, do_pxe,
+	   "commands to get and boot from pxe files",
+	   "get - try to retrieve a pxe file using tftp\n"
+	   "pxe boot [pxefile_addr_r] - boot from the pxe file@pxefile_addr_r\n"
 );
 #endif
Signature · 1 line
2.17.1
#12 lore raw

PATCH v3 6/6 cmd: pxe: Fix checkpatch WARNING/CHECK

Quoted 3 lines · Patrice Chotard

Fix checkpatch WARNING and CHECK issues

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191206/39a6de76/attachment.sig>