How does Android-x86 work?

333 views
Skip to first unread message

Machine2A03

unread,
Nov 29, 2017, 3:41:12 PM11/29/17
to Android-x86
     I am a student writing a school project where I have to describe how an individual Linux distribution works. I have chosen to write about Android-x86 because it is a unique distribution and it works very well.

     I am having trouble finding documentation about how Android-x86 7.1rc2 actually works. My basic understanding about what Android-x86 is doing comes from experimentation, reading release notes, google group posts and online articles and examining the init script from debug mode.

     I understand that Android runs on top of the linux kernel, and that in Android-x86 both Android and the kernel have been modified to work better with the x86 architecture. Compatibility for ARM apps is provided by the native bridge.

     In my research about Android, I found this diagram explaining how Android normally works. The kernel handles resource allocation, process management and controls the hardware while Android runs on top, providing libraries, a framework and a runtime for apps. 

Image result

My questions are: 

     How do the modifications made to Android and the kernel by the Android-x86 project relate to this diagram? I understand that some of the kernel drivers have been swapped out for other open source ones, such as ALSA, MESA, drm_gralloc and so on, and that components above the kernel have been patched to work with these changes. How, broadly speaking, would this diagram have to be changed so that it properly described how Android-x86 works?

     How is the linux side of the distribution configured for Android-x86? When I enter debug mode, I see that busybox provides most of the command line utilities. Is service management provided by customized scripts? What is the default partitioning scheme? 

I apologize if anything in my post here demonstrates a lack of understanding about the Android-x86 project, Android or linux in general, as I am new to all of these subjects. If anyone here can help me answer these questions, or point me in the right direction to extra documentation or reading material, that would be very much appreciated.

Thank you!

M2A03

Antony Stone

unread,
Nov 29, 2017, 4:04:16 PM11/29/17
to andro...@googlegroups.com
On Wednesday 29 November 2017 at 21:41:12, Machine2A03 wrote:

> I am a student writing a school project

Just for the avoidance of doubt, what does "school" mean in your geographical
location? I only ask because in England, it means education before going to
university, whereas in America, it seems to mean the part where you are
already at university. I don't know about other English-speaking parts of the
world such as South Africa, Australia, Hong Kong, New Zealand, etc.

> where I have to describe how an individual Linux distribution works. I have
> chosen to write about Android-x86 because it is a unique distribution and it
> works very well.

Are you confident that whoever assesses you work will accept that Android-x86
is a Linux distribution?

Have you discussed this with your supervisor / teacher / whoever is relevant?

I ask simply because I would not consider Android (x86 or otherwise) to be a
"Linux distribution". It is (in my opinion) a very much more specific and
controlled system of software, albeit based on the Linux kernel.

> I am having trouble finding documentation about how Android-x86 7.1rc2
> actually works.

It basically works the same way as every other Android system does, just on
different hardware from most.

> My basic understanding about what Android-x86 is doing comes from
> experimentation, reading release notes, google group posts and online
> articles and examining the init script from debug mode.

Okay, that's good.

> I understand that Android runs on top of the linux kernel,

Right.

> and that in Android-x86 both Android and the kernel have been modified to
> work better with the x86 architecture.

Not so much "modified to work better with" rather than "recompiled to run on".

Android is usually built to run on ARM CPUs, because that's what's in the
majority of phones and tablets.

Android-x86 is the same thing, compiled to run on x86 (Intel, AMD) CPUs and
the other adjustments are for things like the common GPUs you find in PC /
laptop hardware etc.

> Compatibility for ARM apps is provided by the native bridge.

Right.

> In my research about Android, I found this diagram

Unfortunately that did not come through in your post.

> explaining how Android normally works. The kernel handles resource
> allocation, process management and controls the hardware while Android runs
> on top, providing libraries, a framework and a runtime for apps.

Right, some concept, different implementation, as for any Linux distribution.

> My questions are:
>
> How do the modifications made to Android and the kernel by the Android-x86
> project relate to this diagram?

Please re-post, including the diagram (or if necessary, a link to it).

> I understand that some of the kernel drivers have been swapped out for other
> open source ones, such as ALSA, MESA, drm_gralloc and so on, and that
> components above the kernel have been patched to work with these changes.
> How, broadly speaking, would this diagram have to be changed so that it
> properly described how Android-x86 works?
>
> How is the linux side of the distribution configured for Android-x86?

Android-x86 is not (in my opinion) a Linux distribution.

It's Android, recompiled and rebuilt to run on x86 hardware, but it doesn't
try to achieve the same goals as a standard Linux distribution.

> When I enter debug mode, I see that busybox provides most of the command
> line utilities. Is service management provided by customized scripts? What
> is the default partitioning scheme?
>
> I apologize if anything in my post here demonstrates a lack of
> understanding about the Android-x86 project, Android or linux in general,
> as I am new to all of these subjects. If anyone here can help me answer
> these questions, or point me in the right direction to extra documentation
> or reading material, that would be very much appreciated.

I recommend that, if you have not already done so, you discuss this with your
course assessor / supervisor / mentor / whatever is the relevant title, to find
out whether this approach fits with what they are expecting you to do to get a
good grade at the end of the project.

If, once you have done that, they agree that investigating Android-x86 and the
way it operates is a good course to follow, by all means come back and ask
further questions (with diagrams where relevant!).


Regards,


Antony.

--
I own three Windows books, published by O'Reilly. They are "Windows
Annoyances", "Office 97 Annoyances" and "Windows 98 Annoyances". That pretty
much sums it up for me.

Please reply to the list;
please *don't* CC me.

Machine2A03

unread,
Nov 29, 2017, 7:17:24 PM11/29/17
to Android-x86
Thank you for your reply!

I am a student at Algonquin College in Ottawa, Canada. I am in the Computer Systems Technician program, and this project is for the Linux II course. 

Thank you for your clarification about how Android and Android-x86 do not strive achieve the same goals as a linux distribution. 

I spoke to the professor for this course and he advised me that Android-x86 was a challenging subject to use for this project, but that it was an acceptable one. 

The objective of the project is to write a brief document that explains the basics of how a specific linux-based operating system works. I need to provide an overview of the components that make up the operating system, identify how service management and package management are achieved, as well as explain the default partitioning scheme.

In regards to the diagram I mentioned, it can be seen here. It is the first image in the body of the article, and it is a diagram that shows the basic components of the Android operating system. 

If one were to create a similar diagram to describe Android-x86, how would it differ from this one? I like to imagine this diagram with an ARM RISC CPU underneath it and a similar diagram for Android-x86 with an x86 CPU under it.

From what I understand, the Android components have been re-compiled to run on the LTS kernel 4.9.54 for the x86 architecture. This, and additional adjustments, allow it to run on PC hardware.

I see that Android-x86 makes use of other open source software, such as MESA for OpenGL and ALSA for sound. Would it be correct to say that MESA and ALSA are running behind Android and provide it with 3D graphics and audio output capability that is compatible with the x86-compiled kernel that Android-x86 is running on? Does this replace and provide emulation for the original software that would have been running on the ARM-compiled kernel in standard Android?

I have learned in my studies about systemd and SysV. Are these used for service management in Android-x86 or is a custom service management implementation used? What scripts or utilities make sure that necessary services such as networking and display start and stay running?

From what I can tell, on Android-x86, an Android image is mounted and a lot of filesystems are emulated so that Android thinks it is running on a mobile device. My installation of Android-x86 only uses one 16gb disk formatted in ext3, but various other filesystems are mounted once Android is running. I need to better understand Android's default partitioning scheme to be able to tell how Android-x86's is different.

Thank you for taking the time to reply and for pointing me in the right direction to discover how Android-x86 works!

Chih-Wei Huang

unread,
Nov 29, 2017, 10:38:59 PM11/29/17
to Android-x86
2017-11-30 8:17 GMT+08:00 Machine2A03 <aidan....@gmail.com>:
> Thank you for your reply!
>
> I am a student at Algonquin College in Ottawa, Canada. I am in the Computer
> Systems Technician program, and this project is for the Linux II course.
>
> Thank you for your clarification about how Android and Android-x86 do not
> strive achieve the same goals as a linux distribution.
>
> I spoke to the professor for this course and he advised me that Android-x86
> was a challenging subject to use for this project, but that it was an
> acceptable one.

Whether Android (and the derived Android-x86) counts as a Linux
distribution is just a matter of definition.
A general accepted definition is an operating system made from a
software collection, which is based upon the Linux kernel.
Android(-x86) fits the definition well. So it's a Linux distribution
IMO -- a non-GNU distribution.
Refer: https://en.wikipedia.org/wiki/Linux_distribution
Besides, Android-x86 is also listed in DistroWatch.com.

> The objective of the project is to write a brief document that explains the
> basics of how a specific linux-based operating system works. I need to
> provide an overview of the components that make up the operating system,
> identify how service management and package management are achieved, as well
> as explain the default partitioning scheme.
>
> In regards to the diagram I mentioned, it can be seen here. It is the first
> image in the body of the article, and it is a diagram that shows the basic
> components of the Android operating system.
>
> If one were to create a similar diagram to describe Android-x86, how would
> it differ from this one? I like to imagine this diagram with an ARM RISC CPU
> underneath it and a similar diagram for Android-x86 with an x86 CPU under
> it.

Basically speaking, nothing differs specially.

Android-x86 is just a porting of AOSP (Android open source project) to
the x86 platform.
By "porting", we mean to make AOSP run on the target device.
You should understand Google's AOSP doesn't contain hardware related code.
If you build AOSP's default taregt, the image won't run on any
hardware (no matter arm or x86)
except "goldfish", a QEMU based Android emulator.
To make Android run on a real hardware, you need to build a kernel
with appropriate drivers
and related HALs for the target peripherals -- that's what "porting" means.
This is usually done by chip vendors (e.g., Qualcomm, MTK, etc) and it's called
BSP of the target device (https://en.wikipedia.org/wiki/Board_support_package).
In this sense Android-x86 is a BSP of x86 platform.
We play the role of the chip vendor in the open source way.

Saying that, there are certain aspects make Android-x86 differ
than a traditional Android. Unlike a traditional Android image which
can only run on its target device, we made a generic image to run
on almost all x86 devices. To achieve that we modify/implement the
functions:

* Detects peripherals and load correct kernel modules
at runtime. Traditional Android usually doesn't use module
(but since Android 8.0 modules supporting is mandatory)
* Detects peripherals and load appropriate HALs at runtime.

Android-x86 also supports live mode (running on ramdisk)
and different partitioning scheme which are our unique features.

> From what I understand, the Android components have been re-compiled to run
> on the LTS kernel 4.9.54 for the x86 architecture. This, and additional
> adjustments, allow it to run on PC hardware.
>
> I see that Android-x86 makes use of other open source software, such as MESA
> for OpenGL and ALSA for sound. Would it be correct to say that MESA and ALSA
> are running behind Android and provide it with 3D graphics and audio output
> capability that is compatible with the x86-compiled kernel that Android-x86
> is running on? Does this replace and provide emulation for the original
> software that would have been running on the ARM-compiled kernel in standard
> Android?

Not to replace, just implement.
MESA implements the OpenGL ES function required by Android.
As I said, AOSP doesn't contain any code to run on a real GPU.
The BSP provider needs to implement the OpenGL ES drivers and libraries
for the target GPU. That's what we did.
Of course we won't and can't implement it from scratch.
We just re-use the open source project MESA. We ported it to Android.

About ALSA, we didn't really use it except some ALSA tools
to configure the sound cards. It's not really necessary but simpler.

> I have learned in my studies about systemd and SysV. Are these used for
> service management in Android-x86 or is a custom service management
> implementation used? What scripts or utilities make sure that necessary
> services such as networking and display start and stay running?

This part is exactly the same as original Android.

> From what I can tell, on Android-x86, an Android image is mounted and a lot
> of filesystems are emulated so that Android thinks it is running on a mobile
> device. My installation of Android-x86 only uses one 16gb disk formatted in
> ext3, but various other filesystems are mounted once Android is running. I
> need to better understand Android's default partitioning scheme to be able
> to tell how Android-x86's is different.

A traditional Android image usually contains system, data, cache, recovery
and possible more depends on vendor's implementations.
On the other hand Android-x86 can run within a directory of one partition
in different filesystems (ext4/ntfs/vfat).
However, this is just for convenient usage. The users don't need
to re-partition their disk to install Android-x86. Of course
it's possible to run Android-x86 with standard Android partitioning scheme.

> Thank you for taking the time to reply and for pointing me in the right
> direction to discover how Android-x86 works!




--
Chih-Wei
Android-x86 project
http://www.android-x86.org

Machine2A03

unread,
Nov 30, 2017, 11:49:35 AM11/30/17
to Android-x86
Thank you very much for your reply! This has helped me immensely. 
Reply all
Reply to author
Forward
0 new messages