From patchwork Wed Jun 9 07:06:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ryan Sundberg X-Patchwork-Id: 30072 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 A000F27BC81; Wed, 9 Jun 2021 08:07:14 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id EA1F727BC78 for ; Wed, 9 Jun 2021 08:07:13 +0100 (BST) Received: from localhost ([::1]:35534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqsIy-0002gH-VW for patchwork@mira.cbaines.net; Wed, 09 Jun 2021 03:07:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqsIo-0002fs-QW for guix-patches@gnu.org; Wed, 09 Jun 2021 03:07:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48810) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lqsIo-0007Is-Ep for guix-patches@gnu.org; Wed, 09 Jun 2021 03:07:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lqsIo-0006id-8o for guix-patches@gnu.org; Wed, 09 Jun 2021 03:07:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48889] [PATCH 4/4] bpftool: new package Resent-From: Ryan Sundberg Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 09 Jun 2021 07:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48889 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxime Devos Cc: 48889@debbugs.gnu.org Received: via spool by 48889-submit@debbugs.gnu.org id=B48889.162322237725773 (code B ref 48889); Wed, 09 Jun 2021 07:07:02 +0000 Received: (at 48889) by debbugs.gnu.org; 9 Jun 2021 07:06:17 +0000 Received: from localhost ([127.0.0.1]:60356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqsI1-0006hY-9x for submit@debbugs.gnu.org; Wed, 09 Jun 2021 03:06:17 -0400 Received: from mail.arctype.co ([138.68.9.245]:54603) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqsHy-0006hK-Nt for 48889@debbugs.gnu.org; Wed, 09 Jun 2021 03:06:12 -0400 Received: from authenticated-user (mail.arctype.co [138.68.9.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.arctype.co (Postfix) with ESMTPSA id EB50611F07C; Wed, 9 Jun 2021 00:06:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arctype.co; s=mail; t=1623222365; bh=A0/Pc+yhzRil3ccEhXsL9vQ0xeMoOIAVb3WaV1XZ0Jk=; h=To:References:From:Cc:Subject:Date:In-Reply-To:From; b=Z75Ssh/slkotzzj1LbQpdTA8VSr8qRhDoePFKR8skBv/i5DmXjrECvswOaaKAlAiN EoDKPWNKyqxo4BhHAsnpxCFBHaUiefw8PhGai/N3aobAaWqXozkMUTsJmMhCVf+Z0X 51rCrN73GuqEoS+mlkuvk4m4DtJ8VFLlItn5SnM1BQ9JvH3TwKaMPW+4fwf25u3NOA drXmuIgbmwZkIc7QaCHaBPcIoUWEpPJF8ArBHG/10t32jJyQg/qRxPCor7hBbbmI5V BiSchY6x6MCXVvYlRP/AXS9pf5kDgvpVz72O3fV9la/9/NUV092u4qO8JsBgYJnRKT 1vLaeL5zVCd2w== References: <20210606185204.17617-1-ryan@arctype.co> <20210606185204.17617-4-ryan@arctype.co> <95c21dc7fa0e9c6864df06b307f3375d511847a8.camel@telenet.be> Message-ID: <9f6bfb31-ad8a-a45f-2c80-e4423647aa28@arctype.co> Date: Wed, 9 Jun 2021 00:06:04 -0700 MIME-Version: 1.0 In-Reply-To: <95c21dc7fa0e9c6864df06b307f3375d511847a8.camel@telenet.be> 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Ryan Sundberg X-ACL-Warn: , Ryan Sundberg via Guix-patches X-Patchwork-Original-From: Ryan Sundberg via Guix-patches via From: Ryan Sundberg X-getmail-retrieved-from-mailbox: Patches Here is the revised bpftool patch. Responses below. --- Sincerely, Ryan Sundberg On 6/7/21 2:50 AM, Maxime Devos wrote: > Ryan Sundberg via Guix-patches via schreef op zo 06-06-2021 om 11:52 [-0700]: >> Adds the bpftool package from the Linux kernel source tree. >> --- >> gnu/packages/linux.scm | 40 ++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 40 insertions(+) >> >> diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm >> index c8ec310665..06bb344475 100644 >> --- a/gnu/packages/linux.scm >> +++ b/gnu/packages/linux.scm >> @@ -54,6 +54,7 @@ >> ;;; Copyright © 2020 David Dashyan >> ;;; Copyright © 2020 pukkamustard >> ;;; Copyright © 2021 B. Wilson >> +;;; Copyright © 2021 Ryan Sundberg >> ;;; >> ;;; This file is part of GNU Guix. >> ;;; >> @@ -8108,3 +8109,42 @@ Availability and Serviceability} reports from Linux kernel trace events. >> These trace events are logged in @file{/sys/kernel/debug/tracing} and reported >> through standard log mechanisms like syslog.") >> (license license:gpl2))) >> + >> +(define-public bpftool >> + (package >> + (name "bpftool") >> + (version (package-version linux-libre)) >> + (source (package-source linux-libre)) >> + (build-system gnu-build-system) >> + (arguments >> + `(#:tests? #f > > Why are tests disabled? This program has no tests. I commented as such in the new patch. > >> + #:phases >> + (modify-phases %standard-phases >> + (add-before 'configure 'chdir >> + (lambda _ (chdir "tools/bpf") #t)) >> + (delete 'configure) >> + (replace 'build >> + (lambda _ (invoke "make" "CC=gcc" "bpftool") #t)) > > Use ,(string-append "CC=" (cc-for-target)), to make sure cross-compiling bpftools > works. > >> + (replace 'install >> + (lambda* (#:key outputs #:allow-other-keys) >> + (let* ((out (assoc-ref outputs "out"))) >> + (mkdir-p (string-append out "/sbin")) >> + (mkdir-p (string-append out "/share/bash-completion/completions")) >> + (invoke "make" >> + (string-append "prefix=" out) >> + (string-append "bash_compdir=" out "/share/bash-completion/completions") >> + "-C" "bpftool" >> + "install") >> + #t)))))) >> + (inputs >> + `(("bison" ,bison) > > Bison looks like a native input to me. > >> + ("python" ,python-3) > > Could be input, could be native-input. I don't know what's appropriate for bpftools. You are right, python should be a native-input. > > You can check with > ./pre-inst-env guix build bpftools --target=aarch64-linux-gnu Cross-compiling produced this linker error I'm not sure how to deal with right now: ld: staticobjs/libbpf.o: error adding symbols: file in wrong format > > If there is "command not found: python" or something like that, > you'll need to move python to native-inputs. > >> + ("readline" ,readline))) >> + (propagated-inputs >> + `(("libcap" ,libcap) >> + ("libelf" ,libelf) >> + ("zlib" ,zlib))) > > bpftool is a tool, and not a library, right? > Then these libraries should be in inputs, not propagated-inputs, > to avoid polluting the profile. > > bpftool should still have access to these libraries by ELF's RPATH > or something like that. > >> + (home-page (package-home-page linux-libre)) > > I don't see anything about bpftools on . > Maybe bpftools has a wiki somewhere? I linked https://lwn.net/Articles/739357/ as the new home-page, which is the closest this program gets to online documentation that I could find. > >> + (synopsis "bpftool is a tool for inspection and simple manipulation of eBPF programs and maps") >> + (description "*bpftool* allows for inspection and simple modification of BPF objects on the system. Note that format of the output of all tools is not guaranteed to be stable and should not be depended upon.") > > Line is too long. Also, what's up with surrounding bpftools with *asterisks*? Copy-paste error > > Greetings, > Maxime. > From 87104ca47671801f34848326a17f4eb453dc3c9a Mon Sep 17 00:00:00 2001 From: Ryan Sundberg Date: Sun, 6 Jun 2021 09:53:43 -0700 Subject: [PATCH] gnu: Add bpftool in sync with the Linux kernel version. * gnu/packages/linux.scm (bpftool): New variable Signed-off-by: Ryan Sundberg --- gnu/packages/linux.scm | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index c8ec310665..5d4d1669c2 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -54,6 +54,7 @@ ;;; Copyright © 2020 David Dashyan ;;; Copyright © 2020 pukkamustard ;;; Copyright © 2021 B. Wilson +;;; Copyright © 2021 Ryan Sundberg ;;; ;;; This file is part of GNU Guix. ;;; @@ -8108,3 +8109,48 @@ Availability and Serviceability} reports from Linux kernel trace events. These trace events are logged in @file{/sys/kernel/debug/tracing} and reported through standard log mechanisms like syslog.") (license license:gpl2))) + +(define-public bpftool + (package + (name "bpftool") + (version (package-version linux-libre)) + (source (package-source linux-libre)) + (build-system gnu-build-system) + (arguments + `(#:tests? #f ; This package has no tests. + #:phases + (modify-phases %standard-phases + (add-before 'configure 'chdir + (lambda _ (chdir "tools/bpf") #t)) + (delete 'configure) + (replace 'build + (lambda _ (invoke "make" + ,(string-append "CC=" (cc-for-target)) + "bpftool") + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out"))) + (mkdir-p (string-append out "/sbin")) + (mkdir-p (string-append out "/share/bash-completion/completions")) + (invoke "make" + (string-append "prefix=" out) + (string-append "bash_compdir=" out + "/share/bash-completion/completions") + "-C" "bpftool" + "install") + #t)))))) + (inputs + `(("readline" ,readline) + ("libcap" ,libcap) + ("libelf" ,libelf) + ("zlib" ,zlib))) + (native-inputs + `(("bison" ,bison) + ("python" ,python-3))) + ; This tool does not have a proper web page. + (home-page "https://lwn.net/Articles/739357/") + (synopsis "Tool for inspection and simple manipulation of eBPF programs and maps") + (description "bpftool allows for inspection and simple modification of BPF +objects on the system.") + (license (package-license linux-libre)))) -- 2.31.1