From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 6CE6B1393F1 for ; Wed, 16 Sep 2015 05:16:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F1ECBE085D; Wed, 16 Sep 2015 05:16:41 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 70963E085D for ; Wed, 16 Sep 2015 05:16:41 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id DF5CA34096D for ; Wed, 16 Sep 2015 05:16:37 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id CF1E518B for ; Wed, 16 Sep 2015 05:16:34 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: <1442380878.7fd80a5aacbcae4eb5d2526b9d9a831eb089fcdb.blueness@gentoo> Subject: [gentoo-commits] proj/grss:master commit in: grs/ X-VCS-Repository: proj/grss X-VCS-Files: grs/Kernel.py X-VCS-Directories: grs/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: 7fd80a5aacbcae4eb5d2526b9d9a831eb089fcdb X-VCS-Branch: master Date: Wed, 16 Sep 2015 05:16:34 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: b02727e0-e838-4640-870f-d382fd4bea3b X-Archives-Hash: 96461a3256413bd7726f94dddcf71d09 commit: 7fd80a5aacbcae4eb5d2526b9d9a831eb089fcdb Author: Anthony G. Basile gentoo org> AuthorDate: Wed Sep 16 05:21:18 2015 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Wed Sep 16 05:21:18 2015 +0000 URL: https://gitweb.gentoo.org/proj/grss.git/commit/?id=7fd80a5a grs/Kernel.py: build either modular or static kernel. grs/Kernel.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/grs/Kernel.py b/grs/Kernel.py index 7f96d91..7ec5615 100644 --- a/grs/Kernel.py +++ b/grs/Kernel.py @@ -40,12 +40,15 @@ class Kernel(): def parse_kernel_config(self): """ Parse the version to be built/installed from the kernel-config file. """ with open(self.kernel_config, 'r') as f: - for i in range(3): - line = f.readline() + lines = f.readlines() + # Are we building a modular kernel or statically linked? + has_modules = 'CONFIG_MODULES=y\n' in lines + # The third line is the version line in the kernel config file. + version_line = lines[2] # The version line looks like the following: # Linux/x86 4.0.6-hardened-r2 Kernel Configuration # The 2nd group contains the version. - m = re.search('^#\s+(\S+)\s+(\S+).+$', line) + m = re.search('^#\s+(\S+)\s+(\S+).+$', version_line) gentoo_version = m.group(2) try: # Either the verison is of the form '4.0.6-hardened-r2' with two -'s @@ -61,7 +64,7 @@ class Kernel(): flavor = m.group(2) pkg_name = flavor + '-sources-' + vanilla_version pkg_name = '=sys-kernel/' + pkg_name - return (gentoo_version, pkg_name) + return (gentoo_version, pkg_name, has_modules) def kernel(self): @@ -72,7 +75,7 @@ class Kernel(): and finally installs it to the system's portage configroot. """ # Grab the parsed verison and pkg atom. - (gentoo_version, pkg_name) = self.parse_kernel_config() + (gentoo_version, pkg_name, has_modules) = self.parse_kernel_config() # Prepare the paths to where we'll emerge and build the kernel, # as well as paths for genkernel. @@ -117,10 +120,14 @@ class Kernel(): cmd += '--bootdir=%s ' % boot_dir cmd += '--module-prefix=%s ' % image_dir cmd += '--modprobedir=%s ' % modprobe_dir - cmd += 'all' + if has_modules: + cmd += 'all' + else: + cmd += 'bzImage' Execute(cmd, timeout=None, logfile=self.logfile) # Strip the modules to shrink their size enormously! + # This will do nothing if there is not modules_dir for dirpath, dirnames, filenames in os.walk(modules_dir): for filename in filenames: if filename.endswith('.ko'):