Discussion:
Writing my own Free Plain Phone sw distro for GTA02
(too old to reply)
Michael Sokolov
2011-09-17 22:04:45 UTC
Permalink
Hello Openmoko community,

I have just ordered my GTA02 hardware unit from Golden Delicious a few
days ago, and I greatly look forward to receiving it in the next few
weeks (intercontinental shipping and all). But the real purpose of this
introductory post of mine is to announce what I plan to do with it: my
desire is to write my own from-scratch Free Plain Phone software distro
for it. (More specifically, take the existing & working U-Boot and the
Linux kernel with no or just minor changes, but bring up my own userland
from the ground up.) Before anyone tells me that I'm crazy or why in
the world do I wish to do that, let me list my primary motivations:

Motivation 1, which can also be seen as a simplification of the task: I
am quite different from most free-your-phone hackers in that from the
functionality POV, I have absolutely no interest in a "smart" or
"feature" phone. I have no interest in cameras, BT, Wifi, VoIP or
heavy-duty PDA functionality; I don't need my phone to display fancy
color graphics or play music in stereo. Instead what I want is a phone
that I can carry in my pocket with good power management, i.e., use the
absolute minimum power required to stay registered with the cell network
and be ready to receive incoming calls and SMS while everything else is
powered off, I want this phone to ring when someone calls, I want it to
beep when someone sends me an SMS, and I want to be able to pull it out
of my pocket and wake it up to place an outgoing call or send SMS.

In order words, the phone functionality I am after is what people would
call a "dumb" phone, or I prefer to call it a Plain Phone to use a more
neutral / non-derogatory term. Basically the kind of functionality GSM
phones had in the 1990s and early 2000s. (And for me it isn't just the
level of functionality: I'd like to make the user experience as close as
possible to those ancient phones as well.) With my Free Plain Phone SW
distro I would like to take the FreeRunner/GTA02 hardware unit and make
it function as a Plain Phone, recreating that rustic user experience and
level of functionality. I'll keep the Wifi, BT, GPS and G sensor
modules always powered off at the PMIC and basically forget about their
existence, and instead focus on power management, talking to the GSM
modem block and doing the rustic Plain Phone UI.

Seen from this perspective, what most people see as major shortcomings
of the FreeRunner's HW capabilities are actually advantages for me. For
example, I have absolutely no interest in using my phone as a web
browser or doing any other "data as in Internet" activities on my phone.
Don't get me wrong, I like the idea of being able to check my email,
look something up on the web or ssh into my server back at home from the
side of a road in the middle of nowhere. And I do use a mobile device
for those functions - but I use a different mobile device, one with a
full-size screen and a full-size keyboard. That mobile device is called
a laptop - not a phone. What I'm getting at is that I see absolutely no
need for UMTS/3G/4G in a phone: UMTS better belongs in a laptop or a USB
stick plugged into one. Thus to me a phone like GTA02 that supports
only plain GSM and no UMTS is a welcome simplification rather than a
drawback.

At this point one may well ask: "If your needs are so basic, why do you
want a Linux phone at all? Why not just get a 10 y old phone from Ebay
and be happy with it?" Well, I do in fact use such an ancient phone
right now: I've used it to confirm that plain non-UMTS GSM1900 coverage
is still available with good signal strength in all of the local spots I
care about. But here are the reasons why I want to build my own Free
Plain Phone functionality on a HW platform like GTA02 rather than use an
existing one from 10 y ago:

Philosophical motivation: I believe in freedom as a principle, much like
Richard Stallman. Being a basic philosophical principle, freedom is
essentially orthogonal to technological preferences. In my mind the
idea of freeing your phone should not be restricted to just "smart"
phones chock-full of fancy features; "dumb" or plain phones deserve to
be free too!

Learning motivation: that's the biggest one for me. I am a knowledge
freak. I want to know, know, know. Like many people nowadays, I carry
my phone with me everywhere, the only exceptions being places like
showers. It's an electronic device that sits within centimeters of me
all the time. As such, the idea of this device being a closed/proprietary
black box over which I have no control is very bothersome to me. But if
I write my own userland software stack for the GTA02, i.e., implement
100% my own UI, my own version of gsmd talking to the GSM modem, etc, I
can aim for the ultimate understanding of my phone. I can use it exactly
the way I use my current Mot V66 (a classic/ancient Plain Phone, exact
same GSM bands as GTA02), but with an extra twist: every time I press a
button on the screen, every time I make or answer a call, every time I
send and receive an SMS I can say: aha, when the phone rings what
actually happens is that the GSM modem raises this IRQ, the PMIC enables
this and that power domain, the Linux kernel does such and such, my own
code in gsmd does such and such communication with the GSM serial port,
then this process is spawned, and it interacts with my own main UI
daemon in such and such way...

Gaining this level of understanding of the electronic device I virtually
never part with is what I'm really after. For me that includes all
layers of both HW and SW. The main feature of the GTA02 that solidified
my decision to use this HW platform for my Free Plain Phone is the
availability of schematics. I would not be content with just a listing
of major components and links to GPL drivers: I want the schematics!
It is also awesome that the GTA02 schematics are freely downloadable
without having to buy the HW first. I have downloaded the GTA02
schematics, printed them out and carefully pored over every page several
times over long before I gathered the cash to order the actual HW unit
from Golden Delicious. I seek to understand every power domain, every
GPIO, every interface between modules in my Plain Phone. Being able to
inspect the schematics of *any* electronic device before buying it
should be an essential consumer-bill-of-rights type of freedom: inspecting
the actual schematics is the only way for a truly smart user to know for
certain that what he is buying matches what he needs. There are some
other phones out there that claim to come with schematics, but as far as
I could tell it's an only-after-you-buy type of deal. Asking someone to
pony up the cash without letting them see exactly what is offered first
is NOT cool with me.

I realize that I will unfortunately have to treat the Calypso GSM block
as a black box. If I had a spare million dollars laying around, I could
probably find an ex-Openmoko-Inc employee whom I could bribe for an
illegal copy of the 3 missing schematic sheets and of whatever mix of
partial source and linkable binary/object modules I'm guessing they must
have had for the Calypso firmware: still not stellar, but better than
what the community currently possesses, which is a block diagram on
schematic page 14 and a fully-built FW image. But I don't have a spare
$1M laying around, so that is probably not an option. :-(

But even with the GSM modem being a black box sequestered behind a serial
port, I can still have the joy of understanding exactly how the rest of
the hardware in my phone works: the USB port, the battery charger, the
PMIC (or rather the non-GSM PMIC), the audio subsystem... In this way
the GTA02 with only redacted schematics being available to the public is
still an improvement over my current Mot V66 for which I have no hardware
docs of any kind at all.

That brings us to the software part. On the SW side I really do want to
bring up my own userland in a Linux
Radek Polak
2011-09-18 07:47:40 UTC
Permalink
Post by Michael Sokolov
Hello Openmoko community,
I have just ordered my GTA02 hardware unit from Golden Delicious a few
days ago, and I greatly look forward to receiving it in the next few
weeks (intercontinental shipping and all). But the real purpose of this
introductory post of mine is to announce what I plan to do with it: my
desire is to write my own from-scratch Free Plain Phone software distro
for it. (More specifically, take the existing & working U-Boot and the
Linux kernel with no or just minor changes, but bring up my own userland
from the ground up.) Before anyone tells me that I'm crazy or why in
Hi,
you have chosen openmoko very well for your project. Just a few notes that
might be interesting for you:

As for good power management - it's given by HW design and linux kernel. You
can't affect very much from userspace. You can get 4-5 days on one battery
charge, if the phone is in suspend (PMU+RAM+modem is on, rest if off).

Take a look at http://wiki.openmoko.org/wiki/OpenWRT - they have also very
minimal userspace (just few megabytes) and nice kernel-like build system.

Btw why X11 for such project? Wouldnt be framebuffer enough?

Anyway good luck with your project, let us know if you have something working.

Regards

Radek
Denis 'GNUtoo' Carikli
2011-09-18 10:03:08 UTC
Permalink
Post by Michael Sokolov
In order words, the phone functionality I am after is what people would
call a "dumb" phone, or I prefer to call it a Plain Phone to use a more
neutral / non-derogatory term.
feature phone is also non-derogatory and means exacty the same thing
Post by Michael Sokolov
Learning motivation: that's the biggest one for me. I am a knowledge
freak. I want to know, know, know.
check out the wiki, there is explanation on how the hardware works
there...
Post by Michael Sokolov
I realize that I will unfortunately have to treat the Calypso GSM block
as a black box. If I had a spare million dollars laying around, I could
probably find an ex-Openmoko-Inc employee whom I could bribe for an
illegal copy of the 3 missing schematic sheets and of whatever mix of
partial source and linkable binary/object modules I'm guessing they must
have had for the Calypso firmware: still not stellar, but better than
what the community currently possesses, which is a block diagram on
schematic page 14 and a fully-built FW image. But I don't have a spare
$1M laying around, so that is probably not an option. :-(
learn about osmcombb, however it's not a drop-in replacement as it lacks:
*an AT command interpreter part(however they have an abandoned nuttx
port)
*any kind of certification needed for connecting to carrier networks
Post by Michael Sokolov
But even with the GSM modem being a black box sequestered behind a serial
port,
still that's not so bad, the GSM modem doesn't control the CODEC(the
"sound card") nor the GPS.
Post by Michael Sokolov
As a more concrete example, I don't want my UI to use either GTK or Qt,
and in fact I don't want any pre-existing UI code period: I want to
design and implement my own UI 100% myself. My UI design will be rather
monolithic, centering around Plain Phone functionality: making and
receiving plain old voice calls on the GSM network, receiving, replying
to and composing SMS, managing contacts, and that's about it. (*No*
"apps" or the like.) I will implement my Plain Phone UI in plain C
using just libX11, no GTK or Qt, because that's my programming comfort
zone.
too bad because there was already a feature-phone distro called aurora,
but its GUI is in QT(using the framebuffer), but yet very basic.
Post by Michael Sokolov
I also don't like dbus: too modern for my taste. Hence I will need to
implement my own version of gsmd that doesn't depend on dbus or any
other infrastructural backbone of a "modern" Linux distro.
too bad that rules out freesmartphone, which is a great hardware
abstraction layer. if you would use freesmartphone you could have
written the GUI quickely enough to make it a reality.
Post by Michael Sokolov
1. Learn the process for loading new code images into the phone, build a
very basic rootfs image (using the techniques and principles from my
HEClinux-am3517 project) that does nothing other than allow an ssh
root login over the USB port, load it, get it to boot (debug board
with serial console bring-out for the win!) and get the USB login
to work. Try doing it with the battery removed (USB power only) if
possible.
just read the wiki for that.
Post by Michael Sokolov
2. Write the first inklings of the battery charger daemon: minimal power
management code to enable battery charging and control the USB
current draw limiter. Charge the battery and see it boot w/o USB
power.
battery charging is done in the kernel.
Post by Michael Sokolov
3. Write the first minimal gsmd. Have it save incoming SMS in an
"airlog" file with no UI. Try placing an outbound call or sending
an SMS from the command line (from the shell accessed via USB port
login session).
4. Write the bottom layer of my own UI, roughly taking the place of the
X11 window manager. Have the userland display *something* on the LCD.
why not using framebuffer directly?

Denis.
Neil Jerram
2011-09-18 11:04:36 UTC
Permalink
Post by Michael Sokolov
weeks (intercontinental shipping and all). But the real purpose of this
introductory post of mine is to announce what I plan to do with it: my
desire is to write my own from-scratch Free Plain Phone software distro
for it.
That's an interesting post and new project, and I think I understand
your motivation.

On the GSM front, however, you may want to consider the DeforaOS code
at http://www.defora.org/os/project/browse/3343?file=/src. It was also
written from scratch, in C, and to be minimal (compared to something
like FSO or oFono), and I think it may be small enough for you to feel
happy studying it instead of reimplementing it yourself.

Regards,
Neil
Michael Sokolov
2011-09-20 02:27:57 UTC
Permalink
Hello again,

Thanks to everyone who has responded to my introductory post with
helpful tips and suggestions!
Post by Radek Polak
As for good power management - it's given by HW design and linux kernel.
You can't affect very much from userspace.
But doesn't the userspace need to tell the kernel when some things
should be powered up or down? Things like the LCD, the backlight, the
audio codec...
Post by Radek Polak
You can get 4-5 days on one battery charge,
if the phone is in suspend (PMU+RAM+modem is on, rest if off).
That's very good to hear! I was a little afraid of the FreeRunner being
a charge 2-3 times a day type of deal: that's what some sources were
suggesting. Glad to hear that the original Om developers did a good job
building the HW such that it *can* provide "normal phone" battery life,
assuming that of course the software does its part properly as well and
does not needlessly waste power.
Post by Radek Polak
Btw why X11 for such project? Wouldnt be framebuffer enough?
I've been thinking about going the X11 route for two reasons:

* My personal programming comfort zone: I've written X11 apps using just
libX11, and I'm comfortable with it. If I want to put a piece of text
on the screen, I can just ask X11 to do it for me, exactly the same
way as how I do it on the 1980s UNIX workstations which stay back in
my office while I roam around with my FR. :-) If I went the directfb
route, I would have to learn how to use some text/font rendering
library outside of X11. Yes, my project is all about learning, but
I'm interested in more focused learning: I want to learn how to make
my phone place and answer voice calls, not how to use whatever is the
"modern Linux" world's preferred text/font rendering library du jour.

* X11's client/server architecture is generally viewed as a nuisance in
the embedded world, but it might actually help me split my UI code
into more manageable pieces. I tentatively plan on having a main UI
daemon, but some pieces could be split off into separate programs.
For example, upon getting an incoming call (MT = Mobile Terminated in
GSM-speak), I could make my gsmd fork/exec off an mtcall process; the
mtcall binary would then connect to the X11 server and display a
window showing the number and/or contact name of whoever is calling.

All of the above are just my tentative thoughts, I may well end up
choosing a different approach when I actually get into it. I have a
strong dislike for abstract-ware, so I need to hold the hardware in my
hand before my brain can really kick into gear and decide how I should
write the software for it.

I am still waiting for my GTA02 to arrive, and until I get it I am
limited to fairly idle speculation. :-(
Post by Radek Polak
feature phone is also non-derogatory and means exacty the same thing
I don't think it means the same thing though: as I understand it, people
generally use the term "feature" in "feature phone" to refer to
non-basic-telephony features: camera, mobile web browser, integration
with AIM/Yahoo/Facebook/whatever, all that stuff I hate with a passion.

A phone that does voice calls, SMS, and absolutely positively nothing
else would not be a "feature phone" to most people, it would be a
featureless phone. That is what I am after, and that is what I call a
Plain Phone.

Actually, I need to clarify a little: I'm not against the non-telephony
features per se, I just consider them much less important. I can see
how *some* non-telephony features, such as GPS+openstreetmaps for
navigation in a car when I get lost, would be a useful thing to have on
the phone even for me. *After* I put together my "featureless" Free
Plain Phone distro, I may well become interested in making an extended
version of it with some non-telephony features added. But not before:
I want a really good Plain Phone first.

Part of it is just natural resistance: if someone were to constantly
keep forcing some particular type of food down your throat, you'd
naturally develop a hatred for it pretty quickly, even if it's something
you would find tasty under different circumstances. That's how it is
for me with "smart" and "features" phones.

For many years now I have become disgusted with the kind of phones that
are made, sold and bought by the mainstream society nowadays. And it
isn't even the phones themselves, it's where the makers, promoters and
ultimately buyers/users of these phones put their emphasis. Over the
past many years now, every time I've been compelled into shopping for a
new phone (be it a change of carrier, or old phone broke, or whatever),
I've been bombarded by disgust: the phone salespeople keep focusing
their sales pitches on non-telephony features. It seems to me that the
phone industry and its user community have become so obsessed with their
phones doing everything but basic telephony functions, that perhaps if
someone came out with a new cool smartphone that browses the web, goes
to Facebook, does GPS, displays TV and movies, plays MP3s but can't
make a simple voice call, most users would likely never even notice the
last minor omission.

The non-telephony features occupy such a prominent role in the minds of
the designers of today's phones, in their UI design, in their manuals,
in their marketing and in the minds of the intended users, that the
basic Plain Phone features are some little "ugly duckling" tucked away
in the corner. *That* is what I am rebelling against, and that is why
I want a Free Plain Phone distro that would make a phone do voice calls,
SMS, and absolutely positively nothing else: it is my form of expressing
protest against today's dominant smart/feature phone mentality.
Post by Radek Polak
learn about osmcombb,
Googled for it, found the site, read the basics - wow, that is very,
very cool! Awesome in fact! Definitely something to keep an eye on.
Post by Radek Polak
*an AT command interpreter part(however they have an abandoned nuttx
port)
Yes, it clearly is nowhere near ready for production use yet. But it's
still something very much worth keeping an eye on.
Post by Radek Polak
*any kind of certification needed for connecting to carrier networks
How would they enforce that? Just transmit a valid-looking IMEI and
they would never know the difference, right?
Post by Radek Polak
still that's not so bad, the GSM modem doesn't control the CODEC(the
"sound card") nor the GPS.
Yes, having no GPS in the Calypso is a very very good thing. I have a
big problem with RRLP. Of course it is still possible for Calypso to
implement E-OTD - does anyone know if Om's Calypso FW does or not?
If it does, replacing it with a future usable version of OsmocomBB
would be a good project. But that's for the future.
Post by Radek Polak
battery charging is done in the kernel.
Including the intelligent logic to tell the PMIC how much current it
should draw from USB VBUS?

That's all from me for now, gotta wait for the GTA02 hardware unit to
arrive...

MS
Philip Rhoades
2011-09-22 08:30:35 UTC
Permalink
MS,
Post by Michael Sokolov
Hello again,
Thanks to everyone who has responded to my introductory post with
helpful tips and suggestions!
Post by Radek Polak
As for good power management - it's given by HW design and linux kernel.
You can't affect very much from userspace.
But doesn't the userspace need to tell the kernel when some things
should be powered up or down? Things like the LCD, the backlight, the
audio codec...
Post by Radek Polak
You can get 4-5 days on one battery charge,
if the phone is in suspend (PMU+RAM+modem is on, rest if off).
That's very good to hear! I was a little afraid of the FreeRunner being
a charge 2-3 times a day type of deal: that's what some sources were
suggesting. Glad to hear that the original Om developers did a good job
building the HW such that it *can* provide "normal phone" battery life,
assuming that of course the software does its part properly as well and
does not needlessly waste power.
Post by Radek Polak
Btw why X11 for such project? Wouldnt be framebuffer enough?
* My personal programming comfort zone: I've written X11 apps using just
libX11, and I'm comfortable with it. If I want to put a piece of text
on the screen, I can just ask X11 to do it for me, exactly the same
way as how I do it on the 1980s UNIX workstations which stay back in
my office while I roam around with my FR. :-) If I went the
directfb
route, I would have to learn how to use some text/font rendering
library outside of X11. Yes, my project is all about learning, but
I'm interested in more focused learning: I want to learn how to make
my phone place and answer voice calls, not how to use whatever is the
"modern Linux" world's preferred text/font rendering library du jour.
* X11's client/server architecture is generally viewed as a nuisance in
the embedded world, but it might actually help me split my UI code
into more manageable pieces. I tentatively plan on having a main UI
daemon, but some pieces could be split off into separate programs.
For example, upon getting an incoming call (MT = Mobile Terminated in
GSM-speak), I could make my gsmd fork/exec off an mtcall process; the
mtcall binary would then connect to the X11 server and display a
window showing the number and/or contact name of whoever is
calling.
All of the above are just my tentative thoughts, I may well end up
choosing a different approach when I actually get into it. I have a
strong dislike for abstract-ware, so I need to hold the hardware in my
hand before my brain can really kick into gear and decide how I should
write the software for it.
I am still waiting for my GTA02 to arrive, and until I get it I am
limited to fairly idle speculation. :-(
Post by Radek Polak
feature phone is also non-derogatory and means exacty the same thing
I don't think it means the same thing though: as I understand it, people
generally use the term "feature" in "feature phone" to refer to
non-basic-telephony features: camera, mobile web browser, integration
with AIM/Yahoo/Facebook/whatever, all that stuff I hate with a
passion.
A phone that does voice calls, SMS, and absolutely positively nothing
else would not be a "feature phone" to most people, it would be a
featureless phone. That is what I am after, and that is what I call a
Plain Phone.
Actually, I need to clarify a little: I'm not against the
non-telephony
features per se, I just consider them much less important. I can see
how *some* non-telephony features, such as GPS+openstreetmaps for
navigation in a car when I get lost, would be a useful thing to have on
the phone even for me. *After* I put together my "featureless" Free
Plain Phone distro, I may well become interested in making an
extended
version of it with some non-telephony features added. But not
I want a really good Plain Phone first.
Part of it is just natural resistance: if someone were to constantly
keep forcing some particular type of food down your throat, you'd
naturally develop a hatred for it pretty quickly, even if it's
something
you would find tasty under different circumstances. That's how it is
for me with "smart" and "features" phones.
For many years now I have become disgusted with the kind of phones that
are made, sold and bought by the mainstream society nowadays. And it
isn't even the phones themselves, it's where the makers, promoters and
ultimately buyers/users of these phones put their emphasis. Over the
past many years now, every time I've been compelled into shopping for a
new phone (be it a change of carrier, or old phone broke, or
whatever),
I've been bombarded by disgust: the phone salespeople keep focusing
their sales pitches on non-telephony features. It seems to me that the
phone industry and its user community have become so obsessed with their
phones doing everything but basic telephony functions, that perhaps if
someone came out with a new cool smartphone that browses the web, goes
to Facebook, does GPS, displays TV and movies, plays MP3s but can't
make a simple voice call, most users would likely never even notice the
last minor omission.
The non-telephony features occupy such a prominent role in the minds of
the designers of today's phones, in their UI design, in their
manuals,
in their marketing and in the minds of the intended users, that the
basic Plain Phone features are some little "ugly duckling" tucked away
in the corner. *That* is what I am rebelling against, and that is why
I want a Free Plain Phone distro that would make a phone do voice calls,
SMS, and absolutely positively nothing else: it is my form of
expressing
protest against today's dominant smart/feature phone mentality.
Post by Radek Polak
learn about osmcombb,
Googled for it, found the site, read the basics - wow, that is very,
very cool! Awesome in fact! Definitely something to keep an eye on.
Post by Radek Polak
*an AT command interpreter part(however they have an abandoned nuttx
port)
Yes, it clearly is nowhere near ready for production use yet. But it's
still something very much worth keeping an eye on.
Post by Radek Polak
*any kind of certification needed for connecting to carrier networks
How would they enforce that? Just transmit a valid-looking IMEI and
they would never know the difference, right?
Post by Radek Polak
still that's not so bad, the GSM modem doesn't control the CODEC(the
"sound card") nor the GPS.
Yes, having no GPS in the Calypso is a very very good thing. I have a
big problem with RRLP. Of course it is still possible for Calypso to
implement E-OTD - does anyone know if Om's Calypso FW does or not?
If it does, replacing it with a future usable version of OsmocomBB
would be a good project. But that's for the future.
Post by Radek Polak
battery charging is done in the kernel.
Including the intelligent logic to tell the PMIC how much current it
should draw from USB VBUS?
That's all from me for now, gotta wait for the GTA02 hardware unit to
arrive...
I agree with a lot of what you said above! I think another reason to
think about a "plain" phone is that it then should be able to be used
easily with shell scripts to act as a SMS server ie the phone is
connected to a Linux server - either via the USB cable or wifi and
emails that come in via the server can be processed and sent to the
phone which could then do some minimal processing and send the result
out as a text message. I know that Radek is working on something that
might allow this in the future but a "plain" phone might be a better
solution.

Regards,

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW 2001
Australia
E-mail: ***@pricom.com.au
Continue reading on narkive:
Loading...