コード例 #1
0
def guess_arch_from_filename(filename):
    """
    Guesses the 'best' architecture for the given filename.

    If the file is in the Linux HAL (e.g., 'arch/arm/init.c', then the
    architecture is deduced from the filename

    Defaults to 'vamos.default_architecture' (default: 'x86')

    returns a tuple (arch, subarch) with the architecture identifier (as
    in the subdirectory part) and the preferred "subarchitecture". The
    latter is used e.g. to disable CONFIG_64BIT on 'make allnoconfig'
    when compiling on a 64bit host (default behavior), unless
    vamos.prefer_32bit is set to False.
    """

    m = re.search("^arch/([^/]*)/", os.path.normpath(filename))
    if m:
        arch = m.group(1)
    else:
        arch = vamos.default_architecture

    subarch = guess_subarch_from_arch(arch)

    forced_64bit = False
    forced_32bit = False

    if arch == 'x86' and '.config' in filename:
        c = Config(filename)
        if c.valueOf('CONFIG_X86_64') == 'y' or c.valueOf(
                'CONFIG_64BIT') == 'y':
            subarch = 'x86_64'
            logging.debug("Config %s forces subarch x86_64", filename)
            forced_64bit = True

        if c.valueOf('CONFIG_X86_64') == 'n' or c.valueOf('CONFIG_64BIT') == 'n' \
                or c.valueOf('CONFIG_X86_32') == 'y':
            subarch = 'i386'
            logging.debug("Config %s forces subarch i386", filename)
            forced_32bit = True

    if forced_32bit and forced_64bit:
        logging.error(
            "%s is inconsistent: cannot enable 64bit and 32bit together (using %s)",
            filename, subarch)

    return (arch, subarch)
コード例 #2
0
ファイル: Config_test.py プロジェクト: ckaestne/undertaker
 def test_addFeature(self):
     confA = Config()
     confA.addFeature("CONFIG_FOO","m")
     self.assertEqual(confA.valueOf("CONFIG_FOO"),"m")
コード例 #3
0
ファイル: Config_test.py プロジェクト: ckaestne/undertaker
 def test_valueOf(self):
     confA = Config()
     confA.readConfigFile(self.configA.name)
     self.assertEqual(confA.valueOf("CONFIG_A"),"y")
コード例 #4
0
 def test_addFeature(self):
     confA = Config()
     confA.addFeature("CONFIG_FOO", "m")
     self.assertEqual(confA.valueOf("CONFIG_FOO"), "m")
コード例 #5
0
 def test_valueOf(self):
     confA = Config()
     confA.readConfigFile(self.configA.name)
     self.assertEqual(confA.valueOf("CONFIG_A"), "y")