mirror of
https://github.com/drasko/codezero.git
synced 2026-01-29 19:23:14 +01:00
Changes since April
Clean up of build directories. Simplifications to capability model.
This commit is contained in:
178
build.py
178
build.py
@@ -9,75 +9,127 @@
|
||||
#
|
||||
import os, sys, shelve, shutil
|
||||
from os.path import join
|
||||
from config.projpaths import *
|
||||
from config.configuration import *
|
||||
from config.config_check import *
|
||||
from scripts.qemu import qemu_cmdline
|
||||
from scripts.config.projpaths import *
|
||||
from scripts.config.configuration import *
|
||||
from scripts.config.config_check import *
|
||||
from scripts.qemu.qemu_cmdline import *
|
||||
from scripts.conts import containers
|
||||
from configure import *
|
||||
from scripts.config.config_invoke import *
|
||||
from scripts.kernel.check_kernel_limit import *
|
||||
|
||||
def build_system(opts, args):
|
||||
if opts.print_config:
|
||||
config = configuration_retrieve()
|
||||
if config:
|
||||
config.config_print()
|
||||
else:
|
||||
print '\nNo configuration to print...\n'
|
||||
return None
|
||||
|
||||
# Configure
|
||||
configure_system(opts, args)
|
||||
|
||||
# Are we asked to configure only
|
||||
if opts.config_only:
|
||||
return None
|
||||
|
||||
# Check for sanity of containers
|
||||
sanity_check_conts()
|
||||
|
||||
# Build userspace libraries
|
||||
os.chdir(USERLIBS_DIR)
|
||||
print "\nBuilding userspace libraries..."
|
||||
ret = os.system("scons" + " -j " + opts.jobs)
|
||||
if(ret):
|
||||
print "Building userspace libraries failed...\n"
|
||||
sys.exit(1)
|
||||
|
||||
# Build containers
|
||||
os.chdir(PROJROOT)
|
||||
print "\nBuilding containers..."
|
||||
containers.build_all_containers(opts)
|
||||
|
||||
# Build the kernel
|
||||
print "\nBuilding the kernel..."
|
||||
os.chdir(PROJROOT)
|
||||
ret = os.system("scons" + " -j " + opts.jobs)
|
||||
if(ret):
|
||||
print "Building kernel failed...\n"
|
||||
sys.exit(1)
|
||||
|
||||
# Check if kernel overlap with first container
|
||||
if(check_kernel_container_overlap()):
|
||||
print "Kernel overlaps with first continer."
|
||||
print "Please shift the first container to some higher " + \
|
||||
"address after the kernel and build again...\n"
|
||||
sys.exit(1)
|
||||
|
||||
# Build the loader
|
||||
os.chdir(PROJROOT)
|
||||
print "\nBuilding the loader and packing..."
|
||||
ret = os.system("scons -f " + join(LOADERDIR, 'SConstruct') + " -j " + opts.jobs)
|
||||
if(ret):
|
||||
print "Building loader failed...\n"
|
||||
sys.exit(1)
|
||||
|
||||
# Build qemu-insight-script
|
||||
print "\nBuilding qemu-insight-script..."
|
||||
build_qemu_cmdline_script()
|
||||
|
||||
print "\nBuild complete..."
|
||||
print "\nRun qemu with following command: ./tools/run-qemu-insight\n"
|
||||
|
||||
renamed_cml = rename_config_cml(opts)
|
||||
if(renamed_cml):
|
||||
print 'CML configuration file saved as ' + renamed_cml + '\n'
|
||||
|
||||
return None
|
||||
|
||||
def clean_system(opts):
|
||||
# Clean only if some config exists.
|
||||
if not configuration_retrieve():
|
||||
print '\nNo configuration exists, nothing to clean..\n'
|
||||
return None
|
||||
|
||||
# Clean userspace libraries
|
||||
os.chdir(USERLIBS_DIR)
|
||||
print "\nCleaning userspace libraries..."
|
||||
ret = os.system("scons -c")
|
||||
|
||||
# Clean containers
|
||||
os.chdir(PROJROOT)
|
||||
print "\nCleaning containers..."
|
||||
containers.clean_all_containers()
|
||||
|
||||
# Clean the kernel
|
||||
print "\nCleaning the kernel..."
|
||||
os.chdir(PROJROOT)
|
||||
ret = os.system("scons -c")
|
||||
|
||||
# Clean the loader
|
||||
os.chdir(PROJROOT)
|
||||
print "\nCleaning the loader..."
|
||||
ret = os.system("scons -c -f " + join(LOADERDIR, 'SConstruct'))
|
||||
|
||||
# Remove qemu-insight-script
|
||||
print "\nRemoving qemu-insight-script..."
|
||||
clean_qemu_cmdline_script()
|
||||
|
||||
if opts.clean_all:
|
||||
cml_files_cleanup()
|
||||
|
||||
print '\nCleaning Done...\n'
|
||||
return None
|
||||
|
||||
def main():
|
||||
opts, args = build_parse_options()
|
||||
#
|
||||
# Configure
|
||||
#
|
||||
configure_system(opts, args)
|
||||
|
||||
#
|
||||
# Check for sanity of containers
|
||||
#
|
||||
sanity_check_conts()
|
||||
if opts.clean or opts.clean_all:
|
||||
clean_system(opts)
|
||||
else:
|
||||
build_system(opts, args)
|
||||
|
||||
#
|
||||
# Build userspace libraries
|
||||
#
|
||||
print "\nBuilding userspace libraries..."
|
||||
ret = os.system('scons -f SConstruct.userlibs')
|
||||
if(ret):
|
||||
print "Build failed \n"
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
# Build containers
|
||||
#
|
||||
print "\nBuilding containers..."
|
||||
containers.build_all_containers()
|
||||
|
||||
#
|
||||
# Generate cinfo
|
||||
#
|
||||
generate_cinfo()
|
||||
|
||||
#
|
||||
# Build the kernel
|
||||
#
|
||||
print "\nBuilding the kernel..."
|
||||
os.chdir(PROJROOT)
|
||||
ret = os.system("scons")
|
||||
if(ret):
|
||||
print "Build failed \n"
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
# Build libs and loader
|
||||
#
|
||||
os.chdir(PROJROOT)
|
||||
print "\nBuilding the loader and packing..."
|
||||
ret = os.system("scons -f SConstruct.loader")
|
||||
if(ret):
|
||||
print "Build failed \n"
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
# Build qemu-insight-script
|
||||
#
|
||||
print "\nBuilding qemu-insight-script.."
|
||||
qemu_cmdline.build_qemu_cmdline_script()
|
||||
#build_qemu_cmdline_script()
|
||||
|
||||
print "\nBuild complete."
|
||||
|
||||
print "\nRun qemu with following command: ./tools/run-qemu-insight\n"
|
||||
return None
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user