mirror of
https://github.com/drasko/codezero.git
synced 2026-01-11 18:33:16 +01:00
Taking Linux's Rootfs address from user
This commit is contained in:
@@ -42,6 +42,7 @@ CONT%(cn)d_PAGER_UTCB_END 'Container %(cn)d UTCB Mappings Region End'
|
||||
CONT%(cn)d_LINUX_ZRELADDR 'Container %(cn)d Linux ZRELADDR parameter'
|
||||
CONT%(cn)d_LINUX_PAGE_OFFSET 'Container %(cn)d Linux PAGE_OFFSET Parameter'
|
||||
CONT%(cn)d_LINUX_PHYS_OFFSET 'Container %(cn)d Linux PHYS_OFFSET Parameter'
|
||||
CONT%(cn)d_LINUX_ROOTFS_ADDRESS 'Container %(cn)d Linux ROOTFS Address'
|
||||
CONT%(cn)d_LINUX_MAPSIZE 'Container %(cn)d Linux Initial Kernel Map Size Parameter'
|
||||
|
||||
default CONT%(cn)d_PAGER_LMA from 0x0
|
||||
@@ -56,6 +57,7 @@ default CONT%(cn)d_PAGER_UTCB_END from 0x0
|
||||
default CONT%(cn)d_LINUX_ZRELADDR from 0x0
|
||||
default CONT%(cn)d_LINUX_PAGE_OFFSET from 0x0
|
||||
default CONT%(cn)d_LINUX_PHYS_OFFSET from 0x0
|
||||
default CONT%(cn)d_LINUX_ROOTFS_ADDRESS from 0x0
|
||||
default CONT%(cn)d_LINUX_MAPSIZE from 0x0
|
||||
|
||||
default CONT%(cn)d_VIRTMEM_REGIONS from 1
|
||||
@@ -149,6 +151,7 @@ menu cont%(cn)d_linux_pager_params
|
||||
CONT%(cn)d_LINUX_ZRELADDR@
|
||||
CONT%(cn)d_LINUX_PAGE_OFFSET@
|
||||
CONT%(cn)d_LINUX_PHYS_OFFSET@
|
||||
CONT%(cn)d_LINUX_ROOTFS_ADDRESS@
|
||||
CONT%(cn)d_LINUX_MAPSIZE@
|
||||
|
||||
menu cont%(cn)d_virtmem_list
|
||||
|
||||
@@ -22,6 +22,7 @@ class Container:
|
||||
self.linux_zreladdr = 0
|
||||
self.linux_page_offset = 0
|
||||
self.linux_phys_offset = 0
|
||||
self.linux_rootfs_address = 0
|
||||
self.linux_mapsize = 0
|
||||
self.physmem = {}
|
||||
self.physmem["START"] = {}
|
||||
@@ -123,6 +124,8 @@ class configuration:
|
||||
self.containers[id].pager_lma += int(val, 0)
|
||||
elif param[:len("LINUX_ZRELADDR")] == "LINUX_ZRELADDR":
|
||||
self.containers[id].linux_zreladdr += int(val, 0)
|
||||
elif param[:len("LINUX_ROOTFS_ADDRESS")] == "LINUX_ROOTFS_ADDRESS":
|
||||
self.containers[id].linux_rootfs_address += int(val, 0)
|
||||
elif re.match(r"(VIRT|PHYS){1}([0-9]){1}(_){1}(START|END){1}", param):
|
||||
matchobj = re.match(r"(VIRT|PHYS){1}([0-9]){1}(_){1}(START|END){1}", param)
|
||||
virtphys, regionidstr, discard1, startend = matchobj.groups()
|
||||
|
||||
@@ -34,7 +34,12 @@ class RootfsBuilder:
|
||||
|
||||
self.rootfs_lds_in = join(self.LINUX_ROOTFSDIR, "rootfs.lds.in")
|
||||
self.rootfs_lds_out = join(self.LINUX_ROOTFS_BUILDDIR, "rootfs.lds")
|
||||
|
||||
self.rootfs_h_in = join(self.LINUX_ROOTFSDIR, "rootfs.h.in")
|
||||
self.rootfs_h_out = join(self.LINUX_ROOTFS_BUILDDIR, "rootfs.h")
|
||||
|
||||
self.rootfs_elf_out = join(self.LINUX_ROOTFS_BUILDDIR, "rootfs.elf")
|
||||
self.cont_id = container.id
|
||||
|
||||
def build_rootfs(self):
|
||||
print 'Building the root filesystem...'
|
||||
@@ -43,8 +48,14 @@ class RootfsBuilder:
|
||||
os.chdir(LINUX_ROOTFSDIR)
|
||||
if not os.path.exists(self.LINUX_ROOTFS_BUILDDIR):
|
||||
os.makedirs(self.LINUX_ROOTFS_BUILDDIR)
|
||||
os.system("arm-none-linux-gnueabi-cpp -P " + \
|
||||
"%s > %s" % (self.rootfs_lds_in, self.rootfs_lds_out))
|
||||
|
||||
with open(self.rootfs_h_out, 'w+') as output:
|
||||
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" % \
|
||||
(self.LINUX_ROOTFS_BUILDDIR, self.rootfs_lds_in, \
|
||||
self.rootfs_lds_out))
|
||||
os.system("arm-none-linux-gnueabi-gcc " + \
|
||||
"-nostdlib -o %s -T%s rootfs.S" % (self.rootfs_elf_out, \
|
||||
self.rootfs_lds_out))
|
||||
|
||||
Reference in New Issue
Block a user