From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6730113598409932800 X-Received: by 2002:a0d:e502:: with SMTP id o2mr22736137ywe.33.1567497713058; Tue, 03 Sep 2019 01:01:53 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a81:b188:: with SMTP id p130ls2173496ywh.12.gmail; Tue, 03 Sep 2019 01:01:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxudoOwlwxu5OPuXa0ThhGtWJnVpbfnNIQyieZn4nZUKuY9KNE+oZCaH/d5F+HH9C5ttuX3 X-Received: by 2002:a81:7a0e:: with SMTP id v14mr19635623ywc.1.1567497712761; Tue, 03 Sep 2019 01:01:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567497712; cv=none; d=google.com; s=arc-20160816; b=K0treZNYDKjlkERcyH8GxRFhyijZwnvftK+KTggP0XgguzHJvx/p1TZtHJJAtDer8b hAvMWWUk4JI41iKD+kVJY0q7Y3eZynqmIYyTukd+Z/SK5jO4bZrKxX2yX2gzpiZCz91R sU0GHdaQ3A7E9/RUlZr+F1IsoCWe/GDgpmjj0V2woYVqe+2MRNafJKA+PE0mD16GZ1/s A5YT+esZtiWF6EZrodu/t4IANU+ukyycSJSU2ZJa68csUQExFA/khkcspr+WfbrewXIJ y+ACDE6Od98vsHA48gk1S0XZ+/XcNk3c9PouuTVZoInvViG1noXrXnkX21QB27QoW4Ys KAnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-language:content-transfer-encoding:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :ironport-sdr:ironport-sdr; bh=6snlM2iTR/syM3BKwIV1kaoOdMgIcNcFJka1X/+mo0w=; b=KzUyC5Dqt64U3j4KhIrzvaI38+MT9j6zZQX50sTA2cSdU5atUp7jMwwtZLx2voiyj9 zf6Zo2aREq/0vmlw6Gg38A7FA3P6oHf8Na7yvh4tly5bI6DbBipEaKe1TPzbgVydXgFm Qk6BBHLyCM4e1eeRL4jy8+zCk9lT2LVhqFJlDBwdBzrvaW/qAM/mntHXRcgeVUKbaazy t7LLyDUu9nAJ6BRAKCkTGw4mwLhjNjYFQ6bewMvd9vpeDeWFdLvcFAmrn/lhrRjVi/tM A1OjfnJakrQUfNyhV9iPwHcRf9E+Uf1Pebep/1cTvzT+moHqs384bciNrT1QF16K3uyX yTtA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of cedric_hombourger@mentor.com designates 68.232.129.153 as permitted sender) smtp.mailfrom=Cedric_Hombourger@mentor.com Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com. [68.232.129.153]) by gmr-mx.google.com with ESMTPS id f190si883091ywh.2.2019.09.03.01.01.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Sep 2019 01:01:52 -0700 (PDT) Received-SPF: pass (google.com: domain of cedric_hombourger@mentor.com designates 68.232.129.153 as permitted sender) client-ip=68.232.129.153; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of cedric_hombourger@mentor.com designates 68.232.129.153 as permitted sender) smtp.mailfrom=Cedric_Hombourger@mentor.com IronPort-SDR: EJe87uiYpaTeprH3WLu4+4tTQXXWB3Y2UGRRotEAiPITU6g6pf9TH6NMktRg295bxMZ2tjVnLj IYQjSuzbzpiTa9L/G/B8TQl7/KCUgPcR1fCqPuHPhGzf5X0G3nHBZaWWmRNA6qGpnXSVYQfxnY OcKz7e3ny9ROSxUzaQA5wGPk/kJ+LRLjPk6y5aj9Ugxhzk/gsF/K9OXmSuTy2881nTyre+7/XM pNyAom76GXQujdAt5GGWH5tcKkR2E9L3tkMRy5YvyiR5I1egLAazXsmiHuVb4a7bFrK1kkzViF 5MQ= X-IronPort-AV: E=Sophos;i="5.64,462,1559548800"; d="scan'208";a="42784043" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 03 Sep 2019 00:01:51 -0800 IronPort-SDR: twYxg7m/YyidEeCKg8QiDCfOEOO22TgoPVBa/pdV1FWPXiz7ipPrm0w5J503Ol/Scti/wcQTrD Ql9Nb0Hf/w5O2i4W/Mg7CHDJFDsB/6Gx/UbX9W8k3+d1tKt0VdKKXphPzHNxXO6XymnmS7TXbo PHEByBrh1loWwPA7Tz6GWi/6uRia5LPfpuNsOD2n2qHm1n95GKfDMbf9JL7F8JLB4xnzKpaszZ DLcq2AvSXGIPWhq3vlUF2rpSRQZQO8/npAjj4PMvi8Kq2Y2YF86dFJYRh0GO/kqCYYPiSefa+D 0kM= Subject: Re: [RFC Kernel PATCH 1/1] builddeb: support creation of linux-perf packages To: Henning Schild CC: References: <1566976653-174-1-git-send-email-Cedric_Hombourger@mentor.com> <1566976653-174-2-git-send-email-Cedric_Hombourger@mentor.com> <20190830155815.3042828c@md1za8fc.ad001.siemens.net> From: Cedric Hombourger Message-ID: <4c350bba-d2c1-9689-b42f-9c18dcfb3e13@mentor.com> Date: Tue, 3 Sep 2019 10:01:43 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190830155815.3042828c@md1za8fc.ad001.siemens.net> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Return-Path: Cedric_Hombourger@mentor.com X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) X-TUID: 1kiEkd+JgluR Hi Henning On 8/30/19 3:58 PM, Henning Schild wrote: > Am Wed, 28 Aug 2019 09:17:33 +0200 > schrieb Cedric Hombourger : > >> Provide a mechanism for the Debian package generation scripts to also >> produce perf packages in addition to the kernel packages. Pass >> KDEB_PERF=1 to the "make deb-pkg" command line. The structure of the >> packages should match very closely with Debian's with the perf binary >> and support folders suffixed with the kernel version number >> (Debian's /usr/bin/perf script checks the running kernel to spawn the >> corresponding perf_ binary). It shall also be noted that it >> is left to the user to specify runtime dependencies via the added >> KDEB_PERF_DEPS variable. They are indeed distro and environment >> specific (perf determines what features should be compiled in after >> checking packages installed on the build host) > Good idea, also not doing it inside Isar. I have one other debian based > non-Isar project where we have a debian/ folder for perf ;). > > I would suggest trying that on ubuntu before posting. > Unfortunately Ubuntu does not use the same package structure /usr/bin/perf is a script provided by their linux-tools-common package it does re-route the call to perf to the actual perf binary for your kernel So far, while package names differ, the logic is the same. Now come some more annoying differences: Ubuntu does not suffix perf with _. but instead has the perf tools at /usr/lib/linux-tools/`uname -r`/`basename $0 This is evidently an area where Debian and Ubuntu differ (Ubuntu does have linux-image, linux-headers and linux-libc-dev packages just like Debian) So I am not quite sure how to address this without getting ugly (and therefore hardly upstream'able) Anything comes to mind? Should we give up the idea of using builddeb and instead use our own debian/{control,rules} in Isar? (Jan told me that you have started to discuss/consider this) We would need to design our solution such as distro specifics may be easily implemented Cedric >> Signed-off-by: Cedric Hombourger >> --- >> scripts/package/builddeb | 32 ++++++++++++++++++++++++++++++++ >> scripts/package/mkdebian | 26 ++++++++++++++++++++++++++ >> 2 files changed, 58 insertions(+) >> >> diff --git a/scripts/package/builddeb b/scripts/package/builddeb >> index c4c580f547ef..76c9c49a678f 100755 >> --- a/scripts/package/builddeb >> +++ b/scripts/package/builddeb >> @@ -51,6 +51,8 @@ tmpdir="$objtree/debian/tmp" >> kernel_headers_dir="$objtree/debian/hdrtmp" >> libc_headers_dir="$objtree/debian/headertmp" >> dbg_dir="$objtree/debian/dbgtmp" >> +perf_dir="$objtree/debian/linux-perf-tmp" >> +perf_xy_dir="$objtree/debian/linux-perf-$VERSION.$PATCHLEVEL-tmp" > xy seems like a strange name, i did not even start looking why there > are two and what they are used for > >> packagename=linux-image-$version >> kernel_headers_packagename=linux-headers-$version >> libc_headers_packagename=linux-libc-dev >> @@ -78,6 +80,7 @@ BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes) >> >> # Setup the directory structure >> rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" >> "$dbg_dir" $objtree/debian/files >> +rm -rf "$perf_dir" "$perf_xy_dir" > Seems like this should be merged with the line before. > >> mkdir -m 755 -p "$tmpdir/DEBIAN" >> mkdir -p "$tmpdir/lib" "$tmpdir/boot" >> mkdir -p "$kernel_headers_dir/lib/modules/$version/" >> @@ -129,6 +132,30 @@ if is_enabled CONFIG_MODULES; then >> fi >> fi >> >> +if [ -n "$KDEB_PERF" ]; then >> + mkdir -p $perf_dir $perf_xy_dir >> + $MAKE -C tools/perf -f >> Makefile.perf \ >> + DESTDIR="$(readlink -f >> $perf_xy_dir)" \ >> + >> STRACE_GROUPS_DIR=share/perf_$VERSION.$PATCHLEVEL-core/strace/groups >> \ >> + >> LDFLAGS= >> \ >> + >> prefix=/usr >> \ >> + >> perf_examples_dir=share/doc/linux-perf-$VERSION.$PATCHLEVEL/examples >> \ >> + >> perf_include_dir=include/perf_$VERSION.$PATCHLEVEL >> \ >> + >> perfexecdir=lib/perf_$VERSION.$PATCHLEVEL-core >> \ >> + >> plugindir=/usr/lib/traceevent_$VERSION.$PATCHLEVEL/plugins >> \ >> + >> srctree=$(pwd) >> \ >> + >> tipdir=share/doc/linux-perf-$VERSION.$PATCHLEVEL >> \ >> + install > These lines all seem a little long. > >> + mv >> $perf_xy_dir/etc/bash_completion.d/perf >> \ >> + >> $perf_xy_dir/etc/bash_completion.d/perf_$VERSION.$PATCHLEVEL >> + mv $perf_xy_dir/usr/bin/perf >> $perf_xy_dir/usr/bin/perf_$VERSION.$PATCHLEVEL >> + rm -f $perf_xy_dir/usr/bin/trace >> + for p in $perf_xy_dir/usr/bin/perf-*; do >> + [ -f $p ] || continue >> + mv $p >> $perf_xy_dir/usr/lib/perf_$VERSION.$PATCHLEVEL-core/ >> + done >> +fi >> + >> if [ "$ARCH" != "um" ]; then >> $MAKE -f $srctree/Makefile headers >> $MAKE -f $srctree/Makefile headers_install >> INSTALL_HDR_PATH="$libc_headers_dir/usr" @@ -191,6 +218,11 @@ fi >> >> create_package "$packagename" "$tmpdir" >> >> +if [ -n "$KDEB_PERF" ]; then >> + create_package "linux-perf-$VERSION.$PATCHLEVEL" >> "$perf_xy_dir" >> + forcearch="-DArchitecture=all" create_package "linux-perf" >> "$perf_dir" +fi >> + >> if [ -n "$BUILD_DEBUG" ] ; then >> # Build debug package >> # Different tools want the image in different locations >> diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian >> index e0750b70453f..a5826b634509 100755 >> --- a/scripts/package/mkdebian >> +++ b/scripts/package/mkdebian >> @@ -207,10 +207,36 @@ Description: Linux kernel debugging symbols for >> $version all the necessary debug symbols for the kernel and its >> modules. EOF >> >> +[ -n "${KDEB_PERF}" ] && cat <> debian/control >> + >> +Package: linux-perf >> +Section: devel >> +Architecture: all >> +Depends: linux-perf-${VERSION}.${PATCHLEVEL} >> +Description: Performance analysis tools for Linux (meta-package) >> + This package depends on the package containing the 'perf' >> performance analysis >> + tools for the latest Linux kernel. >> + >> +Package: linux-perf-${VERSION}.${PATCHLEVEL} >> +Section: devel >> +Architecture: $debarch >> +Depends: ${KDEB_PERF_DEPS} >> +Description: Performance analysis tools for Linux $version >> + This package contains the 'perf' performance analysis tools for >> Linux kernel > That all seems copied from Debian, except where does the "Section" come > from and why deviate? > > Henning > >> + version $version >> +EOF >> + >> cat < debian/rules >> #!$(command -v $MAKE) -f >> >> srctree ?= . >> +EOF >> + >> +[ -n "${KDEB_PERF}" ] && cat <> debian/rules >> +export KDEB_PERF=${KDEB_PERF} >> +EOF >> + >> +cat <> debian/rules >> >> build: >> \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \