From b9ff681e3ed5efc0f8f76ce75d89b2214a6e68c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 6 May 2015 17:10:16 +0200 Subject: Separate initialisation Initialisation now can be executed without loop it self. --- scripts/initialize.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) mode change 100644 => 100755 scripts/initialize.py (limited to 'scripts/initialize.py') diff --git a/scripts/initialize.py b/scripts/initialize.py old mode 100644 new mode 100755 index 40d9eb5..314b293 --- 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() -- cgit v1.2.3