Discussion:
porting python in tz_vmm demo
Abhay Amala
2016-07-09 20:09:52 UTC
Permalink
Hi,


I have been trying to port python2.6 into Genode in tz_vmm demo.

I did the following steps.

- In the Genode source directory <source directory>/repo/libports
make prepare PKG=python

- Uncomment the following line in <build directory>/etc/build.conf

REPOSITORIES += $(GENODE_DIR)/libports

- Add '*python.lib.so <http://python.lib.so>*' to the boot module list in
the tz_vmm run script.

- Add '*python*' in the target file of the tz_vmm as follows
LIBS += python

Finally, I got the following error when I compiled the tz_vmm run script.

Program core/core
COMPILE kernel/test.o
LINK core
make[1]: Leaving directory `/home/genode/build/hw_imx53_qsb_tz'
genode build completed
cp: cannot stat ‘bin/tz_vmm’: No such file or directory
while executing
"exec cp bin/$binary [run_dir]/genode"
(procedure "copy_and_strip_genode_binaries_to_run_dir" line 4)
invoked from within
"copy_and_strip_genode_binaries_to_run_dir $binaries"
(procedure "run_boot_dir" line 14)
invoked from within
"run_boot_dir $binaries"
(procedure "build_boot_image" line 2)
invoked from within
"build_boot_image [join $boot_modules " "]"
(file "/home/genode/repos/os/run/tz_vmm.run" line 262)
invoked from within
"source $include_name"
("foreach" body line 6)
invoked from within
"foreach include_name [get_cmd_arg --include ""] {
# first check if the include name is absolute
if {[string first "/" $include_name] == 0} {
puts ..."
(file "/home/genode/tool/run/run" line 642)
make: *** [run/tz_vmm] Error 1

Could anyone have an idea how to fix this error?


Thanks,
Abhay
Abhay Amala
2016-07-28 23:09:33 UTC
Permalink
Hi,

After some trials and errors, I could manage to compile python2.6. I tried
to run the test-python and got the following output. It seems the
interpreter works fine now but I don't understand what is "*int
_sigaction(int, const sigaction*, sigaction*): _sigaction not implemented*"
message? Does anyone have any idea? Thanks in advance for your answers.

[init -> test-python] int _sigaction(int, const sigaction*, sigaction*):
_sigaction not implemented
[init -> test-python] int _sigaction(int, const sigaction*, sigaction*):
_sigaction not implemented
[init -> test-python] int _sigaction(int, const sigaction*, sigaction*):
_sigaction not implemented
[init -> test-python] int main(): Starting python ...
[init -> test-python]
[init -> test-python]
[init -> test-python] -============================-
[init -> test-python] ||
||
[init -> test-python] || Python Core 2.6.4
||
[init -> test-python] ||
||
[init -> test-python] || Genode
11.11 ||
[init -> test-python]
|| ||
[init -> test-python] -============================-
[init -> test-python]
[init -> test-python] 2011 by Genode Labs www.genode-labs.com
[init -> test-python]
[init -> test-python]
[init] virtual void Genode::Child_policy::exit(int): child "test-python"
exited with exit value 0


Thanks,
Post by Abhay Amala
Hi,
I have been trying to port python2.6 into Genode in tz_vmm demo.
I did the following steps.
- In the Genode source directory <source directory>/repo/libports
make prepare PKG=python
- Uncomment the following line in <build directory>/etc/build.conf
REPOSITORIES += $(GENODE_DIR)/libports
- Add '*python.lib.so <http://python.lib.so>*' to the boot module list in
the tz_vmm run script.
- Add '*python*' in the target file of the tz_vmm as follows
LIBS += python
Finally, I got the following error when I compiled the tz_vmm run script.
Program core/core
COMPILE kernel/test.o
LINK core
make[1]: Leaving directory `/home/genode/build/hw_imx53_qsb_tz'
genode build completed
cp: cannot stat ‘bin/tz_vmm’: No such file or directory
while executing
"exec cp bin/$binary [run_dir]/genode"
(procedure "copy_and_strip_genode_binaries_to_run_dir" line 4)
invoked from within
"copy_and_strip_genode_binaries_to_run_dir $binaries"
(procedure "run_boot_dir" line 14)
invoked from within
"run_boot_dir $binaries"
(procedure "build_boot_image" line 2)
invoked from within
"build_boot_image [join $boot_modules " "]"
(file "/home/genode/repos/os/run/tz_vmm.run" line 262)
invoked from within
"source $include_name"
("foreach" body line 6)
invoked from within
"foreach include_name [get_cmd_arg --include ""] {
# first check if the include name is absolute
if {[string first "/" $include_name] == 0} {
puts ..."
(file "/home/genode/tool/run/run" line 642)
make: *** [run/tz_vmm] Error 1
Could anyone have an idea how to fix this error?
Thanks,
Abhay
Alexander Boettcher
2016-08-01 12:54:18 UTC
Permalink
Hello,
Post by Abhay Amala
interpreter works fine now but I don't understand what is "*int
_sigaction(int, const sigaction*, sigaction*): _sigaction not implemented*"
message? Does anyone have any idea? Thanks in advance for your answers.
_sigaction not implemented
some code in python _probably_ calls the libc signal() function which
calls in our ported libc _sigaction().

The function is, as written, not implemented - that means everything
which requires signal support in python will not work.

Alex.


------------------------------------------------------------------------------
Stefan Kalkowski
2016-08-01 13:28:21 UTC
Permalink
Post by Alexander Boettcher
Hello,
Post by Abhay Amala
interpreter works fine now but I don't understand what is "*int
_sigaction(int, const sigaction*, sigaction*): _sigaction not implemented*"
message? Does anyone have any idea? Thanks in advance for your answers.
_sigaction not implemented
some code in python _probably_ calls the libc signal() function which
calls in our ported libc _sigaction().
The function is, as written, not implemented - that means everything
which requires signal support in python will not work.
it's much likely that the python interpreter just registers some exit
handlers. So you do not need to worry about it too much.

Regards
Stefan
Post by Alexander Boettcher
Alex.
------------------------------------------------------------------------------
_______________________________________________
genode-main mailing list
https://lists.sourceforge.net/lists/listinfo/genode-main
--
Stefan Kalkowski
Genode Labs

https://github.com/skalk · http://genode.org/

------------------------------------------------------------------------------
Abhay Amala
2016-08-03 09:10:17 UTC
Permalink
Hi Alexander and Stefan,

Thank you for your responses.

I have another issue now. I couldn't import python built-in modules such as
math, time, itertools, etc. I got "*No module named* " ImportError.
However, I need this modules to run my python project. Does anyone have any
idea to fix this issue? I will be grateful for any help you can provide.

Thanks,

On Monday, August 1, 2016, Stefan Kalkowski <
Post by Abhay Amala
Post by Alexander Boettcher
Hello,
Post by Abhay Amala
interpreter works fine now but I don't understand what is "*int
_sigaction(int, const sigaction*, sigaction*): _sigaction not
implemented*"
Post by Alexander Boettcher
Post by Abhay Amala
message? Does anyone have any idea? Thanks in advance for your answers.
_sigaction not implemented
some code in python _probably_ calls the libc signal() function which
calls in our ported libc _sigaction().
The function is, as written, not implemented - that means everything
which requires signal support in python will not work.
it's much likely that the python interpreter just registers some exit
handlers. So you do not need to worry about it too much.
Regards
Stefan
Post by Alexander Boettcher
Alex.
------------------------------------------------------------------------------
Post by Alexander Boettcher
_______________________________________________
genode-main mailing list
https://lists.sourceforge.net/lists/listinfo/genode-main
--
Stefan Kalkowski
Genode Labs
https://github.com/skalk · http://genode.org/
------------------------------------------------------------------------------
_______________________________________________
genode-main mailing list
https://lists.sourceforge.net/lists/listinfo/genode-main
Sebastian Sumpf
2016-08-03 19:14:44 UTC
Permalink
Hey Abhay,
Post by Abhay Amala
Hi Alexander and Stefan,
Thank you for your responses.
I have another issue now. I couldn't import python built-in modules such
as math, time, itertools, etc. I got "*No module named* " ImportError.
However, I need this modules to run my python project. Does anyone have
any idea to fix this issue? I will be grateful for any help you can provide.
I ported the Python interpreter to Genode back in 2010 and omitted any
module support at the time. My line of thinking was, if someone wants to
use Python on Genode, this lack will get noticed. Congratulations you
are the first one! So, basically it should not be that hard to enable
module support. One has to look at the "import" side of Python, which
should somehow provide the "to be interpreted" code to the interpreter,
while also handling the C-code side of some modules. Since our resources
are very limited, I invite you to fill in this gap and will gladly
answer questions if you chose to proceed in this direction.

Cheers,

Sebastian
--
Sebastian Sumpf
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth




------------------------------------------------------------------------------
Abhay Amala
2016-08-11 22:05:00 UTC
Permalink
Hi,

I could manage to enable python modules for my python project. I put the
directory containing the project file (python modules) and the python
standard libraries into a tar archive to be accessed by the tz_vmm (see the
configuration below). The project runs successfully, but I get the
following message when os module is imported. This message is repeated for
each python module imported in the project. Anyone has any idea to fix
this? Thank you in advance for your answers.


[init -> tar_fs] Could not find record for /Lib/os
[init -> tar_fs] Could not find record for /Lib/os.so
[init -> tar_fs] Could not find record for /Lib/osmodule.so
[init -> tar_fs] Could not find record for /Lib/os.pyc
[init -> tar_fs] Could not find record for /Lib/os.pyc
[init -> tz_vmm] plugin()->open("./Lib/os.pyc") failed


Here is the configuration.

<start name="tar_fs">
<resource name="RAM" quantum="50M"/>
<provides> <service name="File_system"/> </provides>
<config>
<archive name="pyproject.tar" />
<policy root="/" />
</config>
</start>

<start name="tz_vmm">
<resource name="RAM" quantum="100M"/>
<config>
<fstab> <tar name="pyproject.tar" /> </fstab>
<libc stdout="/dev/log" stderr="/dev/log" >
<vfs>
<dir name="dev"> <log/> </dir>
<fs/>
</vfs>
</libc>
</config>
</start>


Thanks,

On Wed, Aug 3, 2016 at 9:14 PM, Sebastian Sumpf <
Post by Sebastian Sumpf
Hey Abhay,
Post by Abhay Amala
Hi Alexander and Stefan,
Thank you for your responses.
I have another issue now. I couldn't import python built-in modules such
as math, time, itertools, etc. I got "*No module named* " ImportError.
However, I need this modules to run my python project. Does anyone have
any idea to fix this issue? I will be grateful for any help you can
provide.
I ported the Python interpreter to Genode back in 2010 and omitted any
module support at the time. My line of thinking was, if someone wants to
use Python on Genode, this lack will get noticed. Congratulations you
are the first one! So, basically it should not be that hard to enable
module support. One has to look at the "import" side of Python, which
should somehow provide the "to be interpreted" code to the interpreter,
while also handling the C-code side of some modules. Since our resources
are very limited, I invite you to fill in this gap and will gladly
answer questions if you chose to proceed in this direction.
Cheers,
Sebastian
--
Sebastian Sumpf
Genode Labs
http://www.genode-labs.com · http://genode.org
Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
GeschÀftsfÌhrer: Dr.-Ing. Norman Feske, Christian Helmuth
------------------------------------------------------------
------------------
_______________________________________________
genode-main mailing list
https://lists.sourceforge.net/lists/listinfo/genode-main
Christian Helmuth
2016-08-12 09:49:31 UTC
Permalink
Hello Abhay,
Post by Abhay Amala
I could manage to enable python modules for my python project. I put the
directory containing the project file (python modules) and the python
standard libraries into a tar archive to be accessed by the tz_vmm (see the
configuration below). The project runs successfully, but I get the
following message when os module is imported. This message is repeated for
each python module imported in the project. Anyone has any idea to fix
this? Thank you in advance for your answers.
[init -> tar_fs] Could not find record for /Lib/os
[init -> tar_fs] Could not find record for /Lib/os.so
[init -> tar_fs] Could not find record for /Lib/osmodule.so
[init -> tar_fs] Could not find record for /Lib/os.pyc
[init -> tar_fs] Could not find record for /Lib/os.pyc
[init -> tz_vmm] plugin()->open("./Lib/os.pyc") failed
I suppose you did not archive 'Lib/os.pyc'? What does

tar tf pyproject.tar

look like? If I understand you correctly your program runs anyway, so
it seems the log output is an artifact of heuristics in the Python
implementation looking for modules names 'os'.
Post by Abhay Amala
Here is the configuration.
<start name="tar_fs">
<resource name="RAM" quantum="50M"/>
<provides> <service name="File_system"/> </provides>
<config>
<archive name="pyproject.tar" />
<policy root="/" />
</config>
</start>
<start name="tz_vmm">
<resource name="RAM" quantum="100M"/>
<config>
<fstab> <tar name="pyproject.tar" /> </fstab>
<libc stdout="/dev/log" stderr="/dev/log" >
<vfs>
<dir name="dev"> <log/> </dir>
<fs/>
</vfs>
</libc>
</config>
</start>
Your configuration has parts of both (the old and the new) ways to use
TAR archives in libc programs. I suggest to remove tar_fs and fix the
VFS integration of pyproject.tar like follows

<libc stdout="/dev/log" stderr="/dev/log">
<vfs>
<dir name="dev"> <log/> </dir>
<tar name="pyproject.tar"/>
</vfs>
</libc>

Regards
--
Christian Helmuth
Genode Labs

http://www.genode-labs.com/ · http://genode.org/
https://twitter.com/GenodeLabs · /ˈdʒiː.nəʊd/

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
Loading...