Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1025364imj; Thu, 7 Feb 2019 16:12:41 -0800 (PST) X-Google-Smtp-Source: AHgI3IagoQsLrXoKzaNIUb7hgQdnECkDLJs80RJ/3XUe4pa/N2rbNd8CvKrOPjWoAHszQahAVpAM X-Received: by 2002:a63:4948:: with SMTP id y8mr17475659pgk.32.1549584761475; Thu, 07 Feb 2019 16:12:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549584761; cv=none; d=google.com; s=arc-20160816; b=HkCnexX/UkfX6lO2OO6qgOTNzwQZiu/yaFB8WzxqpIXtsWUUn1r4U35TbECHlcOQlf Dmbbq08glF6JBR65j4Zq+DIRP1zyJfveqrsh50DsSHUxgXwNQze0hfyM2mkgS8rbZxG9 fnUDrzUMXq6wvrgiX5cU3ZYv8RdGPS2JKncDipbv24mwzy9HoH3ULoRZUhd5saJErqPB rKt6dAm/M0SKeQtC8/fLwLCEm0ksj0O58yvegNLfMB6ike7bxQ/fmBWlbvcNGK61+lVE 7DGi2ErQv4refTCONVUOr1rIht+mNU1baUL+p3xkWcoEP5Pn4Efd2cK2JJaOV3iRpA+h KE2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2jvMzZml8G1fBRXACrLnRWMkKrhzgtpwyBjFhfxntJU=; b=aamcWXcnU/Se/jkSbnYgguOWKd1w6TGgR2N6H2OZdR68Y7hsyKW9rgwHnycOzFRwsO /POpiLp/ReRbIqtWx3YeT3/HkSKQMvOQLRzE55G6vex67cqVbiRVmUdNjKyBWbm7AOIU VZEjzEnAYIR6maklnKJpklHOYk6lRfEDw8x/iP2y2mBku+yjVzYcF1DFX9j+1YtbEgUE dlKXSryOUemwLFB+q/awhNTNFVtUVWc7Jw/+R2QWa+GnkI1ApusqFn7oQEnKG/Np6WD8 8RIOYSdbeji5csTxex+QrtkVvviE/mZPQmTmEm2VgJiIbP0yA/wRNGO/YDj5J3Hr0E1N wB1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=DcrbpoxU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r8si456934plo.203.2019.02.07.16.12.25; Thu, 07 Feb 2019 16:12:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=DcrbpoxU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726924AbfBHALm (ORCPT + 99 others); Thu, 7 Feb 2019 19:11:42 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:42045 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726718AbfBHALm (ORCPT ); Thu, 7 Feb 2019 19:11:42 -0500 Received: by mail-qk1-f195.google.com with SMTP id y140so1118208qkb.9 for ; Thu, 07 Feb 2019 16:11:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=2jvMzZml8G1fBRXACrLnRWMkKrhzgtpwyBjFhfxntJU=; b=DcrbpoxUmYXvksaE6PpHmTeR9ReoaHaRVZuN6U2gq3JgO8YnWQ1R5k6z/8sUjTjq++ 1iO9LRkj+vDobeMt6zIo0Ba00oJTLfBcloI0p+PgDeMv15KySEAUXxSo7uhasG4xaxIn 0hOYiIv8QygM2GrjCdIBBVHGjZzXDVVXVThas= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=2jvMzZml8G1fBRXACrLnRWMkKrhzgtpwyBjFhfxntJU=; b=Bt/X80vQk8mY9dNytYiMLG8NWVqfg3Oja2v0jooxpb8tU/6WcAgrYt8+jISiLp50nI U5sC4/6du/zPMfLYy5rVPtcCBdZk48y2U05gHa/4Zkbb1eGfnev/nd2lloatii/TEoqd fPhXwWQhTqbjed6IDc99H9IIhrdEB8Y2J+pQK2RfyXKACRVPasu04cKb07ROKX9EMIwH 1BetrEcxOlx34zYvh+WQ5DdRSUKe7nNqZ8joWXFaZhNHmnkQWqQ3M2oagqT/EmFtrvwg mki/QbIbe4/Mi788/hkiKSqGfAcvRi9ELI7H9JbPlfz2JoAG2qx5MeIEmYkgA+NHQSg7 70bQ== X-Gm-Message-State: AHQUAuYp8h+qE9mgwfXuaxc5ZQIqUwU5YRSlDMjsHM8/UY7RTHzqBlHe CefgNj3rRqNvxN0Qa+lXJLx/Sg== X-Received: by 2002:a37:8784:: with SMTP id j126mr5455923qkd.228.1549584700638; Thu, 07 Feb 2019 16:11:40 -0800 (PST) Received: from localhost ([2620:0:1004:1100:cca9:fccc:8667:9bdc]) by smtp.gmail.com with ESMTPSA id w34sm842757qtj.27.2019.02.07.16.11.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Feb 2019 16:11:39 -0800 (PST) Date: Thu, 7 Feb 2019 19:11:39 -0500 From: Joel Fernandes To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Alexandre Torgue , Andrew Morton , ast@kernel.org, atishp04@gmail.com, dancol@google.com, Dan Williams , gregkh@linuxfoundation.org, Ingo Molnar , Jonathan Corbet , karim.yaghmour@opersys.com, Kees Cook , kernel-team@android.com, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Manoj Rao , Masahiro Yamada , Mathieu Desnoyers , Maxime Coquelin , paulmck@linux.vnet.ibm.com, "Peter Zijlstra (Intel)" , rdunlap@infradead.org, Shuah Khan , Thomas Gleixner , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , yhs@fb.com Subject: Re: [PATCH 1/2] Provide in-kernel headers for making it easy to extend the kernel Message-ID: <20190208001139.GB193818@google.com> References: <20190207211102.154634-1-joel@joelfernandes.org> <20190207175239.0607f5eb@gandalf.local.home> <20190207233902.GA193818@google.com> <20190207185042.76c7d68f@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190207185042.76c7d68f@gandalf.local.home> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 07, 2019 at 06:50:42PM -0500, Steven Rostedt wrote: > On Thu, 7 Feb 2019 18:39:02 -0500 > Joel Fernandes wrote: > > > > + > > > > +spath="$(dirname "$(readlink -f "$0")")" > > > > + > > > > +rm -rf $1.tmp > > > > +mkdir $1.tmp > > > > + > > > > +for f in "${@:2}"; > > > > + do find "$f" ! -name "*.c" ! -name "*.o" ! -name "*.cmd" ! -name ".*"; > > > > > > I wonder if it is a good idea to pick all files in the directories > > > defined in ikh_file_list, and not just explicitly list what we want, > > > with a '*.h' and such? > > > > I also need few files in the archive that are not .h, these don't take up > > much space but are needed to make an out-of-tree kernel module build succeed. > > > > One of my goals with this was to make a self-contained module that could be > > loaded to build other modules. Majority of the files are kernel headers, but > > some are not, such as Module.symvers and other scripts. Then one can run > > systemtap on Android which can be made to build modules using the embedded > > headers. > > Have you audited what it picks up? My main concern is that we start > adding files that are not necessary or just simply added in the > directory that are not needed for this. Yes, I audited what is needed to be picked up. It turned out that I ended up nitpicking files for not much space-saving advantage while causing the list of files that need to be picked to be long, because most of the space is taken by the headers. > > > > +done | cpio -pd $1.tmp > > > > + > > > > +for f in $(find $1.tmp); do > > > > + $spath/strip-comments.pl $f > > > > +done > > > > + > > > > +tar -Jcf $1 -C $1.tmp/ . > /dev/null > > > > + > > > > +rm -rf $1.tmp > > > > diff --git a/scripts/strip-comments.pl b/scripts/strip-comments.pl > > > > new file mode 100755 > > > > index 000000000000..f8ada87c5802 > > > > --- /dev/null > > > > +++ b/scripts/strip-comments.pl > > > > @@ -0,0 +1,8 @@ > > > > +#!/usr/bin/perl -pi > > > > +# SPDX-License-Identifier: GPL-2.0 > > > > + > > > > +# This script removes /**/ comments from a file, unless such comments > > > > +# contain "SPDX". It is used when building compressed in-kernel headers. > > > > + > > > > +BEGIN {undef $/;} > > > > +s/\/\*((?!SPDX).)*?\*\///smg; > > > > > > Hmm, I'm also wondering if we could us the C pre-processor for the > > > stripping of everything from the header file. We would then even get > > > the header files only having what is necessary for the running kernel. > > > > I thought about this too. An issue with that is it is going to be really slow > > due to the large number of headers. The other is, I think it will actually > > make the headers bigger and take up more space - because all the include > > directives will also be expanded and have more duplication. Let me know if I > > missed something though. > > > > Good point about the duplication. I was mostly thinking of getting rid > of "#ifdef" blocks. > BTW, these comments are more of a "have you thought about this" and not > really action comments. Ok, thanks for the comments :) - Joel