Files
codezero/tools/ksym_to_lds.py
Bahadir Balban 938672f7c9 Changed the virt-to-phys debug breakpoint name to break_virtual
Changed l4id_t type to integer to recognise negative id values like L4_ANYTHREAD.
Added an extremely simple script that cleans and builds everything in right order.

Increased boot pmds by one:
This is due to the fact that if the 1MB initial allocation area of the kernel is
not 1MB-aligned, it is ought to be mapped from the middle of one MB to next,
which requires 2 pmds.

	modified:   .gdbinit
	modified:   README
	new file:   buildall.sh
	modified:   include/l4/arch/arm/types.h
	modified:   include/l4/generic/scheduler.h
	modified:   loader/kernel.S
	modified:   loader/main.c
	modified:   loader/mylink.lds
	modified:   loader/start.axf.S
	modified:   src/glue/arm/init.c
	modified:   src/glue/arm/memory.c
	modified:   tasks/fs0/src/bdev.c
	modified:   tasks/mm0/include/kdata.h
	modified:   tasks/mm0/include/vm_area.h
	modified:   tasks/mm0/src/init.c
	modified:   tasks/mm0/src/task.c
	modified:   tools/ksym_to_lds.py
	modified:   tools/l4-qemu
2008-02-04 16:44:11 +00:00

64 lines
1.3 KiB
Python
Executable File

#!/usr/bin/python
import os
import sys
from string import atoi
from os import popen2
from os.path import join
symbols = ['break_virtual']
builddir = "build"
loaderdir = "loader"
image = "start.axf"
imgpath = join(builddir, image)
asmfile = join(loaderdir, image) + ".S"
symfile = "ksyms"
asmheader = \
'''
/*
* %s autogenerated from %s
*
* This file is included by the loader sources so that any
* kernel symbol address can be known in advance and stopped
* at by debuggers before virtual memory is enabled.
*/
'''
asmcontent = \
'''
.section .text
.align 4
.global %s;
.type %s, function;
.equ %s, %s
'''
def virt_to_phys(addr):
return hex(int(addr, 16) - 0xF0000000)[:-1]
def ksym_to_lds():
asm = open(asmfile, "w+")
asm.write(asmheader % (asmfile, imgpath))
cmd = "arm-none-eabi-objdump -d " + imgpath + " | grep " + "\\<" + symbols[0] + "\\>" + " > " + symfile
os.system(cmd)
kf = open(symfile, "r")
#child_out, child_in = popen2(cmd)
while True:
line = kf.readline()
if len(line) is 0:
break
addr, sym = line.split()
sym = sym[1:-2]
addr = "0x" + addr
addr = virt_to_phys(addr)
if sym in symbols:
print "Adding " + sym + " from " + imgpath + " to " + asmfile + " in physical"
asm.write(asmcontent % (sym, sym, sym, addr))
asm.close()
kf.close()
cmd = "rm -rf " + symfile
os.system(cmd)
if __name__ == "__main__":
ksym_to_lds()