您尚未登录。

楼主 # 2023-10-30 17:49:30

muxi01
会员
注册时间: 2020-10-24
已发帖子: 54
积分: 136

[小爱mini音响 R16 ] regulatory.db 加载失败的问题

[    1.707503] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    1.717596] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    1.724231] ALSA device list:
[    1.727198]   #0: sun8i-a33-audio
[    1.731001] platform regulatory.0: loading regulatory.db failed
[    1.736936] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[.db
[    1.748784] VFS: Mounted root (squashfs filesystem) readonly on device 31:6.
[    1.759426] devtmpfs: mounted
[    1.759791] mmc0: new high speed SDIO card at address 0001
[    1.769257] Freeing unused kernel memory: 1024K
[    1.770834] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    1.819524] Run /sbin/init as init process
[    1.984161] brcmfmac mmc0:0001:1: loading brcm/brcmfmac43430-sdio.bin success
[    2.051478] brcmfmac mmc0:0001:1: loading brcm/brcmfmac43430-sdio.sinovoip,bananapi-m2m.txt success
[    2.369805] random: crng init done

日志如图,可能的原因是regulatory.db 的加载早与文件系统挂载完成,导致找不到指定文件。 因为 regulatory.db 文件确实存在于/lib/firmware中。
我尝试过在加载文件之前调用mdelay(3000)来延时,但问题依旧,表现为整个日志的时间都顺延了3S,请教一下这个问题该如何解决?

离线

楼主 #1 2023-11-03 18:08:43

muxi01
会员
注册时间: 2020-10-24
已发帖子: 54
积分: 136

Re: [小爱mini音响 R16 ] regulatory.db 加载失败的问题

解决办法2个:
1.将相关功能编译成模块。

 .config - Linux/arm 5.4.63 Kernel Configuration
 > Networking support > Wireless ──────────────────────────────────────────────────────────────────────────────────────
  ┌─────────────────────────────────────────────────── Wireless ────────────────────────────────────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus ---> (or empty submenus ----).  Highlighted letters    │
  │  are hotkeys.  Pressing <Y> includes, <N> excludes, <M> modularizes features.  Press <Esc><Esc> to exit, <?>    │
  │  for Help, </> for Search.  Legend: [*] built-in  [ ] excluded  <M> module  < > module capable                  │
  │                                                                                                                 │
  │ ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │
  │ │                   --- Wireless                                                                              │ │
  │ │                   <M>   cfg80211 - wireless configuration API                                               │ │
  │ │                   [ ]     nl80211 testmode command                                                          │ │
  │ │                   [ ]     enable developer warnings                                                         │ │
  │ │                   [*]     enable powersave by default                                                       │ │
  │ │                   [ ]     cfg80211 DebugFS entries                                                          │ │
  │ │                   [*]     cfg80211 wireless extensions compatibility                                        │ │
  │ │                   [ ]   lib80211 debugging messages                                                         │ │
  │ │                   <M>   Generic IEEE 802.11 Networking Stack (mac80211)                                     │ │
  │ │                         Default rate control algorithm (Minstrel)  --->                                     │ │
  │ │                   [*]   Enable mac80211 mesh networking support                                             │ │
  │ │                   [ ]   Enable LED triggers                                                                 │ │
  │ │                   [ ]   Export mac80211 internals in DebugFS                                                │ │
  │ │                   [ ]   Trace all mac80211 debug messages                                                   │ │
  │ │                   [ ]   Select mac80211 debugging features  ----                                            │ │
  │ │                                                                                                             │ │
  │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
  │                            <Select>    < Exit >    < Help >    < Save >    < Load >                             │
  └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

2.骚操作,不建议用

在include/linux/init.h下新增
#define last_initcall(fn)        __define_initcall(fn, 8)
#define last_initcall_sync(fn)        __define_initcall(fn, 8s)


net/wireless/reg.c 下新增
last_initcall(regulatory_init_db);
//late_initcall(regulatory_init_db);


init/main.c 中新增
extern initcall_entry_t __initcall_start[];
extern initcall_entry_t __initcall0_start[];
extern initcall_entry_t __initcall1_start[];
extern initcall_entry_t __initcall2_start[];
extern initcall_entry_t __initcall3_start[];
extern initcall_entry_t __initcall4_start[];
extern initcall_entry_t __initcall5_start[];
extern initcall_entry_t __initcall6_start[];
extern initcall_entry_t __initcall7_start[];
extern initcall_entry_t __initcall8_start[]; //新增
extern initcall_entry_t __initcall_end[];

static initcall_entry_t *initcall_levels[] __initdata = {
    __initcall0_start,
    __initcall1_start,
    __initcall2_start,
    __initcall3_start,
    __initcall4_start,
    __initcall5_start,
    __initcall6_start,
    __initcall7_start,
    __initcall8_start, //新增
    __initcall_end,
};


static void __init do_initcalls(void)
{
    int level;
    for (level = 0; level < ARRAY_SIZE(initcall_levels) - 2; level++) // -1 改为-2
        do_initcall_level(level);
}

static void __init do_last_initcalls(void)
{
    do_initcall_level(ARRAY_SIZE(initcall_levels) - 2);
}


在这个kernel_init_freeable函数最末尾调用do_last_initcalls();


在include/asm-generic/vmlinux.lds.h中

#define INIT_CALLS                            \
        __initcall_start = .;                    \
        KEEP(*(.initcallearly.init))                \
        INIT_CALLS_LEVEL(0)                    \
        INIT_CALLS_LEVEL(1)                    \
        INIT_CALLS_LEVEL(2)                    \
        INIT_CALLS_LEVEL(3)                    \
        INIT_CALLS_LEVEL(4)                    \
        INIT_CALLS_LEVEL(5)                    \
        INIT_CALLS_LEVEL(rootfs)                \
        INIT_CALLS_LEVEL(6)                    \
        INIT_CALLS_LEVEL(7)                    \
        INIT_CALLS_LEVEL(8)                    \ //新增
        __initcall_end = .;

最近编辑记录 muxi01 (2023-11-03 18:31:12)

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn