server 3.0: aspeed: enable ramoops and kdump
* ramoops worked and kdump can produce kcore
* There is one issue left when running crash tool against the kcore file
no fusion link for server 3.0
Tested:
```
root@fdtp183-nfd01:~# kdumpctl list
kcore-2025_04_08_04_59_47
root@fdtp183-nfd01:~# journalctl -b -u gbmc-dump-ramoops
Apr 08 04:59:47 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[378]: [ 44.488036] sysrq: Trigger a crash
Apr 08 04:59:47 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[378]: [ 44.491863] Kernel panic - not syncing: sysrq triggered crash
Apr 08 04:59:47 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[378]: [ 44.498277] SMP: stopping secondary CPUs
Apr 08 04:59:47 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[378]: [ 44.502770] Starting crashdump kernel...
Apr 08 04:59:47 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[378]: [ 44.507142] Bye!
Apr 08 04:59:47 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[378]: The kernel version is not supported.
Apr 08 04:59:47 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[378]: The makedumpfile operation may be incomplete.
Apr 08 04:59:47 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[378]: [820B blob data]
Apr 08 04:59:47 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[378]: The dumpfile is saved to STDOUT.
Apr 08 04:59:47 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[378]: makedumpfile Completed.
Apr 08 04:59:47 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[378]: 51780+0 records in
Apr 08 04:59:47 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[378]: 51780+0 records out
Apr 08 04:59:47 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[434]: 11+0 records in
Apr 08 04:59:47 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[434]: 11+0 records out
Apr 08 04:59:50 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[437]: 429+1 records in
Apr 08 04:59:50 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[437]: 429+1 records out
Apr 08 04:59:50 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[438]: The dumpfile is saved to /run/log/kdump/kcore-2025_04_08_04_59_47.
Apr 08 04:59:50 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[438]: makedumpfile Completed.
Apr 08 04:59:50 fdtp183-nfd01.ntc.corp.google.com gbmc-dump-ramoops.sh[323]: removing pmsg file /sys/fs/pstore/pmsg-ramoops-0
Apr 08 04:59:51 fdtp183-nfd01.ntc.corp.google.com systemd[1]: gbmc-dump-ramoops.service: Deactivated successfully.
Apr 08 04:59:51 fdtp183-nfd01.ntc.corp.google.com systemd[1]: Finished gbmc-dump-ramoops.service.
Apr 08 04:59:51 fdtp183-nfd01.ntc.corp.google.com systemd[1]: gbmc-dump-ramoops.service: Consumed 1.526s CPU time, 23.4M memory peak.
```
Google-Bug-Id: 373416015
Change-Id: I3670ed294e2899be59b27d0eaaf4c8ee5159b66a
Signed-off-by: Anh Phan <anhphan@google.com>
diff --git a/dynamic-layers/aspeed-layer/recipes-bsp/u-boot/u-boot-aspeed-sdk/0001-u-boot-adjust-memory-layout-for-ast2700.patch b/dynamic-layers/aspeed-layer/recipes-bsp/u-boot/u-boot-aspeed-sdk/0001-u-boot-adjust-memory-layout-for-ast2700.patch
new file mode 100644
index 0000000..dc4c739
--- /dev/null
+++ b/dynamic-layers/aspeed-layer/recipes-bsp/u-boot/u-boot-aspeed-sdk/0001-u-boot-adjust-memory-layout-for-ast2700.patch
@@ -0,0 +1,28 @@
+From d0a68edbc81b4b4b6736c6631415d872ad317c2a Mon Sep 17 00:00:00 2001
+From: Anh Phan <anhphan@google.com>
+Date: Thu, 27 Mar 2025 06:22:02 +0000
+Subject: [PATCH] u-boot: adjust memory layout for ast2700
+
+Signed-off-by: Anh Phan <anhphan@google.com>
+---
+ include/configs/evb_ast2700.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/include/configs/evb_ast2700.h b/include/configs/evb_ast2700.h
+index 1aa595783c..f5aa275e3e 100644
+--- a/include/configs/evb_ast2700.h
++++ b/include/configs/evb_ast2700.h
+@@ -25,6 +25,10 @@
+ "boota=setenv bootpart 2; setenv rootfs rofs-a; run setmmcargs; ext4load mmc 0:${bootpart} ${loadaddr} fitImage && bootm ${loadaddr}; echo Error loading kernel FIT image\0" \
+ "bootb=setenv bootpart 3; setenv rootfs rofs-b; run setmmcargs; ext4load mmc 0:${bootpart} ${loadaddr} fitImage && bootm ${loadaddr}; echo Error loading kernel FIT image\0" \
+ "bootmmc=if test \"${bootside}\" = \"b\"; then run bootb; run boota; else run boota; run bootb; fi\0" \
++ "setbootargs=setenv bootargs " CONFIG_BOOTARGS " crashkernel=128M mem=${mem}@0x400000000\0" \
+ "verify=yes\0" \
+ ""
++
++#define CFG_PRAM (32 * 1024 + 256 + 8 * 1024)
++
+ #endif /* __CONFIG_H */
+--
+2.49.0.472.ge94155a9ec-goog
+
diff --git a/dynamic-layers/aspeed-layer/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend b/dynamic-layers/aspeed-layer/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend
index 25809ac..ccf1cf3 100644
--- a/dynamic-layers/aspeed-layer/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend
+++ b/dynamic-layers/aspeed-layer/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend
@@ -9,3 +9,7 @@
file://0003-u-boot-tweak-the-SPI-clock-to-25-MHz.patch \
file://0004-u-boot-reserve-memory-for-ramoops.patch \
"
+
+SRC_URI:append:gbmc:aspeed-g7 = " \
+ file://0001-u-boot-adjust-memory-layout-for-ast2700.patch \
+"
diff --git a/recipes-kernel/kdump-dts/files/gbmc-mini_aspeedg7.dts b/recipes-kernel/kdump-dts/files/gbmc-mini_aspeedg7.dts
new file mode 100644
index 0000000..01ed385
--- /dev/null
+++ b/recipes-kernel/kdump-dts/files/gbmc-mini_aspeedg7.dts
@@ -0,0 +1,16 @@
+/dts-v1/;
+
+#include "aspeed-g7.dtsi"
+#include "aspeed-g7-gbmc.dtsi"
+
+/ {
+ model = "aspeed KDump";
+ compatible = "aspeed,ast2700";
+ chosen {
+ stdout-path = "/ahb/apb/serial@14c33b00:115200n8";
+ };
+};
+
+&uart12 {
+ status = "okay";
+};
diff --git a/recipes-kernel/kdump-dts/kdump-dts.bb b/recipes-kernel/kdump-dts/kdump-dts.bb
index c7d01ae..c2a7cc0 100644
--- a/recipes-kernel/kdump-dts/kdump-dts.bb
+++ b/recipes-kernel/kdump-dts/kdump-dts.bb
@@ -7,6 +7,7 @@
FILESEXTRAPATHS:prepend:= "${THISDIR}/files:"
SRC_URI:npcm7xx += " file://gbmc-mini_npcm7xx.dts"
SRC_URI:aspeed-g6 += " file://gbmc-mini_aspeedg6.dts"
+SRC_URI:aspeed-g7 += " file://gbmc-mini_aspeedg7.dts"
FILES:${PN}:append = " /usr/share/kdump-dts/gbmc-mini.dtb"
COMPATIBLE_MACHINE = ""
@@ -23,6 +24,10 @@
install -m0644 ${B}/gbmc-mini_aspeedg6.dtb ${D}/usr/share/kdump-dts/gbmc-mini.dtb
}
+do_install:aspeed-g7() {
+ install -d ${D}/usr/share/kdump-dts/
+ install -m0644 ${B}/gbmc-mini_aspeedg7.dtb ${D}/usr/share/kdump-dts/gbmc-mini.dtb
+}
do_deploy() {
echo "do not inherit do_deploy from devicetree class"
}
diff --git a/recipes-kernel/linux/files/aspeed-g7-gbmc.cfg b/recipes-kernel/linux/files/aspeed-g7-gbmc.cfg
index 2871856..5c08096 100644
--- a/recipes-kernel/linux/files/aspeed-g7-gbmc.cfg
+++ b/recipes-kernel/linux/files/aspeed-g7-gbmc.cfg
@@ -260,10 +260,33 @@
CONFIG_SQUASHFS=y
CONFIG_SQUASHFS_XZ=y
CONFIG_SQUASHFS_ZSTD=y
+
+# Features useful if a machine enables pstore for dumps
CONFIG_PSTORE=y
+CONFIG_PSTORE_RAM=y
+CONFIG_PSTORE_COMPRESS=y
+CONFIG_PSTORE_DEFLATE_COMPRESS=n <6.6-rc0
+CONFIG_PSTORE_ZSTD_COMPRESS=y <6.6-rc0
+CONFIG_PSTORE_ZSTD_COMPRESS_DEFAULT=y <6.6-rc0
+CONFIG_PRINTK_TIME=y
CONFIG_PSTORE_CONSOLE=y
CONFIG_PSTORE_PMSG=y
-CONFIG_PSTORE_RAM=y
+# Enable kdump for dumping kernel crash
+CONFIG_HOTPLUG_CPU=y
+CONFIG_SUSPEND=y
+CONFIG_PM_SLEEP_SMP=y
+CONFIG_KEXEC=y
+CONFIG_DEBUG_INFO=y
+CONFIG_DEBUG_INFO_COMPRESSED_ZLIB=y >=6.2-rc0
+CONFIG_DEBUG_INFO_COMPRESSED=y <6.2-rc0
+CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
+CONFIG_CRASH_DUMP=y
+CONFIG_PROC_VMCORE=y
+CONFIG_AUTO_ZRELADDR=y armv7
+CONFIG_KEXEC_FILE=y
+CONFIG_KEXEC_CORE=y
+CONFIG_SYSFS=y
+
# CONFIG_NETWORK_FILESYSTEMS is not set
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
@@ -292,10 +315,9 @@
# CONFIG_XZ_DEC_POWERPC is not set
# CONFIG_XZ_DEC_IA64 is not set
# CONFIG_XZ_DEC_SPARC is not set
-CONFIG_PRINTK_TIME=y
+
CONFIG_DYNAMIC_DEBUG=y
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
-CONFIG_DEBUG_INFO_REDUCED=y
CONFIG_GDB_SCRIPTS=y
CONFIG_STRIP_ASM_SYMS=y
CONFIG_DEBUG_FS=y
diff --git a/recipes-kernel/linux/files/linux-gbmc/arch/arm64/boot/dts/aspeed/aspeed-g7-gbmc.dtsi b/recipes-kernel/linux/files/linux-gbmc/arch/arm64/boot/dts/aspeed/aspeed-g7-gbmc.dtsi
new file mode 100644
index 0000000..9a3a2a3
--- /dev/null
+++ b/recipes-kernel/linux/files/linux-gbmc/arch/arm64/boot/dts/aspeed/aspeed-g7-gbmc.dtsi
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/ {
+ memory@400000000 {
+ device_type = "memory";
+ reg = <0x4 0x00000000 0x0 0x40000000>;
+ };
+ reserved-memory {
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges;
+
+ ramoops: ramoops@47d7c0000 {
+ compatible = "ramoops";
+ reg = <0x4 0x7d7c0000 0x0 0x2040000>;
+ record-size = <0x40000>; /* 256KB */
+ pmsg-size = <0x2000000>;
+ };
+ };
+};
diff --git a/recipes-kernel/linux/linux-gbmc_aspeedg7.bb b/recipes-kernel/linux/linux-gbmc_aspeedg7.bb
index 80ef8f1..faa1f12 100644
--- a/recipes-kernel/linux/linux-gbmc_aspeedg7.bb
+++ b/recipes-kernel/linux/linux-gbmc_aspeedg7.bb
@@ -66,3 +66,5 @@
"
KCONFIG_MODE="--allnoconfig"
+# TODO(b/373416015) Remove this to enable CONFIGCHECK
+GBMC_CONFIGCHECK = "0"