예제 #1
0
 def __init__(self, options=None):
     if options:
         self.options = options
     else:
         self.options = dict()
     if not options.has_key('expansion_strategy'):
         self.options['expansion_strategy'] = 'alldefconfig'
     if not options.has_key('arch'):
         self.options['arch'] = vamos.default_architecture
     if not options.has_key('subarch'):
         self.options['subarch'] = guess_subarch_from_arch(
             self.options['arch'])
     self.options['model'] = get_model_for_arch(self.options['arch'])
     KbuildBuildFramework.__init__(self, self.options)
     logging.info("Instantiating LinuxBuildFramework (%s/%s)",
                  self.options['arch'], self.options['subarch'])
예제 #2
0
 def __init__(self, options=None):
     if options:
         self.options = options
     else:
         self.options = dict()
     if not options.has_key('expansion_strategy'):
         self.options['expansion_strategy'] = 'allyesconfig'
     if self.options['expansion_strategy'] == 'alldefconfig':
         # This is set by default but doesn't work in busybox,
         # therfore let's handle this gracefully
         logging.info("expansion_strategy alldefconfig doesn't exist in busybox, " +\
                          "overriding to allyesconfig")
         self.options['expansion_strategy'] = 'allyesconfig'
     self.options['arch'] = 'busybox'
     self.options['subarch'] = 'busybox'
     self.options['model'] = get_model_for_arch('busybox')
     KbuildBuildFramework.__init__(self, self.options)
예제 #3
0
    def expand(self, verify=False):
        """
        @raises ExpansionError if verify=True and expanded config does
                               not patch all requested items
        """
        logging.debug("Trying to expand configuration " + self.kconfig)

        if not os.path.exists(self.kconfig):
            raise RuntimeError("Partial configuration %s does not exist" %
                               self.kconfig)

        files = self.framework.cleanup_autoconf_h()

        if len(files) > 1:
            logging.error("Deleted spurious configuration files: %s",
                          ", ".join(files))

        extra_env = 'KCONFIG_ALLCONFIG="%s"' % self.kconfig
        self.call_makefile(self.expansion_strategy, extra_env=extra_env)
        self.framework.apply_configuration()

        self.expanded = self.save_expanded('.config')

        if verify:
            modelf = get_model_for_arch(self.arch)
            if not modelf:
                logging.error(
                    "Skipping verification as no model could be loaded")
                return

            if not self.model:
                self.model = parse_model(modelf)
                logging.info("Loaded %d items from %s", len(self.model),
                             modelf)

            all_items, violators = self.verify(self.expanded)
            if len(violators) > 0:
                logging.warning("%d/%d mismatched items", len(violators),
                                len(all_items))
                for v in violators:
                    logging.info("violating item: %s", v)
                raise ExpansionError("Config %s failed to expand properly" %
                                     self.kconfig)
            else:
                logging.info("All items are set correctly")
예제 #4
0
    def __init__(self, arch, subarch, directory_prefix = ""):
        InferenceAtoms.__init__(self)
        self.arch = arch
        self.subarch = subarch
        self.directory_prefix = directory_prefix

        if arch:
            modelfile = get_model_for_arch(arch)
        else:
            modelfile = None

        if modelfile:
            logging.info("loading model %s", modelfile)
            self.model = parse_model(modelfile)
        else:
            logging.error("%s not found, please generate models using undertaker-kconfigdump",
                          modelfile)
            self.model = parse_model('/dev/null')

        call_linux_makefile('allnoconfig', arch=self.arch, subarch=self.subarch)
        apply_configuration(arch=self.arch, subarch=self.subarch)
예제 #5
0
    def __init__(self, options=None):
        if options:
            self.options = options
        else:
            self.options = dict()
        self.options['arch'] = 'coreboot'

        self.options['model'] = get_model_for_arch('coreboot')
        if not self.options['model']:
            raise RuntimeError('No model existing! Please run \
                    undertaker-kconfigdump first')
        if os.environ.has_key('SUBARCH'):
            self.options['subarch'] = os.environ['SUBARCH']
        else:
            self.options['subarch'] = "emulation/qemu-x86"
        if not options.has_key('expansion_strategy') or \
            self.options['expansion_strategy'] == 'alldefconfig' or \
            self.options['expansion_strategy'] == 'defconfig':
            self.options['expansion_strategy'] = 'allyesconfig'

        KbuildBuildFramework.__init__(self, options)
예제 #6
0
    def expand(self, verify=False):
        """
        @raises ExpansionError if verify=True and expanded config does
                               not patch all requested items
        """
        logging.debug("Trying to expand configuration " + self.kconfig)

        if not os.path.exists(self.kconfig):
            raise RuntimeError("Partial configuration %s does not exist" % self.kconfig)

        files = self.framework.cleanup_autoconf_h()

        if len(files) > 1:
            logging.error("Deleted spurious configuration files: %s", ", ".join(files))

        extra_env = 'KCONFIG_ALLCONFIG="%s"' % self.kconfig
        self.call_makefile(self.expansion_strategy, extra_env=extra_env)
        self.framework.apply_configuration()

        self.expanded = self.save_expanded('.config')

        if verify:
            modelf = get_model_for_arch(self.arch)
            if not modelf:
                logging.error("Skipping verification as no model could be loaded")
                return

            if not self.model:
                self.model = parse_model(modelf)
                logging.info("Loaded %d items from %s", len(self.model), modelf)

            all_items, violators = self.verify(self.expanded)
            if len(violators) > 0:
                logging.warning("%d/%d mismatched items", len(violators), len(all_items))
                for v in violators:
                    logging.info("violating item: %s", v)
                raise ExpansionError("Config %s failed to expand properly" % self.kconfig)
            else:
                logging.info("All items are set correctly")
    def __init__(self, arch, subarch, directory_prefix=""):
        InferenceAtoms.__init__(self)
        self.arch = arch
        self.subarch = subarch
        self.directory_prefix = directory_prefix

        if arch:
            modelfile = Model.get_model_for_arch(arch)
        else:
            modelfile = None

        if modelfile:
            logging.info("loading model %s", modelfile)
            self.model = Model.parse_model(modelfile)
        else:
            sys.exit("No model for '%s' found, please generate models using undertaker-kconfigdump" \
                    % arch)

        kbuild.call_linux_makefile('allnoconfig',
                                   arch=self.arch,
                                   subarch=self.subarch)
        kbuild.apply_configuration(arch=self.arch, subarch=self.subarch)