Cleese and a New Toolchain
Back in July 2003, I had an idea to "make the Python intepreter a micro-kernel and boot directly to the Python prompt". Thus started Cleese, which I worked on with Dave Long. We made a good deal of progress and I learned a tremendous amount.
In February 2007, I moved Cleese from SourceForge to Google Code Project Hosting in the hope of restarting work on it. In between 2003 and 2007 I'd become a switcher and so I needed to work out how to do on OS X what I'd been doing with a very strange hybrid of Windows command line and Cygwin before. Alas I never got around to that part.
Then about a week ago, inspired by Brian Rosner's interest in the project, I decided to give it another go. I also decided to use it as an opportunity to finally learn Git.
First goal: build a "hello world" kernel (no Python yet). Fortunately I had one from the initial stages of Cleese 2003, but it wouldn't build. In particular ld was barfing on the -T option used to specify a linking script (which OS X's ld doesn't support).
After asking some questions on the #osdev channel on freenode, I discovered I'd need a completely new gcc and binutils toolchain to support i386-elf. This didn't turn out to be difficult at all, though.
Here were my steps:
export PREFIX=/Users/jtauber/Projects/cleese/toolchain export TARGET=i386-elf
cd ~/Projects/cleese curl -O http://ftp.gnu.org/gnu/binutils/binutils-2.19.tar.gz mkdir toolchain tar xvzf binutils-2.19.tar.gz cd binutils-2.19 ./configure --prefix=$PREFIX --target=$TARGET --disable-nls make make install cd .. curl -O http://ftp.gnu.org/gnu/gcc/gcc-4.2.4/gcc-core-4.2.4.tar.bz2 bunzip2 gcc-core-4.2.4.tar.bz2 tar xvf gcc-core-4.2.4.tar cd gcc-4.2.4 ./configure --prefix=$PREFIX --target=$TARGET --disable-nls --enable-languages=c --without-headers make all-gcc make install-gcc
Now my "hello world" kernel builds. Next goal...working out how to programmatically build disk images for VMware Fusion (or, failing that, Qemu)
Comments (3)
Eric Florenzano on Nov. 3, 2008:
Wow, this is a really interesting project. I remember you mentioning it at PyCon 2007 but didn't get a chance to look at the code at that time. It seems way over my head, which is incentive enough to dive head-first into it to figure it all out. What are the potential benefits of this, besides the academic benefit of learning more about operating systems? Python running in an embedded x86-derivative microcontroller? Very cool, if so.
Tony Arkles on Nov. 3, 2008:
I made a "class project" kernel a year or two at school using Qemu.
I'm not sure about VMware, but with Qemu, to simplify our development (i.e. to not code a filesystem right away), we used a floppy disk image built as part of our "make" process. It's a super simple way to do it, since you can bootstrap using BIOS calls (and can access the entire disk image)
Last Modified: Nov. 3, 2008
Author: James Tauber
greg.newman on Nov. 3, 2008:
I was talking with Brian the other night and he was telling me about cleese. To me, this is fascinating. I don't know much about OS programming but am anxious to follow along and give it a try in VMware when you guys make more progress.