[U-Boot] [PATCH v2] common/cmd_bootm.c: fix subcommand processing in OS specific do_bootm_xxx() functions
myan
miao.yan at windriver.com
Mon Nov 4 04:18:14 CET 2013
From: Miao Yan <miao.yan at windriver.com>
In commit "5c427e4: use BOOTM_STATE_OS_CMDLINE flag for plain bootm"
and "3d187b3: Only pass BOOTM_STATE_OS_CMDLINE on PowerPC/MIPS",
BOOTM_STATE_OS_CMDLINE was added to do_bootm for PowerPC and MIPS. This
breaks other OSes (vxworks, netbsd, plan9,...) that don't support
subcommand processing, e.g. they all contain the following code in their
do_bootm_xxx():
if (flag & BOOTM_STATE_OS_PREP)
return 0;
if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
return 1;
which will result a "subcommand not supported" error.
This patch changes the above logic to:
/* if not go command, pretend everything to be OK */
if (flag != BOOTM_STATE_OS_GO)
return 0;
Signed-off-by: Miao Yan <miao.yan at windriver.com>
---
Changes from v1:
1) fix a typo in do_bootm_vxworks
2) fix a typo in commit message
common/cmd_bootm.c | 32 ++++++++------------------------
1 file changed, 8 insertions(+), 24 deletions(-)
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 22b935b..cf60b41 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -1481,10 +1481,8 @@ static int do_bootm_netbsd(int flag, int argc, char * const argv[],
char *consdev;
char *cmdline;
- if (flag & BOOTM_STATE_OS_PREP)
+ if (flag != BOOTM_STATE_OS_GO)
return 0;
- if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
- return 1;
#if defined(CONFIG_FIT)
if (!images->legacy_hdr_valid) {
@@ -1562,10 +1560,8 @@ static int do_bootm_lynxkdi(int flag, int argc, char * const argv[],
{
image_header_t *hdr = &images->legacy_hdr_os_copy;
- if (flag & BOOTM_STATE_OS_PREP)
+ if (flag != BOOTM_STATE_OS_GO)
return 0;
- if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
- return 1;
#if defined(CONFIG_FIT)
if (!images->legacy_hdr_valid) {
@@ -1586,10 +1582,8 @@ static int do_bootm_rtems(int flag, int argc, char * const argv[],
{
void (*entry_point)(bd_t *);
- if (flag & BOOTM_STATE_OS_PREP)
+ if (flag != BOOTM_STATE_OS_GO)
return 0;
- if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
- return 1;
#if defined(CONFIG_FIT)
if (!images->legacy_hdr_valid) {
@@ -1621,10 +1615,8 @@ static int do_bootm_ose(int flag, int argc, char * const argv[],
{
void (*entry_point)(void);
- if (flag & BOOTM_STATE_OS_PREP)
+ if (flag != BOOTM_STATE_OS_GO)
return 0;
- if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
- return 1;
#if defined(CONFIG_FIT)
if (!images->legacy_hdr_valid) {
@@ -1657,10 +1649,8 @@ static int do_bootm_plan9(int flag, int argc, char * const argv[],
void (*entry_point)(void);
char *s;
- if (flag & BOOTM_STATE_OS_PREP)
+ if (flag != BOOTM_STATE_OS_GO)
return 0;
- if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
- return 1;
#if defined(CONFIG_FIT)
if (!images->legacy_hdr_valid) {
@@ -1756,10 +1746,8 @@ void do_bootvx_fdt(bootm_headers_t *images)
static int do_bootm_vxworks(int flag, int argc, char * const argv[],
bootm_headers_t *images)
{
- if (flag & BOOTM_STATE_OS_PREP)
+ if (flag != BOOTM_STATE_OS_GO)
return 0;
- if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
- return 1;
#if defined(CONFIG_FIT)
if (!images->legacy_hdr_valid) {
@@ -1781,10 +1769,8 @@ static int do_bootm_qnxelf(int flag, int argc, char * const argv[],
char *local_args[2];
char str[16];
- if (flag & BOOTM_STATE_OS_PREP)
+ if (flag != BOOTM_STATE_OS_GO)
return 0;
- if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
- return 1;
#if defined(CONFIG_FIT)
if (!images->legacy_hdr_valid) {
@@ -1808,10 +1794,8 @@ static int do_bootm_integrity(int flag, int argc, char * const argv[],
{
void (*entry_point)(void);
- if (flag & BOOTM_STATE_OS_PREP)
+ if (flag != BOOTM_STATE_OS_GO)
return 0;
- if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
- return 1;
#if defined(CONFIG_FIT)
if (!images->legacy_hdr_valid) {
--
1.7.9.5
More information about the U-Boot
mailing list