HELP+="all - Builds basic programs and prints message about next steps.\n"
.PHONY: all
all: $(HELPER_PROGRAMS) .stamp/initram_cyclictest
+ mkdir -p $(CONF_LOG_FOLDER)
+ mkdir -p $(CONF_BUILD_FOLDER)
.PHONY: help
help:
HELP+="run - Executes loop of kernel building, booting and benchmark execution.\n"
.PHONY: run
-run: all $(CONF_BUILD_FOLDER)/rules
- mkdir -p $(CONF_LOG_FOLDER)
+run: all $(CONF_BUILD_FOLDER)/rules $(CONF_BUILD_FOLDER)/fixed
+ ln -sf ../dot_measure $(CONF_BUILD_FOLDER)
scripts/loop.py
-$(CONF_BUILD_FOLDER)/rules: .conf.mk $(CONF_LINUX_SOURCES)/Kconfig .target
- mkdir -p $(dir $@)
+$(CONF_BUILD_FOLDER)/rules $(CONF_BUILD_FOLDER)/symbol_map: .conf.mk $(CONF_LINUX_SOURCES)/Kconfig
scripts/parse_kconfig/parse -v --env .conf.mk $(CONF_LINUX_SOURCES)/Kconfig $(dir $@)
+$(CONF_BUILD_FOLDER)/allconfig: .conf.mk $(CONF_LINUX_SOURCES)/Kconfig $(CONF_LINUX_BUILD_FOLDER)/.config
+ scripts/allconfig/allconfig --env .conf.mk $(CONF_LINUX_SOURCES)/Kconfig $(CONF_LINUX_BUILD_FOLDER)/.config $@
+
+$(CONF_BUILD_FOLDER)/fixed $(CONF_BUILD_FOLDER)/measure: .conf.mk $(CONF_BUILD_FOLDER)/allconfig dot_measure
+ scripts/gen_fixed.py $(CONF_BUILD_FOLDER)/allconfig dot_measure
+
.PHONY: evaluate
evaluate:
scripts/evaluate.py
--- /dev/null
+#!/usr/bin/env python3
+import sys
+import utils
+
+from conf import conf
+
+f_allconfig = open(sys.argv[1], 'r')
+f_options = open(sys.argv[2], 'r')
+
+f_measure = open(conf.measure_file, 'w')
+f_fixed = open(conf.fixed_file, 'w')
+
+variable_options = set()
+for line in f_options:
+ option = line.split('=')[0][7:] # Remove CONFIG_ (7 chars)
+ variable_options.add(option)
+
+utils.build_symbol_map() # Ensure smap existence
+srmap = {value:key for key, value in utils.smap.items()} # swap dictionary
+
+for line in f_allconfig:
+ if (line[0] == '#') or (not '=' in line):
+ continue
+ sym, val = line.rstrip().split('=')
+ sym = sym[7:] # Remove CONFIG_
+ if sym == "MODULES" and val == 'y':
+ raise exceptions.ConfigurationError("Fixed kernel configuration must have MODULES disabled.")
+ if sym in variable_options:
+ print(srmap[sym], file=f_measure)
+ else:
+ print(srmap[sym] * (-1 if val == 'n' else +1), file=f_fixed)
utils.dirtycheck()
except exceptions.DirtyRepository as e:
print("Warning: " + str(e))
- gen_fixed()
checkmeasure()
database.database() # check if database is initialized
-def __gen_allconfig_fixed__():
- wd = os.getcwd()
- os.chdir(sf(conf.linux_sources))
- allconfig_cmd = [sf(conf.allconfig)]
- allconfig_cmd += ['Kconfig', sf(conf.dot_config), sf(conf.dot_measure_file)]
- allconfig_cmd += ['--inv']
- utils.callsubprocess("allconfig_fixed", allconfig_cmd, False,
- env = utils.get_kernel_env())
- os.chdir(wd)
-
-def gen_fixed():
- "Generates fixed depenpency from dot_config file."
- print('Generating required configuration...')
-
- if not os.path.isfile(sf(conf.dot_config)):
- raise exceptions.MissingFile(sf(conf.dot_config),
- 'Generate fixed configuration. Use make dot_config.')
-
- utils.build_symbol_map() # Ensure smap existence
- srmap = {value:key for key, value in utils.smap.items()} # swap dictionary
-
- shutil.copy(sf(conf.dot_config), sf(conf.dot_config_back_file))
- __gen_allconfig_fixed__()
-
- with open(sf(conf.dot_config), 'r') as f:
- with open(sf(conf.fixed_file), 'w') as ffix:
- for line in f:
- if (line[0] == '#') or (not '=' in line):
- continue
- indx = line.index('=')
- if (line[indx + 1] == 'y'):
- if line[7:indx] == "MODULES": # exception if modules set
- raise exceptions.ConfigurationError("Fixed kernel configuration must have MODULES disabled.")
- ffix.write(str(srmap[line[7:indx]]) + "\n")
- elif (line[indx + 1] == 'n' or line[indx + 1] == 'm'):
- ffix.write("-" + str(srmap[line[7:indx]]) + "\n")
- with open(sf(conf.dot_measure_file), 'r') as f:
- with open(sf(conf.measure_file), 'w') as fmes:
- for line in f:
- if (line[0] == '#') or (not '=' in line):
- continue
- indx = line.index('=')
- if line[7:indx] == "MODULES":
- raise exceptions.ConfigurationError("Can't measure configuraion option MODULES. Not supported.")
- fmes.write(str(srmap[line[7:indx]]) + "\n")
-
def checkmeasure():
if os.path.isfile(sf(conf.measurechecked_file)):
print("Checking if all configurations can be measured skiped.")