Compare commits

..

2 Commits

Author SHA1 Message Date
db0ee7322a [Mod] Pstore测试正常
[详细说明]
    1.使用dts方式,Pstore工作正常;模块加载方式未通过(dts中未声明reserver-memory);
    2.resever-memory定义:DRAM 末尾3MB位置开始,大小1MB(RTOS区域紧跟其后):{0x9fd0_0000, 0x9fdf_ffff};
2024-04-09 21:27:56 +08:00
b20adf0a85 [Add] 添加oops测试用ko模块 2024-04-09 21:27:02 +08:00
5 changed files with 70 additions and 0 deletions

View File

@ -530,3 +530,13 @@ CONFIG_BT_HCIUART_H4=y
# CONFIG_BT_HCIVHCI is not set
# CONFIG_BT_MRVL is not set
# CONFIG_BT_MTKSDIO is not set
CONFIG_MAGIC_SYSRQ=y
CONFIG_PSTORE=y
CONFIG_PSTORE_CONSOLE=y
CONFIG_PSTORE_RAM=y
CONFIG_PSTORE_PMSG=y
#CONFIG_FUNCTION_TRACER=y
#CONFIG_PSTORE_FTRACE=y

View File

@ -21,5 +21,12 @@
compatible = "ion-region";
size = <0x0 CVIMMAP_ION_SIZE>;
};
ramoops@9fd00000 {
compatible = "ramoops";
reg = <0 0x9fd00000 0 0x100000>;
record-size = <0x4000>;
console-size = <0x4000>;
};
};
};

View File

@ -49,6 +49,9 @@ ifeq (, ${CONFIG_NO_TP})
OTHERS += cp_ext_tp
endif
KO_LIST += testing
OTHERS += cp_testing
$(info ** [ KO_LIST ] ** = $(KO_LIST))
export CROSS_COMPILE=$(patsubst "%",%,$(CONFIG_CROSS_COMPILE_KERNEL))
@ -69,12 +72,18 @@ wireless:
wiegand-gpio:
@$(call MAKE_EXT_KO, extdrv/${@})
testing:
@$(call MAKE_EXT_KO, extdrv/${@})
cp_ext_wireless:
@find extdrv/wireless -name '*.ko' -print -exec cp {} $(INSTALL_DIR)/3rd/ \;
cp_ext_tp:
@find extdrv/tp -name '*.ko' -print -exec cp {} $(INSTALL_DIR)/3rd/ \;
cp_testing:
@find extdrv/testing -name '*.ko' -print -exec cp {} $(INSTALL_DIR)/3rd/ \;
clean:
@for subdir in $(SUBDIRS); do cd $$subdir && $(MAKE) clean && cd $(CUR_DIR); done
@rm -f $(INSTALL_DIR)/*.ko

View File

@ -0,0 +1,24 @@
#
# Makefile for the Linux testings.
#
obj-m += oops.o
all:
$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNEL_DIR) M=$(shell pwd) modules
strip:
$(CROSS_COMPILE)strip $(MODULE_NAME).ko --strip-unneeded
clean:
find . -name *.d -delete
find . -name *.ko | xargs -i rm -rf {}
find . -name Module.symvers | xargs -i rm -rf {}
find . -name Module.markers | xargs -i rm -rf {}
find . -name modules.order | xargs -i rm -rf {}
find . -name *.mod.c | xargs -i rm -rf {}
find . -name *.mod | xargs -i rm -rf {}
find . -name *.o | xargs -i rm -rf {}
find . -name *.cmd | xargs -i rm -rf {}
find . -name *~ | xargs -i rm -rf {}
rm -fr .tmp_versions

View File

@ -0,0 +1,20 @@
#include <linux/init.h>
#include <linux/module.h>
static int __init trigger_oops_init(void) {
int *ptr = (int *)0; // 强制类型转换0地址为指针并尝试读取
printk(KERN_ALERT "Oops will trigger now!\n");
printk(KERN_ALERT "Dereferenced NULL pointer value: %d\n", *ptr);
return 0; // 加载模块不应该有返回值但这里返回0避免编译警告。
}
static void __exit trigger_oops_exit(void) {
printk(KERN_ALERT "Oops trigger module exiting\n");
}
module_init(trigger_oops_init);
module_exit(trigger_oops_exit);
MODULE_LICENSE("Dual BSD/GPL");