Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a1701005 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "scripts/build-all: look for nested vendor/ defconfig directories"

parents 4614e15f 0224904a
Loading
Loading
Loading
Loading
+27 −63
Original line number Diff line number Diff line
@@ -60,12 +60,8 @@ if not os.environ.get('CROSS_COMPILE'):

def check_kernel():
    """Ensure that PWD is a kernel directory"""
    have_defconfig = any([
        os.path.isfile('arch/arm64/configs/msm_defconfig'),
        os.path.isfile('arch/arm64/configs/sm8150_defconfig')])

    if not all([os.path.isfile('MAINTAINERS'), have_defconfig]):
        fail("This doesn't seem to be an MSM kernel dir")
    if not os.path.isfile('MAINTAINERS'):
        fail("This doesn't seem to be a kernel dir")

def check_build():
    """Ensure that the build directory is present."""
@@ -234,7 +230,7 @@ class Builder():
        self.name = name
        self.defconfig = defconfig

        self.confname = self.defconfig.split('/')[-1]
        self.confname = re.sub('arch/arm[64]*/configs/', '', self.defconfig)

        # Determine if this is a 64-bit target based on the location
        # of the defconfig.
@@ -270,7 +266,6 @@ class Builder():
        steps.append(ExecStep(['make', 'O=%s' % dest_dir,
            self.confname], env=self.make_env))

        if not all_options.updateconfigs:
        # Build targets can be dependent upon the completion of
        # previous build targets, so build them one at a time.
        cmd_line = ['make',
@@ -287,19 +282,8 @@ class Builder():
        for t in build_targets:
            steps.append(ExecStep(cmd_line + [t], env=self.make_env))

        # Copy the defconfig back.
        if all_options.configs or all_options.updateconfigs:
            steps.append(ExecStep(['make', 'O=%s' % dest_dir,
                'savedefconfig'], env=self.make_env))
            steps.append(CopyfileStep(savedefconfig, defconfig))

        return steps

def update_config(file, str):
    print 'Updating %s with \'%s\'\n' % (file, str)
    with open(file, 'a') as defconfig:
        defconfig.write(str + '\n')

def scan_configs():
    """Get the full list of defconfigs appropriate for this tree."""
    names = []
@@ -326,6 +310,13 @@ def scan_configs():
            for n in glob.glob('arch/arm64/configs/' + p):
                name = os.path.basename(n)[:-10] + "-llvm" + "-64"
                names.append(Builder(name, n))
    for defconfig in glob.glob('arch/arm*/configs/vendor/*_defconfig'):
        target = os.path.basename(defconfig)[:-10]
        name = target + "-llvm"
        if 'arch/arm64' in defconfig:
            name = name + "-64"
        names.append(Builder(name, defconfig))

    return names

def build_many(targets):
@@ -341,8 +332,6 @@ def build_many(targets):

    tracker = BuildTracker(parallel)
    for target in targets:
        if all_options.updateconfigs:
            update_config(target.defconfig, all_options.updateconfigs)
        steps = target.build()
        tracker.add_sequence(target.log_name, target.name, steps)
    tracker.run()
@@ -358,25 +347,14 @@ def main():
    usage = ("""
           %prog [options] all                 -- Build all targets
           %prog [options] target target ...   -- List specific targets
           %prog [options] perf                -- Build all perf targets
           %prog [options] noperf              -- Build all non-perf targets""")
           """)
    parser = OptionParser(usage=usage, version=version)
    parser.add_option('--configs', action='store_true',
            dest='configs',
            help="Copy configs back into tree")
    parser.add_option('--list', action='store_true',
            dest='list',
            help='List available targets')
    parser.add_option('-v', '--verbose', action='store_true',
            dest='verbose',
            help='Output to stdout in addition to log file')
    parser.add_option('--oldconfig', action='store_true',
            dest='oldconfig',
            help='Only process "make oldconfig"')
    parser.add_option('--updateconfigs',
            dest='updateconfigs',
            help="Update defconfigs with provided option setting, "
                 "e.g. --updateconfigs=\'CONFIG_USE_THING=y\'")
    parser.add_option('-j', '--jobs', type='int', dest="jobs",
            help="Number of simultaneous jobs")
    parser.add_option('-l', '--load-average', type='int',
@@ -399,25 +377,11 @@ def main():
            print "   %s" % target.name
        sys.exit(0)

    if options.oldconfig:
        make_command = ["oldconfig"]
    elif options.make_target:
    if options.make_target:
        make_command = options.make_target

    if args == ['all']:
        build_many(configs)
    elif args == ['perf']:
        targets = []
        for t in configs:
            if "perf" in t.name:
                targets.append(t)
        build_many(targets)
    elif args == ['noperf']:
        targets = []
        for t in configs:
            if "perf" not in t.name:
                targets.append(t)
        build_many(targets)
    elif len(args) > 0:
        all_configs = {}
        for t in configs: