diff options
author | Karel Kočí <cynerd@email.cz> | 2015-05-06 17:10:16 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2015-05-06 17:10:16 +0200 |
commit | b9ff681e3ed5efc0f8f76ce75d89b2214a6e68c9 (patch) | |
tree | 124f397a5b42bca85cad84cb48a4e2b1a883818f | |
parent | 86777e27fcb6870694cd166866a37360b7591f5f (diff) | |
download | linux-conf-perf-b9ff681e3ed5efc0f8f76ce75d89b2214a6e68c9.tar.gz linux-conf-perf-b9ff681e3ed5efc0f8f76ce75d89b2214a6e68c9.tar.bz2 linux-conf-perf-b9ff681e3ed5efc0f8f76ce75d89b2214a6e68c9.zip |
Separate initialisation
Initialisation now can be executed without loop it self.
-rw-r--r-- | Makefile | 14 | ||||
-rw-r--r-- | scripts/boot.py | 16 | ||||
-rwxr-xr-x | scripts/confmk.py | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | scripts/initialize.py | 42 | ||||
-rwxr-xr-x | scripts/loop.py | 15 |
5 files changed, 66 insertions, 25 deletions
@@ -13,6 +13,8 @@ help: @echo " configuration." @echo "deflinux - Executes 'make defconfig' in linux folder. This generates default" @echo " linux configuration for architecture specified in conf.py" + @echo "initialize - Executes only initialization. Depending on configuration this" + @echo " can take various amount of time." @echo "test - Executes boot and benchmark test. You should use this before" @echo " target run. This target is for testing if initial kernel" @echo " configuration, buildroot configuration and benchmark are" @@ -38,6 +40,10 @@ mlinux: deflinux: ARCH=$(SRCARCH) $(MAKE) -C linux defconfig +init: initialize +initialize: + scripts/initialize.py + test: $(BUILDROOT_INITRAM) parse_kconfig scripts/test.py @@ -51,6 +57,7 @@ clean: @$(MAKE) -C scripts/parse_kconfig clean @$(MAKE) -C scripts/write_config clean @if [ -e scripts/picosat-959/makefile ]; then $(MAKE) -C scripts/picosat-959 clean; fi + $(RM) .conf.mk $(RM) -r build $(RM) $(NBSCRIPT) @@ -94,3 +101,10 @@ picosat: scripts/picosat-959/picosat scripts/picosat-959/picosat: cd scripts/picosat-959 && ./configure $(MAKE) -C scripts/picosat-959 + +####################################### + +$(PHASE_FILE): initialize +$(SYMBOL_MAP_FILE): initialize +$(RULES_FILE): initialize +$(VARIABLE_COUNT_FILE): initialize diff --git a/scripts/boot.py b/scripts/boot.py index c8c9bea..bff70d9 100644 --- a/scripts/boot.py +++ b/scripts/boot.py @@ -5,24 +5,14 @@ import shutil import importlib import utils +import initialize from conf import conf from conf import sf from exceptions import MissingFile -def gen_nbscript(): - try: - os.remove(sf(conf.nbscript)) - except OSError: - pass - - with open(sf(conf.nbscript), 'w') as f: - f.write('# generated novaboot script. Please don\'t edit.\n') - f.write('load ' + sf(conf.linux_image) + ' console=ttyS0,115200\n') - f.write('load ' + sf(conf.initram) + '\n') - def boot(): if not os.path.isfile((conf.nbscript)): - gen_nbscript() + initialize.gen_nbscript() try: os.mkdir(sf(conf.output_folder)) except FileExistsError: @@ -41,6 +31,8 @@ def boot(): if line.startswith('lcp-output: '): output += line[12:] print(output) + + # TODO change data = bench.stdoutput(output) iteration = 0 diff --git a/scripts/confmk.py b/scripts/confmk.py index de9052e..952e674 100755 --- a/scripts/confmk.py +++ b/scripts/confmk.py @@ -1,4 +1,4 @@ -#!/bin/python3 +#!/bin/env python3 import os import sys from conf import conf @@ -18,7 +18,7 @@ def gen_confmk(): f.write("BUILDROOT_INITSCRIPT := " + conf.buildroot_initscript + "\n") f.write("BUILDROOT_DEF_CONFIG := " + conf.buildroot_def_config + "\n") f.write("\n") - f.write("NBSCRIPTS := " + conf.nbscript + "\n") + f.write("NBSCRIPT := " + conf.nbscript + "\n") ################################################################################# diff --git a/scripts/initialize.py b/scripts/initialize.py index 40d9eb5..314b293 100644..100755 --- a/scripts/initialize.py +++ b/scripts/initialize.py @@ -1,3 +1,4 @@ +#!/bin/env python3 import os import sys import subprocess @@ -7,6 +8,29 @@ import utils from conf import conf from conf import sf import exceptions +import loop + +def all(): + base() + parse_kconfig() + gen_requred() + gen_nbscript() + +def base(): + try: os.mkdir(conf.build_folder) + except FileExistsError: + pass + + if os.path.isfile(sf(conf.phase_file)): + print("Warning: file " + conf.phase_file + " already exists. Not overwritten.") + else: + loop.phase_set(1) + + if os.path.isfile(sf(conf.iteration_file)): + print("Warning: file " + conf.iteration_file + " already exists. Not overwritten.") + else: + loop.iteration_reset() + def parse_kconfig(): "Execute parse_kconfig in linux_sources directory." @@ -20,6 +44,7 @@ def parse_kconfig(): os.chdir(wd) + def gen_requred(): "Generates required depenpency from .config file in linux source tree." @@ -54,3 +79,20 @@ def gen_requred(): else: fconf.write(line); freq.write("-" + srmap["MODULES"] + "\n"); # force modules no + + +def gen_nbscript(): + if os.path.isfile(sf(conf.nbscript)): + print("Warning: file " + conf.nbscript + + " already exists. Generation skipped.") + return + + with open(sf(conf.nbscript), 'w') as f: + f.write('# generated novaboot script. Please don\'t edit.\n') + f.write('load ' + sf(conf.linux_image) + ' console=ttyS0,115200\n') + f.write('load ' + sf(conf.buildroot_initram) + '\n') + +################################################################################# + +if __name__ == '__main__': + all() diff --git a/scripts/loop.py b/scripts/loop.py index 21aabe8..dd5949a 100755 --- a/scripts/loop.py +++ b/scripts/loop.py @@ -1,4 +1,4 @@ -#!/bin/python3 +#!/bin/env python3 import os import sys import subprocess @@ -15,17 +15,9 @@ import exceptions def step(): phs = phase_get() - if phs == 0: - try: - os.mkdir(conf.build_folder) - except FileExistsError: - pass - phase_set(1) - elif phs == 1: + if phs == 0 or phs == 1: phase_message(1) - initialize.parse_kconfig() - initialize.gen_requred() - iteration_reset() + initialize.all() phase_set(2) elif phs == 2: phase_message(2) @@ -102,6 +94,7 @@ def phase_get(): return 0 def phase_set(phs): + # TODO global thr if thr.term: return |