Reputation: 562
Background: I am working with a Pixel 4, build QQ2A.200501.001.B2
, which is Android 10. When I build the kernel from the official sources and flash it, the touchscreen, wlan and other features do not work. I tracked this down to the fact that the kernel modules in /vendor/lib/modules
do not get updated, thus the new kernel can't load any of them. I tried flashing both only boot.img
and the entire AOSP, same issue, they don't get updated. I can workaround this by manually pushing the kernel modules I built to the device and manually insmod
ing them in the right order.
So my questions are:
Surely there must be an "official" way to do this? How are the kernel modules normally deployed?
Some notes:
I can't push them to /vendor/lib/modules
because I can't remount /vendor
writable:
flame:/ # mount -o rw,remount /vendor
'/dev/block/dm-5' is read-only
Disabling dm-verity
doesn't seem to help.
I noticed that the AOSP source contains all the modules that are in /vendor/lib/modules
, in the same place where it takes the kernel image form (in my case that's device/google/coral-kernel
). So naturally, I tried replacing the modules there with the ones I built, but after building and flashing, I see that /vendor/lib/modules
still contains the old modules.
The AOSP docs say that boot.img
does not contain the ramdisk anymore, it's now in the system
partititon. Also, OverlayFS
is used and one should use a "vendor overlay" to update files there, if I read it right. However, on my device, there is no product/vendor_overlay
directory like the docs say, only product/overlay/
. I'm also not sure if this is the right way to tackle this or how I would go about creating such an overlay in my case.
Thanks
Upvotes: 6
Views: 2960
Reputation: 11
You can use below command to disable verity :
adb root
adb disable-verity
adb shell sync
adb reboot
then push the .ko(s) to /vendor/lib/modules/ :
adb root
adb remount
adb push *.ko /vendor/lib/modules/
adb shell sync
adb reboot
Upvotes: 0
Reputation: 7907
Ok. Several questions, several answers:
Why don't they get updated in the first place?
Because they are expected to be in /vendor/lib/modules, and when you recompile a kernel you're only creating the kernel binary which goes into the boot.img.
How can I update them along with the kernel when I flash?
You could compile the modules into the kernel. That makes your kernel a bit bigger, but relieves you from the need to insert these modules.
You can indeed modify /vendor like you've tried - but not the DM-verity block device (/dev/block/dm-5 in your case) - the underlying partition (/dev/block/sd?#, something, which you can see if you look at the links from /dev/block/by-name/vendor).
CAVEAT: This will cause dm-verity to fail mounting /vendor unless you correctly disable dm-verity!
Another avenue to try for testing: Linux kernel modules have a strict vermagic requirement (in simpler terms, the module string must match the 'uname -r' of the kernel, to ensure that critical kernel structures have not been modified). If you don't change the kernel magic (VERSION, PATCHLEVEL, SUBLEVEL and EXTRAVERSION from Makefile) (or "fake" them to the original kernel version your device came with) the modules should load.
Upvotes: 2