我正在基于Raspberry Pi 4-Yocto的嵌入式Linux系统上试验引导优化,并希望在加载vc4-drm内核模块时设置。
我想让vc4-drm内核模块更早地加载,这样/dev/fb0就可以更早地准备好了。现在,它超过了我的用户空间引导时间,因此我不能在上面显示任何东西大约9秒。然而,如果我移动它,使它更早地被初始化,我认为它会更好。
下面的图片显示了在完全调试模式下加载到我的系统上的主要内核模块(bootchart+initcall_debug+serial+printk已启用)。您将看到vc4_drm_register已接近尾声。

为了解决这个问题,我发现了以下内容:What is the Linux built-in driver load order?和How does Linux determine the order of module init calls?。靖国神社;
将您的init功能放在更高的级别,或者将您的设备驱动程序放在Makefile的较高位置。
对于first方法,在我正在编译的内核中,我在drivers/gpu/drm/vc4中找到了模块,然后用early_initcall(vc4_drm_register)和subsys_initcall(vc4_drm_register)替换了module_init(vc4_drm_register)。两次尝试都完全没有区别,vc4仍然在~9秒左右加载。要么我漏掉了什么,要么这件事被不同的处理了。
第二种方法建议的方法是调整驱动程序/Makefile中的顺序。然而,对我来说,gpu/驱动程序似乎已经很初级了。
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-drmdmesg
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 发布于 2020-05-26 10:13:40
我解决了这个问题。结果表明,为了使*_initcall()工作,模块应该是静态链接的,因此,我设置;
CONFIG_DRM_VC4=y
CONFIG_SND=y
CONFIG_SNC_SOC=y这会损失几毫秒的启动时间,但是现在/dev/fb0在大约0.3秒,而不是9秒左右加载。
https://stackoverflow.com/questions/62007282
复制相似问题