1, kernel没打印
这个有两种可能,第一个是earlycon没设好,对于riscv来说最常用的就是
bootargs = "console=hvc0 earlycon=sbi";
这个需要搭配kernel的选项
(1)
│ Symbol: SERIAL_EARLYCON_RISCV_SBI [=y]
│
│ Type : bool
│ Defined at drivers/tty/serial/Kconfig:87
│ Prompt: Early console using RISC-V SBI
│ Depends on: TTY [=y] && HAS_IOMEM [=y] && RISCV_SBI_V01 [=y]│
│ Location:
│ -> Device Drivers
│ -> Character devices
│ -> Enable TTY (TTY [=y])
│ -> Serial drivers
(2)
│ Symbol: HVC_RISCV_SBI [=y]
│ Type : bool
│ Defined at drivers/tty/hvc/Kconfig:89
│ Prompt: RISC-V SBI console support
│ Depends on: TTY [=y] && RISCV_SBI_V01 [=y]
│
│ Location:
│ -> Device Drivers
│ -> Character devices
│ -> Enable TTY (TTY [=y])
第二个可能是mmu的问题,详细点就是TLB配置,在用的时候配置TLB,处理缺页异常的时候。
2, 卡在sched_clock: 64 bits at 1000kHz, resolution 1000ns,…
riscv的mtimer没初始化好,最可能就是没有初始化,当然如果你用了别的时钟源当我没说
3, 启动不了bash
plic的初始化
4, insmod时,Oops - Oops - load address misaligned
检查下你的driver是不是没对齐
这个有两种可能,硬件和软件。
硬件方面的话,check with vendor是不是支持HW misaligned handle。
否则考虑软件,关掉
-> Platform type
-> RISCV_ISA_C
然后重新编译kernel和driver试下
5, insmod: ERROR: could not insert module xx.ko: Invalid parameters
在ioremap的时候,有两对操作是成对出现的,分别是:
#define TX_BUF_PA 0x3000000
unsigned char *tx_buf_va;
// reuest memory
if (!request_mem_region(TX_BUF_PA, 0x40000, "TX_BUF"))
return -EINVAL;
// map to virtual addr
tx_buf_va = ioremap(TX_BUF_PA, 0x40000);
// unmap tx_buff
iounmap(tx_buf_va);
// release reuested memory
release_mem_region(TX_BUF_PA, 0x40000);
而这个错误的产生是由于编程的时候掉了release_mem_region
6, insmod: module verification failed: signature and/or required key missing - tainting
这个error其实不用太关注,关键要看是不是driver里的printk有打印,如果有打印的话其实是不要紧的,如果没有打印的话,看网上说的是在Makefile
文件中加入CONFIG_MODULE_SIG=n
,大家可以试下,反正我是不需要的。
7, insmod: ERROR: could not insert module xx.ko: Invalid module format
看一下dmesg会有错误提示,我遇到的这个问题是由于之前把driver拷到了/lib/modules/extra/xx
下,然后开机自动加载了,我又加载一遍,产生了重复的export symbol
。