Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2020.02 net cmds #1

Open
wants to merge 2 commits into
base: v2020.02/develop
Choose a base branch
from
Open

V2020.02 net cmds #1

wants to merge 2 commits into from

Conversation

sarnold
Copy link
Member

@sarnold sarnold commented Feb 7, 2023

Add scaffolding to detect a custom ethernet protocol (pkt) type for triggering swupdate/rescue boot instead of normal rootfs.

gcc 10 will default to -fno-common, which causes this error at link
time:

  (.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here

This is because both dtc-lexer as well as dtc-parser define the same
global symbol yyloc. Before with -fcommon those were merged into one
defintion. The proper solution would be to to mark this as "extern",
however that leads to:

  dtc-lexer.l:26:16: error: redundant redeclaration of 'yylloc' [-Werror=redundant-decls]
   26 | extern YYLTYPE yylloc;
      |                ^~~~~~
In file included from dtc-lexer.l:24:
dtc-parser.tab.h:127:16: note: previous declaration of 'yylloc' was here
  127 | extern YYLTYPE yylloc;
      |                ^~~~~~
cc1: all warnings being treated as errors

which means the declaration is completely redundant and can just be
dropped.

Signed-off-by: Dirk Mueller <[email protected]>
Signed-off-by: David Gibson <[email protected]>
[robh: cherry-pick from upstream]
Cc: [email protected]
Signed-off-by: Rob Herring <[email protected]>
@sarnold sarnold requested a review from SJLC February 7, 2023 21:36
@sarnold sarnold self-assigned this Feb 7, 2023
@sarnold sarnold added the enhancement New feature or request label Feb 7, 2023
net/Makefile Outdated
@@ -28,6 +28,7 @@ obj-$(CONFIG_CMD_SNTP) += sntp.o
obj-$(CONFIG_CMD_TFTPBOOT) += tftp.o
obj-$(CONFIG_UDP_FUNCTION_FASTBOOT) += fastboot.o
obj-$(CONFIG_CMD_WOL) += wol.o
obj-$(CONFIG_CMD_WOL) += swu.o
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be CONFIG_CMD_SWU ?

net/net.c Outdated
@@ -526,6 +529,11 @@ int net_loop(enum proto_t protocol)
link_local_start();
break;
#endif
#if defined(CONFIG_CMD_SWU)
case WOL:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be SWU?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx, you caught more typos than I did, and now it's at least what it was supposed to be...

if (argc < 2)
return CMD_RET_USAGE;
swu_set_timeout(simple_strtol(argv[1], NULL, 10) * 1000);
if (net_loop(SWU) < 0)
Copy link
Member

@SJLC SJLC Feb 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see timeout stay in msec, instead of user specifying seconds and converting here from sec to msec

cmd/swu.c Outdated
U_BOOT_CMD(
swu, 2, 1, do_swu,
"wait for an incoming swupdate trigger packet",
"Timeout"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If timeout is changed to msec, that should be mentioned here (sec seems to be default time unit for u-boot, think they don't explicitly mention seconds)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right, the default time units for console commands must be seconds, but the #define default values are millisec. Why do we want to be different than other u-boot cmds for console values?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was planning to waste less than a second pausing to listen, if possible

Copy link
Member

@SJLC SJLC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good, but looks like a few copy-modify errors

@sarnold sarnold force-pushed the v2020.02-net-cmds branch 8 times, most recently from a913211 to 4bd2373 Compare February 14, 2023 01:41
* define a custom ether type and corresponding swu command to trigger a
  rescue boot for in-field software upgrades; the expected software
  upgrade framework is currently swupdate (but this is not a hard
  requirement)

* add do_rescue to default u-boot env and set to 0. This fixes an env
  quirk (bug) where test <undefined> -eq N returns true

* check for custom ethertype (0xb990) in main net loop and set do_rescue
  equal 1 in u-boot environment if detected.  The full packet definition
  and a test tool can be found in radar-test-gui repo; see python code in
  protocols/radar_packet_proto.py for packet classes and the corresponding
  wiki docs for packet formats)

https://github.com/goletastar/pcr-data-app/wiki

Signed-off-by: Stephen L Arnold <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants