coredump: support mtdoutstream

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This commit is contained in:
buxiasen 2024-11-08 12:02:23 +08:00 committed by Xiang Xiao
parent 3add14714e
commit ddf428d66c
2 changed files with 18 additions and 3 deletions

View file

@ -4722,6 +4722,12 @@ config BOARD_COREDUMP_BLKDEV
---help---
Enable save coredump to block device when crash.
config BOARD_COREDUMP_MTDDEV
bool "Enable Core Dump to mtd device"
depends on COREDUMP
---help---
Enable save coredump to mtd device when crash.
config BOARD_CRASHDUMP_NONE
bool "No Board level crash dump"
@ -4729,9 +4735,9 @@ endchoice # BOARD crashdump method
config BOARD_COREDUMP_DEVPATH
string "Save Core Dump data with device PATH"
depends on BOARD_COREDUMP_BLKDEV
depends on BOARD_COREDUMP_BLKDEV || BOARD_COREDUMP_MTDDEV
---help---
Save coredump file into block device path.
Save coredump file into block/mtd device path.
config BOARD_COREDUMP_FULL
bool "Core Dump all thread registers and stacks"

View file

@ -47,7 +47,8 @@
# define ELF_PAGESIZE 1024
#endif
#ifdef CONFIG_BOARD_COREDUMP_BLKDEV
#if defined(CONFIG_BOARD_COREDUMP_BLKDEV) || \
defined(CONFIG_BOARD_COREDUMP_MTDDEV)
# define CONFIG_BOARD_COREDUMP_DEV
#endif
@ -92,6 +93,8 @@ static struct lib_hexdumpstream_s g_hexstream;
#ifdef CONFIG_BOARD_COREDUMP_BLKDEV
static struct lib_blkoutstream_s g_devstream;
#elif defined(CONFIG_BOARD_COREDUMP_MTDDEV)
static struct lib_mtdoutstream_s g_devstream;
#endif
#ifdef CONFIG_BOARD_MEMORY_RANGE
@ -867,6 +870,12 @@ int coredump_initialize(void)
#ifdef CONFIG_BOARD_COREDUMP_BLKDEV
ret = lib_blkoutstream_open(&g_devstream,
CONFIG_BOARD_COREDUMP_DEVPATH);
#elif defined(CONFIG_BOARD_COREDUMP_MTDDEV)
ret = lib_mtdoutstream_open(&g_devstream,
CONFIG_BOARD_COREDUMP_DEVPATH);
#endif
#ifdef CONFIG_BOARD_COREDUMP_DEV
if (ret < 0)
{
_alert("%s Coredump device not found %d\n",