1

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.

  • Any ROM that's not from the manufacturer is a custom ROM. Manufacturer's​ ROM are stock. – esQmo_ Mar 20 '17 at 19:18
  • I know that any ROM that is not from the manufacturer is a custom ROM. – Kryptomatrix Mar 20 '17 at 19:23
0

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.

  • Thank you for your help. Do I understand this correctly? The community takes the original, binary drivers, or reverse enginieer them to write new drivers that work with newer versions of Android? Sorry if this is a stupid question, but if the driver interface changes with new versions of Linux then why desktop Linux distros (e.g. ubuntu) (nearly) always work on old hardware? I never had a Linux Laptop/Desktop that was not updatable. – Kryptomatrix Mar 21 '17 at 20:29
  • It's different for different devices. Typically GPU drivers have a binary part and a part for which source is available. Sometimes it's possible for third-parties to update the source part and keep using the unmodified binary part. – Dan Hulme Mar 22 '17 at 10:21
  • As for the difference with desktops, there are two things going on. First, the distro takes care of making sure all the drivers in the distro are updated if they want to move to a new kernel version. Second, new Ubuntu versions don't introduce new hardware requirements (such as "must support Vulkan"), while new Android versions often do. – Dan Hulme Mar 22 '17 at 10:23
  • Thank you. Is it possible to run a new version of Android with an old version of the Linux kernel? This way, the old drivers should work. – Kryptomatrix Mar 22 '17 at 11:38
  • Not if the new Android version needs features that aren't in the old kernel version. Usually each Android version has a range of kernel versions that it can support. – Dan Hulme Mar 22 '17 at 11:39
0

Hot flashing is certainly possible, though harder than it's worth.

AFAIK all data on the phone, including the drivers get deleted if I flash a custom ROM (eg. Stock Android 7.0 or LineageOS)

That's not correct. Data only gets wiped if the flashing script does so or if the device is encrypted. Likewise, firmware only gets overrwritten/wiped if the flashing script does so.

If you're not flashing a stock ROM from the manufacturer (or vanilla Android on a Nexus/Pixel phone), then you're flashing a custom ROM. This approach is not going to gain you anything really, except on a device with a very very tightly locked bootloader.

  • Thanks for correcting me. Is it possible to copy the original drivers from the smartphone onto my PC? " This approach is not going to gain you anything really" With this approach, you have the original drivers, written by Samsung, If you flash your custom ROM you have the community written drivers that may or may not work very well – Kryptomatrix Mar 20 '17 at 19:01
  • 1
    @Kryptomatrix Most custom ROMs that I've seen re-use the binary bits from OEM ROMs, they do not write their own. Here's a repository with blobs for your device, for example. They are included in the packaged ROM by the build system. – eldarerathis Mar 20 '17 at 19:58
  • @eldarerathis Thx. I didn't know that. Some guy told me that it's not pssible to get the original drivers from the smartphone and that this is the reason why Custom ROMs are sometimes unstable or cannot use a specific part of the hardware – Kryptomatrix Mar 20 '17 at 20:57
  • 2
    @Kryptomatrix I think the bigger stumbling block is typically getting the drivers to work with updates to the Android framework. If the OEM doesn't update the drivers then they effectively become obsolete and won't integrate properly into the system at large. I've never really tried to get Android working on a device after it had lost "official" support, though. so I could be mistaken on that. – eldarerathis Mar 20 '17 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.