From 4bbf9adb86cc1f3f3278c0d9939d409cb8e2e19d Mon Sep 17 00:00:00 2001 From: Amit Mahajan Date: Wed, 14 Oct 2009 12:25:40 +0530 Subject: [PATCH] Passing PHYS_OFFSET as load address of linux elf --- scripts/linux/build_linux.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/linux/build_linux.py b/scripts/linux/build_linux.py index 3f119eb..81c73b4 100755 --- a/scripts/linux/build_linux.py +++ b/scripts/linux/build_linux.py @@ -148,6 +148,10 @@ class LinuxBuilder: self.linux_lds_out = join(self.LINUX_KERNEL_BUILDDIR, "linux.lds") self.linux_S_in = join(self.LINUX_KERNELDIR, "linux.S.in") self.linux_S_out = join(self.LINUX_KERNEL_BUILDDIR, "linux.S") + + self.linux_h_in = join(self.LINUX_KERNELDIR, "linux.h.in") + self.linux_h_out = join(self.LINUX_KERNEL_BUILDDIR, "linux.h") + self.linux_elf_out = join(self.LINUX_KERNEL_BUILDDIR, "linux.elf") self.container = container @@ -167,13 +171,18 @@ class LinuxBuilder: "CROSS_COMPILE=arm-none-linux-gnueabi- O=" + \ self.LINUX_KERNEL_BUILDDIR) + with open(self.linux_h_out, 'w+') as output: + with open(self.linux_h_in, 'r') as input: + output.write(input.read() % {'cn' : self.container.id}) + with open(self.linux_S_in, 'r') as input: with open(self.linux_S_out, 'w+') as output: content = input.read() % self.kernel_binary_image output.write(content) - os.system("arm-none-linux-gnueabi-cpp -P " + \ - "%s > %s" % (self.linux_lds_in, self.linux_lds_out)) + os.system("arm-none-linux-gnueabi-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" % \ (self.linux_elf_out, self.linux_lds_out, self.linux_S_out))