更改Linux内核模块的启动顺序

Mozcelikors

我正在Raspberry Pi 4-基于Yocto的嵌入式Linux系统上尝试启动优化,并且想在加载vc4-drm内核模块时进行设置。

我想更早地加载vc4-drm内核模块,以便/ dev / fb0更早地准备好。现在,它超出了我的用户空间启动时间,因此大约9秒钟我无法显示任何内容。但是,如果我移动它以便早点初始化,我认为它会更好。

下图显示了以完整调试模式(启用bootchart + initcall_debug + serial + printk)在系统上加载的主要内核模块。您将看到vc4_drm_register快要结束了。

在此处输入图片说明

In order to approach the issue, I found these: What is the Linux built-in driver load order? and How does Linux determine the order of module init calls?. Yasushi Shoji states;

put your init function in the higher level, or put your device driver at the higher position in Makefile

For the first method, in the kernel that I'm compiling, I found the module in drivers/gpu/drm/vc4, then replaced module_init(vc4_drm_register) with both early_initcall(vc4_drm_register) and subsys_initcall(vc4_drm_register). Both attempts made absolutely no difference, vc4 still loads at around ~9th second. Either I'm missing something here, or this is being handled differently.

Second method suggested is to adjust the order in drivers/Makefile. However, to me gpu/ drivers seems already pretty early stage.

obj-y               += irqchip/
obj-y               += bus/

obj-$(CONFIG_GENERIC_PHY)   += phy/

# GPIO must come after pinctrl as gpios may need to mux pins etc
obj-$(CONFIG_PINCTRL)       += pinctrl/
obj-$(CONFIG_GPIOLIB)       += gpio/
obj-y               += pwm/

obj-y               += pci/

obj-$(CONFIG_PARISC)        += parisc/
obj-$(CONFIG_RAPIDIO)       += rapidio/
obj-y               += video/
obj-y               += idle/

# IPMI must come before ACPI in order to provide IPMI opregion support
obj-y               += char/ipmi/

obj-$(CONFIG_ACPI)      += acpi/
obj-$(CONFIG_SFI)       += sfi/
# PnP must come after ACPI since it will eventually need to check if acpi
# was used and do nothing if so
obj-$(CONFIG_PNP)       += pnp/
obj-y               += amba/

obj-y               += clk/
# Many drivers will want to use DMA so this has to be made available
# really early.
obj-$(CONFIG_DMADEVICES)    += dma/

# SOC specific infrastructure drivers.
obj-y               += soc/

obj-$(CONFIG_VIRTIO)        += virtio/
obj-$(CONFIG_XEN)       += xen/

# regulators early, since some subsystems rely on them to initialize
obj-$(CONFIG_REGULATOR)     += regulator/

# reset controllers early, since gpu drivers might rely on them to initialize
obj-$(CONFIG_RESET_CONTROLLER)  += reset/

# tty/ comes before char/ so that the VT console is the boot-time
# default.
obj-y               += tty/
obj-y               += char/

# iommu/ comes before gpu as gpu are using iommu controllers
obj-$(CONFIG_IOMMU_SUPPORT) += iommu/

# gpu/ comes after char for AGP vs DRM startup and after iommu
obj-y               += gpu/
# ...
# ...
# ...
# Continues with a lot more drivers here...

因此,我需要帮助来解决这个问题。如何确保vc4的加载时间早于现在的加载时间?如果我有任何遗漏,请告诉我。非常感谢你。

注意: vc4-drm dmesg

root@raspberrypi4-64:~# dmesg | grep vc4                                            
[    9.123494] calling  vc4_drm_register+0x0/0x1000 [vc4] @ 299                     
[    9.184440] vc4-drm soc:gpu: bound fe600000.firmwarekms (ops vc4_fkms_ops [vc4]) 
[    9.192810] [drm] Initialized vc4 0.0.0 20140616 for soc:gpu on minor 1          
[    9.380513] vc4-drm soc:gpu: fb0: DRM emulated frame buffer device               
[    9.393112] initcall vc4_drm_register+0x0/0x1000 [vc4] returned 0 after 187677 us
ecs 
Mozcelikors

我能够解决问题。事实证明,为了使*_initcall()的工作,模块应该静态链接,因此,我设置了;

CONFIG_DRM_VC4=y
CONFIG_SND=y
CONFIG_SNC_SOC=y

这会浪费几毫秒的启动时间,但是现在/ dev / fb0的加载时间约为0.3秒,而不是9秒。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章