mirror of
https://github.com/drasko/codezero.git
synced 2026-07-13 02:44:13 +02:00
Removed the containers SConscript
This commit is contained in:
@@ -1,114 +0,0 @@
|
|||||||
#
|
|
||||||
# Build script to autogenerate and compile a container image
|
|
||||||
#
|
|
||||||
# Copyright (C) 2009 B Labs
|
|
||||||
#
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import shutil
|
|
||||||
from os.path import join
|
|
||||||
|
|
||||||
Import('environment')
|
|
||||||
|
|
||||||
env = environment.Clone()
|
|
||||||
|
|
||||||
linux_kernel_path = join("/opt/codezero/build/conts/linux/arch/arm/boot/compressed/vmlinux")
|
|
||||||
rootfs_path = join("rootfs/rootfs.elf")
|
|
||||||
|
|
||||||
container_assembler_body = \
|
|
||||||
'''
|
|
||||||
.align 4
|
|
||||||
.section .img.%d
|
|
||||||
.incbin "%s"
|
|
||||||
'''
|
|
||||||
|
|
||||||
container_lds_start = \
|
|
||||||
'''/*
|
|
||||||
* Autogenerated linker script that embeds each container image.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 B Labs
|
|
||||||
*/
|
|
||||||
|
|
||||||
SECTIONS
|
|
||||||
{'''
|
|
||||||
|
|
||||||
container_lds_body = \
|
|
||||||
'''
|
|
||||||
.img.%d : { *(.img.%d) }'''
|
|
||||||
|
|
||||||
container_lds_end = \
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
'''
|
|
||||||
|
|
||||||
# TODO: This might be done much more elegantly and flexibly.
|
|
||||||
#
|
|
||||||
# But it makes sense to put the image finding logic to a function
|
|
||||||
# rather than hard-code it in an array at the beginning.
|
|
||||||
def collect_images(target, source, env):
|
|
||||||
cmd1 = "cp " + linux_kernel_path + " ./"
|
|
||||||
cmd2 = "cp " + rootfs_path + " ./"
|
|
||||||
os.system(cmd1)
|
|
||||||
os.system(cmd2)
|
|
||||||
os.system("echo " + cmd1)
|
|
||||||
os.system("echo " + cmd2)
|
|
||||||
|
|
||||||
images.append("vmlinux")
|
|
||||||
images.append("rootfs.elf")
|
|
||||||
for i in images:
|
|
||||||
print i
|
|
||||||
|
|
||||||
def generate_container_assembler(source, target, env):
|
|
||||||
f = open("container.S", "w+")
|
|
||||||
file_body = ""
|
|
||||||
img_i = 0
|
|
||||||
for img in source:
|
|
||||||
file_body += container_assembler_body % (img_i, img)
|
|
||||||
img_i += 1
|
|
||||||
|
|
||||||
f.write(file_body)
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
def generate_container_lds(source, target, env):
|
|
||||||
f = open("container.lds", "w+")
|
|
||||||
img_i = 0
|
|
||||||
file_body = container_lds_start
|
|
||||||
for img in source:
|
|
||||||
file_body += container_lds_body % (img_i, img_i)
|
|
||||||
img_i += 1
|
|
||||||
file_body += container_lds_end
|
|
||||||
f.write(file_body)
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
linux_builddir="/opt/codezero/build/conts/linux/build"
|
|
||||||
linux_srcdir = "/opt/codezero/conts/linux/linux-2.6.28.10"
|
|
||||||
linux_image = join(linux_builddir, "arch/arm/compressed/vmlinux")
|
|
||||||
|
|
||||||
def build_linux(source, target, env):
|
|
||||||
cwd = os.getcwd()
|
|
||||||
os.chdir(source[0].path)
|
|
||||||
print target[1].path
|
|
||||||
os.system("mkdir -p " + linux_builddir)
|
|
||||||
os.system("make defconfig " + "ARCH=arm " + "O=" + linux_builddir)
|
|
||||||
os.system("make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- O=" + linux_builddir)
|
|
||||||
os.chdir(cwd)
|
|
||||||
|
|
||||||
images = []
|
|
||||||
linux_kernel = env.Command([linux_image, linux_builddir], linux_srcdir, build_linux)
|
|
||||||
|
|
||||||
#rootfs = env.Command(rootfs_path, "rootfs/rootfs.img", build_rootfs)
|
|
||||||
#env.Command(["vmlinux", "rootfs.elf"], [linux_kernel_path, rootfs_path], collect_images)
|
|
||||||
#container_S = env.Command("container.S", ["vmlinux", "rootfs.elf"], generate_container_assembler)
|
|
||||||
#container_lds = env.Command("container.lds", ["vmlinux", "rootfs.elf"], generate_container_lds)
|
|
||||||
|
|
||||||
#env.Replace(LINKFLAGS = ['-nostdlib', '-Tcontainer.lds'])
|
|
||||||
#env.Replace(PROGSUFFIX = '.elf')
|
|
||||||
#objs = env.Object('container.S')
|
|
||||||
#container = env.Program('container.elf', objs)
|
|
||||||
#env.Depends(container, [linux_kernel, rootfs, container_S, container_lds])
|
|
||||||
|
|
||||||
#image = []
|
|
||||||
#image.append(File("container.elf"))
|
|
||||||
|
|
||||||
|
|
||||||
Return('linux_kernel')
|
|
||||||
Reference in New Issue
Block a user