* [PATCH v6 0/3] Add command for getting ramsize in scripts
@ 2026-01-25 13:12 Frank Wunderlich
2026-01-25 13:12 ` [PATCH v6 1/3] cmd: mem: add command for getting ram size for use " Frank Wunderlich
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Frank Wunderlich @ 2026-01-25 13:12 UTC (permalink / raw)
To: Tom Rini; +Cc: Frank Wunderlich, u-boot, Daniel Golle
From: Frank Wunderlich <frank-w@public-files.de>
Add command for getting ramsize in scripts
v6:
- add missing return for error in env_set_long
v5:
- move msize to meminfo and drop first param (always display as MiB)
- rename msize to memsize
- add doc and test so it becomes a series
Frank Wunderlich (3):
cmd: mem: add command for getting ram size for use in scripts
test: cmd: add test for memsize
doc: cmd: add usage doc for memsize
cmd/Kconfig | 7 +++++++
cmd/meminfo.c | 25 +++++++++++++++++++++++
doc/usage/cmd/memsize.rst | 43 +++++++++++++++++++++++++++++++++++++++
test/cmd/meminfo.c | 17 ++++++++++++++++
4 files changed, 92 insertions(+)
create mode 100644 doc/usage/cmd/memsize.rst
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v6 1/3] cmd: mem: add command for getting ram size for use in scripts 2026-01-25 13:12 [PATCH v6 0/3] Add command for getting ramsize in scripts Frank Wunderlich @ 2026-01-25 13:12 ` Frank Wunderlich 2026-01-25 13:12 ` [PATCH v6 2/3] test: cmd: add test for memsize Frank Wunderlich 2026-01-25 13:12 ` [PATCH v6 3/3] doc: cmd: add usage doc " Frank Wunderlich 2 siblings, 0 replies; 9+ messages in thread From: Frank Wunderlich @ 2026-01-25 13:12 UTC (permalink / raw) To: Tom Rini; +Cc: Frank Wunderlich, u-boot, Daniel Golle From: Frank Wunderlich <frank-w@public-files.de> Add a command for getting detected ram size with possibility to assign it to an environment variable. example usage: BPI-R4> memsize 4096 MiB BPI-R4> memsize memsz BPI-R4> printenv memsz memsz=4096 BPI-R4> board with 8GB ram: BPI-R4> memsize 8192 MiB BPI-R4> memsize memsz BPI-R4> printenv memsz memsz=8192 BPI-R4> Signed-off-by: Frank Wunderlich <frank-w@public-files.de> --- v6: add missing return for error in env_set_ulong v5: move msize to meminfo and drop first param (always display as MiB) rename msize to memsize v4: drop rounding to full MB/GB as it leads to wrong display v3: add missing ifdefs v2: add Kconfig entry --- cmd/Kconfig | 6 ++++++ cmd/meminfo.c | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/cmd/Kconfig b/cmd/Kconfig index 5c611fb3016e..be79bf0747df 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -925,6 +925,12 @@ config CMD_MEMINFO_MAP See doc/usage/cmd/meminfo.rst for more information. +config CMD_MEMSIZE + bool "memsize" + depends on CMD_MEMINFO + help + Get RAM via command for use in scripts. + config CMD_MEMORY bool "md, mm, nm, mw, cp, cmp, base, loop" default y diff --git a/cmd/meminfo.c b/cmd/meminfo.c index aa3b5bafe176..e7db9d065f5a 100644 --- a/cmd/meminfo.c +++ b/cmd/meminfo.c @@ -8,10 +8,12 @@ #include <bootstage.h> #include <command.h> #include <display_options.h> +#include <env.h> #include <lmb.h> #include <malloc.h> #include <mapmem.h> #include <asm/global_data.h> +#include <linux/sizes.h> DECLARE_GLOBAL_DATA_PTR; @@ -98,8 +100,31 @@ static int do_meminfo(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } +#ifdef CONFIG_CMD_MEMSIZE +static int do_mem_size(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + u64 memsize = gd->ram_size / SZ_1M; + + if (argc > 1) + return env_set_ulong(argv[1], memsize); + else + printf("%lld MiB\n", memsize); + + return 0; +} +#endif /* CONFIG_CMD_MEMSIZE */ + U_BOOT_CMD( meminfo, 1, 1, do_meminfo, "display memory information", "" ); + +#ifdef CONFIG_CMD_MEMSIZE +U_BOOT_CMD( + memsize, 2, 1, do_mem_size, + "get detected ram size in MiB, optional set env variable with value", + "[envvar]" +); +#endif /* CONFIG_CMD_MEMSIZE */ -- 2.43.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v6 2/3] test: cmd: add test for memsize 2026-01-25 13:12 [PATCH v6 0/3] Add command for getting ramsize in scripts Frank Wunderlich 2026-01-25 13:12 ` [PATCH v6 1/3] cmd: mem: add command for getting ram size for use " Frank Wunderlich @ 2026-01-25 13:12 ` Frank Wunderlich 2026-02-03 23:34 ` Tom Rini 2026-01-25 13:12 ` [PATCH v6 3/3] doc: cmd: add usage doc " Frank Wunderlich 2 siblings, 1 reply; 9+ messages in thread From: Frank Wunderlich @ 2026-01-25 13:12 UTC (permalink / raw) To: Tom Rini; +Cc: Frank Wunderlich, u-boot, Daniel Golle From: Frank Wunderlich <frank-w@public-files.de> Add a test for memsize command in same way as meminfo. Signed-off-by: Frank Wunderlich <frank-w@public-files.de> --- tested via: $ ./u-boot -T -c "ut cmd cmd_test_memsize" ... Test: memsize: meminfo.c Tests run: 1, 0 ms, average: 0 ms, failures: 0 --- cmd/Kconfig | 1 + test/cmd/meminfo.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/cmd/Kconfig b/cmd/Kconfig index be79bf0747df..2bafa156ca8a 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -927,6 +927,7 @@ config CMD_MEMINFO_MAP config CMD_MEMSIZE bool "memsize" + default y if SANDBOX depends on CMD_MEMINFO help Get RAM via command for use in scripts. diff --git a/test/cmd/meminfo.c b/test/cmd/meminfo.c index 53b41e3b49e0..ba772a8b7616 100644 --- a/test/cmd/meminfo.c +++ b/test/cmd/meminfo.c @@ -7,6 +7,7 @@ */ #include <dm/test.h> +#include <env.h> #include <test/cmd.h> #include <test/ut.h> @@ -39,4 +40,20 @@ static int cmd_test_meminfo(struct unit_test_state *uts) return 0; } + +/* Test 'memsize' command */ +static int cmd_test_memsize(struct unit_test_state *uts) +{ + ut_assertok(run_command("memsize", 0)); + ut_assert_nextline("256 MiB"); + ut_assert_console_end(); + + ut_assertok(run_command("memsize memsz", 0)); + ut_asserteq_str("256", env_get("memsz")); + ut_assert_console_end(); + + return 0; +} + CMD_TEST(cmd_test_meminfo, UTF_CONSOLE); +CMD_TEST(cmd_test_memsize, UTF_CONSOLE); -- 2.43.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v6 2/3] test: cmd: add test for memsize 2026-01-25 13:12 ` [PATCH v6 2/3] test: cmd: add test for memsize Frank Wunderlich @ 2026-02-03 23:34 ` Tom Rini 2026-02-04 6:40 ` Frank Wunderlich 0 siblings, 1 reply; 9+ messages in thread From: Tom Rini @ 2026-02-03 23:34 UTC (permalink / raw) To: Frank Wunderlich; +Cc: Frank Wunderlich, u-boot, Daniel Golle [-- Attachment #1: Type: text/plain, Size: 1857 bytes --] On Sun, Jan 25, 2026 at 02:12:52PM +0100, Frank Wunderlich wrote: > From: Frank Wunderlich <frank-w@public-files.de> > > Add a test for memsize command in same way as meminfo. > > Signed-off-by: Frank Wunderlich <frank-w@public-files.de> > --- > tested via: > $ ./u-boot -T -c "ut cmd cmd_test_memsize" > ... > Test: memsize: meminfo.c > Tests run: 1, 0 ms, average: 0 ms, failures: 0 > --- > cmd/Kconfig | 1 + > test/cmd/meminfo.c | 17 +++++++++++++++++ > 2 files changed, 18 insertions(+) > > diff --git a/cmd/Kconfig b/cmd/Kconfig > index be79bf0747df..2bafa156ca8a 100644 > --- a/cmd/Kconfig > +++ b/cmd/Kconfig > @@ -927,6 +927,7 @@ config CMD_MEMINFO_MAP > > config CMD_MEMSIZE > bool "memsize" > + default y if SANDBOX > depends on CMD_MEMINFO > help > Get RAM via command for use in scripts. > diff --git a/test/cmd/meminfo.c b/test/cmd/meminfo.c > index 53b41e3b49e0..ba772a8b7616 100644 > --- a/test/cmd/meminfo.c > +++ b/test/cmd/meminfo.c > @@ -7,6 +7,7 @@ > */ > > #include <dm/test.h> > +#include <env.h> > #include <test/cmd.h> > #include <test/ut.h> > > @@ -39,4 +40,20 @@ static int cmd_test_meminfo(struct unit_test_state *uts) > > return 0; > } > + > +/* Test 'memsize' command */ > +static int cmd_test_memsize(struct unit_test_state *uts) > +{ > + ut_assertok(run_command("memsize", 0)); > + ut_assert_nextline("256 MiB"); > + ut_assert_console_end(); > + > + ut_assertok(run_command("memsize memsz", 0)); > + ut_asserteq_str("256", env_get("memsz")); > + ut_assert_console_end(); > + > + return 0; > +} > + > CMD_TEST(cmd_test_meminfo, UTF_CONSOLE); > +CMD_TEST(cmd_test_memsize, UTF_CONSOLE); Since the new test isn't guarded with memsize, this fails on qemu-x86_64 where meminfo is enabled, but memsize is not. -- Tom [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v6 2/3] test: cmd: add test for memsize 2026-02-03 23:34 ` Tom Rini @ 2026-02-04 6:40 ` Frank Wunderlich 2026-02-04 13:53 ` Tom Rini 0 siblings, 1 reply; 9+ messages in thread From: Frank Wunderlich @ 2026-02-04 6:40 UTC (permalink / raw) To: Tom Rini, Frank Wunderlich; +Cc: u-boot, Daniel Golle Am 4. Februar 2026 00:34:02 MEZ schrieb Tom Rini <trini@konsulko.com>: >On Sun, Jan 25, 2026 at 02:12:52PM +0100, Frank Wunderlich wrote: > >> From: Frank Wunderlich <frank-w@public-files.de> >> >> Add a test for memsize command in same way as meminfo. >> >> Signed-off-by: Frank Wunderlich <frank-w@public-files.de> >> --- >> tested via: >> $ ./u-boot -T -c "ut cmd cmd_test_memsize" >> ... >> Test: memsize: meminfo.c >> Tests run: 1, 0 ms, average: 0 ms, failures: 0 >> --- >> cmd/Kconfig | 1 + >> test/cmd/meminfo.c | 17 +++++++++++++++++ >> 2 files changed, 18 insertions(+) >> >> diff --git a/cmd/Kconfig b/cmd/Kconfig >> index be79bf0747df..2bafa156ca8a 100644 >> --- a/cmd/Kconfig >> +++ b/cmd/Kconfig >> @@ -927,6 +927,7 @@ config CMD_MEMINFO_MAP >> >> config CMD_MEMSIZE >> bool "memsize" >> + default y if SANDBOX >> depends on CMD_MEMINFO >> help >> Get RAM via command for use in scripts. >> diff --git a/test/cmd/meminfo.c b/test/cmd/meminfo.c >> index 53b41e3b49e0..ba772a8b7616 100644 >> --- a/test/cmd/meminfo.c >> +++ b/test/cmd/meminfo.c >> @@ -7,6 +7,7 @@ >> */ >> >> #include <dm/test.h> >> +#include <env.h> >> #include <test/cmd.h> >> #include <test/ut.h> >> >> @@ -39,4 +40,20 @@ static int cmd_test_meminfo(struct unit_test_state *uts) >> >> return 0; >> } >> + >> +/* Test 'memsize' command */ >> +static int cmd_test_memsize(struct unit_test_state *uts) >> +{ >> + ut_assertok(run_command("memsize", 0)); >> + ut_assert_nextline("256 MiB"); >> + ut_assert_console_end(); >> + >> + ut_assertok(run_command("memsize memsz", 0)); >> + ut_asserteq_str("256", env_get("memsz")); >> + ut_assert_console_end(); >> + >> + return 0; >> +} >> + >> CMD_TEST(cmd_test_meminfo, UTF_CONSOLE); >> +CMD_TEST(cmd_test_memsize, UTF_CONSOLE); > >Since the new test isn't guarded with memsize, this fails on qemu-x86_64 >where meminfo is enabled, but memsize is not. Does x86_64 test not use SANDBOX? Do i need to enable it somewhere else? Imho it should ve tested also there so guarding just prevents the test. But of course i can add guards for it. regards Frank ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v6 2/3] test: cmd: add test for memsize 2026-02-04 6:40 ` Frank Wunderlich @ 2026-02-04 13:53 ` Tom Rini 2026-02-04 14:48 ` Frank Wunderlich 0 siblings, 1 reply; 9+ messages in thread From: Tom Rini @ 2026-02-04 13:53 UTC (permalink / raw) To: Frank Wunderlich; +Cc: Frank Wunderlich, u-boot, Daniel Golle [-- Attachment #1: Type: text/plain, Size: 2441 bytes --] On Wed, Feb 04, 2026 at 07:40:05AM +0100, Frank Wunderlich wrote: > Am 4. Februar 2026 00:34:02 MEZ schrieb Tom Rini <trini@konsulko.com>: > >On Sun, Jan 25, 2026 at 02:12:52PM +0100, Frank Wunderlich wrote: > > > >> From: Frank Wunderlich <frank-w@public-files.de> > >> > >> Add a test for memsize command in same way as meminfo. > >> > >> Signed-off-by: Frank Wunderlich <frank-w@public-files.de> > >> --- > >> tested via: > >> $ ./u-boot -T -c "ut cmd cmd_test_memsize" > >> ... > >> Test: memsize: meminfo.c > >> Tests run: 1, 0 ms, average: 0 ms, failures: 0 > >> --- > >> cmd/Kconfig | 1 + > >> test/cmd/meminfo.c | 17 +++++++++++++++++ > >> 2 files changed, 18 insertions(+) > >> > >> diff --git a/cmd/Kconfig b/cmd/Kconfig > >> index be79bf0747df..2bafa156ca8a 100644 > >> --- a/cmd/Kconfig > >> +++ b/cmd/Kconfig > >> @@ -927,6 +927,7 @@ config CMD_MEMINFO_MAP > >> > >> config CMD_MEMSIZE > >> bool "memsize" > >> + default y if SANDBOX > >> depends on CMD_MEMINFO > >> help > >> Get RAM via command for use in scripts. > >> diff --git a/test/cmd/meminfo.c b/test/cmd/meminfo.c > >> index 53b41e3b49e0..ba772a8b7616 100644 > >> --- a/test/cmd/meminfo.c > >> +++ b/test/cmd/meminfo.c > >> @@ -7,6 +7,7 @@ > >> */ > >> > >> #include <dm/test.h> > >> +#include <env.h> > >> #include <test/cmd.h> > >> #include <test/ut.h> > >> > >> @@ -39,4 +40,20 @@ static int cmd_test_meminfo(struct unit_test_state *uts) > >> > >> return 0; > >> } > >> + > >> +/* Test 'memsize' command */ > >> +static int cmd_test_memsize(struct unit_test_state *uts) > >> +{ > >> + ut_assertok(run_command("memsize", 0)); > >> + ut_assert_nextline("256 MiB"); > >> + ut_assert_console_end(); > >> + > >> + ut_assertok(run_command("memsize memsz", 0)); > >> + ut_asserteq_str("256", env_get("memsz")); > >> + ut_assert_console_end(); > >> + > >> + return 0; > >> +} > >> + > >> CMD_TEST(cmd_test_meminfo, UTF_CONSOLE); > >> +CMD_TEST(cmd_test_memsize, UTF_CONSOLE); > > > >Since the new test isn't guarded with memsize, this fails on qemu-x86_64 > >where meminfo is enabled, but memsize is not. > > Does x86_64 test not use SANDBOX? Do i need to enable it somewhere else? Imho it should ve tested also there so guarding just prevents the test. But of course i can add guards for it. No, it's qemu-x86_64 which is a different board :) -- Tom [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v6 2/3] test: cmd: add test for memsize 2026-02-04 13:53 ` Tom Rini @ 2026-02-04 14:48 ` Frank Wunderlich 2026-02-04 14:51 ` Tom Rini 0 siblings, 1 reply; 9+ messages in thread From: Frank Wunderlich @ 2026-02-04 14:48 UTC (permalink / raw) To: Tom Rini; +Cc: Frank Wunderlich, u-boot, Daniel Golle Am 4. Februar 2026 14:53:38 MEZ schrieb Tom Rini <trini@konsulko.com>: >On Wed, Feb 04, 2026 at 07:40:05AM +0100, Frank Wunderlich wrote: >> Am 4. Februar 2026 00:34:02 MEZ schrieb Tom Rini <trini@konsulko.com>: >> >On Sun, Jan 25, 2026 at 02:12:52PM +0100, Frank Wunderlich wrote: >> > >> >> From: Frank Wunderlich <frank-w@public-files.de> >> >> >> >> Add a test for memsize command in same way as meminfo. >> >> >> >> Signed-off-by: Frank Wunderlich <frank-w@public-files.de> >> >> --- >> >> tested via: >> >> $ ./u-boot -T -c "ut cmd cmd_test_memsize" >> >> ... >> >> Test: memsize: meminfo.c >> >> Tests run: 1, 0 ms, average: 0 ms, failures: 0 >> >> --- >> >> cmd/Kconfig | 1 + >> >> test/cmd/meminfo.c | 17 +++++++++++++++++ >> >> 2 files changed, 18 insertions(+) >> >> >> >> diff --git a/cmd/Kconfig b/cmd/Kconfig >> >> index be79bf0747df..2bafa156ca8a 100644 >> >> --- a/cmd/Kconfig >> >> +++ b/cmd/Kconfig >> >> @@ -927,6 +927,7 @@ config CMD_MEMINFO_MAP >> >> >> >> config CMD_MEMSIZE >> >> bool "memsize" >> >> + default y if SANDBOX >> >> depends on CMD_MEMINFO >> >> help >> >> Get RAM via command for use in scripts. >> >> diff --git a/test/cmd/meminfo.c b/test/cmd/meminfo.c >> >> index 53b41e3b49e0..ba772a8b7616 100644 >> >> --- a/test/cmd/meminfo.c >> >> +++ b/test/cmd/meminfo.c >> >> @@ -7,6 +7,7 @@ >> >> */ >> >> >> >> #include <dm/test.h> >> >> +#include <env.h> >> >> #include <test/cmd.h> >> >> #include <test/ut.h> >> >> >> >> @@ -39,4 +40,20 @@ static int cmd_test_meminfo(struct unit_test_state *uts) >> >> >> >> return 0; >> >> } >> >> + >> >> +/* Test 'memsize' command */ >> >> +static int cmd_test_memsize(struct unit_test_state *uts) >> >> +{ >> >> + ut_assertok(run_command("memsize", 0)); >> >> + ut_assert_nextline("256 MiB"); >> >> + ut_assert_console_end(); >> >> + >> >> + ut_assertok(run_command("memsize memsz", 0)); >> >> + ut_asserteq_str("256", env_get("memsz")); >> >> + ut_assert_console_end(); >> >> + >> >> + return 0; >> >> +} >> >> + >> >> CMD_TEST(cmd_test_meminfo, UTF_CONSOLE); >> >> +CMD_TEST(cmd_test_memsize, UTF_CONSOLE); >> > >> >Since the new test isn't guarded with memsize, this fails on qemu-x86_64 >> >where meminfo is enabled, but memsize is not. >> >> Does x86_64 test not use SANDBOX? Do i need to enable it somewhere else? Imho it should ve tested also there so guarding just prevents the test. But of course i can add guards for it. > >No, it's qemu-x86_64 which is a different board :) Ah ok,thought it is a platform test :) Then i add only config-guards. Should it send full series with the requested changes (squashed) or an update (afair you have already applied to next/master)? regards Frank ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v6 2/3] test: cmd: add test for memsize 2026-02-04 14:48 ` Frank Wunderlich @ 2026-02-04 14:51 ` Tom Rini 0 siblings, 0 replies; 9+ messages in thread From: Tom Rini @ 2026-02-04 14:51 UTC (permalink / raw) To: Frank Wunderlich; +Cc: Frank Wunderlich, u-boot, Daniel Golle [-- Attachment #1: Type: text/plain, Size: 3130 bytes --] On Wed, Feb 04, 2026 at 03:48:17PM +0100, Frank Wunderlich wrote: > Am 4. Februar 2026 14:53:38 MEZ schrieb Tom Rini <trini@konsulko.com>: > >On Wed, Feb 04, 2026 at 07:40:05AM +0100, Frank Wunderlich wrote: > >> Am 4. Februar 2026 00:34:02 MEZ schrieb Tom Rini <trini@konsulko.com>: > >> >On Sun, Jan 25, 2026 at 02:12:52PM +0100, Frank Wunderlich wrote: > >> > > >> >> From: Frank Wunderlich <frank-w@public-files.de> > >> >> > >> >> Add a test for memsize command in same way as meminfo. > >> >> > >> >> Signed-off-by: Frank Wunderlich <frank-w@public-files.de> > >> >> --- > >> >> tested via: > >> >> $ ./u-boot -T -c "ut cmd cmd_test_memsize" > >> >> ... > >> >> Test: memsize: meminfo.c > >> >> Tests run: 1, 0 ms, average: 0 ms, failures: 0 > >> >> --- > >> >> cmd/Kconfig | 1 + > >> >> test/cmd/meminfo.c | 17 +++++++++++++++++ > >> >> 2 files changed, 18 insertions(+) > >> >> > >> >> diff --git a/cmd/Kconfig b/cmd/Kconfig > >> >> index be79bf0747df..2bafa156ca8a 100644 > >> >> --- a/cmd/Kconfig > >> >> +++ b/cmd/Kconfig > >> >> @@ -927,6 +927,7 @@ config CMD_MEMINFO_MAP > >> >> > >> >> config CMD_MEMSIZE > >> >> bool "memsize" > >> >> + default y if SANDBOX > >> >> depends on CMD_MEMINFO > >> >> help > >> >> Get RAM via command for use in scripts. > >> >> diff --git a/test/cmd/meminfo.c b/test/cmd/meminfo.c > >> >> index 53b41e3b49e0..ba772a8b7616 100644 > >> >> --- a/test/cmd/meminfo.c > >> >> +++ b/test/cmd/meminfo.c > >> >> @@ -7,6 +7,7 @@ > >> >> */ > >> >> > >> >> #include <dm/test.h> > >> >> +#include <env.h> > >> >> #include <test/cmd.h> > >> >> #include <test/ut.h> > >> >> > >> >> @@ -39,4 +40,20 @@ static int cmd_test_meminfo(struct unit_test_state *uts) > >> >> > >> >> return 0; > >> >> } > >> >> + > >> >> +/* Test 'memsize' command */ > >> >> +static int cmd_test_memsize(struct unit_test_state *uts) > >> >> +{ > >> >> + ut_assertok(run_command("memsize", 0)); > >> >> + ut_assert_nextline("256 MiB"); > >> >> + ut_assert_console_end(); > >> >> + > >> >> + ut_assertok(run_command("memsize memsz", 0)); > >> >> + ut_asserteq_str("256", env_get("memsz")); > >> >> + ut_assert_console_end(); > >> >> + > >> >> + return 0; > >> >> +} > >> >> + > >> >> CMD_TEST(cmd_test_meminfo, UTF_CONSOLE); > >> >> +CMD_TEST(cmd_test_memsize, UTF_CONSOLE); > >> > > >> >Since the new test isn't guarded with memsize, this fails on qemu-x86_64 > >> >where meminfo is enabled, but memsize is not. > >> > >> Does x86_64 test not use SANDBOX? Do i need to enable it somewhere else? Imho it should ve tested also there so guarding just prevents the test. But of course i can add guards for it. > > > >No, it's qemu-x86_64 which is a different board :) > > Ah ok,thought it is a platform test :) > Then i add only config-guards. > > Should it send full series with the requested changes (squashed) or an update (afair you have already applied to next/master)? Please send a v7 that include this fix in this patch, I didn't apply it to master because it caused CI to fail :) -- Tom [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v6 3/3] doc: cmd: add usage doc for memsize 2026-01-25 13:12 [PATCH v6 0/3] Add command for getting ramsize in scripts Frank Wunderlich 2026-01-25 13:12 ` [PATCH v6 1/3] cmd: mem: add command for getting ram size for use " Frank Wunderlich 2026-01-25 13:12 ` [PATCH v6 2/3] test: cmd: add test for memsize Frank Wunderlich @ 2026-01-25 13:12 ` Frank Wunderlich 2 siblings, 0 replies; 9+ messages in thread From: Frank Wunderlich @ 2026-01-25 13:12 UTC (permalink / raw) To: Tom Rini; +Cc: Frank Wunderlich, u-boot, Daniel Golle From: Frank Wunderlich <frank-w@public-files.de> Add documentation for memsize command. Signed-off-by: Frank Wunderlich <frank-w@public-files.de> --- doc/usage/cmd/memsize.rst | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 doc/usage/cmd/memsize.rst diff --git a/doc/usage/cmd/memsize.rst b/doc/usage/cmd/memsize.rst new file mode 100644 index 000000000000..4571795c7b41 --- /dev/null +++ b/doc/usage/cmd/memsize.rst @@ -0,0 +1,43 @@ +.. SPDX-License-Identifier: GPL-2.0+: + +.. index:: + single: memsize (command) + +memsize command +=============== + +Synopsis +-------- + +:: + + memsize [name] + +Description +----------- + +The memsize command shows the amount of memory in MiB. +Optionally value can be assigned to an environment variable. + +Examples +-------- + +This first example shows printing of ram size: + +:: + + => memsize + 8192 MiB + +This second example shows assign ram size to environment variable: + +:: + + => memsize memsz + => printenv memsz + memsz=8192 + +Return value +------------ + +The return value is always 0 except error happens on setting environment variable. -- 2.43.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-02-04 14:52 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-01-25 13:12 [PATCH v6 0/3] Add command for getting ramsize in scripts Frank Wunderlich 2026-01-25 13:12 ` [PATCH v6 1/3] cmd: mem: add command for getting ram size for use " Frank Wunderlich 2026-01-25 13:12 ` [PATCH v6 2/3] test: cmd: add test for memsize Frank Wunderlich 2026-02-03 23:34 ` Tom Rini 2026-02-04 6:40 ` Frank Wunderlich 2026-02-04 13:53 ` Tom Rini 2026-02-04 14:48 ` Frank Wunderlich 2026-02-04 14:51 ` Tom Rini 2026-01-25 13:12 ` [PATCH v6 3/3] doc: cmd: add usage doc " Frank Wunderlich
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox