Archive for December, 2004

How to Create a Virtual Floppy Under OSX

Friday, December 31st, 2004

The objective is creating a mountpoint on the system as it were a normal floppy disk, formated with MS-DOS FAT, I use this virtual disks to test my operating system kernel under Bochs.

To start with I create 1.44 Mb file, with .dmg extension

dd if=/dev/zero of=./disk.dmg bs=10 count=147456

After that I attach it to the /dev tree, I do it without assigning a mountpoint, as the disk is not yet formated and would give us an error

hdid disk.dmg -nomount

This will return something like : /dev/disk1 . Now the disk needs to be formated and given a label

diskutil eraseDisk MS-DOS Label disk1

We can now normally mount the /dev/disk1 to the mountpoint we want.

Firefox 1.0 NY Times Ad

Saturday, December 18th, 2004

On the 16th of this month came the so long expected NY Time Mozilla Ad. Yesterday we had a look at it and finally found our names, Pau Oliva Fora, my flatmate and Esteve Espuna, me. And here is the proof, heheh:

Ny times Ad

The Full PDF of the ad.

Ion 3 on MacOsX

Sunday, December 12th, 2004

I finally got the latest version of Ion3 from SVN to work on my XDarwin, to compile it I just downloaded the sources from the ion3 SVN, and executed ./configure with the option, –disable-shared. After configure, the make, here there are a lot of problems with libintl, to solve this problems, everytime there was a linking problem I modified the Makefile and added: -L/sw/lib/ -liconv /sw/lib/libintl.a. To be able to do all this process easily fink has to be installed and all ion3 dependecies, such as lua, have to be properly installed.

Building a Kernel Cross Compiler on MacosX

Sunday, December 12th, 2004

I’ve just configured an enviroment for developing an x86 kernel on MacosX. My enviroment is quite simple at the moment, just a cross compiler and an x86 emulator, in the case Bochs. In this post I’ll cover the process of configuring and building the cross compiler.

As the compiler I’ll be using Gcc, which will be used to target x86 architecture i686, I compile gcc as bootstrap only, as I don’t need to be able to compile any glibc source, kernels are not linked against glibc.

Requirements:
Binutils and gcc are needed, these are the versions I use:
binutils-2.15.92.0.2
gcc-3.4.3

Compiling
First of all I create the directory structure for the cross compiler. I put all the stuff in /home/crossdev/ .
I create /home/crossdev/src/ where I uncompress binutils and gcc. /home/crossdev/i686/ will hold all the binaries.
Untar binutils in /home/crossdev/src/, and enter the new binutils source directory. Create a build-i686 directory and execute the following script:

#!/bin/bash

echo “Configure Binutils for i686 from MacosX”

CROSS_CHOST=”i686-pc-linux-gnu”
MY_CHOST=”powerpc-unknown-linux-gnu”
MY_CFLAGS=”-mcpu=powerpc -mtune=powerpc”
CROSS_INSTALL=”/home/crossdev/i686/”

CFLAGS=”$MY_CFLAGS”
../configure \
    –target=$CROSS_CHOST \
    –host=$MY_CHOST \
    –prefix=$CROSS_INSTALL \
    –enable-shared \
    –enable-64-bit-bfd \

echo “Compile Binutils”

make

echo “Install”

make install

Now do the same with gcc but execute the following script:

#!/bin/bash

echo “Configure GCC for i686 from MacosX”

CROSS_CHOST=”i686-pc-linux-gnu”
MY_CHOST=”powerpc-unknown-linux-gnu”
MY_CFLAGS=”-mcpu=powerpc -mtune=powerpc”
CROSS_INSTALL=”/home/crossdev/i686/”

export PATH=”$PATH:/home/crossdev/i686/bin/”

CFLAGS=”$MY_CFLAGS”
../configure \
    –prefix=$CROSS_INSTALL \
    –host=$MY_CHOST \
    –target=$CROSS_CHOST \
    –with-newlib \
    –disable-shared \
    –disable-threads \
    –enable-languages=”c” \
    –disable-multilib \
    –disable-nls \
    –enable-symvers=gnu \
    –enable-__cxa_atexit \
    –with-headers=/home/crossdev/i686/include \
    –enable-static

echo “Compile Gcc”
make

echo “Install”

make install

Now we have a kernel cross compiler, we can compile x86-i686 kernel on MacosX. If we add /home/crossdev/i686/bin to our path, it will be easier to use it as to cross compile we just need to call i686-pc-linux-gnu-*** where *** is gcc, ld or any other of the usual gnu tools.