whitenoise

technology notes… mobile and embedded.

Archive for the ‘foss’ Category

An Android 101 : Boot and platform init.

leave a comment »

Over the past few months I have been dabbling with Android  SDK and a some amount  of programming.  Sharing what I learnt .

53731_android_101_training_course_vancouver_255255255 

A Linux system:

Apart from the application framework, much of Android uses concepts from Linux directly. This includes file systems , partitions and init scripts (like the init.d). A typical Android device would have the following partitions :

image

Besides there may be some device specific partitions (/modem etc) that the OEMs may use for their own (non –android ) purpose.

Of these ,the recovery partition is particularly interesting. Normal android boot would start running the image in the  boot partition. However if you power on device in the ‘recovery mode’ , you could get started with an alternate boot image (the recovery image).

It was originally designed for OEMs to provide OTA upgrades. But custom ROM makes have come up with custom recovery images  that could flash other kernel images (like CynogenMod etc). A popular custom recovery image is the ClockworkMod Recovery.

AndroidBootSequence

Bootup:

When a normal boot happens, the Android platform starts executing code in the /boot partition .The bootloader then starts the kernel. The kernel does the basic initialization (of hardware ,memory subsystems) before mounting the root file system ( / ). Once / is mounted the ‘init’ process is started.

init.rc :
Like normal (desktop ) Linux systems ,Android init parses and runs the various commands as mentioned in the init.rc  script. The bulk of Android platform init happens here. The init.rc script mounts various partitions , It then starts  daemons like the adbd, service manager (responsible for IPC ).,rild, netd and others.  Finally the init.rc also invokes app_process which actually results in the process called zygote.

Zygote: Every new app is hosted on a dedicated VM. However each VM is not started afresh (not a cold start).  Zygote takes care of loading all system libraries beforehand . When a new app is started ,zygote forks itself to provide a new VM that has most components preloaded .
There is more detail on this here : http://elinux.org/Android_Zygote_Startup

SystemServer:   Once Zygote is fully launched, we have the VM initialized . The platform then starts the SystemServer.(frameworks/base/services/java/com/android/server/SystemServer.java)

SystemServer is the first Java component to run on the system . This module starts all ‘Android services’  like the PowerManager, ActivityManager etc. Once the SystemService completes, Android’s bootup is considered complete.

The platform sends a standard broadcast action called ‘ACTION_BOOT_COMPLETED ‘. Clients that want to do some action once boot up is complete could register for this module.

In the next post I will share about other components of Android , like its IPC mechanism (Binder)  and shared memory implementations (ASHMEM)

[Image courtesy: http://www.techvibes.com/ , http://hmtsay.blogspot.com/2010/10/android-startup.html ]

Written by sujai

November 7, 2011 at 7:15 pm

A ready reckoner on OpenSource licenses

with 6 comments

This is a very short primer on the various licenses used for open source software.  Its intended as a quick look for those in hurry . For elaborate stuff, refer wikipedia.

Historically, there have been three license types or families :
Academic license (MIT Athena ,Berkley and Apache).
Free software licenses(General Public License and the LGPL).
Mozilla-style licenses(Mozilla and the IBM licenses).

Here are some salient features of each of them.

The Berkley license essentially:
*  Enables the software user to do anything with the software,including extending and selling it.
*  Does not require any derived software be licensed under the same license of that the changes
be published. This enables proprietary products to include such licensed software safely.
*  Requires that attribution be given for the work, and copyrights maintained.
*  Disclaims any warranties (express or otherwise) just as a proprietary EULA does.

Free Software Licenses(GPL and LGPL)
Richard Stallman created the Free Software Foundation and his definition of software freedom ,where a
program source code was always available and a user could always fix and extend t he software without
restriction. The GPL defined this particular sharing foundation.
*  If the user distributes a modified version version of code released under GPL,they can do so ,only by
sharing their changes through the same license (i.e. their changes to GPL code shall be available under GPL).
*  If a user make use of any of the GPL code in her program and distributes the program, the entire program
including its source code becomes subject to GPL. (i.e. users’ application that make use of GPL code should also be
licensed under GPL)
*  The GPL disclaims any warranties just as proprietary EULA’s.

The LGPL:
The LGPL was developed later to account for software libraries.Many developers who shared utility libraries
under GPL did not want to force the user of their libraries to share their ENTIRE source code (as in
the case of GPL),but only the changes that is done to the library.

The Mozilla License:
In the late 1990’s ,Netscape published the source code of their browser and built a community of developers around it.
This project was called Mozilla project and a new license viz. Mozilla Public Licence was created.
*  Derivatives of an original MPL work to be licensed under the MPL similar to the GPL.
*  Enables MPL licensed works to be combined with other software and re-licensed to a “Larger work”. This enables
development of closed proprietary software using MPL softwares (similar to the academic licenses).
*  Discusses patent rights relevant to the licensed work.
*  Disclaims any warranties just as a proprietary EULA does.
There are several derivatives of the MPL that is being used by various companies that wish to develop
collaborative software .

One more term that’s associated with all these licenses is ‘dual licensing’.
Dual licensing:
It is an attribute of the intellectual property law,that the property owner can license their property to
as many people as many times ,and in as many ways as they choose.
This clause allows companies distributing open source software to sell the same software under an OEM license.
Dual licensing helps clients of open source software to embed the code within their works,
without a need to redistribute their works.

Popular OSS that are released under Dual licensing are MySQl from MySQL AB and QT from Trolltech Nokia.

TiVoization and GPLv3: TiVo is a Digital Video Recorder that uses GPL software and the Linux kernel. To comply with GPLv2 conditions, TiVO did release their code . However it was alleged that TiVo prevented modified software from running on their hardware by running only the programs that used valid digital signatures  from the manufacturer.This way,though the code was released, modified software would not run on the hardware.  This behavior was declared as ‘Tivoization’ and one of the goals of GPL Version 3 was  to prevent this .

The OSS community was divided in their support for GPLv3 . Finally some modifications were made to the GPLv3 license so that the anti-tivoization will not be applied when the software is distributed to a business.
Wikipedia has a well written summary on Tivoization and GPLv3 .Have a look for more on this.

Written by sujai

October 8, 2008 at 8:34 am

FOSS.in and the Omelette post

with one comment

FOSS.in is an annual open source event that happens in Bangalore. I’ve not attended the event anytime,but I go through the presentations of the speakers. There were several presentations on many topics like OpenMoko ,OpenSolaris,etc last year which were quite informative.

The event will happen Nov 25-29 this year. The CFP announcement was done quite some back  . Yesterday I received an email on what has  changed and whats the focus. This year’s focus would be ‘Talk is cheap.Show me the Code‘.The bar has been raised now and its more of a ‘developer only’ event .The organizers want to keep the noise low and concentrate on what matters most..RESULTS… Way to go!!

Some thoughts: As the post says, much of it sounds idealistic… I really don’t know if coding workouts could produce ‘results’ as the post suggests.

I may be quite wrong but in my opinion ,summits/conferences are for ideas and not for writing code..not many would come to a   room and start coding…I may not be able to attend the meeting (I don’t want to stand on the way of  smart people).

I wish good luck for FOSS.in to be a grand success.

Here is the original Omelette post: http://foss.in/2008/10/fossin2008-the-omelette-post/

Written by sujai

October 3, 2008 at 10:54 am

Posted in foss

Tagged with , ,

%d bloggers like this: