Is it Possible to Create an Operating System for Android Devices?


Question

Is it possible to run an operating system other than Android on Android devices? I know that the bootloader is hard-coded into the firmware and even if you tried you can't change what it does but what about from that bootloader you use the kernel that it loads to load another Operating System. Something like a secondary bootloader. Is that possible? Could you compile your own Operating System and install it on an Android device if all the necessary requirements are met? What about a "Hello World" Operating System? Is that possible too at least? And I don't mean Linux.


Answer


Something like a secondary bootloader. Is that possible?




Yes it's possible. As you mentioned, since the boot chain up to bootloader stage is closed source and binaries are signed with OEM's private keys, it's not possible to replace or modify the bootloader. However if bootloader is unlockable, it's possible to boot a custom kernel (your own OS). But the first thing is that you need to follow the standard format of boot.img (i.e. fixed offsets and file formats for kernel binary, ramdisk, DTB etc.) as specified in Android (AOSP).



Secondly building a "Hello World" kernel (or even a bootloader) for a PC is rather simple because many of the buses and the hardware attached to them are already recognized by BIOS/UEFI. However mostly Android devices are ARM based, so they don't have ACPI like in BIOS/UEFI. Instead hardware mapping is provided in the form of Device Tree which is provided by the SoC vendor. The Android/Linux kernel source provided by OEM also includes drivers for all hardware components. So you need to include the Device Tree Blob (DTB) and relevant parts from kernel source with your custom kernel.



Bootloader itself is built with the DTB to use hardware components like eMMC/UFS, display, USB etc. to be able to flash partitions, show boot splash screen, connect to PC etc. For instance, splash_region or freamebuffer in DTB specifies memory addresses of display hardware, which is required to print e.g. Hello World on screen.



Thirdly many of the kernel interfaces are proprietary (not documented) and they don't work with standard Linux ioctls/syscalls. In order to fully make use of hardware features (camera, gps, modem an so on) you need proprietary binary blobs (HALs) in userspace, again provided by device OEM. Android framework uses HIDL to communicate with HALs, so you also need to rely on that.



So what you come up with is not a purely “other than Android” OS. For a large part you have to share the same codebase, specifications and resources that run in Android OS, whether it's kernel or userspace.



For more details see:




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