mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Added function to extract cputype, this function was earlier rewritten
in build_linux
This commit is contained in:
@@ -67,6 +67,7 @@ class configuration:
|
||||
self.arch = None
|
||||
self.subarch = None
|
||||
self.platform = None
|
||||
self.cpu = None
|
||||
self.gcc_cpu_flag = None
|
||||
self.user_toolchain = None
|
||||
self.kernel_toolchain = None
|
||||
@@ -114,6 +115,12 @@ class configuration:
|
||||
if i[0] == parts[2]:
|
||||
self.gcc_cpu_flag = i[1]
|
||||
|
||||
# Extract cpu from a name value pair
|
||||
def get_cpu(self, name, val):
|
||||
if name[:len("CONFIG_CPU_")] == "CONFIG_CPU_":
|
||||
parts = name.split("_", 3)
|
||||
self.cpu = parts[2].lower()
|
||||
|
||||
# Extract number of containers
|
||||
def get_ncontainers(self, name, val):
|
||||
if name[:len("CONFIG_CONTAINERS")] == "CONFIG_CONTAINERS":
|
||||
@@ -252,6 +259,7 @@ def configuration_save(config):
|
||||
config_shelve["arch"] = config.arch
|
||||
config_shelve["subarch"] = config.subarch
|
||||
config_shelve["platform"] = config.platform
|
||||
config_shelve["cpu"] = config.cpu
|
||||
config_shelve["all_symbols"] = config.all
|
||||
config_shelve.close()
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ def cml2_header_to_symbols(cml2_header, config):
|
||||
config.get_arch(name, value)
|
||||
config.get_subarch(name, value)
|
||||
config.get_platform(name, value)
|
||||
config.get_cpu(name, value)
|
||||
config.get_ncontainers(name, value)
|
||||
config.get_container_parameters(name, value)
|
||||
|
||||
|
||||
@@ -116,34 +116,15 @@ class LinuxUpdateKernel:
|
||||
|
||||
# Update ARCHID, CPUID and ATAGS ADDRESS
|
||||
def modify_register_values(self, container):
|
||||
# Patterns as defined in config.h
|
||||
cpuid_pattern = '#define CONFIG_CPU_'
|
||||
archid_pattern = '#define CONFIG_PLATFORM_'
|
||||
|
||||
config_h_path = join(PROJROOT, CONFIG_H)
|
||||
|
||||
for pattern in cpuid_pattern, archid_pattern:
|
||||
with open(config_h_path, 'r') as f:
|
||||
for line in f:
|
||||
start = string.find(line, pattern)
|
||||
if start == -1:
|
||||
continue
|
||||
else:
|
||||
end = start + len(pattern)
|
||||
start = end
|
||||
while line[end] != ' ':
|
||||
end = end + 1
|
||||
if pattern == cpuid_pattern:
|
||||
cpu_type = line[start:end]
|
||||
elif pattern == archid_pattern:
|
||||
arch_type = line[start:end]
|
||||
break
|
||||
# TODO: This call needs to be made global
|
||||
config = configuration_retrieve()
|
||||
for i in self.cpuid_list:
|
||||
if i[0] == cpu_type:
|
||||
if i[0] == config.cpu.upper():
|
||||
cpuid = i[1]
|
||||
break
|
||||
for i in self.archid_list:
|
||||
if i[0] == arch_type:
|
||||
if i[0] == config.platform.upper():
|
||||
archid = i[1]
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user