Shorter names for symbols, class symbols to contain symbol information

This commit is contained in:
Bahadir Balban
2009-09-10 22:45:39 +03:00
parent a41ce94ac1
commit 202e9cab94
2 changed files with 111 additions and 93 deletions

View File

@@ -5,30 +5,30 @@ start main_menu
############# #############
symbols symbols
ARCH_ARM 'ARM' CONFIG_ARCH_ARM 'ARM'
arm_cpu_type 'ARM Processor Type' arm_cpu_type 'ARM Processor Type'
ARM_CPU_ARM1136 'ARM1136 - To be added' CONFIG_CPU_ARM1136 'ARM1136 - To be added'
ARM_CPU_ARM11MPCORE 'ARM11 MPCore - To be added' CONFIG_CPU_ARM11MPCORE 'ARM11 MPCore - To be added'
ARM_CPU_ARM926 'ARM926EJ-S' CONFIG_CPU_ARM926 'ARM926EJ-S'
ARM_CPU_CORTEXA8 'ARM Cortex-A8 - Not supported' CONFIG_CPU_CORTEXA8 'ARM Cortex-A8 - Not supported'
arm_subarch_type 'ARM Architecture Family' arm_subarch_type 'ARM Architecture Family'
ARM_SUBARCH_V5 'ARM v5 Architecture' CONFIG_SUBARCH_V5 'ARM v5 Architecture'
ARM_SUBARCH_V6 'ARM v6 Architecture, To be added' CONFIG_SUBARCH_V6 'ARM v6 Architecture, To be added'
ARM_SUBARCH_V7 'ARM v7 Architecture, To be added' CONFIG_SUBARCH_V7 'ARM v7 Architecture, To be added'
arm_platform_type 'ARM Platform Type' arm_platform_type 'ARM Platform Type'
ARM_PLATFORM_EB 'Realview EB Platform, Unsupported yet' CONFIG_PLATFORM_EB 'Realview EB Platform, Unsupported yet'
ARM_PLATFORM_AB926 'Versatile AB926 Platform, Unsupported yet' CONFIG_PLATFORM_AB926 'Versatile AB926 Platform, Unsupported yet'
ARM_PLATFORM_PB926 'Versatile PB926 Platform' CONFIG_PLATFORM_PB926 'Versatile PB926 Platform'
ARM_PLATFORM_PB11MPCORE 'Realview PB11MPCore Platform' CONFIG_PLATFORM_PB11MPCORE 'Realview PB11MPCore Platform'
ARM_PLATFORM_PBA8 'Realview PB-A8 Platform' CONFIG_PLATFORM_PBA8 'Realview PB-A8 Platform'
DRIVER_UART_PL011 'ARM UART Primecell driver PL011' CONFIG_DRIVER_UART_PL011 'ARM UART Primecell driver PL011'
DRIVER_TIMER_SP804 'ARM Dual Timer Primecell driver SP804' CONFIG_DRIVER_TIMER_SP804 'ARM Dual Timer Primecell driver SP804'
DRIVER_IRQ_PL190 'ARM Vectored Interrupt Controller PL190' CONFIG_DRIVER_IRQ_PL190 'ARM Vectored Interrupt Controller PL190'
DRIVER_IRQ_GIC 'ARM Generic Interrupt Controller GIC' CONFIG_DRIVER_IRQ_GIC 'ARM Generic Interrupt Controller GIC'
main_menu 'Codezero Microkernel Configurator' main_menu 'Codezero Microkernel Configurator'
arm_menu 'ARM Architecture Configuration' arm_menu 'ARM Architecture Configuration'
@@ -79,29 +79,29 @@ Physical address that this container ends
# CHOICES # # CHOICES #
############# #############
choices arch_type choices arch_type
ARCH_ARM CONFIG_ARCH_ARM
default ARCH_ARM default CONFIG_ARCH_ARM
choices arm_subarch_type choices arm_subarch_type
ARM_SUBARCH_V5 CONFIG_SUBARCH_V5
ARM_SUBARCH_V6 CONFIG_SUBARCH_V6
ARM_SUBARCH_V7 CONFIG_SUBARCH_V7
default ARM_SUBARCH_V5 default CONFIG_SUBARCH_V5
choices arm_cpu_type choices arm_cpu_type
ARM_CPU_ARM926 CONFIG_CPU_ARM926
ARM_CPU_ARM1136 CONFIG_CPU_ARM1136
ARM_CPU_ARM11MPCORE CONFIG_CPU_ARM11MPCORE
ARM_CPU_CORTEXA8 CONFIG_CPU_CORTEXA8
default ARM_CPU_ARM926 default CONFIG_CPU_ARM926
choices arm_platform_type choices arm_platform_type
ARM_PLATFORM_EB CONFIG_PLATFORM_EB
ARM_PLATFORM_AB926 CONFIG_PLATFORM_AB926
ARM_PLATFORM_PB926 CONFIG_PLATFORM_PB926
ARM_PLATFORM_PB11MPCORE CONFIG_PLATFORM_PB11MPCORE
ARM_PLATFORM_PBA8 CONFIG_PLATFORM_PBA8
default ARM_PLATFORM_PB926 default CONFIG_PLATFORM_PB926
############# #############
# MENUS # # MENUS #
@@ -123,10 +123,10 @@ menu arm_platform_menu
arm_platform_type arm_platform_type
menu drivers_menu menu drivers_menu
DRIVER_UART_PL011 CONFIG_DRIVER_UART_PL011
DRIVER_TIMER_SP804 CONFIG_DRIVER_TIMER_SP804
DRIVER_IRQ_PL190 CONFIG_DRIVER_IRQ_PL190
DRIVER_IRQ_GIC CONFIG_DRIVER_IRQ_GIC
menu arm_menu menu arm_menu
arm_subarch_type arm_subarch_type
@@ -145,31 +145,31 @@ menu main_menu
############# #############
#Platform rules: #Platform rules:
unless ARM_SUBARCH_V5 suppress ARM_PLATFORM_PB926 unless CONFIG_SUBARCH_V5 suppress CONFIG_PLATFORM_PB926
unless ARM_SUBARCH_V5 suppress ARM_PLATFORM_AB926 unless CONFIG_SUBARCH_V5 suppress CONFIG_PLATFORM_AB926
unless ARM_SUBARCH_V6 suppress ARM_PLATFORM_PB11MPCORE unless CONFIG_SUBARCH_V6 suppress CONFIG_PLATFORM_PB11MPCORE
unless ARM_SUBARCH_V7 suppress ARM_PLATFORM_PBA8 unless CONFIG_SUBARCH_V7 suppress CONFIG_PLATFORM_PBA8
#CPU rules: #CPU rules:
unless ARM_SUBARCH_V5 suppress ARM_CPU_ARM926 unless CONFIG_SUBARCH_V5 suppress CONFIG_CPU_ARM926
unless ARM_SUBARCH_V6 suppress ARM_CPU_ARM1136 unless CONFIG_SUBARCH_V6 suppress CONFIG_CPU_ARM1136
unless ARM_SUBARCH_V6 suppress ARM_CPU_ARM11MPCORE unless CONFIG_SUBARCH_V6 suppress CONFIG_CPU_ARM11MPCORE
unless ARM_SUBARCH_V7 suppress ARM_CPU_CORTEXA8 unless CONFIG_SUBARCH_V7 suppress CONFIG_CPU_CORTEXA8
# NOTE: Unlike menus, choices dont take { sym } model of visibility # NOTE: Unlike menus, choices dont take { sym } model of visibility
# dependencies. Instead, a choice symbol is declared in a menu, and # dependencies. Instead, a choice symbol is declared in a menu, and
# suppress statement is used to make sym visible, instead of a # suppress statement is used to make sym visible, instead of a
# { sym } model under the choices. (See manual for { sym } usage). # { sym } model under the choices. (See manual for { sym } usage).
unless ARM_SUBARCH_V5 suppress ARM_PLATFORM_PB926 unless CONFIG_SUBARCH_V5 suppress CONFIG_PLATFORM_PB926
unless ARCH_ARM suppress arm_menu unless CONFIG_ARCH_ARM suppress arm_menu
unless ARM_PLATFORM_PB926 or ARM_PLATFORM_AB926 suppress DRIVER_IRQ_PL190 unless CONFIG_PLATFORM_PB926 or CONFIG_PLATFORM_AB926 suppress CONFIG_DRIVER_IRQ_PL190
unless ARM_PLATFORM_EB suppress ARM_CPU_ARM1136 unless CONFIG_PLATFORM_EB suppress CONFIG_CPU_ARM1136
unless ARM_PLATFORM_EB or ARM_PLATFORM_PBA8 or ARM_PLATFORM_PB11MPCORE suppress DRIVER_IRQ_GIC unless CONFIG_PLATFORM_EB or CONFIG_PLATFORM_PBA8 or CONFIG_PLATFORM_PB11MPCORE suppress CONFIG_DRIVER_IRQ_GIC
default DRIVER_UART_PL011 from y default CONFIG_DRIVER_UART_PL011 from y
default DRIVER_TIMER_SP804 from y default CONFIG_DRIVER_TIMER_SP804 from y
default DRIVER_IRQ_PL190 from y default CONFIG_DRIVER_IRQ_PL190 from y
default DRIVER_IRQ_GIC from y default CONFIG_DRIVER_IRQ_GIC from y
# Container Rules # Container Rules
default CONFIG_CONTAINERS from 1 default CONFIG_CONTAINERS from 1

View File

@@ -16,6 +16,7 @@ CONFIG_DATA_DIR = join(BUILDDIR, "configdata")
CONFIG_DATA_FILENAME = "configuration" CONFIG_DATA_FILENAME = "configuration"
CONFIG_DATA = join(CONFIG_DATA_DIR, CONFIG_DATA_FILENAME) CONFIG_DATA = join(CONFIG_DATA_DIR, CONFIG_DATA_FILENAME)
configuration = {} configuration = {}
config_data = {}
def save_configuration(configuration): def save_configuration(configuration):
if not os.path.exists(CONFIG_DATA_DIR): if not os.path.exists(CONFIG_DATA_DIR):
@@ -25,14 +26,55 @@ def save_configuration(configuration):
config_shelve["cml2_config"] = configuration config_shelve["cml2_config"] = configuration
config_shelve.close() config_shelve.close()
def cml2_process(cml2_conf_props): '''
config_items = {} def cml2_parse_config_symbol(name, value):
with file(cml2_conf_props) as config_file: sname, sval = line.split('=')
for line in config_file: if len(config_sym_pair) == 2: # This means it is a valid symbol
item = line.split('=') cml2_parse_config_symbol(name, value)
if len(item) == 2: config, rest = name.split("_", 1)
config_items[item[0].strip()] = (item[1].strip() == 'y') print symparts
return config_items '''
class config_symbols:
arch = None
subarch = None
platform = None
kbuild = []
all = []
# Get all name value symbols
def get_all(self, name, val):
self.all.append([name, val])
# Convert line to name value pair, if possible
def line_to_name_value(self, line):
parts = line.split()
if len(parts) > 0:
if parts[0] == "#define":
return parts[1], parts[2]
return None
# Extract architecture from a name value pair
def get_arch(self, name, val):
if name[:len("CONFIG_ARCH_")] == "CONFIG_ARCH_":
parts = name.split("_", 3)
print parts
self.arch = parts[2].lower()
symbols = config_symbols()
def cml2_header_to_symbols(cml2_header):
with file(cml2_header) as header_file:
for line in header_file:
pair = symbols.line_to_name_value(line)
if pair is not None:
print pair
name, value = pair
symbols.get_all(name,value)
symbols.get_arch(name,value)
print symbols.all
print symbols.arch
def cml2_update_config_h(configuration): def cml2_update_config_h(configuration):
config_h_path = BUILDDIR + '/l4/config.h' config_h_path = BUILDDIR + '/l4/config.h'
@@ -41,26 +83,6 @@ def cml2_update_config_h(configuration):
config_h.write("#define __PLATFORM__ " + configuration['PLATFORM'] + '\n') config_h.write("#define __PLATFORM__ " + configuration['PLATFORM'] + '\n')
config_h.write("#define __SUBARCH__ " + configuration['SUBARCH'] + '\n') config_h.write("#define __SUBARCH__ " + configuration['SUBARCH'] + '\n')
def cml2_parse_configuration(configuration, config_data):
for key, value in config_data.items():
if value:
items = key.split('_')
if items[0] == 'ARCH':
configuration['ARCH'] = items[1].lower()
for key, value in config_data.items():
if value:
items = key.split('_')
if items[0] == 'ARCH': continue
if items[0] == configuration['ARCH'].upper():
configuration[items[1]] = items[2].lower()
else:
path = items[1].lower() + '/' + items[2].lower()
try:
configuration[items[0]]
except KeyError:
configuration[items[0]] = []
configuration[items[0]].append(path)
def cml2_configure(cml2_config_file): def cml2_configure(cml2_config_file):
os.system(CML2TOOLSDIR + '/cmlcompile.py -o ' + CML2RULES + ' ' + cml2_config_file) os.system(CML2TOOLSDIR + '/cmlcompile.py -o ' + CML2RULES + ' ' + cml2_config_file)
os.system(CML2TOOLSDIR + '/cmlconfigure.py -c -o ' + CML2_CONFIG_PROPERTIES + ' ' + CML2RULES) os.system(CML2TOOLSDIR + '/cmlconfigure.py -c -o ' + CML2_CONFIG_PROPERTIES + ' ' + CML2RULES)
@@ -74,13 +96,9 @@ def configure_kernel(cml_file):
os.mkdir(BUILDDIR) os.mkdir(BUILDDIR)
cml2_configure(cml_file) cml2_configure(cml_file)
cml2_header_to_symbols(CML2_CONFIG_H)
config_data = cml2_process(CML2_CONFIG_PROPERTIES) #cml2_parse_config_data(configuration, config_data)
#cml2_update_config_h(configuration)
cml2_parse_configuration(configuration, config_data)
cml2_update_config_h(configuration)
save_configuration(configuration) save_configuration(configuration)
return configuration return configuration