From ea43db77ffee2d2be816d50e2a9fd62bb9205d75 Mon Sep 17 00:00:00 2001 From: Timo Sairiala Date: Wed, 31 Jul 2024 16:06:02 +0300 Subject: [PATCH 1/4] add git top info --- Tools/generate_basic_build_info.sh | 5 +++++ src/lib/version/px_update_git_header.py | 11 +++++++++++ src/lib/version/version.c | 5 +++++ src/lib/version/version.h | 6 ++++++ 4 files changed, 27 insertions(+) diff --git a/Tools/generate_basic_build_info.sh b/Tools/generate_basic_build_info.sh index 8838aeef4516..e12f4924d69c 100755 --- a/Tools/generate_basic_build_info.sh +++ b/Tools/generate_basic_build_info.sh @@ -16,7 +16,11 @@ if [ -z "${1:-}" ]; then fi repo=$(basename `git rev-parse --show-toplevel`) +# short sha for compatibility sha=$(git rev-parse --short HEAD) +# separate px4_sha for long sha +px4_sha=$(git rev-parse HEAD) + # github variables are set only in github if [ -z "${GITHUB_SERVER_URL:-}" ] || [ -z "${GITHUB_REPOSITORY:-}" ] || [ -z "${GITHUB_RUN_ID:-}" ]; then build_url="undefined" @@ -28,6 +32,7 @@ fi declare -A build_info build_info["reponame"]=${repo} build_info["sha"]=${sha} +build_info["px4_firmware_sha"]=${px4_sha} build_info["build_url"]=${build_url} # loop thru associative array and print key value pairs diff --git a/src/lib/version/px_update_git_header.py b/src/lib/version/px_update_git_header.py index 61e42865ef60..1fd9ca21d658 100755 --- a/src/lib/version/px_update_git_header.py +++ b/src/lib/version/px_update_git_header.py @@ -107,6 +107,16 @@ if not tag_or_branch.startswith('release-'): tag_or_branch = 'master' +# count commits since last tag +# git log --oneline $(git describe --tags --abbrev=0)..HEAD | wc -l +# this has to be ran with shell=True because if uses $() subshell +try: + git_tag_top = subprocess.check_output('git log --oneline $(git describe --tags --abbrev=0)..HEAD | wc -l', + shell=True, + stderr=subprocess.STDOUT).decode('utf-8').strip() +except: + git_tag_top = 0 + # build timestamp in epoch format build_timestamp = subprocess.check_output('date -u +%s'.split(), stderr=subprocess.STDOUT).decode('utf-8').strip() @@ -119,6 +129,7 @@ #define PX4_GIT_OEM_VERSION_STR "{oem_tag}" #define PX4_GIT_TAG_OR_BRANCH_NAME "{tag_or_branch}" // special variable: git tag, release or master branch +#define PX4_GIT_VERSION_TOP {git_tag_top} #define PX4_BUILD_TIME {build_timestamp} """ diff --git a/src/lib/version/version.c b/src/lib/version/version.c index 6c49e1fd8d04..ea214611d57e 100644 --- a/src/lib/version/version.c +++ b/src/lib/version/version.c @@ -242,6 +242,11 @@ uint32_t px4_firmware_vendor_version(void) return version_tag_to_vendor_version_number(PX4_GIT_TAG_STR); } +uint32_t px4_firmware_git_top_number(void) +{ + return PX4_GIT_VERSION_TOP; +} + const char *px4_firmware_git_branch(void) { return PX4_GIT_BRANCH_NAME; diff --git a/src/lib/version/version.h b/src/lib/version/version.h index d6cb16310e05..f5b7cc2a22eb 100644 --- a/src/lib/version/version.h +++ b/src/lib/version/version.h @@ -141,6 +141,12 @@ __EXPORT uint32_t version_tag_to_vendor_version_number(const char *tag); */ __EXPORT uint32_t px4_firmware_vendor_version(void); +/** + * get the PX4 Firmware vendor version git tag top number + * @return number of git commits after git tag + */ +__EXPORT uint32_t px4_firmware_git_top_number(void); + /** * get the board version (last 8 bytes should be silicon ID, if any) */ From 64d0ddb62a4b5e84c6bd46882deabb6274dc012f Mon Sep 17 00:00:00 2001 From: Timo Sairiala Date: Wed, 21 Aug 2024 08:05:50 +0300 Subject: [PATCH 2/4] update px4 entrypoint to include long px4 sha --- Tools/px_uploader.entrypoint | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tools/px_uploader.entrypoint b/Tools/px_uploader.entrypoint index d9dbe012402d..540ff26de3c5 100755 --- a/Tools/px_uploader.entrypoint +++ b/Tools/px_uploader.entrypoint @@ -39,6 +39,7 @@ function generate_metadata() { saluki_file_info=$(cat ${SALUKI_FILE_INFO_JSON} | jq -c '.files[] | select (.filename | contains("'${px4_filename}'")) | .filename = "'${px4_bin_filename}'" | + .px4_firmware_sha = "'${px4_sha}'" | .type = "px4-bin"') echo ${saluki_file_info} > ${validation_file} @@ -75,6 +76,9 @@ if [ -n "$PX4_EXPORT_DIR" ]; then rm ${TEMP_JSON} fi + # px4 sha from the original json file + px4_sha=$(cat ${SALUKI_FILE_INFO_JSON} | jq -r '.px4_firmware_sha') + # find all px4 files in the firmware directory for px4_file in /firmware/*.px4; do extract_bin_from_px4 $px4_file $PX4_EXPORT_DIR From 5b4ce6122c7e3c83705419e3e7226250daa8b805 Mon Sep 17 00:00:00 2001 From: Jari Nippula Date: Fri, 10 May 2024 13:05:30 +0300 Subject: [PATCH 3/4] Add fw updater submodules New submodules: src/modules/px4_fw_update_client src/lib/secure_udp Update clone_public to skip new private modules --- .gitmodules | 6 ++++++ clone_public.sh | 2 ++ src/lib/CMakeLists.txt | 3 +++ src/lib/secure_udp | 1 + src/modules/px4_fw_update_client | 1 + 5 files changed, 13 insertions(+) create mode 160000 src/lib/secure_udp create mode 160000 src/modules/px4_fw_update_client diff --git a/.gitmodules b/.gitmodules index 2f789aaeff5e..525328b71596 100644 --- a/.gitmodules +++ b/.gitmodules @@ -94,3 +94,9 @@ [submodule "Tools/simulation/gz/plugins/px4-gzsim-plugins"] path = Tools/simulation/gz/plugins/px4-gzsim-plugins url = https://github.com/tiiuae/px4-gzsim-plugins.git +[submodule "src/modules/px4_fw_update_client"] + path = src/modules/px4_fw_update_client + url = git@github.com:tiiuae/px4-fw-update-client.git +[submodule "src/lib/secure_udp"] + path = src/lib/secure_udp + url = git@github.com:tiiuae/px4-lib-secure-udp.git diff --git a/clone_public.sh b/clone_public.sh index c5ed7d21e599..447382303a97 100755 --- a/clone_public.sh +++ b/clone_public.sh @@ -9,6 +9,8 @@ do [[ "${repo}" == *pfsoc_crypto ]] || \ [[ "${repo}" == *pfsoc_keystore ]] || \ [[ "${repo}" == *pf_crypto ]] || \ + [[ "${repo}" == *px4_fw_update_client ]] || \ + [[ "${repo}" == *secure_udp ]] || \ [[ "${repo}" == *process ]] && continue git submodule update --init --recursive "${repo}" done <<< "$(git submodule status | awk '{print $2}')" diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 479b0fa141f2..58473f866634 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -75,3 +75,6 @@ add_subdirectory(version EXCLUDE_FROM_ALL) add_subdirectory(weather_vane EXCLUDE_FROM_ALL) add_subdirectory(wind_estimator EXCLUDE_FROM_ALL) add_subdirectory(world_magnetic_model EXCLUDE_FROM_ALL) +if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/secure_udp/CMakeLists.txt") + add_subdirectory(secure_udp EXCLUDE_FROM_ALL) +endif() diff --git a/src/lib/secure_udp b/src/lib/secure_udp new file mode 160000 index 000000000000..6a12f0e3a15f --- /dev/null +++ b/src/lib/secure_udp @@ -0,0 +1 @@ +Subproject commit 6a12f0e3a15f64cfd8cfafaf2441b20ebed0456b diff --git a/src/modules/px4_fw_update_client b/src/modules/px4_fw_update_client new file mode 160000 index 000000000000..c7cc4248a74b --- /dev/null +++ b/src/modules/px4_fw_update_client @@ -0,0 +1 @@ +Subproject commit c7cc4248a74b27b7007bf79a7f68e60e3ec9f02f From e1b6037987fc6895fc1a75f5cde8a4f49ac0d835 Mon Sep 17 00:00:00 2001 From: Jari Nippula Date: Mon, 19 Aug 2024 15:30:58 +0300 Subject: [PATCH 4/4] update boards/ssrc for fw update --- boards/ssrc/common | 2 +- boards/ssrc/saluki-pi | 2 +- boards/ssrc/saluki-v3 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/boards/ssrc/common b/boards/ssrc/common index 9d484db8e8c5..5fbd488ee59e 160000 --- a/boards/ssrc/common +++ b/boards/ssrc/common @@ -1 +1 @@ -Subproject commit 9d484db8e8c52793f78d5f8f7a29d6470da6e3ce +Subproject commit 5fbd488ee59e9f019d7c4369bd646165475740ed diff --git a/boards/ssrc/saluki-pi b/boards/ssrc/saluki-pi index 4534047159f6..1f859a0efe60 160000 --- a/boards/ssrc/saluki-pi +++ b/boards/ssrc/saluki-pi @@ -1 +1 @@ -Subproject commit 4534047159f66067813bbf5f147a5323de87b5d8 +Subproject commit 1f859a0efe602a30330369ba81200f1490a428f8 diff --git a/boards/ssrc/saluki-v3 b/boards/ssrc/saluki-v3 index 6462e1dd62e9..58e0793bb187 160000 --- a/boards/ssrc/saluki-v3 +++ b/boards/ssrc/saluki-v3 @@ -1 +1 @@ -Subproject commit 6462e1dd62e93714e12e4c6b2929c2bf795972a3 +Subproject commit 58e0793bb187dc0a4edc17457ed71b32e7f46cae