mirror of
https://github.com/drasko/codezero.git
synced 2026-07-19 13:45:23 +02:00
Encapsulating Linux Image binary in elf
This commit is contained in:
@@ -170,8 +170,8 @@ pager_ifdefs_todotext = \
|
|||||||
pager_ifdefs = \
|
pager_ifdefs = \
|
||||||
'''
|
'''
|
||||||
#if defined(CONFIG_CONT%(cn)d_TYPE_LINUX)
|
#if defined(CONFIG_CONT%(cn)d_TYPE_LINUX)
|
||||||
#define CONFIG_CONT%(cn)d_PAGER_LMA (CONFIG_CONT%(cn)d_LINUX_PHYS_OFFSET + CONFIG_CONT%(cn)d_LINUX_TEXT_OFFSET)
|
#define CONFIG_CONT%(cn)d_PAGER_LMA (CONFIG_CONT%(cn)d_LINUX_PHYS_OFFSET)
|
||||||
#define CONFIG_CONT%(cn)d_PAGER_VMA (CONFIG_CONT%(cn)d_LINUX_PAGE_OFFSET + CONFIG_CONT%(cn)d_LINUX_TEXT_OFFSET)
|
#define CONFIG_CONT%(cn)d_PAGER_VMA (CONFIG_CONT%(cn)d_LINUX_PAGE_OFFSET)
|
||||||
#define CONFIG_CONT%(cn)d_PAGER_SIZE CONFIG_CONT%(cn)d_LINUX_MAPSIZE
|
#define CONFIG_CONT%(cn)d_PAGER_SIZE CONFIG_CONT%(cn)d_LINUX_MAPSIZE
|
||||||
#endif
|
#endif
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -36,6 +36,15 @@ class LinuxBuilder:
|
|||||||
self.LINUX_KERNEL_BUILDDIR = \
|
self.LINUX_KERNEL_BUILDDIR = \
|
||||||
source_to_builddir(LINUX_KERNELDIR, container.id)
|
source_to_builddir(LINUX_KERNELDIR, container.id)
|
||||||
|
|
||||||
|
self.linux_lds_in = join(self.LINUX_KERNELDIR, "linux.lds.in")
|
||||||
|
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_elf_out = join(self.LINUX_KERNEL_BUILDDIR, "linux.elf")
|
||||||
|
|
||||||
|
self.kernel_binary_image = \
|
||||||
|
join(os.path.relpath(self.LINUX_KERNEL_BUILDDIR, LINUX_KERNELDIR), \
|
||||||
|
"arch/arm/boot/Image")
|
||||||
self.kernel_image = None
|
self.kernel_image = None
|
||||||
|
|
||||||
def build_linux(self):
|
def build_linux(self):
|
||||||
@@ -48,10 +57,18 @@ class LinuxBuilder:
|
|||||||
"CROSS_COMPILE=arm-none-linux-gnueabi- O=" + \
|
"CROSS_COMPILE=arm-none-linux-gnueabi- O=" + \
|
||||||
self.LINUX_KERNEL_BUILDDIR)
|
self.LINUX_KERNEL_BUILDDIR)
|
||||||
|
|
||||||
|
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-gcc -nostdlib -o %s -T%s %s" % \
|
||||||
|
(self.linux_elf_out, self.linux_lds_out, self.linux_S_out))
|
||||||
|
|
||||||
# Get the kernel image path
|
# Get the kernel image path
|
||||||
self.kernel_image = \
|
self.kernel_image = self.linux_elf_out
|
||||||
join(self.LINUX_KERNEL_BUILDDIR, \
|
|
||||||
'arch/arm/boot/compressed/vmlinux')
|
|
||||||
|
|
||||||
print 'Done...'
|
print 'Done...'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user