I am just learning. I have installed email, bluetooth and several other items on my RaspberryPi. Now I have purchased a 5" screen to use and the drivers are on a separate img file provided by the screen manufacturer. How can I get the drivers from that img onto the original image that I have been using and working with?
This Q&A explains how to mount the partitions in the manufacturers image.
Here's what you'll need:
From the 1st partition,
kernel.imgor (for a Pi 2)
kernel7.img. Copy this and rename it
mykernel.img. Edit your
config.txtand add a line:
Make sure there's no other
kernel=line in there.
In the second partition, look in
/lib/modules. There is probably one directory in there with a tuplesque name like
3.18.4. There probably is not a directory in your second partition with that exact name, in which case you can just copy the whole directory in. If by some chance you do have a pre-existing one, rename it first (e.g.,
3.18.4-backup) to keep a copy.
/libdirectory there will be a
firmwaredirectory in both filesystems. There's probably nothing in there you need, but just in case, you don't want versions of things you already have, so, e.g.,
cp -an /mnt/image/lib/firmware/* /lib/firmware/
This presumes you have the whole image mounted on a running pi which is unlikely because of its size; obviously you'll have to use the real paths.
If you ever have to rebuild the kernel or a module, you'll have to use an exact match version wise and this is still not guaranteed to work. Keep in mind when viewing documentation, etc., here your kernel version is going to be well behind the current. The manufacturer probably made this image when they started distribution and they will never bother updating it, because it is a methodology that plays on the naivete of the consumer to start with.
My recommendation is to never, ever buy anything that comes with drivers packaged this way, or that refers to drivers for a specific kernel version, unless they also make it clear the source is available. At least one distributor of TFT screens (Adafruit) has (I think) mainlined their driver, meaning it now comes with updated kernels (instead of the other way around). Their are also existing in-tree drivers in some cases. This is a much better solution, but most manufacturers will not bother with it for philosophical reasons and because, as mentioned, they are targeting people who won't know any better until well after the product has been paid for, and their reputation as manufacturers and distributors is not significant to their marketing model (sell cheap generic goods online).