Android 10:更新内核模块 [英] Android 10: Update kernel modules

查看:297
本文介绍了Android 10:更新内核模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:我正在使用Pixel 4,版本为QQ2A.200501.001.B2,它是Android10.当我从官方来源构建内核并对其进行刷新时,触摸屏,WLAN和其他功能均不起作用.我将其追溯到/vendor/lib/modules中的内核模块未得到更新的事实,因此新内核无法加载其中的任何一个.我尝试只刷新boot.img和整个AOSP,这是相同的问题,它们没有更新.我可以通过手动将构建的内核模块推送到设备并按正确的顺序手动insmod来解决此问题.

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 insmoding them in the right order.

所以我的问题是:

  • 为什么他们不首先得到更新?
  • 刷新时如何与内核一起更新它们?
  • 或者,如何在刷新后永久更新它们?

当然,必须有一个官方"网站.做到这一点的方法?内核模块通常如何部署?

Surely there must be an "official" way to do this? How are the kernel modules normally deployed?

一些注意事项:

我无法将它们推入/vendor/lib/modules,因为我无法重新安装/vendor可写:

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

禁用dm-verity似乎无济于事.

我注意到AOSP源包含/vendor/lib/modules中的所有模块,它们位于采用内核映像格式的同一位置(在我的情况下为device/google/coral-kernel).因此,很自然地,我尝试用自己构建的模块替换那里的模块,但是在构建并刷新后,我发现/vendor/lib/modules仍然包含旧模块.

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.

AOSP文档说 boot.img不再包含虚拟磁盘,现在位于system分区中.同样,使用OverlayFS,并且应该使用供应商覆盖".如果我没看错的话,可以在那里更新文件.但是,在我的设备上,没有像文档所说的product/vendor_overlay目录,只有product/overlay/.我也不确定这是否是解决此问题的正确方法,或者我将如何在我的案例中创建这样的覆盖层.

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.

谢谢

推荐答案

好.几个问题,几个答案:

Ok. Several questions, several answers:

  • 为什么他们不首先得到更新?

  • Why don't they get updated in the first place?

  • 因为它们应该位于/vendor/lib/modules中,所以当您重新编译内核时,您只是在创建进入boot.img的内核二进制文件.

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

  • 或者,如何在刷新后永久更新它们?

您确实可以按照您的尝试修改/vendor-但不能修改DM-verity块设备(在您的情况下为/dev/block/dm-5)-基础分区(/dev/block/sd?#,如果您查看/dev/block/by-name/vendor中的链接,就会看到这些内容.

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

注意:这将导致dm-verity无法安装/vendor,除非您正确禁用dm-verity!

CAVEAT: This will cause dm-verity to fail mounting /vendor unless you correctly disable dm-verity!

另一种测试途径:Linux内核模块有严格的严格要求(简单来说,模块字符串必须与内核的'uname -r'相匹配,以确保关键的内核结构没有被修改).如果您不更改内核魔术(Makefile中的VERSION,PATCHLEVEL,SUBLEVEL和EXTRAVERSION)(或将它们伪造"为设备随附的原始内核版本),则应该加载模块.

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.

这篇关于Android 10:更新内核模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆