aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuren Baghdasaryan <surenb@google.com>2017-08-31 13:28:47 -0700
committerSuren Baghdasaryan <surenb@google.com>2017-10-02 23:29:14 +0000
commit865cf9598537f5a405e8ada5ffed91daae9ac414 (patch)
tree6256c2082bdaec02a8e871e5c375b730580100d5
parent07048eeb8bf34603db2670cb40630df2d5e59d49 (diff)
downloaddevlib-865cf9598537f5a405e8ada5ffed91daae9ac414.tar.gz
utils/android_build: Remove methods to build kernel
Kernel build process will be described in an external script referenced from board config file. Change-Id: Ied74824996a4121cdfded55b283e196e8193c6bc Signed-off-by: Suren Baghdasaryan <surenb@google.com>
-rw-r--r--devlib/utils/android_build.py70
1 files changed, 8 insertions, 62 deletions
diff --git a/devlib/utils/android_build.py b/devlib/utils/android_build.py
index da89dbb..de638ba 100644
--- a/devlib/utils/android_build.py
+++ b/devlib/utils/android_build.py
@@ -17,16 +17,11 @@
import logging
import os
+import shutil
+import subprocess
from collections import namedtuple
class Build(object):
- BuildParams = namedtuple("BuildParams", "arch defconfig cross_compile")
-
- device_kernel_build_params = {
- 'hikey960': BuildParams('arm64', 'hikey960_defconfig', 'aarch64-linux-android-'),
- 'hikey': BuildParams('arm64', 'hikey_defconfig', 'aarch64-linux-android-')
- }
-
"""
Collection of Android related build actions
"""
@@ -37,6 +32,11 @@ class Build(object):
te._log.warning('Build initialization failed: invalid paramterers')
raise
+ def exec_cmd(self, cmd):
+ ret = subprocess.call(cmd, shell=True)
+ if ret != 0:
+ raise RuntimeError('Command \'{}\' returned error code {}'.format(cmd, ret))
+
def build_module(self, module_path):
"""
Build a module and its dependencies.
@@ -45,66 +45,12 @@ class Build(object):
:type module_path: str
"""
- self._te._log.info('BUILDING module %s', module_path)
cur_dir = os.getcwd()
os.chdir(self._te.ANDROID_BUILD_TOP)
lunch_target = self._te.TARGET_PRODUCT + '-' + self._te.TARGET_BUILD_VARIANT
- os.system('source build/envsetup.sh && lunch ' +
+ self.exec_cmd('source build/envsetup.sh && lunch ' +
lunch_target + ' && mmma -j16 ' + module_path)
os.chdir(cur_dir)
- def build_kernel(self, kernel_path, arch, defconfig, cross_compile, clean=False):
- """
- Build kernel.
-
- :param kernel_path: path to kernel sources
- :type kernel_path: str
-
- :param arch: device architecture string used in ARCH command line parameter
- :type arch: str
-
- :param defconfig: defconfig file name
- :type defconfig: str
-
- :param cross_compile: compiler string used in CROSS_COMPILE command line parameter
- :type cross_compile: str
-
- :param clean: flag to clean the previous build
- :type clean: boolean
-
- """
- self._te._log.info('BUILDING kernel @ %s', kernel_path)
- cur_dir = os.getcwd()
- os.chdir(kernel_path)
- os.system('. ./build.config')
- if clean:
- os.system('make clean')
- os.system('make ARCH=' + arch + ' ' + defconfig)
- os.system('make -j24 ARCH=' + arch + ' CROSS_COMPILE=' + cross_compile)
- os.chdir(cur_dir)
-
- def build_kernel_for_device(self, kernel_path, device_name, clean):
- """
- Build kernel for specified device.
-
- :param kernel_path: path to kernel sources
- :type kernel_path: str
-
- :param device_name: device name
- :type device_name: str
-
- :param clean: flag to clean the previous build
- :type clean: boolean
-
- """
- if not device_name in self.device_kernel_build_params:
- return False
-
- params = self.device_kernel_build_params[device_name]
- self.build_kernel(kernel_path, params.arch,
- params.defconfig, params.cross_compile, clean)
- return True
-
-
# vim :set tabstop=4 shiftwidth=4 expandtab