Mobile/Android devices architecture

Search This thread

plus_rlus

Member
Aug 13, 2022
5
1
I'm having trouble understanding the architecture of mobile (and Android) devices. I compare it a lot to the design of PCs, laptops, etc, which I know quite well.

Here's my understanding on how PCs work when booting:
The hardware has firmware stored in ROM (Read Only Memory). Actually, Flash memory is used nowadays, on which the stored content can of course be changed, unlike real ROM memories in the old days. Because the firmware is hardware-specific and its operation is very critical, its content is rarely updated or otherwise changed. Installing new firmware is called flashing. Firmware in a PC is most commonly BIOS or UEFI, the task of which is (briefly) to first run the POST tests, provide some interfaces and finally start the software in the mass storage. By mass storage, I mean memory separate from the firmware's Flash memory, which can also be Flash memory, such as an SSD disk, or a more traditional hard disk.​
The BIOS (i.e. firmware) in the specified order (which first is the internal NVMe SSD or the external USB hard disk?) tries to load the software into the RAM memory for execution from mass storage MBR (Master Boot Record) part . Master boot record is a physical defined area in mass storage. Bootloader software is stored on this MBR part.​
When the bootloader (located on the MBR part) is loaded into RAM and run, it knows the contents of the end of the disk and starts the kernel from there.​
The kernel starts (in Linux) the init process, nowadays often Systemd, which starts the rest of the software.​
--------------------

What kind of memories and storages are most commonly found in Android devices? One main memory (i.e. RAM)? One Flash memory for firmware (i.e ROM)? Another separate flash drive that acts as mass storage? Possibly SD card and USB stick as external mass storage?

What is firmware on Android devices?

What is the bootloader in (located in MBR part) on Android?

Linux is the kernel used by Android, which is started by the bootloader? After that, Android continues to boot, how?

A pile of terms, which I have ambiguities:
  • Bootloader; What's it like on Android? It is often characterized as hardware specific. So is it the case that the bootloader in Android is firmware? So in Android, the firmware runs the tasks of the PC world BIOS and bootloader (located in the MBR part), and then starts the Android located on the mass storage?
  • Recovery; What is this technically?
  • Android ROM; I can't understand this. As far as I know, Android is an operating system located mass storage, not Read-Only-Memory firmware.
  • Rooting; On a PC, we are used to the fact that the owner of the device has root rights. Is it just that the manufacturers have decided to set the default root password to some generated random string, and by default, the user only has access to the basic user account?

After the above has been answered, I would like someone to explain to me (separately) technically, starting from the hardware level (where and how), how do Android devices booting and work? Links to additional information are also welcome. hank you very much! If anyone can answer my questions, thank you very much!
 

plus_rlus

Member
Aug 13, 2022
5
1
Your questions should put you to shame.
Start reading yourself, building up your knowledge as you read.
Anyway, welcome to the forum. After a year of reading, you will laugh at your post.
I know my questions are stupid, but I'm impasse. It seems that there is much less information about designing for mobile devices than PCs. Could you link some articles on this? As the last article I read this, but it didn't help much, because I compare too much what I learned on PCs.
 
  • Haha
Reactions: ipdev

plus_rlus

Member
Aug 13, 2022
5
1
There are no stupid questions, there are only stupid answers.

Start with the basics based on information from google:

That is useful, but there is a reason why I asked about mobile/Android device design/architecture. Android itself is as far as I know (if I'm not mistaken) just an operating system, like the desktop operating systems Windows and Ubuntu, but mobile/Android devices are very different from PCs in terms of hardware and firmware. For example: https://www.quora.com/Is-there-anything-like-BIOS-in-mobiles-How-do-they-boot
 

blackhawk

Senior Member
Jun 23, 2020
10,377
4,129
Samsung Galaxy Note 10+
How long is a huge ball of string?
No simple answer...
This is for those who are new to Android development and basically have NO understanding about the partition structure. I will give a high-level introductory explanation. PC GNU/Linux users: please note this is completely different from x86 (PC Linux) partition table. You will not come across partitions denoted as sda1, sda2, sdb1, sdb2, and so on. Instead, it will be structured as follows:

/boot

This is the partition that has all the data that is necessary for the phone to boot. It includes the kernel and the RAMDISK (these are the only components of the operating system that are stored in this partition. The remaining are stored in /System). Without this partition, the device will simply not be able to boot. Wiping this partition from recovery should only be done if absolutely required and once done, the device must NOT be rebooted before installing a new one, which can be done by installing a ROM that includes a /boot partition.

/system

This partition basically contains the entire operating system, except the kernel and the RAMDISK (as mentioned in /boot explanation). This includes the Android User Interface as well as all the system applications that come pre-installed on the device. Wiping this partition will remove Android from the device without rendering it unbootable, but you will still be able to boot into the /recovery partition to install a new ROM.

/recovery

The recovery partition can be considered as an alternative boot partition that lets you boot the device into a recovery console for performing advanced recovery and maintenance operations on it. Think of this like a proprietary recovery partition that PC companies put on prebuilt PCs. When you flash a custom recovery such as TWRP or CWM, you are overwriting this partition.

/data

Also called userdata, the data partition contains the user’s data – this is where your contacts, messages, settings and apps that you have installed go. Wiping this partition essentially performs a factory reset on your device, restoring it to the way it was when you first booted it, or the way it was after the last official or custom ROM installation. When you perform a wipe data/factory reset from recovery, it is this partition that you are wiping.

/cache

This is the partition where Android stores frequently accessed data and app components. Wiping the cache doesn’t effect your personal data but simply gets rid of the existing data there, which gets automatically rebuilt as you continue using the device.

/misc

This partition contains miscellaneous system settings in form of on/off switches. These settings may include CID (Carrier or Region ID), USB configuration and certain hardware settings etc. This is an important partition and if it is corrupt or missing, several of the device’s features will will not function normally.

/sdcard

This is not a partition on the internal memory of the device but rather the SD card. In terms of usage, this is your storage space to store your media, documents, downloads, pictures, videos, ROMs etc. on it. It is like the equivalent of the ' Users/[Username] ' folder in Windows and ' /home/~ ' folder in x86 Linux. Wiping it is perfectly safe as long as you backup all the data you require from it, to your computer first. Though several user-installed apps save their data and settings on the SD card and wiping this partition will make you lose all that data.

On devices with both an internal and an external SD card – devices like the Samsung Galaxy S and several tablets – the /sdcard partition is always used to refer to the internal SD card. For the external SD card – if present – an alternative partition is used, which differs from device to device. In case of Samsung Galaxy S series devices, it is /sdcard/sd while in many other devices, it is /sdcard2. Unlike /sdcard, no system or app data whatsoever is stored automatically on this external SD card and everything present on it has been added there by the user. You can safely wipe it after backing up any data from it that you need to save.

/sd-ext

This is not a standard Android partition, but has become popular in the custom ROM scene. It is basically an additional partition on your SD card that acts as the /data partition when used with certain ROMs that have special features called APP2SD+ or data2ext enabled. It is especially useful on devices with little internal memory allotted to the /data partition. Thus, users who want to install more programs than the internal memory allows can make this partition and use it with a custom ROM that supports this feature, to get additional storage for installing their apps. Wiping this partition is essentially the same as wiping the /data partition – you lose your contacts, SMS, market apps and settings.

/Boot (Is NOT viewable in Android)
/Recovery (Is NOT viewable in Android)
/Data (Userdata) (Is viewable in Android)
/Cache (Is viewable in Android)
/System (Is viewable in Android)
/Misc (Is NOT viewable in Android)

Ram
https://developer.android.com/topic/performance/memory-management

Understanding Firmware naming:
N986USQU1ATGM
N=Note
986U or F etc, the model of device
SQ, FX etc = CPU and model specific
U,S,E = Update, Security, Engineering, respectively
1,2,3,4,5 etc = bootloader revision (This is important! You cannot go to a previous revision)
A,B,C,D = Android version
T, U = Year (T=2020, U=2021 etc)
A,B,C etc = month (January A - December L)
1 - 9 and then A - Z =build compilation. This basically means how many builds there are in a month. They start at 1 and go to Z
So N986USQU1ATGM would be
N968-U-SQ-U-1-A-T-G-M
N968U (Note 20 Ultra Carrier version), SQ (Snapdragon), U (Update), 1 (Bootloader version), A (Build 10), T (2020), G (July), M (22nd build)

How to enter Download Mode:
Turn off the device.
Connect USB cable to your PC (Leave it disconnected from the phone)
Press and hold down the Volume Up and Volume Down buttons. While they are still pressed, plug in the USB cable into your phone.
The phone will go into download mode press volume up. In Odin you will see that phone is added.

Dirty Flash:
I would only do this if you are having to manually update to the newer firmware and would not do it if you are coming/going to U/U1 or from beta firmware or if you are on an old firmware. I'd also highly recommend doing a back up prior to the doing this
Load these into Odin
BL
AP
CP
HOME_CSC
Do NOT flash CSC or USERDATA, either of these WILL wipe your device
This is a "dirty flash" and these can sometimes cause issues. Keep in mind if things start going sideways and stuff starts not working right, your first step to a solution will be to wipe the device.

Tips on flashing U1 Firmware:
You will have to wipe, can NOT dirty Flash going between U and U1 firmware
Use the patched ODIN linked in post #2 or #3, Odin3_v3.13.3b (They are exactly the same)
Have an active US Carrier SIM installed to get carrier features


If you get your CSC Stuck on XAA/XAA/(Insert your carrier here), and can not get Carrier options back.

PIT files
https://ihax.io/samsung-pit-files-explained
 
  • Like
Reactions: ipdev

ipdev

Recognized Contributor
Feb 14, 2016
1,916
1
3,507
Google Nexus 10
Nexus 7 (2013)
I know my questions are stupid, but I'm impasse. It seems that there is much less information about designing for mobile devices than PCs. Could you link some articles on this? As the last article I read this, but it didn't help much, because I compare too much what I learned on PCs.
The are no stupid questions.

Questions are asked when we do not understand something and want to learn.

There is nothing wrong or negative about asking questions.
Questions are a part of how we learn. 🙃

Cheers. :cowboy:
 
  • Like
Reactions: blackhawk

ipdev

Recognized Contributor
Feb 14, 2016
1,916
1
3,507
Google Nexus 10
Nexus 7 (2013)
<SNIP>
What kind of memories and storages are most commonly found in Android devices? One main memory (i.e. RAM)? One Flash memory for firmware (i.e ROM)? Another separate flash drive that acts as mass storage? Possibly SD card and USB stick as external mass storage?

What is firmware on Android devices?

What is the bootloader in (located in MBR part) on Android?

Linux is the kernel used by Android, which is started by the bootloader? After that, Android continues to boot, how?

A pile of terms, which I have ambiguities:
  • Bootloader; What's it like on Android? It is often characterized as hardware specific. So is it the case that the bootloader in Android is firmware? So in Android, the firmware runs the tasks of the PC world BIOS and bootloader (located in the MBR part), and then starts the Android located on the mass storage?
  • Recovery; What is this technically?
  • Android ROM; I can't understand this. As far as I know, Android is an operating system located mass storage, not Read-Only-Memory firmware.
  • Rooting; On a PC, we are used to the fact that the owner of the device has root rights. Is it just that the manufacturers have decided to set the default root password to some generated random string, and by default, the user only has access to the basic user account?

After the above has been answered, I would like someone to explain to me (separately) technically, starting from the hardware level (where and how), how do Android devices booting and work? Links to additional information are also welcome. hank you very much! If anyone can answer my questions, thank you very much!

Firmware is the hardware specific drivers, library files and other resources that are supplied by the manufacture(s) and are chipset specific.
The firmware is proprietary and normally closed source. Basically the parts that make the hardware work. 🙃

The bootloader is what actually boots the device.
This is supplied by the device manufacture(s) and is device specific.
It is separate from the system.​

Recovery is a mini Android environment.
- Factory (Stock) recoveries are restricted to the user but have unrestricted (root) access to the device.
- Custom recoveries (TWRP, OrangeFox, ..) allow the user unrestricted (root) access to the device.

Android ROM (rom) is the actual system (OS) and normally you would include the version that you are running.
Stock roms - Google 12L, AOSP xx, OOS 12, MIUI xx, ColorOS xx, ...
Custom roms - Lineage 19.1, crDroid 12.1, AospExtended 12.1, ...
In computer terms it would be..
Windows 7, Linux (Fedora 34), MacOS Monterey.​
I am not sure what the current versions of MIUI and ColorOS are, hence the xx.​

Once the bootloader boots the device, a few things can happen.
- The system boot image (system kernel) takes over and boots the device into system (rom).
- The recovery boot image (recovery kernel) takes over and boots the device into recovery (mini Android environment).
- If system fails to boot, device reboots into recovery (Recovery Party) if recovery can boot.
- If no boot image takes over, you will stay in the bootloader, reboot into some special mode or just a good old fashion boot-loop.

There have been a lot of changes to Android though the years..
Each device, manufacture, Android version.. can be different from another.

The most common bootloader is (or supports) fastboot but, this is manufacture and device specific.
Not to be confused with fastboot_d (new story that started with Android 10/11?).​
This has also changed though the years, some manufacture use their own variation of bootloader.
HTC had H-BOOT, Samsung does their own thing along with some other manufactures.


Rooting....

By default the substitute (switch) user su command is removed from Android.
This is what most refer to as superuser since it defaults to root user if you do not specify a substitute user.​

This has been a long and changing story in the Android world also. 🙃

Old but, well worth the read.
How-To SU - [chainfire.eu] - Link

The current most popular used root solution is Magisk.
It is a little more than just su. 🙃
Magisk - [GitHub] - Link

---

It might be easier if you see an actual partition table.
Nexus 7 16 Gig WiFi - [PastBin] - Link
Might as well make it an ... interesting one.
In this example, userdata only has 1.2 Gigs since the rest is used by other partitions.
userdata is mounted as /sdcard.​

Save for boot, cache, system, misc, recovery and userdata.
The other partitions would be considered firmware.

When the device boots, the partitions get mounted to /dev/block.

Hope it helps more than confuse. 🙃

Cheers. :cowboy:
 
Last edited:
  • Like
Reactions: blackhawk

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Your questions should put you to shame.
    Start reading yourself, building up your knowledge as you read.
    Anyway, welcome to the forum. After a year of reading, you will laugh at your post.
    I know my questions are stupid, but I'm impasse. It seems that there is much less information about designing for mobile devices than PCs. Could you link some articles on this? As the last article I read this, but it didn't help much, because I compare too much what I learned on PCs.
    1
    There are no stupid questions, there are only stupid answers.

    Start with the basics based on information from google:

    1
    How long is a huge ball of string?
    No simple answer...
    This is for those who are new to Android development and basically have NO understanding about the partition structure. I will give a high-level introductory explanation. PC GNU/Linux users: please note this is completely different from x86 (PC Linux) partition table. You will not come across partitions denoted as sda1, sda2, sdb1, sdb2, and so on. Instead, it will be structured as follows:

    /boot

    This is the partition that has all the data that is necessary for the phone to boot. It includes the kernel and the RAMDISK (these are the only components of the operating system that are stored in this partition. The remaining are stored in /System). Without this partition, the device will simply not be able to boot. Wiping this partition from recovery should only be done if absolutely required and once done, the device must NOT be rebooted before installing a new one, which can be done by installing a ROM that includes a /boot partition.

    /system

    This partition basically contains the entire operating system, except the kernel and the RAMDISK (as mentioned in /boot explanation). This includes the Android User Interface as well as all the system applications that come pre-installed on the device. Wiping this partition will remove Android from the device without rendering it unbootable, but you will still be able to boot into the /recovery partition to install a new ROM.

    /recovery

    The recovery partition can be considered as an alternative boot partition that lets you boot the device into a recovery console for performing advanced recovery and maintenance operations on it. Think of this like a proprietary recovery partition that PC companies put on prebuilt PCs. When you flash a custom recovery such as TWRP or CWM, you are overwriting this partition.

    /data

    Also called userdata, the data partition contains the user’s data – this is where your contacts, messages, settings and apps that you have installed go. Wiping this partition essentially performs a factory reset on your device, restoring it to the way it was when you first booted it, or the way it was after the last official or custom ROM installation. When you perform a wipe data/factory reset from recovery, it is this partition that you are wiping.

    /cache

    This is the partition where Android stores frequently accessed data and app components. Wiping the cache doesn’t effect your personal data but simply gets rid of the existing data there, which gets automatically rebuilt as you continue using the device.

    /misc

    This partition contains miscellaneous system settings in form of on/off switches. These settings may include CID (Carrier or Region ID), USB configuration and certain hardware settings etc. This is an important partition and if it is corrupt or missing, several of the device’s features will will not function normally.

    /sdcard

    This is not a partition on the internal memory of the device but rather the SD card. In terms of usage, this is your storage space to store your media, documents, downloads, pictures, videos, ROMs etc. on it. It is like the equivalent of the ' Users/[Username] ' folder in Windows and ' /home/~ ' folder in x86 Linux. Wiping it is perfectly safe as long as you backup all the data you require from it, to your computer first. Though several user-installed apps save their data and settings on the SD card and wiping this partition will make you lose all that data.

    On devices with both an internal and an external SD card – devices like the Samsung Galaxy S and several tablets – the /sdcard partition is always used to refer to the internal SD card. For the external SD card – if present – an alternative partition is used, which differs from device to device. In case of Samsung Galaxy S series devices, it is /sdcard/sd while in many other devices, it is /sdcard2. Unlike /sdcard, no system or app data whatsoever is stored automatically on this external SD card and everything present on it has been added there by the user. You can safely wipe it after backing up any data from it that you need to save.

    /sd-ext

    This is not a standard Android partition, but has become popular in the custom ROM scene. It is basically an additional partition on your SD card that acts as the /data partition when used with certain ROMs that have special features called APP2SD+ or data2ext enabled. It is especially useful on devices with little internal memory allotted to the /data partition. Thus, users who want to install more programs than the internal memory allows can make this partition and use it with a custom ROM that supports this feature, to get additional storage for installing their apps. Wiping this partition is essentially the same as wiping the /data partition – you lose your contacts, SMS, market apps and settings.

    /Boot (Is NOT viewable in Android)
    /Recovery (Is NOT viewable in Android)
    /Data (Userdata) (Is viewable in Android)
    /Cache (Is viewable in Android)
    /System (Is viewable in Android)
    /Misc (Is NOT viewable in Android)

    Ram
    https://developer.android.com/topic/performance/memory-management

    Understanding Firmware naming:
    N986USQU1ATGM
    N=Note
    986U or F etc, the model of device
    SQ, FX etc = CPU and model specific
    U,S,E = Update, Security, Engineering, respectively
    1,2,3,4,5 etc = bootloader revision (This is important! You cannot go to a previous revision)
    A,B,C,D = Android version
    T, U = Year (T=2020, U=2021 etc)
    A,B,C etc = month (January A - December L)
    1 - 9 and then A - Z =build compilation. This basically means how many builds there are in a month. They start at 1 and go to Z
    So N986USQU1ATGM would be
    N968-U-SQ-U-1-A-T-G-M
    N968U (Note 20 Ultra Carrier version), SQ (Snapdragon), U (Update), 1 (Bootloader version), A (Build 10), T (2020), G (July), M (22nd build)

    How to enter Download Mode:
    Turn off the device.
    Connect USB cable to your PC (Leave it disconnected from the phone)
    Press and hold down the Volume Up and Volume Down buttons. While they are still pressed, plug in the USB cable into your phone.
    The phone will go into download mode press volume up. In Odin you will see that phone is added.

    Dirty Flash:
    I would only do this if you are having to manually update to the newer firmware and would not do it if you are coming/going to U/U1 or from beta firmware or if you are on an old firmware. I'd also highly recommend doing a back up prior to the doing this
    Load these into Odin
    BL
    AP
    CP
    HOME_CSC
    Do NOT flash CSC or USERDATA, either of these WILL wipe your device
    This is a "dirty flash" and these can sometimes cause issues. Keep in mind if things start going sideways and stuff starts not working right, your first step to a solution will be to wipe the device.

    Tips on flashing U1 Firmware:
    You will have to wipe, can NOT dirty Flash going between U and U1 firmware
    Use the patched ODIN linked in post #2 or #3, Odin3_v3.13.3b (They are exactly the same)
    Have an active US Carrier SIM installed to get carrier features


    If you get your CSC Stuck on XAA/XAA/(Insert your carrier here), and can not get Carrier options back.

    PIT files
    https://ihax.io/samsung-pit-files-explained
    1
    I know my questions are stupid, but I'm impasse. It seems that there is much less information about designing for mobile devices than PCs. Could you link some articles on this? As the last article I read this, but it didn't help much, because I compare too much what I learned on PCs.
    The are no stupid questions.

    Questions are asked when we do not understand something and want to learn.

    There is nothing wrong or negative about asking questions.
    Questions are a part of how we learn. 🙃

    Cheers. :cowboy:
    1
    <SNIP>
    What kind of memories and storages are most commonly found in Android devices? One main memory (i.e. RAM)? One Flash memory for firmware (i.e ROM)? Another separate flash drive that acts as mass storage? Possibly SD card and USB stick as external mass storage?

    What is firmware on Android devices?

    What is the bootloader in (located in MBR part) on Android?

    Linux is the kernel used by Android, which is started by the bootloader? After that, Android continues to boot, how?

    A pile of terms, which I have ambiguities:
    • Bootloader; What's it like on Android? It is often characterized as hardware specific. So is it the case that the bootloader in Android is firmware? So in Android, the firmware runs the tasks of the PC world BIOS and bootloader (located in the MBR part), and then starts the Android located on the mass storage?
    • Recovery; What is this technically?
    • Android ROM; I can't understand this. As far as I know, Android is an operating system located mass storage, not Read-Only-Memory firmware.
    • Rooting; On a PC, we are used to the fact that the owner of the device has root rights. Is it just that the manufacturers have decided to set the default root password to some generated random string, and by default, the user only has access to the basic user account?

    After the above has been answered, I would like someone to explain to me (separately) technically, starting from the hardware level (where and how), how do Android devices booting and work? Links to additional information are also welcome. hank you very much! If anyone can answer my questions, thank you very much!

    Firmware is the hardware specific drivers, library files and other resources that are supplied by the manufacture(s) and are chipset specific.
    The firmware is proprietary and normally closed source. Basically the parts that make the hardware work. 🙃

    The bootloader is what actually boots the device.
    This is supplied by the device manufacture(s) and is device specific.
    It is separate from the system.​

    Recovery is a mini Android environment.
    - Factory (Stock) recoveries are restricted to the user but have unrestricted (root) access to the device.
    - Custom recoveries (TWRP, OrangeFox, ..) allow the user unrestricted (root) access to the device.

    Android ROM (rom) is the actual system (OS) and normally you would include the version that you are running.
    Stock roms - Google 12L, AOSP xx, OOS 12, MIUI xx, ColorOS xx, ...
    Custom roms - Lineage 19.1, crDroid 12.1, AospExtended 12.1, ...
    In computer terms it would be..
    Windows 7, Linux (Fedora 34), MacOS Monterey.​
    I am not sure what the current versions of MIUI and ColorOS are, hence the xx.​

    Once the bootloader boots the device, a few things can happen.
    - The system boot image (system kernel) takes over and boots the device into system (rom).
    - The recovery boot image (recovery kernel) takes over and boots the device into recovery (mini Android environment).
    - If system fails to boot, device reboots into recovery (Recovery Party) if recovery can boot.
    - If no boot image takes over, you will stay in the bootloader, reboot into some special mode or just a good old fashion boot-loop.

    There have been a lot of changes to Android though the years..
    Each device, manufacture, Android version.. can be different from another.

    The most common bootloader is (or supports) fastboot but, this is manufacture and device specific.
    Not to be confused with fastboot_d (new story that started with Android 10/11?).​
    This has also changed though the years, some manufacture use their own variation of bootloader.
    HTC had H-BOOT, Samsung does their own thing along with some other manufactures.


    Rooting....

    By default the substitute (switch) user su command is removed from Android.
    This is what most refer to as superuser since it defaults to root user if you do not specify a substitute user.​

    This has been a long and changing story in the Android world also. 🙃

    Old but, well worth the read.
    How-To SU - [chainfire.eu] - Link

    The current most popular used root solution is Magisk.
    It is a little more than just su. 🙃
    Magisk - [GitHub] - Link

    ---

    It might be easier if you see an actual partition table.
    Nexus 7 16 Gig WiFi - [PastBin] - Link
    Might as well make it an ... interesting one.
    In this example, userdata only has 1.2 Gigs since the rest is used by other partitions.
    userdata is mounted as /sdcard.​

    Save for boot, cache, system, misc, recovery and userdata.
    The other partitions would be considered firmware.

    When the device boots, the partitions get mounted to /dev/block.

    Hope it helps more than confuse. 🙃

    Cheers. :cowboy: