From patchwork Fri May 14 21:58:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 1478715 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FhjBh1C0kz9sWH; Sat, 15 May 2021 08:00:28 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lhfr7-0003w0-6q; Fri, 14 May 2021 22:00:25 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lhfr3-0003v9-Md for kernel-team@lists.ubuntu.com; Fri, 14 May 2021 22:00:21 +0000 Received: from mail-ua1-f72.google.com ([209.85.222.72]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lhfr3-0007cF-EP for kernel-team@lists.ubuntu.com; Fri, 14 May 2021 22:00:21 +0000 Received: by mail-ua1-f72.google.com with SMTP id d30-20020ab007de0000b029020e2f98646dso129543uaf.5 for ; Fri, 14 May 2021 15:00:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=3Db3YMprnb4rPZAU3sZEPQ1yB23j924T6/fqFFArOd4=; b=iD/ZRP0I+U+s12pIvVZ11TSxj4JIdL17iXZIcnLHPi30h7XB+AagOHc9SoTspkz9IT Fxt/UKj40FDawoXraOE9+x4CEz9t03dmuUr9ecp1zNrulOYJi5y0xYI8s2aFoQRAIkn5 3VnsPwdce8G217GA4n2M4j4NDpYuUenK82x8bpgA9Qa0tUIiYYof3dZ4UKtyf3aCacF+ NzTm949UeTO+oZdbkZBsdAKSdVpnPMx7gAxUi19Mq+xZZZN2HYMyjNT9lg4076kNHMl+ 9uXNy2pkYu6DdNq69DYm7dWUdTreJCCa1TBhUxG+407L5KFmPHcne2ixieqV/Mg+eJFo t8FQ== X-Gm-Message-State: AOAM530zX3XI1yF7xfHbd9wa5vDQSR0bUeILxop9yz7VGVW0TORuwLxG IixszpdeOiWoG5HgOV5qY/bifHpdW1PE/CZfwlLhR0xmStYdZA9xhCBnqMFJdBP81ltCcfUJD7m DzIkR7QRfjdTSEvgFG7Vd3veYoCqgKw2dgMoKZrF0HQ== X-Received: by 2002:ab0:2eae:: with SMTP id y14mr19708741uay.15.1621029620188; Fri, 14 May 2021 15:00:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyB57RNe8K2ShGB9/urghfHFgCgaKOUiCBIE3DZN9aTx+SBHzE0cNoEDQqcQuBgOAXCC6nd2A== X-Received: by 2002:ab0:2eae:: with SMTP id y14mr19708729uay.15.1621029619978; Fri, 14 May 2021 15:00:19 -0700 (PDT) Received: from localhost.localdomain ([45.237.48.1]) by smtp.gmail.com with ESMTPSA id a5sm1079779vkl.19.2021.05.14.15.00.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 15:00:19 -0700 (PDT) From: Krzysztof Kozlowski To: kernel-team@lists.ubuntu.com Subject: [SRU][F][RFC 1/1] UBUNTU: [Packaging] Build and include GDB Python scripts into debug packages Date: Fri, 14 May 2021 17:58:05 -0400 Message-Id: <20210514215805.249031-1-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" The kernel comes with useful GDB debugging scripts/commands (enabled with CONFIG_GDB_SCRIPTS), however these are built either with "all" make target or with "scripts_gdb". Build these in "$(stampdir)/stamp-build-%" target and package in "install-%" under /usr/lib/debug/share. Signed-off-by: Krzysztof Kozlowski --- Work in progress, not extensively tested. I am sending to gather early comments and hints. I will prepare proper SRU once this looks good and is tested. See https://www.kernel.org/doc/html/latest/dev-tools/gdb-kernel-debugging.html --- debian/rules.d/2-binary-arch.mk | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk index 0542c12a708b..74577c14b5a6 100644 --- a/debian/rules.d/2-binary-arch.mk +++ b/debian/rules.d/2-binary-arch.mk @@ -52,6 +52,12 @@ $(stampdir)/stamp-build-%: $(stampdir)/stamp-prepare-% @echo Debug: $@ build_image $(build_image) bldimg $(bldimg) $(build_cd) $(kmake) $(build_O) $(conc_level) $(bldimg) modules $(if $(filter true,$(do_dtbs)),dtbs) +ifneq ($(skipdbg),true) + if grep -q CONFIG_GDB_SCRIPTS=y $(builddir)/build-$*/.config; then \ + $(build_cd) $(kmake) $(build_O) $(conc_level) scripts_gdb ; \ + fi +endif + @touch $@ define build_dkms_sign = @@ -294,6 +300,12 @@ ifneq ($(skipdbg),true) # Debug image is simple install -m644 -D $(builddir)/build-$*/vmlinux \ $(dbgpkgdir)/usr/lib/debug/boot/vmlinux-$(abi_release)-$* + if [ -d $(builddir)/build-$*/scripts/gdb/linux ]; then \ + install -m644 -D $(builddir)/build-$*/vmlinux-gdb.py \ + $(dbgpkgdir)/usr/lib/debug/share/$(abi_release)-$*/vmlinux-gdb.py; \ + install -m644 -D $(builddir)/build-$*/scripts/gdb/linux/* \ + --target-directory=$(dbgpkgdir)/usr/lib/debug/share/$(abi_release)-$*/scripts/gdb/linux; \ + fi $(build_cd) $(kmake) $(build_O) modules_install $(vdso) \ INSTALL_MOD_PATH=$(dbgpkgdir)/usr/lib/debug # Add .gnu_debuglink sections only after all/DKMS modules are built.