Updating Android without Manufacturer support (Not with a custom ROM but with a different approach)


Question

Summary for the inpatient: I want to run a new version of Android on an old smarphone (s3mini).



(Sorry for bad English, I'm German. Feel free to correct my grammar in the comments)



Hello Programmers and Android fans,



as you might know, most Android smartphones only receive updates for a short amount of time until the hardware manufacturer stops supporting that smartphone. For example my smartphone (s3mini GT-I8200N) still has Android 4.2.2, which is obviously not ideal.



Please correct me if I understand something wrong here, but AFAIK all data on the phone, including the drivers get deleted if I flash a custom ROM (eg. Stock Android 7.0 or LineageOS). Because the manufacturer (in this case Samsung) does not publish their drivers, the community has to write their own drivers for every smartphone (which are obviously not as good as drivers written by the manufacturer because they know the hardware better).



It is possible to get a root shell on the smartphone / run my own program as root on the smartphone. Because a root process can read/write every file on the device except the kernel, and Android 7.0/LineageOS is publicly available it should be possible to write a program that updates every single android system file. Updating the kernel with root privileges shouldn't be a problem either since the linux kernel is signed. So that's the plan:



Step 1: Download and compile Android 7.0/LineageOS



Step 2: Copy CompiledAndroid7.0.tar and the program on the smartphone



Step 3: Start the program with root rights



Step 4: The program terminates every other process



Step 5: The program deletes every file on the smartphone except drivers, the kernel, kernel modules, bootloader related files, the Program itself and CompiledAndroid7.0.tar



Step 6: The program unpacks CompiledAndroid7.0.tar in the root dir (/) (The program has to be able to unpack a .tar file without any other software except the kernel. But this shouldn't be hard to do, just Copy+Paste from open source unpackaging software).



Step 7: Install the new signed kernel (via syscall) and reboot.



Now you have an old smartphone with Stock Android 7.0/LineageOS and the original drivers!



Could this work in principle or did I understood something wrong about the way Android Smartphones work?



One comment said that Step 4 could crash my phone. A nice work-around would be that the program replace init with a copy of itself and then runs "sudo reboot"



Do old kernel modules/drivers work with new Linux versions? If not, why?



UPDATE



I want to thank all of you for your help. The idea from above won't work, so I have to get mad at google for not having good android update servers and not making sure old kernel modules work and get mad at Samsung because they do not publish driver source or updated drivers. If I find the time to do so, I will check if LineageOS supports my device and if not, write drivers.


Answer


Do old kernel modules/drivers work with new Linux versions? If not, why?




No, not always. There are two interfaces in kernel modules: the interface from the module to the kernel, and the interface from the whole kernel-side driver to the user-space driver. The latter changes more frequently, but the former does too sometimes. On the whole you'll find that some drivers are fine, but others can't work with a different version.




Could this work in principle or did I understood something wrong about the way Android Smartphones work?




New Android versions often introduce new features which the drivers need to be updated to support. So you might be able to use the same kernel module in a new Android version, but you would (for example) need to write a new user-space driver to support all the features needed for the new Android version.



Overall, it's as Matthew said. Custom ROMs already have to reuse some binary parts of official drivers, and integrating those is a big source of pain. The "deleting the drivers" you've asked about isn't the reason why it's painful. With binary parts of drivers, often there's nothing you can do to make them work with a newer Android version.



If you're serious about getting your old phone supported, see Why isn't there a Cyanogenmod stable ROM for my device? to learn what you can do to help.


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