]> rtime.felk.cvut.cz Git - linux-conf-perf.git/commitdiff
Makefile configuration is now automatically generated and more changes
authorKarel Kočí <cynerd@email.cz>
Wed, 22 Jul 2015 09:12:24 +0000 (11:12 +0200)
committerKarel Kočí <cynerd@email.cz>
Wed, 22 Jul 2015 09:12:24 +0000 (11:12 +0200)
Makefile configuration file is now generated automatically and contains all
string config options.

Separated tables drop from databaseinit.sql to file databaseclean.sql.

Also add clean and init target for database.
For this reason is also separated output and result from normal clean.
From now on won't be results removed on standard clean.

ARCH config variable is renamed to kernel_arch to make name more clear.

Makefile
conf.py
scripts/confmk.py
scripts/databaseclean.sql [new file with mode: 0644]
scripts/databaseinit.sql

index e95c742cd5689b21ea97f2810a4e41c34c77a37b..52eef26b9b247974f7a3b4e46b70fd5f12d65df2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.PHONY: all help parse_kconfig write_config build run test clean clean_linux clean_buildroot mlinux mbuildroot deflinux distclean_linux distclean_buildroot distclean picosat init initialize permute_conf
+.PHONY: all help parse_kconfig write_config build run test clean clean_db clean_database clean_measure clean_linux clean_buildroot mlinux mbuildroot deflinux distclean_linux distclean_buildroot distclean picosat init initialize initialize_database initdb permute_conf
 
 -include .conf.mk
 
@@ -35,18 +35,27 @@ mbuildroot: buildroot/.config buildroot/system/skeleton/usr/bin/linux-conf-perf
        $(MAKE) -C buildroot menuconfig
 
 mlinux:
-       ARCH=$(ARCH) $(MAKE) -C linux menuconfig
+       ARCH=$(CONF_KERNEL_ARCH) $(MAKE) -C linux menuconfig
 
 deflinux:
-       ARCH=$(ARCH) $(MAKE) -C linux defconfig
+       ARCH=$(CONF_KERNEL_ARCH) $(MAKE) -C linux defconfig
 
 mpermute_conf: permute_conf
-       cd linux && SRCARCH=$(ARCH) ARCH=$(ARCH) KERNELVERSION=$(ARCH) ../scripts/permute_conf/permute_conf Kconfig
+       cd linux && \
+       SRCARCH=$(CONF_KERNEL_ARCH) ARCH=$(CONF_KERNEL_ARCH) \
+       KERNELVERSION=$(CONF_KERNEL_ARCH) \
+       ../scripts/permute_conf/permute_conf Kconfig
 
 init: initialize
 initialize: parse_kconfig picosat
        scripts/initialize.py
 
+initdb: initialize_database
+initialize_database:
+       echo "$(CONF_DB_HOST):$(CONF_DB_PORT):$(CONF_DB_DATABASE):$(CONF_DB_USER):$(CONF_DB_PASSWORD)" > .pgpass
+       psql -d "$(CONF_DB_DATABASE)" -h "$(CONF_DB_HOST)" -p "$(CONF_DB_PORT)" -f scripts/databaseinit.sql
+       $(RM) .pgpass
+
 test: parse_kconfig
        scripts/test.py
 
@@ -63,7 +72,18 @@ clean:
        @$(MAKE) -C scripts/allconfig clean
        @if [ -e scripts/picosat-959/makefile ]; then $(MAKE) -C scripts/picosat-959 clean; fi
        $(RM) .conf.mk
-       $(RM) -r jobfiles output result
+       $(RM) -r jobfiles
+
+clean_measure: cleandb
+       $(RM) -r configurations
+       $(RM) -r output
+       $(RM) -r result
+
+cleandb: clean_database
+clean_database:
+       echo "$(CONF_DB_HOST):$(CONF_DB_PORT):$(CONF_DB_DATABASE):$(CONF_DB_USER):$(CONF_DB_PASSWORD)" > .pgpass
+       psql -d "$(CONF_DB_DATABASE)" -h "$(CONF_DB_HOST)" -p "$(CONF_DB_PORT)" -f scripts/databaseclean.sql
+       rm -f .pgpass
 
 distclean: clean distclean_linux distclean_buildroot
        $(RM) .conf.mk
@@ -98,11 +118,11 @@ permute_conf:
        @$(MAKE) -C scripts/permute_conf/
 
 buildroot/.config:
-       cp $(BUILDROOT_DEF_CONFIG) $@
+       cp $(CONF_BUILDROOT_DEF_CONFIG) $@
 
 buildroot/system/skeleton/usr/bin/linux-conf-perf:
-       cp $(BUILDROOT_INITSCRIPT) $@
-       cat $(BUILDROOT_INITTAB_DIRECTIVE) >> buildroot/system/skeleton/etc/inittab
+       cp $(CONF_BUILDROOT_INITSCRIPT) $@
+       cat $(CONF_BUILDROOT_INITTAB_DIRECTIVE) >> buildroot/system/skeleton/etc/inittab
 
 picosat: scripts/picosat-959/picosat
 scripts/picosat-959/picosat:
diff --git a/conf.py b/conf.py
index 3909de7c4da4b164b3060e73bc2dec97a558fe6c..c3835073b5e66f746e688af6faedb8f118362e94 100644 (file)
--- a/conf.py
+++ b/conf.py
@@ -1,14 +1,14 @@
 import os
 
 ## Global configs
-# ARCH
-# This defines environment variable for linux kernel.
+# kernel_arch
+# This defines environment variable ARCH for linux kernel.
 # Change this to change target architecture
-ARCH = 'x86'
+kernel_arch = 'x86'
 
 # kernle_env
 # Enviroment variables for Linux
-kernel_env = {'SRCARCH': ARCH, 'ARCH': ARCH, 'KERNELVERSION': ARCH}
+kernel_env = {'SRCARCH': kernel_arch, 'ARCH': kernel_arch, 'KERNELVERSION': kernel_arch}
 # linux_make_args
 # These are arguments passed to make when linux is build.
 linux_make_args = ['-j8']
@@ -78,7 +78,7 @@ dot_config = 'dot_config'
 linux_sources = 'linux/'
 linux_kconfig_head = linux_sources + 'Kconfig'
 linux_dot_config = linux_sources + '.config'
-linux_image = linux_sources + 'arch/' + ARCH + '/boot/bzImage'
+linux_image = linux_sources + 'arch/' + kernel_arch + '/boot/bzImage'
 
 buildroot_def_config = 'buildroot_recipe/buildroot.def.config'
 buildroot_inittab_directive = 'buildroot_recipe/inittab_directive'
index b8a1e6c0b9bca65eb9eaec57c1b611c75af3cd67..3a595101f9bdcd2a13c03901f24ba5ccde5910bd 100755 (executable)
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 import os
 import sys
+import re
 from conf import conf
 
 def gen_confmk():
@@ -11,12 +12,12 @@ def gen_confmk():
 
        with open(conf.dot_confmk, 'w') as f:
                f.write("# This file is generated. Please don't edit this file.\n")
-               f.write("ARCH := " + conf.ARCH + "\n")
-               f.write("\n")
-               f.write("BUILDROOT_INITRAM := " + conf.buildroot_initram + "\n")
-               f.write("BUILDROOT_INITTAB_DIRECTIVE := " + conf.buildroot_inittab_directive + "\n")
-               f.write("BUILDROOT_INITSCRIPT := " + conf.buildroot_initscript + "\n")
-               f.write("BUILDROOT_DEF_CONFIG := " + conf.buildroot_def_config + "\n")
+               for var in dir(conf):
+                       if not re.match('__.*__', var):
+                               val = eval('conf.' + var)
+                               if type(val) is str:
+                                       f.write("CONF_" + var.upper() + " := ")
+                                       f.write(val + '\n')
 
 #################################################################################
 
diff --git a/scripts/databaseclean.sql b/scripts/databaseclean.sql
new file mode 100644 (file)
index 0000000..0eb3193
--- /dev/null
@@ -0,0 +1,3 @@
+DROP TABLE IF EXISTS measure;
+DROP TABLE IF EXISTS configurations;
+DROP TABLE IF EXISTS toolsgit;
index 95702fbd510ff75835b2dbed31997ab204be069e..eee51fa86e7e10b4f93e225e31b0fc5ff67c7356 100644 (file)
@@ -1,14 +1,3 @@
---
--- Drop all tables
---
-DROP TABLE IF EXISTS measure;
-DROP TABLE IF EXISTS configurations;
-DROP TABLE IF EXISTS toolsgit;
-
---
--- Initialize database
---
-
 -- In this table are tracked versions of tools in git
 CREATE TABLE toolsgit (
        id BIGSERIAL PRIMARY KEY, -- Id