views:

194

answers:

4

Is it possible for me to write a OS for a mobile phone? How do I go about building it?

+3  A: 

I think it would be difficult on your own, and without detailed information regarding the devices you expect to run it on. But if you still want to try...

Symbian have just open sourced their entire mobile operating system. That might be a good place to start.

UpTheCreek
+2  A: 

Android is also open source, if you're not looking to start from scratch. Otherwise, you'll need to find documentation for your phone's architecture. Do you have a particular phone in mind?

outis
+7  A: 

If you mean from scratch: it would certainly be possible. But it requires a lot of human resources :-). Manufactures of mobile phones often have hundreds of programmers, and yet the SW it often filled with bugs :-).

Simplifying things you could say that there's often two SW modules in a mobile phone:

  • The "UI OS" which handles display, sound and user input.
  • The "Baseband OS" which handles communication towards the mobile network.

The UI OS could be for example Linux or something simpler. A vanilla Linux kernel can easily run on almost any modern mobile phones.

The second part is the baseband OS. This part usually requires real time properties to be able to handle communication with the mobile network as the timing needs to be precise when sending data in specific "time slots".

There's only one catch: you need to find a "open hardware mobile phone" where to put the OS on. Telecom operators often require rigorous security measures on todays phones so it's very hard to program your own OS on a phone out on the market. Also you would need access to the circuit board schematics, chip details and so on, which is not going to happen :-).

One idea could be OpenMoko which is a "open phone project": http://wiki.openmoko.org/wiki/Main_Page or the Google Android project.

Also, the CPU:s used in todays phones, such as TI OMAP, are often available via development boards such as http://www.igep-platform.com/index.php?option=com_content&view=article&id=46&Itemid=55

The down thing here is that the board does not contain a baseband chip to handle communication towards the mobile network.

Edit: About building and running SW for mobile phones. What happens in the startup of a mobile phone depends on the hardware platform obviously but something like this could happen (this is also true for most embedded systems):

  1. ASIC (which contains the CPU) starts up, resets itself and starts executing a so called boot strap (hard coded into the ASIC).
  2. The boot strap tries to set up flash chips connected to the ASIC.
  3. The boot strap loads SW from the flash into the SRAM of the chip (Integrated RAM on the ASIC silicon).
  4. The SW in SRAM sets up the SDRAM (timings et c) and loads the "OS" (or whatever SW you would want) into the SDRAM from the flash.
  5. The SW in SRAM sets the internal instruction pointer in the CPU to the SDRAM and thus the CPU core of the ASIC starts executing in the SDRAM.
  6. The SW in the SDRAM ("The OS") sets up timers, interrupts, memory management or whatever is needed.
  7. The SW could be whatever, an unlimited for loop, a full blown OS, or just a SW pulling some LED's hi or low.

If the ASIC would have a NOR flash it could execute directly without first uploading the SW into the SDRAM.

The OS in the SDRAM could be a vanilla Linux kernel. The only thing the Linux kernel would need is a few information blocks such as memory size, physical location of that memory and so on (one way is using an ATAG list). Of course it would also need to know some of the internals of the ASIC, this would be added to the Linux kernel. But most chips out on the market today exist in the Linux kernel already. Nokia has for example contributed a lot of code to the TI OMAP3430 adaption and this can be seen in the kernel source code itself (arch/ directory or similar). I am not certain which phones from Nokia uses this chip, but it's probably the high-end Linux and Symbian phones.

Giving a more detailed answer than above would require a few pages, so your best bet would be to use the answers you got on SO and try to use it to get more information from elsewhere.

Good luck :-)

Henrik
A: 

Hopefully this is more Phantom and less Phantom Menace (badoom-tish) but this person is writing their own mobile operating system and you might find the website interesting.

Richard