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?
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.