configuration_retrieve pending work done

This commit is contained in:
Amit Mahajan
2009-11-03 11:13:51 +05:30
parent 03b2751377
commit 6e898151bc
6 changed files with 18 additions and 47 deletions

View File

@@ -24,12 +24,12 @@ from packall import *
def build_linux_container(config, projpaths, container): def build_linux_container(config, projpaths, container):
linux_builder = LinuxBuilder(projpaths, container) linux_builder = LinuxBuilder(projpaths, container)
linux_builder.build_linux() linux_builder.build_linux(config)
rootfs_builder = RootfsBuilder(projpaths, container) rootfs_builder = RootfsBuilder(projpaths, container)
rootfs_builder.build_rootfs() rootfs_builder.build_rootfs(config)
atags_builder = AtagsBuilder(projpaths, container) atags_builder = AtagsBuilder(projpaths, container)
atags_builder.build_atags() atags_builder.build_atags(config)
# Calculate and store size of pager # Calculate and store size of pager
pager_binary = \ pager_binary = \
@@ -40,7 +40,7 @@ def build_linux_container(config, projpaths, container):
linux_container_packer = \ linux_container_packer = \
LinuxContainerPacker(container, linux_builder, \ LinuxContainerPacker(container, linux_builder, \
rootfs_builder, atags_builder) rootfs_builder, atags_builder)
return linux_container_packer.pack_container() return linux_container_packer.pack_container(config)
def glob_by_walk(arg, dirname, names): def glob_by_walk(arg, dirname, names):
ext, imglist = arg ext, imglist = arg
@@ -75,7 +75,7 @@ def build_posix_container(config, projpaths, container):
conv_hex(elf_binary_size(join(BUILDDIR, pager_binary))) conv_hex(elf_binary_size(join(BUILDDIR, pager_binary)))
container_packer = DefaultContainerPacker(container, images) container_packer = DefaultContainerPacker(container, images)
return container_packer.pack_container() return container_packer.pack_container(config)
# We simply use SCons to figure all this out from container.id # We simply use SCons to figure all this out from container.id
# Builds the test container. # Builds the test container.
@@ -93,7 +93,7 @@ def build_test_container(config, projpaths, container):
# TODO: Need to Calculate and store size of pager # TODO: Need to Calculate and store size of pager
container_packer = DefaultContainerPacker(container, images) container_packer = DefaultContainerPacker(container, images)
return container_packer.pack_container() return container_packer.pack_container(config)
# This simply calls SCons on a given container, and collects # This simply calls SCons on a given container, and collects
# all images with .elf extension, instead of using whole classes # all images with .elf extension, instead of using whole classes
@@ -112,7 +112,7 @@ def build_default_container(config, projpaths, container):
conv_hex(elf_binary_size(join(PROJROOT, pager_binary))) conv_hex(elf_binary_size(join(PROJROOT, pager_binary)))
container_packer = DefaultContainerPacker(container, images) container_packer = DefaultContainerPacker(container, images)
return container_packer.pack_container() return container_packer.pack_container(config)
def build_all_containers(): def build_all_containers():
config = configuration_retrieve() config = configuration_retrieve()
@@ -134,7 +134,7 @@ def build_all_containers():
configuration_save(config) configuration_save(config)
all_cont_packer = AllContainerPacker(cont_images, config.containers) all_cont_packer = AllContainerPacker(cont_images, config.containers)
return all_cont_packer.pack_all() return all_cont_packer.pack_all(config)
if __name__ == "__main__": if __name__ == "__main__":
build_all_containers() build_all_containers()

View File

@@ -91,16 +91,10 @@ class LinuxContainerPacker:
f.write(file_body) f.write(file_body)
f.close() f.close()
def pack_container(self): def pack_container(self, config):
# TODO: Need to sort this, we cannot call it in global space self.generate_container_lds([self.kernel_image_in, self.rootfs_elf_in, \
# as configuration file is not presnt in beginning
config = configuration_retrieve()
self.generate_container_lds([self.kernel_image_in, \
self.rootfs_elf_in, \
self.atags_elf_in]) self.atags_elf_in])
self.generate_container_assembler([self.kernel_image_in, \ self.generate_container_assembler([self.kernel_image_in, self.rootfs_elf_in, \
self.rootfs_elf_in, \
self.atags_elf_in]) self.atags_elf_in])
os.system(config.user_toolchain + "gcc " + "-nostdlib -o %s -T%s %s" \ os.system(config.user_toolchain + "gcc " + "-nostdlib -o %s -T%s %s" \
% (self.container_elf_out, self.container_lds_out, \ % (self.container_elf_out, self.container_lds_out, \
@@ -158,11 +152,7 @@ class DefaultContainerPacker:
f.write(file_body) f.write(file_body)
f.close() f.close()
def pack_container(self): def pack_container(self, config):
# TODO: Need to sort this, we cannot call it in global space
# as configuration file is not presnt in beginning
config = configuration_retrieve()
self.generate_container_lds(self.images_in) self.generate_container_lds(self.images_in)
self.generate_container_assembler(self.images_in) self.generate_container_assembler(self.images_in)
os.system(config.user_toolchain + "gcc " + "-nostdlib -o %s -T%s %s" \ os.system(config.user_toolchain + "gcc " + "-nostdlib -o %s -T%s %s" \

View File

@@ -76,11 +76,7 @@ class AllContainerPacker:
file_body += containers_lds_end file_body += containers_lds_end
f.write(file_body) f.write(file_body)
def pack_all(self): def pack_all(self, config):
# TODO: Need to sort this, we cannot call it in global space
# as configuration file is not presnt in beginning
config = configuration_retrieve()
self.generate_container_lds(self.containers_lds_out) self.generate_container_lds(self.containers_lds_out)
self.generate_container_S(self.containers_S_out) self.generate_container_S(self.containers_S_out)
os.system(config.user_toolchain + "gcc " + "-nostdlib -o %s -T%s %s" \ os.system(config.user_toolchain + "gcc " + "-nostdlib -o %s -T%s %s" \

View File

@@ -49,12 +49,8 @@ class AtagsBuilder:
self.elf_relpath = os.path.relpath(self.atags_elf_out, \ self.elf_relpath = os.path.relpath(self.atags_elf_out, \
self.LINUX_ATAGSDIR) self.LINUX_ATAGSDIR)
def build_atags(self): def build_atags(self, config):
print 'Building Atags for linux kenel...' print 'Building Atags for linux kenel...'
# TODO: Need to sort this, we cannot call it in global space
# as configuration file is not presnt in beginning
config = configuration_retrieve()
# IO files from this build # IO files from this build
os.chdir(LINUX_ATAGSDIR) os.chdir(LINUX_ATAGSDIR)
if not os.path.exists(self.LINUX_ATAGS_BUILDDIR): if not os.path.exists(self.LINUX_ATAGS_BUILDDIR):

View File

@@ -117,10 +117,7 @@ class LinuxUpdateKernel:
self.replace_line(file, data_to_replace, new_data, prev_line) self.replace_line(file, data_to_replace, new_data, prev_line)
# Update ARCHID, CPUID and ATAGS ADDRESS # Update ARCHID, CPUID and ATAGS ADDRESS
def modify_register_values(self, container): def modify_register_values(self, config, container):
# TODO: This call needs to be made global
config = configuration_retrieve()
for cpu_type, cpu_id in self.cpuid_list: for cpu_type, cpu_id in self.cpuid_list:
if cpu_type == config.cpu.upper(): if cpu_type == config.cpu.upper():
cpuid = cpu_id cpuid = cpu_id
@@ -185,19 +182,15 @@ class LinuxBuilder:
self.kernel_image = None self.kernel_image = None
self.kernel_updater = LinuxUpdateKernel(self.container) self.kernel_updater = LinuxUpdateKernel(self.container)
def build_linux(self): def build_linux(self, config):
print '\nBuilding the linux kernel...' print '\nBuilding the linux kernel...'
# TODO: Need to sort this, we cannot call it in global space
# as configuration file is not presnt in beginning
config = configuration_retrieve()
os.chdir(self.LINUX_KERNELDIR) os.chdir(self.LINUX_KERNELDIR)
if not os.path.exists(self.LINUX_KERNEL_BUILDDIR): if not os.path.exists(self.LINUX_KERNEL_BUILDDIR):
os.makedirs(self.LINUX_KERNEL_BUILDDIR) os.makedirs(self.LINUX_KERNEL_BUILDDIR)
self.kernel_updater.modify_kernel_config() self.kernel_updater.modify_kernel_config()
self.kernel_updater.update_kernel_params(self.container) self.kernel_updater.update_kernel_params(self.container)
self.kernel_updater.modify_register_values(self.container) self.kernel_updater.modify_register_values(config, self.container)
os.system("make defconfig ARCH=arm O=" + self.LINUX_KERNEL_BUILDDIR) os.system("make defconfig ARCH=arm O=" + self.LINUX_KERNEL_BUILDDIR)
os.system("make ARCH=arm " + \ os.system("make ARCH=arm " + \

View File

@@ -40,12 +40,8 @@ class RootfsBuilder:
self.rootfs_elf_out = join(self.LINUX_ROOTFS_BUILDDIR, "rootfs.elf") self.rootfs_elf_out = join(self.LINUX_ROOTFS_BUILDDIR, "rootfs.elf")
self.cont_id = container.id self.cont_id = container.id
def build_rootfs(self): def build_rootfs(self, config):
print 'Building the root filesystem...' print 'Building the root filesystem...'
# TODO: Need to sort this, we cannot call it in global space
# as configuration file is not presnt in beginning
config = configuration_retrieve()
# IO files from this build # IO files from this build
os.chdir(LINUX_ROOTFSDIR) os.chdir(LINUX_ROOTFSDIR)
if not os.path.exists(self.LINUX_ROOTFS_BUILDDIR): if not os.path.exists(self.LINUX_ROOTFS_BUILDDIR):