I've been working in creating a package for a driver I need to make Wi-Fi work on a target device. I created the package by the following way:
File structure:
├── b43-sprom-driver
│ ├── Makefile
│ └── src
│ ├── b43-sprom-fallback.c
│ └── Makefile
The .c file is just a small driver to create a dummy SPROM for those Broadcom's Wifi chipsets which does not have an SPROM or it can't be read for whatever reason. Can be found here: openwrt/b43-sprom.c at master · openwrt/openwrt (github.com)
This is the Makefile:
#
# Copyright (C) 2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=b43-sprom-fallback
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk
define KernelPackage/b43-sprom-fallback
SECTION:=kernel
SUBMENU:=B43 SPROM Fallback Driver
TITLE:=B43 SPROM Fallback Driver
DEPENDS:= @PCI_SUPPORT +kmod-ssb +kmod-bcma
FILES:=$(PKG_BUILD_DIR)/b43-sprom-fallback.ko
KCONFIG:= \
CONFIG_BCMA=y \
CONFIG_BCMA_BLOCKIO=y \
CONFIG_BCMA_DRIVER_PCI=y \
CONFIG_BCMA_HOST_PCI=y \
CONFIG_BCMA_HOST_PCI_POSSIBLE=y \
CONFIG_SSB=y\
CONFIG_SSB_B43_PCI_BRIDGE=y \
CONFIG_SSB_BLOCKIO=y \
CONFIG_SSB_DRIVER_PCICORE=y\
CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y\
CONFIG_SSB_PCIHOST=y\
CONFIG_SSB_PCIHOST_POSSIBLE=y \
CONFIG_SSB_SPROM=y
AUTOLOAD:=AUTOLOAD:=$(call AutoLoad,1,b43-sprom-fallback,1)
endef
define KernelPackage/b43-sprom-fallback/description
Enable B43 Fallback SPROM Driver
endef
define Build/Compile
$(MAKE) -C "$(LINUX_DIR)" \
$(KERNEL_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(BUILDFLAGS)" \
modules
endef
$(eval $(call KernelPackage,b43-sprom-fallback))
And the makefile inside the src:
obj-m += b43-sprom-fallback.o
The module works. But the problem is that I need this module to be initialized in the very begining stage of the kernel boot (after another module). I had another approach which basically was compiling that .c directly into the kernel, and that worked. I just had to use the core_initcall()
function and passing by argument the initialization function of the driver, so it will be launched soon. But that won't happen here:
[ 12.250182] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[ 12.262271] Fallback driver started
The module will be launched by the kmodloader very late. Is there a way I can make this module be launched sooner?
Thanks in advice