Removed hard coded values of toolchain and gcc cpu flags

This commit is contained in:
Amit Mahajan
2009-10-27 15:35:37 +05:30
parent 2b29170633
commit 91c617d0b2
26 changed files with 162 additions and 89 deletions

View File

@@ -92,15 +92,18 @@ class LinuxContainerPacker:
f.close()
def pack_container(self):
# 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.kernel_image_in, \
self.rootfs_elf_in, \
self.atags_elf_in])
self.generate_container_assembler([self.kernel_image_in, \
self.rootfs_elf_in, \
self.atags_elf_in])
os.system("arm-none-linux-gnueabi-gcc " + "-nostdlib -o %s -T%s %s" \
% (self.container_elf_out, \
self.container_lds_out,
os.system(config.user_toolchain + "gcc " + "-nostdlib -o %s -T%s %s" \
% (self.container_elf_out, self.container_lds_out, \
self.container_S_out))
# Final file is returned so that the final packer needn't
# get the packer object for this information
@@ -156,11 +159,14 @@ class DefaultContainerPacker:
f.close()
def pack_container(self):
# 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_assembler(self.images_in)
os.system("arm-none-linux-gnueabi-gcc " + "-nostdlib -o %s -T%s %s" \
% (self.container_elf_out, \
self.container_lds_out,
os.system(config.user_toolchain + "gcc " + "-nostdlib -o %s -T%s %s" \
% (self.container_elf_out, self.container_lds_out, \
self.container_S_out))
# Final file is returned so that the final packer needn't
# get the packer object for this information

View File

@@ -16,7 +16,6 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), PROJRELR
from config.projpaths import *
from config.configuration import *
containers_assembler_body = \
'''
.align 4
@@ -78,11 +77,14 @@ class AllContainerPacker:
f.write(file_body)
def pack_all(self):
# 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_S(self.containers_S_out)
os.system("arm-none-linux-gnueabi-gcc " + "-nostdlib -o %s -T%s %s" \
% (self.containers_elf_out, \
self.containers_lds_out,
os.system(config.user_toolchain + "gcc " + "-nostdlib -o %s -T%s %s" \
% (self.containers_elf_out, self.containers_lds_out, \
self.containers_S_out))
# Return the final image to calling script

View File

@@ -51,8 +51,11 @@ class AtagsBuilder:
def build_atags(self):
print 'Building Atags for linux kenel...'
# IO files from this build
# 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
os.chdir(LINUX_ATAGSDIR)
if not os.path.exists(self.LINUX_ATAGS_BUILDDIR):
os.makedirs(self.LINUX_ATAGS_BUILDDIR)
@@ -65,7 +68,7 @@ class AtagsBuilder:
with open(self.atags_h_in, 'r') as input:
output.write(input.read() % {'cn' : self.cont_id})
os.system("arm-none-linux-gnueabi-cpp -I%s -P %s > %s" % \
os.system(config.user_toolchain + "cpp -I%s -P %s > %s" % \
(self.LINUX_ATAGS_BUILDDIR, self.atags_lds_in, \
self.atags_lds_out))
@@ -73,7 +76,7 @@ class AtagsBuilder:
with open(self.atags_c_in, 'r') as input:
output.write(input.read() % {'cn' : self.cont_id})
os.system("arm-none-linux-gnueabi-gcc " + \
os.system(config.user_toolchain + "gcc " + \
"-g -ffreestanding -std=gnu99 -Wall -Werror " + \
"-nostdlib -o %s -T%s %s" % \
(self.atags_elf_out, self.atags_lds_out, self.atags_c_out))

View File

@@ -66,7 +66,7 @@ class LinuxUpdateKernel:
break
if flag == 0:
print 'Warning: No match found for the parameter'
#print 'Warning: No match found for the parameter'
return
else:
# Prevent recompilation in case kernel parameter is same
@@ -205,6 +205,10 @@ class LinuxBuilder:
def build_linux(self):
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)
if not os.path.exists(self.LINUX_KERNEL_BUILDDIR):
os.makedirs(self.LINUX_KERNEL_BUILDDIR)
@@ -215,7 +219,7 @@ class LinuxBuilder:
os.system("make defconfig ARCH=arm O=" + self.LINUX_KERNEL_BUILDDIR)
os.system("make ARCH=arm " + \
"CROSS_COMPILE=arm-none-linux-gnueabi- O=" + \
"CROSS_COMPILE=" + config.user_toolchain + " O=" + \
self.LINUX_KERNEL_BUILDDIR)
with open(self.linux_h_out, 'w+') as output:
@@ -227,10 +231,10 @@ class LinuxBuilder:
content = input.read() % self.kernel_binary_image
output.write(content)
os.system("arm-none-linux-gnueabi-cpp -I%s -P %s > %s" % \
os.system(config.user_toolchain + "cpp -I%s -P %s > %s" % \
(self.LINUX_KERNEL_BUILDDIR, self.linux_lds_in, \
self.linux_lds_out))
os.system("arm-none-linux-gnueabi-gcc -nostdlib -o %s -T%s %s" % \
os.system(config.user_toolchain + "gcc -nostdlib -o %s -T%s %s" % \
(self.linux_elf_out, self.linux_lds_out, self.linux_S_out))
# Get the kernel image path

View File

@@ -15,7 +15,6 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), PROJRELR
from config.projpaths import *
from config.configuration import *
# Create linux kernel build directory path as:
# conts/linux -> build/cont[0-9]/linux
def source_to_builddir(srcdir, id):
@@ -43,8 +42,11 @@ class RootfsBuilder:
def build_rootfs(self):
print 'Building the root filesystem...'
# IO files from this build
# 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
os.chdir(LINUX_ROOTFSDIR)
if not os.path.exists(self.LINUX_ROOTFS_BUILDDIR):
os.makedirs(self.LINUX_ROOTFS_BUILDDIR)
@@ -53,10 +55,10 @@ class RootfsBuilder:
with open(self.rootfs_h_in, 'r') as input:
output.write(input.read() % {'cn' : self.cont_id})
os.system("arm-none-linux-gnueabi-cpp -I%s -P %s > %s" % \
os.system(config.user_toolchain + "cpp -I%s -P %s > %s" % \
(self.LINUX_ROOTFS_BUILDDIR, self.rootfs_lds_in, \
self.rootfs_lds_out))
os.system("arm-none-linux-gnueabi-gcc " + \
os.system(config.user_toolchain + "gcc " + \
"-nostdlib -o %s -T%s rootfs.S" % (self.rootfs_elf_out, \
self.rootfs_lds_out))
print "Done..."

View File

@@ -7,6 +7,7 @@
#
import os, sys, shelve, subprocess
from os.path import join
from configure import *
PROJRELROOT = '../../'
@@ -16,6 +17,8 @@ from config.projpaths import *
from config.configuration import *
from config.lib import *
config = configuration_retrieve()
# Convert address from python literal to numeric value
def address_remove_literal(address):
value = hex(int(address, 16) - 0xf0000000)
@@ -49,8 +52,9 @@ def generate_ksym_to_loader(target_path, source_path):
with open(target_path, 'w') as asm_file:
asm_file.write(ksym_header % (target_path, source_path, sys.argv[0]))
for symbol in symbols:
process = subprocess.Popen('arm-none-eabi-objdump -d ' + \
source_path + ' | grep "<' + \
process = \
subprocess.Popen(config.kernel_toolchain + 'objdump -d ' + \
source_path + ' | grep "<' + \
symbol + '>"', shell=True, \
stdout=subprocess.PIPE)
assert process.wait() == 0