From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-6.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id E786B7D099 for ; Thu, 7 Feb 2019 23:50:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726622AbfBGXur (ORCPT ); Thu, 7 Feb 2019 18:50:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:47902 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726650AbfBGXuq (ORCPT ); Thu, 7 Feb 2019 18:50:46 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A4EEE2173B; Thu, 7 Feb 2019 23:50:43 +0000 (UTC) Date: Thu, 7 Feb 2019 18:50:42 -0500 From: Steven Rostedt To: Joel Fernandes 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: <20190207185042.76c7d68f@gandalf.local.home> In-Reply-To: <20190207233902.GA193818@google.com> References: <20190207211102.154634-1-joel@joelfernandes.org> <20190207175239.0607f5eb@gandalf.local.home> <20190207233902.GA193818@google.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org 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. > > > > +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. -- Steve