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

@@ -9,11 +9,18 @@ import configure
from configure import *
from os.path import *
env = Environment(CC = 'arm-none-eabi-gcc',
config = configuration_retrieve()
arch = config.arch
subarch = config.subarch
platform = config.platform
gcc_cpu_flag = config.gcc_cpu_flag
all_syms = config.all
env = Environment(CC = config.kernel_toolchain + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-mcpu=arm926ej-s', '-nostdlib', '-ffreestanding', \
'-std=gnu99', '-Wall', '-Werror'],
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \
'-Werror', ('-mcpu=' + gcc_cpu_flag)],
LINKFLAGS = ['-nostdlib', '-T' + "include/l4/arch/arm/linker.lds"],
ASFLAGS = ['-D__ASSEMBLY__'],
PROGSUFFIX = '.elf', # The suffix to use for final executable
@@ -22,13 +29,6 @@ env = Environment(CC = 'arm-none-eabi-gcc',
CPPPATH = "#include",
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h -D__KERNEL__')
config = configuration_retrieve()
arch = config.arch
subarch = config.subarch
platform = config.platform
all_syms = config.all
objects = []
objects += SConscript('src/drivers/SConscript', exports = {'symbols' : all_syms, 'env' : env})
objects += SConscript('src/generic/SConscript',exports = {'symbols' : all_syms, 'env' : env})
@@ -42,3 +42,4 @@ objects += SConscript('src/api/SConscript', exports = {'symbols' : all_syms, 'en
kernel_elf = env.Program(BUILDDIR + '/kernel.elf', objects)
Alias('kernel', kernel_elf)
Depends(kernel_elf, 'include/l4/config.h')

View File

@@ -13,6 +13,7 @@ from config.projpaths import *
config = configuration_retrieve()
arch = config.arch
platform = config.platform
gcc_cpu_flag = config.gcc_cpu_flag
# Locally important paths are here
LIBC_PATH = 'loader/libs/c'
@@ -24,11 +25,11 @@ LIBELF_PATH = 'loader/libs/elf'
LIBELF_LIBPATH = LIBELF_PATH
LIBELF_INCPATH = '#' + join(LIBELF_PATH, 'include')
env = Environment(CC = 'arm-none-eabi-gcc',
env = Environment(CC = config.kernel_toolchain + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-mcpu=arm926ej-s', '-nostdlib', '-ffreestanding', \
'-std=gnu99', '-Wall', '-Werror'],
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \
'-Werror', ('-mcpu=' + gcc_cpu_flag)],
LINKFLAGS = ['-nostdlib', '-T' + join(BUILDDIR, 'loader/linker.lds'), "-u_start"],
ASFLAGS = ['-D__ASSEMBLY__'],
PROGSUFFIX = '.elf',

View File

@@ -9,11 +9,18 @@ import configure
from configure import *
from os.path import *
env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
config = configuration_retrieve()
arch = config.arch
subarcn = config.subarch
platform = config.platform
gcc_cpu_flag = config.gcc_cpu_flag
all_syms = config.all
env = Environment(CC = config.user_toolchain + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-mcpu=arm926ej-s', '-nostdlib', '-ffreestanding', \
'-std=gnu99', '-Wall', '-Werror'],
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \
'-Werror', ('-mcpu=' + gcc_cpu_flag)],
LINKFLAGS = ['-nostdlib'],
ASFLAGS = ['-D__ASSEMBLY__'],
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path
@@ -21,11 +28,6 @@ env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
CPPPATH = "#include",
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
config = configuration_retrieve()
arch = config.arch
subarch = config.subarch
platform = config.platform
all_syms = config.all
libl4 = SConscript('conts/libl4/SConscript', \

View File

@@ -52,9 +52,24 @@ class Container:
class configuration:
def __init__(self):
# Mapping between platform selected and gcc flags for it
self.cpu_to_gcc_flag = (['PB926', 'arm926ej-s'],
['CORTEXA8', 'cortex-a8'],
['ARM11MPCORE', 'mpcore'],
['CORTEXA9', 'cortex-a9'],
['ARM1136', 'arm1136jf-s'],
['ARM1176', 'arm1176jz-s'],)
# Mapping between the processor architecture and toolchain
self.toolchain_kernel = (['ARM', 'arm-none-eabi-'],)
self.toolchain_user = (['ARM', 'arm-none-linux-gnueabi-'],)
self.arch = None
self.subarch = None
self.platform = None
self.gcc_cpu_flag = None
self.user_toolchain = None
self.kernel_toolchain = None
self.all = []
self.containers = []
self.ncontainers = 0
@@ -72,10 +87,17 @@ class configuration:
return None
# Extract architecture from a name value pair
# And based on this define the toolchains to be used
def get_arch(self, name, val):
if name[:len("CONFIG_ARCH_")] == "CONFIG_ARCH_":
parts = name.split("_", 3)
self.arch = parts[2].lower()
for i in self.toolchain_kernel:
if i[0] == parts[2]:
self.kernel_toolchain = i[1]
for i in self.toolchain_user:
if i[0] == parts[2]:
self.user_toolchain = i[1]
# Extract subarch from a name value pair
def get_subarch(self, name, val):
@@ -88,6 +110,9 @@ class configuration:
if name[:len("CONFIG_PLATFORM_")] == "CONFIG_PLATFORM_":
parts = name.split("_", 3)
self.platform = parts[2].lower()
for i in self.cpu_to_gcc_flag:
if i[0] == parts[2]:
self.gcc_cpu_flag = i[1]
# Extract number of containers
def get_ncontainers(self, name, val):

View File

@@ -7,3 +7,4 @@ def conv_hex(val):
if hexval[-1:] == 'L':
hexval = hexval[:-1]
return hexval

View File

@@ -13,11 +13,11 @@ sys.path.append(PROJRELROOT)
from config.projpaths import *
from config.configuration import *
from configure import *
config = configuration_retrieve()
arch = config.arch
gcc_cpu_flag = config.gcc_cpu_flag
# Wrapper library for system calls
LIBL4_RELDIR = 'conts/libl4'
@@ -38,20 +38,20 @@ LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
LIBMEM_INCLUDE = LIBMEM_DIR
env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
# We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-mcpu=arm926ej-s', '-nostdlib', '-ffreestanding', \
'-std=gnu99', '-Wall', '-Werror'],
LINKFLAGS = ['-nostdlib', '-T' + "include/linker.lds", "-u_start"],
ASFLAGS = ['-D__ASSEMBLY__'],
PROGSUFFIX = '.elf', # The suffix to use for final executable
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path
LIBS = ['gcc', 'libl4', 'c-userspace', 'libmm', 'libmc', 'libmalloc', \
'gcc', 'c-userspace'], # libgcc.a - This is required for division routines.
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBC_INCLUDE, LIBMEM_INCLUDE],
LIBPATH = [LIBL4_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH],
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
env = Environment(CC = config.user_toolchain + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \
'-Werror', ('-mcpu=' + gcc_cpu_flag)], \
LINKFLAGS = ['-nostdlib', '-T' + "include/linker.lds", "-u_start"],\
ASFLAGS = ['-D__ASSEMBLY__'], \
PROGSUFFIX = '.elf', # The suffix to use for final executable
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path
LIBS = ['gcc', 'libl4', 'c-userspace', 'libmm', 'libmc', 'libmalloc', \
'gcc', 'c-userspace'], # libgcc.a - This is required for division routines.
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBC_INCLUDE, LIBMEM_INCLUDE],
LIBPATH = [LIBL4_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH],
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
src = Glob('*.[cS]')
src += Glob('src/*.[cS]')

View File

@@ -24,10 +24,13 @@ PROJRELROOT = '../..'
sys.path.append(PROJRELROOT)
from config.projpaths import *
from configure import *
Import('arch')
env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
config = configuration_retrieve()
env = Environment(CC = config.user_toolchain + 'gcc',
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding'],
LINKFLAGS = ['-nostdlib'],
ASFLAGS = ['-D__ASSEMBLY__'],

View File

@@ -14,10 +14,9 @@ from config.projpaths import *
from config.configuration import *
config = configuration_retrieve()
arch = config.arch
env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
env = Environment(CC = config.user_toolchain + 'gcc',
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding'],
LINKFLAGS = ['-nostdlib'],
ASFLAGS = ['-D__ASSEMBLY__'],

View File

@@ -10,6 +10,9 @@ PROJRELROOT = '../..'
sys.path.append(PROJRELROOT)
from config.projpaths import *
from configure import *
config = configuration_retrieve()
KERNEL_INCLUDE = join(PROJROOT, 'include')
LIBL4_RELDIR = 'conts/libl4'
@@ -17,7 +20,7 @@ LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
LIBL4_INCLUDE = join(LIBL4_DIR, 'include')
LIBL4_LIBPATH = join(BUILDDIR, LIBL4_RELDIR)
env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
env = Environment(CC = config.user_toolchain + 'gcc',
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding'],
LINKFLAGS = ['-nostdlib'],
ASFLAGS = ['-D__ASSEMBLY__'],

View File

@@ -7,6 +7,9 @@ import glob
import sys
from os.path import join
from string import split
from configure import *
config = configuration_retrieve()
project_root = "../.."
headers_root = join(project_root, "include/l4")
@@ -33,8 +36,7 @@ test_env = Environment(CC = 'gcc -m32',
LIBPATH = ['#'],
CPPPATH = ['#include', join(project_root, "include"), "#", libl4_headers])
env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
env = Environment(CC = config.user_toolchain + 'gcc',
CCFLAGS = ['-g', '-nostdlib', '-Wall', '-Werror', '-ffreestanding', '-std=gnu99'],
LINKFLAGS = ['-nostdlib'],
ENV = {'PATH' : os.environ['PATH']},

View File

@@ -19,7 +19,6 @@ from config.lib import *
config = configuration_retrieve()
arch = config.arch
LIBL4_RELDIR = 'conts/libl4'
KERNEL_INCLUDE = join(PROJROOT, 'include')
LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
@@ -44,7 +43,7 @@ LIBPOSIX_INCLUDE_SERVER = join(LIBPOSIX_DIR, 'include')
LIBPOSIX_INCLUDE_USERSPACE = join(LIBPOSIX_DIR, 'include/posix')
LIBPOSIX_LIBPATH = join(BUILDDIR, LIBPOSIX_RELDIR)
env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
env = Environment(CC = config.user_toolchain + 'gcc',
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', \
'-std=gnu99', '-Wall', '-Werror'],
LINKFLAGS = ['-nostdlib'],

View File

@@ -23,6 +23,8 @@ from config.projpaths import *
from config.configuration import *
from tools.pyelf import elf
config = configuration_retrieve()
bootdesc_template = \
'''
/* This file is autogenerated, do not edit by hand. */
@@ -95,8 +97,8 @@ def relocate_bootdesc(target, source, env):
images = source[1:]
mm0 = images[0]
start, end = image_lma_start_end(mm0.path)
print "arm-none-linux-gnueabi-objcopy --adjust-section-vma .data=" + conv_hex(end) + " " + bootdesc_raw.path
os.system("arm-none-linux-gnueabi-objcopy --adjust-section-vma .data=" + conv_hex(end) + " " + bootdesc_raw.path)
print config.user_toolchain + "objcopy --adjust-section-vma .data=" + conv_hex(end) + " " + bootdesc_raw.path
os.system(config.user_toolchain + "objcopy --adjust-section-vma .data=" + conv_hex(end) + " " + bootdesc_raw.path)
shutil.copyfile(bootdesc_raw.path, target[0].path)
bootdesc_c = e.Command('bootdesc.c', images, generate_bootdesc)

View File

@@ -7,10 +7,12 @@ import os
import sys
import shutil
from os.path import join
from configure import *
config = configuration_retrieve()
builddir = ARGUMENTS.get('builddir', 'build/conts/posix')
env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
env = Environment(CC = config.user_toolchain + 'gcc',
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', '-Werror'],
LINKFLAGS = ['-nostdlib','-Tlinker.lds'],
ASFLAGS = ['-D__ASSEMBLY__'],

View File

@@ -7,13 +7,16 @@ import glob
import sys
from os.path import join
from string import split
from configure import *
config = configuration_retrieve()
project_root = "../.."
kernel_headers = join(project_root, "include")
l4lib_headers = join(project_root, "tasks/libl4/include")
config_h = join(project_root, "include/l4/config.h")
env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
env = Environment(CC = config.user_toolchain + 'gcc',
CCFLAGS = ['-g', '-std=gnu99', '-nostdlib', '-ffreestanding'],
LINKFLAGS = ['-nostdlib'],
CPPPATH = ['#include'],

View File

@@ -14,7 +14,6 @@ sys.path.append(PROJRELROOT)
from config.projpaths import *
from config.configuration import *
config = configuration_retrieve()
arch = config.arch
@@ -31,8 +30,7 @@ LIBC_LIBPATH = join(BUILDDIR, LIBC_RELDIR)
LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \
join(LIBC_DIR, 'include/arch' + '/' + arch)]
env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
env = Environment(CC = config.user_toolchain + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', \

View File

@@ -2,7 +2,9 @@
import os
import sys
compiler_prefix = "arm-none-linux-gnueabi-"
from configure import *
config = configuration_retrieve()
objdump = "objdump"
command = "-t"
image_name = "inittask.axf"
@@ -10,7 +12,7 @@ linkoutput_file_suffix = "-linkinfo.txt"
linkoutput_file = image_name + linkoutput_file_suffix
def generate_bootdesc():
command = compiler_prefix + objdump + " -t " + image_name + " > " + linkoutput_file
command = config.user_toolchain + objdump + " -t " + image_name + " > " + linkoutput_file
print command
os.system(command)
f = open(linkoutput_file, "r")

View File

@@ -8,6 +8,9 @@ import sys
import shutil
from os.path import join
from glob import glob
from configure import *
config = configuration_retrieve()
task_name = "test0"
@@ -54,8 +57,8 @@ def get_physical_base(source, target, env):
os.system(join(tools_root, "pyelf/readelf.py --first-free-page " + \
prev_image + " >> " + physical_base_ld_script))
# The kernel build environment:
env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
# The kernel build environment
env = Environment(CC = config.user_toolchain + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', '-Werror'],
@@ -71,7 +74,7 @@ env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
test_exec_ld_script = "include/test_exec_linker.lds"
# The kernel build environment:
test_exec_env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
test_exec_env = Environment(CC = config.user_toolchain + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-O3', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', '-Werror'],

View File

@@ -5,17 +5,20 @@
# Copyright © 2009 B Labs Ltd
import os, sys, shelve
from configure import *
arch = 'arm'
subarch = 'v5'
platform = 'pb926'
variant = "baremetal"
config = configuration_retrieve()
arch = config.arch
subarch = config.subarch
platform = config.platform
gcc_cpu_flag = config.gcc_cpu_flag
env = Environment(CC = 'arm-none-eabi-gcc',
env = Environment(CC = config.kernel_toolchain + 'gcc',
# We don't use -nostdinc because sometimes we need standard headers,
# such as stdarg.h e.g. for variable args, as in printk().
CCFLAGS = ['-g', '-mcpu=arm926ej-s', '-nostdlib', '-ffreestanding', \
'-std=gnu99', '-Wall', '-Werror'],
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \
'-Werror', ('-mcpu=' + gcc_cpu_flag)],
LINKFLAGS = ['-nostdlib', '-T' + "include/l4/arch/arm/linker.lds"],
ASFLAGS = ['-D__ASSEMBLY__'],
PROGSUFFIX = '.elf', # The suffix to use for final executable

View File

@@ -6,9 +6,11 @@
import os, sys, shelve
from os.path import join
from configure import *
arch = 'arm'
platform = 'pb926'
config = configuration_retrieve()
arch = config.arch
platform = config.platform
# Get global paths
PROJRELROOT="../../../"
@@ -19,7 +21,7 @@ LIBC_LIBPATH = LIBC_PATH
LIBC_INCPATH = [join(LIBC_PATH, 'include'), \
join(LIBC_PATH, 'include/arch/' + arch)]
env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
env = Environment(CC = config.user_toolchain + 'gcc',
CCFLAGS = ['-g', '-nostdinc', '-nostdlib', '-ffreestanding'],
LINKFLAGS = ['-nostdlib'],
ENV = {'PATH' : os.environ['PATH']},

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

View File

@@ -3,6 +3,7 @@
import re, elf, sys, os
from optparse import OptionParser
# May need to do something about this
toolprefix = "arm-none-linux-gnueabi-"
objdump = toolprefix + "objdump"
objcopy = toolprefix + "objcopy"