From 50e6bbcf7f648a7793ecf6b1ddd9a4148fc776b8 Mon Sep 17 00:00:00 2001 From: Petr Hodina Date: Mon, 21 Feb 2022 13:25:16 +0100 Subject: [PATCH 1/2] gnu: rkdeveloptool: Fix build. * gnu/packages/hardware.scm (rkdeveloptool): Update to newer commit 46bb4c. [source]: Apply patch to fix GCC format truncation error. [arguments]: Add phase after install to install udev rules. * gnu/local.mk: Add patch. * gnu/packages/patches/rkdeveloptool-fix-format-truncation.patch: New file. diff --git a/gnu/local.mk b/gnu/local.mk index dcee1611b2..3e84188937 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1754,6 +1754,7 @@ dist_patch_DATA = \ %D%/packages/patches/remake-impure-dirs.patch \ %D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \ %D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \ + %D%/packages/patches/rkdeveloptool-fix-format-truncation.patch \ %D%/packages/patches/rnp-add-version.cmake.patch \ %D%/packages/patches/rnp-disable-ruby-rnp-tests.patch \ %D%/packages/patches/rnp-unbundle-googletest.patch \ diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm index a3ce90f75e..e4aceab54b 100644 --- a/gnu/packages/hardware.scm +++ b/gnu/packages/hardware.scm @@ -770,29 +770,40 @@ (define-public wavemon (license license:gpl3+))) (define-public rkdeveloptool - (let ((commit "6e92ebcf8b1812da02663494a68972f956e490d3") - (revision "0")) + (let ((commit "46bb4c073624226c3f05b37b9ecc50bbcf543f5a") + (revision "1")) (package (name "rkdeveloptool") - (version (git-version "1.3" revision commit)) + (version (git-version "1.32" revision commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/rockchip-linux/rkdeveloptool") (commit commit))) + ;; https://github.com/rockchip-linux/rkdeveloptool/pull/62 + (patches (search-patches "rkdeveloptool-fix-format-truncation.patch")) (file-name (git-file-name name version)) (sha256 - (base32 "0zwrkqfxd671iy69v3q0844gfdpm1yk51i9qh2rqc969bd8glxga")))) + (base32 "0kb2ylsrqqrdf4np66yxmk96kdc5g8nvjx13gifpm5rshv5770bq")))) (build-system gnu-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'install 'install-udev-rules + (lambda* (#:key outputs #:allow-other-keys) + (let ((udev (string-append (assoc-ref outputs "out") + "/lib/udev/rules.d"))) + (mkdir-p udev) + (install-file "99-rk-rockusb.rules" udev))))))) (native-inputs (list autoconf automake pkg-config)) (inputs (list libusb)) (home-page "https://github.com/rockchip-linux/rkdeveloptool") - (synopsis "Read from and write to RockChicp devices over USB") + (synopsis "Read/write to rockchip devices over USB") (description - "Rkdeveloptool can read from and write to RockChip devices over USB, such + "Rkdeveloptool can read from and write to rockchip devices over USB, such as the Pinebook Pro.") (license license:gpl2+)))) diff --git a/gnu/packages/patches/rkdeveloptool-fix-format-truncation.patch b/gnu/packages/patches/rkdeveloptool-fix-format-truncation.patch new file mode 100644 index 0000000000..fd9a193e76 --- /dev/null +++ b/gnu/packages/patches/rkdeveloptool-fix-format-truncation.patch @@ -0,0 +1,22 @@ +From bc9e5f03d71b3dd4360721f4df3524c1dcba9bc8 Mon Sep 17 00:00:00 2001 +From: Petr Hodina +Date: Mon, 21 Feb 2022 13:00:53 +0100 +Subject: [PATCH] Fix format truncation for GCC >7.1. + + +diff --git a/main.cpp b/main.cpp +index 72bd94b..800db0b 100644 +--- a/main.cpp ++++ b/main.cpp +@@ -1490,7 +1490,7 @@ static bool saveEntry(FILE* outFile, char* path, rk_entry_type type, + static inline uint32_t convertChipType(const char* chip) { + char buffer[5]; + memset(buffer, 0, sizeof(buffer)); +- snprintf(buffer, sizeof(buffer), "%s", chip); ++ memcpy(buffer, chip, 4); + return buffer[0] << 24 | buffer[1] << 16 | buffer[2] << 8 | buffer[3]; + } + +-- +2.34.0 + -- 2.34.0