Talk:Porting Python

From OSDev.wiki
Revision as of 23:34, 26 February 2010 by osdev>Pcmattman

Latest comment: 14 years ago by Pcmattman
Jump to navigation Jump to search

Correct me if I'm wrong, but Python 2.5 is way out of date. 2.6, not as much, but still..

--Kotuxguy 06:14, 22 February 2010 (UTC)Reply

This tutorial works for 2.5 and 2.6. It hasn't been tested on 2.7 (as that is still in alpha), and I don't consider 3.0 worth discussing yet. Python 2.5.5 was released on January 31 2010.

If you'd like to contribute a tutorial for Python 3.0 rather than just complaining about nothing, be my guest ;)

--pcmattman 06:48, 22 February 2010 (UTC)Reply

Fair enough. I'll work on it as soon as I get my OS to that stage.

--Kotuxguy 06:25, 23 February 2010 (UTC)Reply

Regarding the stage required for porting Python, in our OS, Python (strictly core python lib only) was the 3rd user mode program ever for our OS, after Hello World and 99 bottles of beer. Required porting newlib, and a way to build statically linked binaries for usermode, basic paging and processes - we did not do complete elf loader but just an easy format based on a custom linker script with all 3 sections at page aligned locations and 4k header. We did not have filesystem support either, only write and exit system calls were fully implemented in newlib. The executable in question originally initialized Python 2.5 interpreter and executed a python "hello world" script that was hardcoded in the executable. When we noticed that we really need filesystem for many modules to work correctly, only then we implemented FAT readonly support for ram disks :)

--Ztane 11:27, 26 February 2010 (UTC)Reply

Sure, it is possible to port Python with a very minimal libc. However, as you found out, without more than just the basic support in your libc you run into a lot of restrictions with Python (specifically, its modules). For example, you can't port modules which use networking until you write a Berkeley sockets layer.

The reason I decided to label this tutorial "Advanced" and imply a requirement of more than just a rudimentary libc is simply because the understanding of the toolchain, configure process, and library calls that comes from more experience with porting and using other software is very, very useful here.

--pcmattman 23:34, 26 February 2010 (UTC)Reply