From patchwork Mon Jan 9 15:08:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: phodina X-Patchwork-Id: 45992 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 75FDC27BBED; Mon, 9 Jan 2023 15:09:43 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4D63027BBE9 for ; Mon, 9 Jan 2023 15:09:40 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEtm6-0006pq-JL; Mon, 09 Jan 2023 10:09:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEtlm-0006pe-Vj for guix-patches@gnu.org; Mon, 09 Jan 2023 10:09:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEtlm-0005nI-Jn for guix-patches@gnu.org; Mon, 09 Jan 2023 10:09:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pEtlm-0000Z0-6x for guix-patches@gnu.org; Mon, 09 Jan 2023 10:09:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51043] Fix build of rkdeveloptool Resent-From: phodina Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 09 Jan 2023 15:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51043 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: "51043@debbugs.gnu.org" <51043@debbugs.gnu.org>, Efraim Flashner Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Tobias Geerinckx-Rice Received: via spool by 51043-submit@debbugs.gnu.org id=B51043.16732769412159 (code B ref 51043); Mon, 09 Jan 2023 15:09:02 +0000 Received: (at 51043) by debbugs.gnu.org; 9 Jan 2023 15:09:01 +0000 Received: from localhost ([127.0.0.1]:37967 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEtlk-0000Yk-3R for submit@debbugs.gnu.org; Mon, 09 Jan 2023 10:09:01 -0500 Received: from mail-40134.protonmail.ch ([185.70.40.134]:54469) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEtlh-0000YV-5m for 51043@debbugs.gnu.org; Mon, 09 Jan 2023 10:08:58 -0500 Date: Mon, 09 Jan 2023 15:08:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1673276930; x=1673536130; bh=VyRrD9doHzQO4A+tD43KqvFFusmQWLGRV2xzDQJ69+w=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=ESOOGOdoW3/btC70cI6j9D9TVondL67UC0Tk6mpn0EDMCjKtPinMoo2UqN7VFnzaB cmdkTP3kr7AHfTKj/63AMmTzKARzSOVLiCAMdFSDOEocXCqhkHras7LzEjDx4Bc88i YXNb5anrsYxHZ3HUKrLmmddSCCnnGxpubzzyqBI+3lBBR9gVlVlE6ByxetAFb+ZioN /pnCAqRqr13n506ZF6POqQRTK4ECtRzX65d9fYX3EG3ucdTplOJ9XoF8ynGEa9+e4g v2OWH9pSkYY/Sk7K+2sGSNaINOw87cB6itZ0OCQqmdDb0mU+HDct1jMbeWtSQsVmkq kCLP7Wergldng== Message-ID: <6XwlW0pv9PKJRs5EpjYqiuxGyWHP4CkN6LgVyRTWr2sckdnqv2IN4t4CXdwTMWobju8YsW1X1OdeFPm4hbc_Pl0-a2vQg9emVleqQsZ1GCY=@protonmail.com> In-Reply-To: References: <9bQQgGpGjEpK7TZ2fb-yyHVRE5iY_PwlW7-do2Vk-7GwTPccqK2gx8ZQxETFeCXM6RmGa8352V9dxCWEKLUc5UhLScl67ZdLVQk3FyUQFp8=@protonmail.com> Feedback-ID: 14143818:user:proton MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: phodina X-ACL-Warn: , phodina via Guix-patches X-Patchwork-Original-From: phodina via Guix-patches via From: phodina Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Here's updated patch as it had some conflicts. Plus I added patch to speedup the transfer. Tested on Pinenote and Quartz64. ---- Petr ------- Original Message ------- On Monday, January 9th, 2023 at 1:49 PM, phodina wrote: > Hi Efraim, > > since you fixed the build can for the rkdeveloptool (commit 3ad3869297fd327ef417b1ecb95c2c4caf53d2e6) can you have a look also on the second patch please? > > ---- > Petr > ------- Original Message ------- > On Thursday, December 15th, 2022 at 9:36 PM, phodina wrote: > >> Hi Ludo’, >> >> speaking of lost patches this one is little bit annoying as it does not even build. >> >> Excerpt of the build log, build failure caused probably by introducing stricter compilation flags in `gnu-build-system`: >> >> starting phase `build' >> make[1]: Entering directory '/tmp/guix-build-rkdeveloptool-1.3-0.6e92ebc.drv-0/source' >> g++ -DHAVE_CONFIG_H -I. -I./cfg -Wall -Werror -Wextra -Wreturn-type -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -I/gnu/store/vjlg2z75qwbwxdp5qiklcdx7df9xvbb2-libusb-1.0.24/include/libusb-1.0 -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.cpp >> g++ -DHAVE_CONFIG_H -I. -I./cfg -Wall -Werror -Wextra -Wreturn-type -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -I/gnu/store/vjlg2z75qwbwxdp5qiklcdx7df9xvbb2-libusb-1.0.24/include/libusb-1.0 -g -O2 -MT crc.o -MD -MP -MF .deps/crc.Tpo -c -o crc.o crc.cpp >> g++ -DHAVE_CONFIG_H -I. -I./cfg -Wall -Werror -Wextra -Wreturn-type -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -I/gnu/store/vjlg2z75qwbwxdp5qiklcdx7df9xvbb2-libusb-1.0.24/include/libusb-1.0 -g -O2 -MT RKBoot.o -MD -MP -MF .deps/RKBoot.Tpo -c -o RKBoot.o RKBoot.cpp >> g++ -DHAVE_CONFIG_H -I. -I./cfg -Wall -Werror -Wextra -Wreturn-type -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -I/gnu/store/vjlg2z75qwbwxdp5qiklcdx7df9xvbb2-libusb-1.0.24/include/libusb-1.0 -g -O2 -MT RKComm.o -MD -MP -MF .deps/RKComm.Tpo -c -o RKComm.o RKComm.cpp >> g++ -DHAVE_CONFIG_H -I. -I./cfg -Wall -Werror -Wextra -Wreturn-type -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -I/gnu/store/vjlg2z75qwbwxdp5qiklcdx7df9xvbb2-libusb-1.0.24/include/libusb-1.0 -g -O2 -MT RKDevice.o -MD -MP -MF .deps/RKDevice.Tpo -c -o RKDevice.o RKDevice.cpp >> g++ -DHAVE_CONFIG_H -I. -I./cfg -Wall -Werror -Wextra -Wreturn-type -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -I/gnu/store/vjlg2z75qwbwxdp5qiklcdx7df9xvbb2-libusb-1.0.24/include/libusb-1.0 -g -O2 -MT RKImage.o -MD -MP -MF .deps/RKImage.Tpo -c -o RKImage.o RKImage.cpp >> g++ -DHAVE_CONFIG_H -I. -I./cfg -Wall -Werror -Wextra -Wreturn-type -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -I/gnu/store/vjlg2z75qwbwxdp5qiklcdx7df9xvbb2-libusb-1.0.24/include/libusb-1.0 -g -O2 -MT RKLog.o -MD -MP -MF .deps/RKLog.Tpo -c -o RKLog.o RKLog.cpp >> g++ -DHAVE_CONFIG_H -I. -I./cfg -Wall -Werror -Wextra -Wreturn-type -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -I/gnu/store/vjlg2z75qwbwxdp5qiklcdx7df9xvbb2-libusb-1.0.24/include/libusb-1.0 -g -O2 -MT RKScan.o -MD -MP -MF .deps/RKScan.Tpo -c -o RKScan.o RKScan.cpp >> mv -f .deps/RKBoot.Tpo .deps/RKBoot.Po >> mv -f .deps/RKImage.Tpo .deps/RKImage.Po >> mv -f .deps/RKLog.Tpo .deps/RKLog.Po >> mv -f .deps/RKDevice.Tpo .deps/RKDevice.Po >> mv -f .deps/RKComm.Tpo .deps/RKComm.Po >> mv -f .deps/crc.Tpo .deps/crc.Po >> mv -f .deps/RKScan.Tpo .deps/RKScan.Po >> main.cpp: In function ‘bool _Z9mergeBootv.part.0()’: >> main.cpp:1541:36: error: ‘%s’ directive output may be truncated writing up to 557 bytes into a region of size 5 [-Werror=format-truncation=] >> 1541 | snprintf(buffer, sizeof(buffer), "%s", chip); >> | ^~ >> ...... >> 1582 | chipType = convertChipType(chip + 2); >> | ~~~~~~~~~~~~~~~~~~~~~~~~~ >> main.cpp:1541:10: note: ‘snprintf’ output between 1 and 558 bytes into a destination of size 5 >> 1541 | snprintf(buffer, sizeof(buffer), "%s", chip); >> | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> cc1plus: all warnings being treated as errors >> make[1]: *** [Makefile:473: main.o] Error 1 >> make[1]: Leaving directory '/tmp/guix-build-rkdeveloptool-1.3-0.6e92ebc.drv-0/source' >> make: *** [Makefile:493: all-recursive] Error 1 >> error: in phase 'build': uncaught exception: >> %exception #<&invoke-error program: "make" arguments: ("-j" "16") exit-status: 2 term-signal: #f stop-signal: #f> >> phase `build' failed after 2.2 seconds >> command "make" "-j" "16" failed with status 2 >> builder for `/gnu/store/srykckhmy9lpdg2gl6702vs71b20apsj-rkdeveloptool-1.3-0.6e92ebc.drv' failed with exit code 1 >> build of /gnu/store/srykckhmy9lpdg2gl6702vs71b20apsj-rkdeveloptool-1.3-0.6e92ebc.drv failed >> View build log at '/var/log/guix/drvs/sr/ykckhmy9lpdg2gl6702vs71b20apsj-rkdeveloptool-1.3-0.6e92ebc.drv.gz'.guix build: error: build of `/gnu/store/srykckhmy9lpdg2gl6702vs71b20apsj-rkdeveloptool-1.3-0.6e92ebc.drv' failed >> ------- Original Message ------- >> On Monday, February 21st, 2022 at 1:43 PM, phodina wrote: >> >>> Hi, >>> >>> Here's fix of the rkdeveloptool package which fails to build due to GCC complaining about the truncation error. >>> >>> See https://github.com/rockchip-linux/rkdeveloptool/pull/62. >>> >>> ---- >>> Petr From 5d339ca82211b7bdecd12ddcd14cf9dcc1dbb98d Mon Sep 17 00:00:00 2001 From: Petr Hodina Date: Mon, 21 Feb 2022 13:33:41 +0100 Subject: [PATCH v2] gnu: Add rkdeveloptool-pine64. * gnu/packages/hardware.scm (rkdeveloptool-pine64): New variable. * gnu/local.mk: Add patches. * gnu/packages/patches/rkdeveloptool-pine64-speed-up-xfer.patch: New file. * gnu/packages/patches/rkdeveloptool-pine64-dump-over-2gib.patch: New file. diff --git a/gnu/local.mk b/gnu/local.mk index f0b1b3fd15..177ad1996b 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1800,6 +1800,8 @@ dist_patch_DATA = \ %D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \ %D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \ %D%/packages/patches/r-mixedpower-r2power.patch \ + %D%/packages/patches/rkdeveloptool-pine64-speed-up-xfer.patch \ + %D%/packages/patches/rkdeveloptool-pine64-dump-over-2gib.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 81f38d069b..e86d96b792 100644 --- a/gnu/packages/hardware.scm +++ b/gnu/packages/hardware.scm @@ -15,6 +15,7 @@ ;;; Copyright © 2022 Marcel Kupiec ;;; Copyright © 2022 Maxim Cournoyer ;;; Copyright © 2022 Efraim Flashner +;;; Copyright © 2023 Petr Hodina ;;; ;;; This file is part of GNU Guix. ;;; @@ -1174,6 +1175,43 @@ (define-public rkdeveloptool as the Pinebook Pro.") (license license:gpl2+)))) +(define-public rkdeveloptool-pine64 + (package + (name "rkdeveloptool-pine64") + (version "1.1.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url + "https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool") + (commit version))) + (file-name (git-file-name name version)) + (patches (search-patches + "rkdeveloptool-pine64-speed-up-xfer.patch" + "rkdeveloptool-pine64-dump-over-2gib.patch")) + (sha256 + (base32 + "0nh9592mllygycnxbw91vg58wwais7w3w62rl9gcvc4m3i909b1z")))) + (build-system meson-build-system) + (arguments + `(#:tests? #f ;no test suite + #:phases (modify-phases %standard-phases + ;; attempts to place the file into the udev pkg read-only path + (add-after 'unpack 'fix-udev-path + (lambda* _ + (substitute* "meson.build" + (("udev_rules_dir,") + (string-append "'" %output "/lib/udev/rules.d',")))))))) + (native-inputs (list pkg-config)) + (inputs (list eudev libusb)) + (synopsis "Read from and write to RockChip devices over USB") + (description + "Rkdeveloptool is a fastboot-like CLI tool to read from and +write to RockChip devices over USB. Supports PineNote and Quartz64 as well +as other Pine64 RK devices.") + (home-page "https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool") + (license license:gpl2+))) + (define-public usbguard (package (name "usbguard") diff --git a/gnu/packages/patches/rkdeveloptool-pine64-dump-over-2gib.patch b/gnu/packages/patches/rkdeveloptool-pine64-dump-over-2gib.patch new file mode 100644 index 0000000000..e2c7328bfa --- /dev/null +++ b/gnu/packages/patches/rkdeveloptool-pine64-dump-over-2gib.patch @@ -0,0 +1,54 @@ +diff --git a/main.cpp b/main.cpp +index 029f0e2..e40bce2 100644 +--- a/main.cpp ++++ b/main.cpp +@@ -2455,12 +2455,6 @@ bool read_lba( + + if (!check_device_type(dev, RKUSB_LOADER | RKUSB_MASKROM)) + return false; +- if (uiLen % 512) { +- fprintf(stderr, "Length must be a multiple of sector size (%d)\n", +- SECTOR_SIZE); +- return false; +- } +- uiLen /= 512; + + if (!bRet) { + fprintf(stderr, "Read LBA quit, creating comm object failed!\n"); +@@ -3265,7 +3259,7 @@ bool handle_command(int argc, char *argv[], CRKScan *pScan) { + bRet = get_lba_from_gpt(master_gpt, argv[2], &lba, &lba_end); + if (bRet) { + bSuccess = read_lba(dev, (u32)lba, +- ((u32)(lba_end - lba + 1)) * 512, argv[3]); ++ (u32)(lba_end - lba + 1), argv[3]); + } else { + fprintf(stderr, "Could not find the %s partition\n", argv[2]); + } +@@ -3276,7 +3270,7 @@ bool handle_command(int argc, char *argv[], CRKScan *pScan) { + } else if (strcmp(strCmd.c_str(), "RL") == 0 || + strcmp(strCmd.c_str(), "READ") == 0) { + char *pszEnd; +- UINT uiBegin, uiLen; ++ UINT uiBegin; + if (argc != 5) + fprintf(stderr, "Usage: rkdeveloptool read start-sector num-bytes " + "filename\n"); +@@ -3285,11 +3279,15 @@ bool handle_command(int argc, char *argv[], CRKScan *pScan) { + if (*pszEnd) + fprintf(stderr, "Begin is invalid, please check!\n"); + else { +- uiLen = strtoul(argv[3], &pszEnd, 0); ++ unsigned long long len = strtoull(argv[3], &pszEnd, 0); + if (*pszEnd) + fprintf(stderr, "Len is invalid, please check!\n"); +- else { +- bSuccess = read_lba(dev, uiBegin, uiLen, argv[4]); ++ else if (len % 512) { ++ fprintf(stderr, "Length must be a multiple of sector size (%d)\n", ++ SECTOR_SIZE); ++ } else { ++ len /= 512; ++ bSuccess = read_lba(dev, uiBegin, len, argv[4]); + } + } + } -- 2.38.1