Where is the baseband firmware stored and how does Android interact with it?


Question

My searches on the web didn't provide suitable answers to these questions:



1) Where is the baseband firmware stored?



My understanding is that this particular firmware is a RTOS built for the Baseband Processor (BP/CP). BP is part of a SoC, so it uses its own RAM and its own storage for the firmware.



Is the firmware really stored in another eMMC than the Android firmware ?



2) How does Android interact with the baseband firmware?



Again, my understanding (which may be incorrect) is that the BP communicates directly with the AP via a serial connection UART trough Radio Interface Layer (RIL). This RIL interact with Android telephony services.



When does the baseband firmware take action ?



3) When the modem/baseband/radio partition is used ?



It seems to me that it only contains the firmware.



One thing I've found is that this partition isn't mounted during Android runtime. Is it only mounted for modem firmware update ?


Answer


Is the firmware really stored in another eMMC than the Android firmware?




No. Baseband firmware, kernel and userspace Android are all stored on the same eMMC (there might be some exception but I don't know of). Some SoCs have boot area partitions which are somewhat isolated at hardware level (usually used for bootloaders) but technically those are also on the same eMMC. So are Replay Protected Memory Block (RPMB) partitions.




How does Android interact with the baseband firmware?




Your understanding is correct that Communication / Baseband Processors (CP/BP or modem) are completely isolated from Application Processor (AP, which runs Android OS) and they run their own RTOS. Communication between AP and BP can be through multiple possible channels but mostly those are proprietary just like BPs themselves (not sure why: if giants like Qualcomm are keeping backdoors, or hiding their security vulnerabilities, or don't want to put users' privacy at stake). On Qualcomm devices, for instance, its in-kernel implementation is called Shared Memory Device/Driver (SMD).



BP also includes a Digital Signal Processor (DSP) which is used for multimedia processing. Both Modem and DSP have their mountable partitions on eMMC (at least on Qualcomm devices) which they access through kernel using RPC mechanism. This old document states:




"No new hardware is required. An eMMC card will have 2 partitions reserved for modem storage.

...

All the modem requests will be handled by a user space program and the remote storage RPC client will provide an interface to the user application to receive the requests from modem and also to send the status of requests to modem."




In-kernel implementation includes just an RPC client, while a closed source userspace daemon (Remote Storage) handles the actual communication with the modem. Though privacy advocates have issues with this approach. Since the kernel interfaces of SMD or other communication drivers are not documented, only the closed source binary blobs (HALs, provided by SoC vendors) in userspace can communicate with them (e.g. rmt_storage uses Userspace I/O API), while Android framework communicates with the HALs. Reference implementations of HALs are part of AOSP.




Is it only mounted for modem firmware update?




No. MODEM is usually first partition on eMMC with FAT filesystem, while DSP has EXT4. Both have entries in fstab and are mounted on every boot. rmt_storage also provides BP access to IMEI which is stored on signed partitions like EFS, MODEMST1, MODEMST2, FSG, FSC along with modem firmware files. All of these partitions have no filesystems but are binary blobs written to raw partitions. So they aren't mounted. All or some of these partitions may get OTA firmware updates from OEM/SoC vendors.



Like rmt_storage, Radio Interface Layer Daemon (rild) is another HAL from vendor which facilitates communication between Android's telephony stack and modem's LTE/3G/2G interface through kernel using control and data transfer protocols like RMNET, QMI etc. Other isolated components including RPM, GPS, Modem Diagnostic Mode and TEE (not sure about SE) also communicate with AP using similar communication channels in kernel (which also include UART) and their respective HALs in userspace. RPM (Resource and Power Management) and TEE (Qualcomm's TtustZone) have also their partitions on eMMC, both contain ELF executable binaries.






RESOURCES:




Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes