This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 56233efe087f0f7f2b2d8cc3aa42b61a55a8f48b
Author: wangjianyu3 <[email protected]>
AuthorDate: Mon Nov 23 13:33:05 2026 +0800

    system/toybox: pin the tarball SHA256 in Kconfig
    
    FetchContent deletes and re-downloads an existing tarball when no hash
    is given, so a pre-downloaded copy is never reused and a replaced or
    corrupted archive goes unnoticed. Pin the SHA256 of the release tarball
    in Kconfig and pass it to FetchContent: a matching pre-downloaded copy
    is reused without network access. Leave the value empty to keep the
    unverified download behavior.
    
    Assisted-by: OpenCode:mimo-v2.6-pro
    Co-authored-by: multica-agent <[email protected]>
    Signed-off-by: wangjianyu3 <[email protected]>
---
 system/toybox/CMakeLists.txt | 5 +++++
 system/toybox/Kconfig        | 9 +++++++++
 2 files changed, 14 insertions(+)

diff --git a/system/toybox/CMakeLists.txt b/system/toybox/CMakeLists.txt
index 87eb4d2bc..5aad6569a 100644
--- a/system/toybox/CMakeLists.txt
+++ b/system/toybox/CMakeLists.txt
@@ -27,6 +27,10 @@ if(CONFIG_SYSTEM_TOYBOX)
   set(TOYBOX_STAMP ${TOYBOX_DIR}/.nuttx_patched-${TOYBOX_VERSION})
   set(TOYBOX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/toybox)
 
+  if(CONFIG_SYSTEM_TOYBOX_SHA256)
+    set(TOYBOX_URL_HASH URL_HASH SHA256=${CONFIG_SYSTEM_TOYBOX_SHA256})
+  endif()
+
   # 
############################################################################
   # Download and patch the pinned release
   # 
############################################################################
@@ -40,6 +44,7 @@ if(CONFIG_SYSTEM_TOYBOX)
       FetchContent_Declare(
         toybox_fetch
         URL "${CONFIG_SYSTEM_TOYBOX_URL}/${TOYBOX_VERSION}.tar.gz"
+            ${TOYBOX_URL_HASH}
             DOWNLOAD_DIR
             ${CMAKE_CURRENT_BINARY_DIR}/toybox-dl
             SOURCE_DIR
diff --git a/system/toybox/Kconfig b/system/toybox/Kconfig
index d866fa0a4..d36fbc4d3 100644
--- a/system/toybox/Kconfig
+++ b/system/toybox/Kconfig
@@ -41,6 +41,15 @@ config SYSTEM_TOYBOX_URL
        ---help---
                Base URL Toybox release tarballs are downloaded from.
 
+config SYSTEM_TOYBOX_SHA256
+       string "Toybox tarball SHA256"
+       default 
"082df8cfd76135ce3c4820c8cf4c0081d61491e0990aff2da48e21fc9bbb24d1"
+       ---help---
+               SHA256 of the SYSTEM_TOYBOX_VERSION release tarball. Update it
+               together with the version. It verifies the download and lets a
+               previously downloaded copy be reused instead of downloading it
+               again. Leave it empty to skip verification and always download.
+
 config SYSTEM_TOYBOX_PRIORITY
        int "Toybox task priority"
        default 100

Reply via email to