Skip to content

Commit

Permalink
Added 'lfs_size' in 'build_config' group
Browse files Browse the repository at this point in the history
  • Loading branch information
serg3295 committed Jun 23, 2024
1 parent 7186232 commit ca8403a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
10 changes: 10 additions & 0 deletions components/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ set(buildinfo_h
#define BUILDINFO_RELEASE_DTS \"@release_dts@\"
#define BUILDINFO_BUILD_DATE \"@build_date@\"
#define BUILDINFO_MODULES \"@buildinfo_modules@\"
#define BUILDINFO_LFS_SIZE \@buildinfo_lfs_size@\
#endif /* __BUILDINFO_H__ */
"
Expand Down Expand Up @@ -245,6 +246,15 @@ execute_process(
OUTPUT_VARIABLE release_dts
)

execute_process(
COMMAND grep "^lfs,.*" ${PROJECT_DIR}/components/platform/partitions.csv
COMMAND cut -d, -f5
COMMAND tr -d " "
COMMAND awk "{print strtonum( $1 )}"
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE buildinfo_lfs_size
)

file(CONFIGURE OUTPUT ${PROJECT_DIR}/components/platform/include/buildinfo.h
CONTENT "${buildinfo_h}"
@ONLY
Expand Down
7 changes: 4 additions & 3 deletions components/modules/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,9 @@ static int node_info( lua_State* L ){
case 2: { // sw_version
lua_createtable(L, 0, 8);
add_string_field(L, NODE_VERSION, "node_version");
add_int_field(L, NODE_VERSION_MAJOR, "node_version_major");
add_int_field(L, NODE_VERSION_MINOR, "node_version_minor");
add_int_field(L, NODE_VERSION_REVISION, "node_version_revision");
add_int_field(L, NODE_VERSION_MAJOR, "node_version_major");
add_int_field(L, NODE_VERSION_MINOR, "node_version_minor");
add_int_field(L, NODE_VERSION_REVISION, "node_version_revision");
add_string_field(L, BUILDINFO_BRANCH, "git_branch");
add_string_field(L, BUILDINFO_COMMIT_ID, "git_commit_id");
add_string_field(L, BUILDINFO_RELEASE, "git_release");
Expand All @@ -472,6 +472,7 @@ static int node_info( lua_State* L ){
lua_createtable(L, 0, 3);
lua_pushboolean(L, CONFIG_MBEDTLS_TLS_ENABLED);
lua_setfield(L, -2, "ssl");
add_int_field(L, BUILDINFO_LFS_SIZE, "lfs_size");
add_string_field(L, BUILDINFO_BUILD_TYPE, "number_type");
add_string_field(L, BUILDINFO_MODULES, "modules");
return 1;
Expand Down
1 change: 1 addition & 0 deletions docs/modules/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ If a `group` is given the return value will be a table containing the following

- for `group` = `"build_config"`
- `ssl` (boolean)
- `lfs_size` (number) as defined at build time
- `modules` (string) comma separated list
- `number_type` (string) `integer`, `float` or `double`

Expand Down

0 comments on commit ca8403a

Please sign in to comment.