mirror of
https://github.com/drasko/codezero.git
synced 2026-01-11 18:33:16 +01:00
Added separate toolchains for userspace and kernel.
This commit is contained in:
10
SConstruct
10
SConstruct
@@ -22,7 +22,7 @@ def generate_kernel_linker_script(target, source, env):
|
||||
linker_in = source[0]
|
||||
linker_out = target[0]
|
||||
|
||||
cmd = config.toolchain + "cpp -D__CPP__ " + \
|
||||
cmd = config.toolchain_kernel + "cpp -D__CPP__ " + \
|
||||
"-I%s -imacros l4/macros.h -imacros %s -imacros %s -C -P %s -o %s" % \
|
||||
('include', 'l4/platform/'+ platform + '/offsets.h', \
|
||||
'l4/glue/' + arch + '/memlayout.h', linker_in, linker_out)
|
||||
@@ -39,7 +39,7 @@ def generate_kernel_phys_linker_script(target, source, env):
|
||||
phys_linker_in = source[0]
|
||||
phys_linker_out = target[0]
|
||||
|
||||
cmd = config.toolchain + "cpp -D__CPP__ " + \
|
||||
cmd = config.toolchain_kernel + "cpp -D__CPP__ " + \
|
||||
"-I%s -imacros l4/macros.h -imacros %s -imacros %s -C -P %s -o %s" % \
|
||||
('include', 'l4/platform/'+ platform + '/offsets.h', \
|
||||
'l4/glue/' + arch + '/memlayout.h', phys_linker_in, phys_linker_out)
|
||||
@@ -50,9 +50,9 @@ create_kernel_phys_linker = Command(join(builddir, 'include/physlink.lds'), \
|
||||
join(PROJROOT, 'include/physlink.lds.in'), \
|
||||
generate_kernel_phys_linker_script)
|
||||
'''
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
AR = config.toolchain + 'ar',
|
||||
RANLIB = config.toolchain + 'ranlib',
|
||||
env = Environment(CC = config.toolchain_kernel + 'gcc',
|
||||
AR = config.toolchain_kernel + 'ar',
|
||||
RANLIB = config.toolchain_kernel + 'ranlib',
|
||||
# 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', \
|
||||
|
||||
@@ -30,9 +30,9 @@ LIBELF_PATH = 'loader/libs/elf'
|
||||
LIBELF_LIBPATH = LIBELF_PATH
|
||||
LIBELF_INCPATH = '#' + join(LIBELF_PATH, 'include')
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
AR = config.toolchain + 'ar',
|
||||
RANLIB = config.toolchain + 'ranlib',
|
||||
env = Environment(CC = config.toolchain_kernel + 'gcc',
|
||||
AR = config.toolchain_kernel + 'ar',
|
||||
RANLIB = config.toolchain_kernel + 'ranlib',
|
||||
# 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', \
|
||||
|
||||
@@ -16,9 +16,9 @@ platform = config.platform
|
||||
gcc_arch_flag = config.gcc_arch_flag
|
||||
all_syms = config.all
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
AR = config.toolchain + 'ar',
|
||||
RANLIB = config.toolchain + 'ranlib',
|
||||
env = Environment(CC = config.toolchain_userspace + 'gcc',
|
||||
AR = config.toolchain_userspace + 'ar',
|
||||
RANLIB = config.toolchain_userspace + 'ranlib',
|
||||
# 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',
|
||||
|
||||
@@ -42,7 +42,8 @@ SCHED_TICKS 'Scheduler ticks per second'
|
||||
ICACHE_DISABLE 'Disable the L1 instruction cache'
|
||||
DCACHE_DISABLE 'Disable the L1 data cache'
|
||||
PREEMPT_DISABLE 'Disable Kernel Preemption'
|
||||
TOOLCHAIN 'Toolchain prefix for kernel'
|
||||
TOOLCHAIN_USERSPACE 'Toolchain prefix for userspace'
|
||||
TOOLCHAIN_KERNEL 'Toolchain prefix for kernel'
|
||||
|
||||
CAPABILITIES 'Enable capability checking'
|
||||
|
||||
@@ -100,7 +101,8 @@ menu kernel_generic_options
|
||||
SCHED_TICKS%
|
||||
|
||||
menu toolchain_menu
|
||||
TOOLCHAIN$
|
||||
TOOLCHAIN_USERSPACE$
|
||||
TOOLCHAIN_KERNEL$
|
||||
|
||||
menu main_menu
|
||||
arch_type
|
||||
@@ -194,7 +196,8 @@ require NCPU <= 4
|
||||
derive RAM_BASE_PLAT from PLATFORM_BEAGLE ? 0x80000000 : 0x00000000
|
||||
|
||||
# Toolchains:
|
||||
default TOOLCHAIN from 'arm-none-eabi-'
|
||||
default TOOLCHAIN_USERSPACE from 'arm-none-linux-gnueabi-'
|
||||
default TOOLCHAIN_KERNEL from 'arm-none-eabi-'
|
||||
|
||||
prefix CONFIG_
|
||||
|
||||
|
||||
@@ -69,7 +69,8 @@ class configuration:
|
||||
self.platform = None
|
||||
self.cpu = None
|
||||
self.gcc_arch_flag = None
|
||||
self.toolchain = None
|
||||
self.toolchain_userspace = None
|
||||
self.toolchain_kernel = None
|
||||
self.all = []
|
||||
self.containers = []
|
||||
self.ncontainers = 0
|
||||
@@ -117,9 +118,16 @@ class configuration:
|
||||
|
||||
# Extract kernel space toolchain from a name value pair
|
||||
def get_toolchain(self, name, val):
|
||||
if name[:len("CONFIG_TOOLCHAIN")] == "CONFIG_TOOLCHAIN":
|
||||
if name[:len("CONFIG_TOOLCHAIN_USERSPACE")] == \
|
||||
"CONFIG_TOOLCHAIN_USERSPACE":
|
||||
parts = val.split("\"", 2)
|
||||
self.toolchain = parts[1]
|
||||
self.toolchain_userspace = parts[1]
|
||||
|
||||
if name[:len("CONFIG_TOOLCHAIN_KERNEL")] == \
|
||||
"CONFIG_TOOLCHAIN_KERNEL":
|
||||
parts = val.split("\"", 2)
|
||||
self.toolchain_kernel = parts[1]
|
||||
|
||||
|
||||
# Extract number of containers
|
||||
def get_ncontainers(self, name, val):
|
||||
|
||||
@@ -42,7 +42,7 @@ LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
|
||||
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
|
||||
LIBMEM_INCLUDE = LIBMEM_DIR
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_userspace + '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', \
|
||||
|
||||
@@ -42,7 +42,7 @@ LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
|
||||
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
|
||||
LIBMEM_INCLUDE = LIBMEM_DIR
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_userspace + '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', \
|
||||
|
||||
@@ -44,7 +44,7 @@ LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
|
||||
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
|
||||
LIBMEM_INCLUDE = LIBMEM_DIR
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_userspace + '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', \
|
||||
|
||||
@@ -43,7 +43,7 @@ LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
|
||||
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
|
||||
LIBMEM_INCLUDE = LIBMEM_DIR
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_userspace + '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', \
|
||||
|
||||
@@ -42,7 +42,7 @@ LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
|
||||
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
|
||||
LIBMEM_INCLUDE = LIBMEM_DIR
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_userspace + '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', \
|
||||
|
||||
@@ -44,7 +44,7 @@ LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
|
||||
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
|
||||
LIBMEM_INCLUDE = LIBMEM_DIR
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_userspace + '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', \
|
||||
|
||||
@@ -43,7 +43,7 @@ LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
|
||||
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
|
||||
LIBMEM_INCLUDE = LIBMEM_DIR
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_userspace + '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', \
|
||||
|
||||
@@ -28,7 +28,7 @@ LIBDEV_RELDIR = 'conts/libdev'
|
||||
LIBDEV_DIR = join(PROJROOT, LIBDEV_RELDIR)
|
||||
LIBDEV_INC = join(LIBDEV_DIR, 'include')
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_userspace + 'gcc',
|
||||
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', \
|
||||
'-nostdinc', '-Wall', '-Werror', '-march=' + gcc_arch_flag],
|
||||
LINKFLAGS = ['-nostdlib'],
|
||||
|
||||
@@ -32,7 +32,7 @@ LIBC_RELDIR = 'conts/libc'
|
||||
LIBC_DIR = join(PROJROOT, LIBC_RELDIR)
|
||||
LIBC_INC = join(LIBC_DIR, 'include')
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_userspace + 'gcc',
|
||||
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', \
|
||||
'-nostdinc', '-Wall', '-DVARIANT_' + variant.upper(), \
|
||||
'-march=' + gcc_arch_flag, '-Werror'],
|
||||
|
||||
@@ -25,7 +25,7 @@ LIBC_RELDIR = 'conts/libc'
|
||||
LIBC_DIR = join(PROJROOT, LIBC_RELDIR)
|
||||
LIBC_INC = join(LIBC_DIR, 'include')
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_userspace + 'gcc',
|
||||
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', \
|
||||
'-nostdinc', '-Wall', '-Werror', '-march=' + gcc_arch_flag],
|
||||
LINKFLAGS = ['-nostdlib'],
|
||||
|
||||
@@ -32,7 +32,7 @@ LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
|
||||
LIBL4_INCLUDE = join(LIBL4_DIR, 'include')
|
||||
|
||||
# This does not work, need to check
|
||||
test_env = Environment(CC = config.toolchain + 'gcc',
|
||||
test_env = Environment(CC = config.toolchain_userspace + 'gcc',
|
||||
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \
|
||||
'-nostdinc', '-Werror', '-march=' + gcc_arch_flag],
|
||||
ENV = {'PATH' : os.environ['PATH']},
|
||||
@@ -40,7 +40,7 @@ test_env = Environment(CC = config.toolchain + 'gcc',
|
||||
LIBPATH = ['#'],
|
||||
CPPPATH = ['#include', join(PROJRELROOT, "include"), "#", LIBL4_INCLUDE])
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_userspace + 'gcc',
|
||||
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', \
|
||||
'-Wall', '-Werror', '-march=' + gcc_arch_flag],
|
||||
LINKFLAGS = ['-nostdlib'],
|
||||
|
||||
@@ -49,9 +49,9 @@ LIBPOSIX_INCLUDE_SERVER = join(LIBPOSIX_DIR, 'include')
|
||||
LIBPOSIX_INCLUDE_USERSPACE = join(LIBPOSIX_DIR, 'include/posix')
|
||||
LIBPOSIX_LIBPATH = join(BUILDDIR, LIBPOSIX_RELDIR)
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
AR = config.toolchain + 'ar',
|
||||
RANLIB = config.toolchain + 'ranlib',
|
||||
env = Environment(CC = config.toolchain_userspace + 'gcc',
|
||||
AR = config.toolchain_userspace + 'ar',
|
||||
RANLIB = config.toolchain_userspace + 'ranlib',
|
||||
CCFLAGS = ['-g','-nostdinc', '-nostdlib', '-ffreestanding',
|
||||
'-march=' + gcc_arch_flag, '-std=gnu99', '-Wall', '-Werror'],
|
||||
LINKFLAGS = ['-nostdlib'],
|
||||
|
||||
@@ -97,8 +97,10 @@ def relocate_bootdesc(target, source, env):
|
||||
images = source[1:]
|
||||
mm0 = images[0]
|
||||
start, end = image_lma_start_end(mm0.path)
|
||||
print config.toolchain + "objcopy --adjust-section-vma .data=" + conv_hex(end) + " " + bootdesc_raw.path
|
||||
os.system(config.toolchain + "objcopy --adjust-section-vma .data=" + conv_hex(end) + " " + bootdesc_raw.path)
|
||||
print config.toolchain_userspace + "objcopy --adjust-section-vma .data=" \
|
||||
+ conv_hex(end) + " " + bootdesc_raw.path
|
||||
os.system(config.toolchain_userspace + "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)
|
||||
|
||||
@@ -12,7 +12,7 @@ from configure import *
|
||||
config = configuration_retrieve()
|
||||
builddir = ARGUMENTS.get('builddir', 'build/conts/posix')
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_userspace + 'gcc',
|
||||
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', '-Werror'],
|
||||
LINKFLAGS = ['-nostdlib','-Tlinker.lds'],
|
||||
ASFLAGS = ['-D__ASSEMBLY__'],
|
||||
|
||||
@@ -16,7 +16,7 @@ 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 = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_userspace + 'gcc',
|
||||
CCFLAGS = ['-g', '-std=gnu99', '-nostdlib', '-ffreestanding'],
|
||||
LINKFLAGS = ['-nostdlib'],
|
||||
CPPPATH = ['#include'],
|
||||
|
||||
@@ -30,7 +30,7 @@ LIBC_LIBPATH = join(BUILDDIR, LIBC_RELDIR)
|
||||
LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \
|
||||
join(LIBC_DIR, 'include/arch' + '/' + arch)]
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_userspace + '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', \
|
||||
|
||||
@@ -12,7 +12,8 @@ linkoutput_file_suffix = "-linkinfo.txt"
|
||||
linkoutput_file = image_name + linkoutput_file_suffix
|
||||
|
||||
def generate_bootdesc():
|
||||
command = config.toolchain + objdump + " -t " + image_name + " > " + linkoutput_file
|
||||
command = config.toolchain_userspace + objdump + \
|
||||
" -t " + image_name + " > " + linkoutput_file
|
||||
print command
|
||||
os.system(command)
|
||||
f = open(linkoutput_file, "r")
|
||||
|
||||
@@ -58,7 +58,7 @@ def get_physical_base(source, target, env):
|
||||
prev_image + " >> " + physical_base_ld_script))
|
||||
|
||||
# The kernel build environment
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_userspace + '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'],
|
||||
@@ -74,7 +74,7 @@ env = Environment(CC = config.toolchain + 'gcc',
|
||||
|
||||
test_exec_ld_script = "include/test_exec_linker.lds"
|
||||
# The kernel build environment:
|
||||
test_exec_env = Environment(CC = config.toolchain + 'gcc',
|
||||
test_exec_env = Environment(CC = config.toolchain_userspace + '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'],
|
||||
|
||||
@@ -44,7 +44,7 @@ LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
|
||||
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
|
||||
LIBMEM_INCLUDE = LIBMEM_DIR
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_userspace + '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', '-march=' + gcc_arch_flag],
|
||||
|
||||
@@ -13,7 +13,7 @@ arch = config.arch
|
||||
subarch = config.subarch
|
||||
gcc_arch_flag = config.gcc_arch_flag
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_kernel + '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', \
|
||||
|
||||
@@ -21,7 +21,7 @@ LIBC_LIBPATH = LIBC_PATH
|
||||
LIBC_INCPATH = [join(LIBC_PATH, 'include'), \
|
||||
join(LIBC_PATH, 'include/arch/' + arch)]
|
||||
|
||||
env = Environment(CC = config.toolchain + 'gcc',
|
||||
env = Environment(CC = config.toolchain_kernel + 'gcc',
|
||||
CCFLAGS = ['-g', '-nostdinc', '-nostdlib', '-ffreestanding'],
|
||||
LINKFLAGS = ['-nostdlib'],
|
||||
ENV = {'PATH' : os.environ['PATH']},
|
||||
|
||||
@@ -96,7 +96,7 @@ class LinuxContainerPacker:
|
||||
self.atags_elf_in])
|
||||
self.generate_container_assembler([self.kernel_image_in, self.rootfs_elf_in, \
|
||||
self.atags_elf_in])
|
||||
os.system(config.toolchain + "gcc " + "-nostdlib -o %s -T%s %s" \
|
||||
os.system(config.toolchain_kernel + "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
|
||||
@@ -155,7 +155,7 @@ class DefaultContainerPacker:
|
||||
def pack_container(self, config):
|
||||
self.generate_container_lds(self.images_in)
|
||||
self.generate_container_assembler(self.images_in)
|
||||
os.system(config.toolchain + "gcc " + "-nostdlib -o %s -T%s %s" \
|
||||
os.system(config.toolchain_kernel + "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
|
||||
|
||||
@@ -79,7 +79,7 @@ class AllContainerPacker:
|
||||
def pack_all(self, config):
|
||||
self.generate_container_lds(self.containers_lds_out)
|
||||
self.generate_container_S(self.containers_S_out)
|
||||
os.system(config.toolchain + "gcc " + "-nostdlib -o %s -T%s %s" \
|
||||
os.system(config.toolchain_kernel + "gcc " + "-nostdlib -o %s -T%s %s" \
|
||||
% (self.containers_elf_out, self.containers_lds_out, \
|
||||
self.containers_S_out))
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class AtagsBuilder:
|
||||
with open(self.atags_h_in, 'r') as input:
|
||||
output.write(input.read() % {'cn' : self.cont_id})
|
||||
|
||||
os.system(config.toolchain + "cpp -I%s -P %s > %s" % \
|
||||
os.system(config.toolchain_userspace + "cpp -I%s -P %s > %s" % \
|
||||
(self.LINUX_ATAGS_BUILDDIR, self.atags_lds_in, \
|
||||
self.atags_lds_out))
|
||||
|
||||
@@ -72,7 +72,7 @@ class AtagsBuilder:
|
||||
with open(self.atags_c_in, 'r') as input:
|
||||
output.write(input.read() % {'cn' : self.cont_id})
|
||||
|
||||
os.system(config.toolchain + "gcc " + \
|
||||
os.system(config.toolchain_userspace + "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))
|
||||
|
||||
@@ -189,20 +189,22 @@ class LinuxBuilder:
|
||||
for platform, config_file in self.platform_config_file:
|
||||
if platform == config.platform.upper():
|
||||
configuration_file = config_file
|
||||
os.system("make ARCH=codezero CROSS_COMPILE=" + config.toolchain + \
|
||||
os.system("make ARCH=codezero CROSS_COMPILE=" + \
|
||||
config.toolchain_userspace + \
|
||||
" O=" + self.LINUX_KERNEL_BUILDDIR + " " + configuration_file)
|
||||
|
||||
self.kernel_updater.modify_kernel_config(self.LINUX_KERNEL_BUILDDIR)
|
||||
self.kernel_updater.update_kernel_params(config, self.container)
|
||||
|
||||
os.system("make ARCH=codezero CROSS_COMPILE=" + config.toolchain + \
|
||||
os.system("make ARCH=codezero CROSS_COMPILE=" + \
|
||||
config.toolchain_userspace + \
|
||||
" O=" + self.LINUX_KERNEL_BUILDDIR + " menuconfig")
|
||||
os.system("make ARCH=codezero " + \
|
||||
"CROSS_COMPILE=" + config.toolchain + " O=" + \
|
||||
self.LINUX_KERNEL_BUILDDIR)
|
||||
"CROSS_COMPILE=" + config.toolchain_userspace + \
|
||||
" O=" + self.LINUX_KERNEL_BUILDDIR)
|
||||
|
||||
# Generate kernel_image, elf to be used by codezero
|
||||
linux_elf_gen_cmd = (config.toolchain + "objcopy -R .note \
|
||||
linux_elf_gen_cmd = (config.toolchain_userspace + "objcopy -R .note \
|
||||
-R .note.gnu.build-id -R .comment -S --change-addresses " + \
|
||||
str(conv_hex(-self.container.linux_page_offset + self.container.linux_phys_offset)) + \
|
||||
" " + self.kernel_binary_image + " " + self.kernel_image)
|
||||
|
||||
@@ -51,10 +51,10 @@ class RootfsBuilder:
|
||||
with open(self.rootfs_h_in, 'r') as input:
|
||||
output.write(input.read() % {'cn' : self.cont_id})
|
||||
|
||||
os.system(config.toolchain + "cpp -I%s -P %s > %s" % \
|
||||
os.system(config.toolchain_userspace + "cpp -I%s -P %s > %s" % \
|
||||
(self.LINUX_ROOTFS_BUILDDIR, self.rootfs_lds_in, \
|
||||
self.rootfs_lds_out))
|
||||
os.system(config.toolchain + "gcc " + \
|
||||
os.system(config.toolchain_userspace + "gcc " + \
|
||||
"-nostdlib -o %s -T%s rootfs.S" % (self.rootfs_elf_out, \
|
||||
self.rootfs_lds_out))
|
||||
print "Done..."
|
||||
|
||||
@@ -53,7 +53,7 @@ def generate_ksym_to_loader(target_path, source_path):
|
||||
asm_file.write(ksym_header % (target_path, source_path, sys.argv[0]))
|
||||
for symbol in symbols:
|
||||
process = \
|
||||
subprocess.Popen(config.toolchain + 'objdump -d ' + \
|
||||
subprocess.Popen(config.toolchain_kernel + 'objdump -d ' + \
|
||||
source_path + ' | grep "<' + \
|
||||
symbol + '>"', shell=True, \
|
||||
stdout=subprocess.PIPE)
|
||||
|
||||
Reference in New Issue
Block a user