Add kdump support for npcm8xx
Some platforms use linux-nuvoton and not linux-gbmc kernel
Platforms-Affected: TTF
Google-Bug-Id: 338664879
Google-Bug-Id: 341330170
Fusion-Link: fusion2 https://fusion2.corp.google.com/0c247695-c777-3cc5-b96f-05dc66c0d98f
Tested: echo c >/proc/sysrq-trigger
Change-Id: If70b1ab525c916f61d314d1e0fc80f7ec7a4fed5
Signed-off-by: Yuxiao Zhang <yuxiaozhang@google.com>
(cherry-picked from a03933fc43bf1b14a23e65f2c4f281ae156d0e8f)
diff --git a/recipes-google/kdump-core/files/gbmc-kexec-init.sh b/recipes-google/kdump-core/files/gbmc-kexec-init.sh
index 5923fb8..e1771ae 100644
--- a/recipes-google/kdump-core/files/gbmc-kexec-init.sh
+++ b/recipes-google/kdump-core/files/gbmc-kexec-init.sh
@@ -29,9 +29,10 @@
rm /tmp/dmesg
total_size=`expr $core_size + $msg_len`
- # 32 * 1024 * 1024 - 64, exclude the length size of the first line, and
+ # pmsg-size - 64, exclude the length size of the first line, and
# a pmsg header for holding metadata.
- max_size=33554368
+ pmsg_size=$(cat /sys/module/ramoops/parameters/pmsg_size)
+ max_size=`expr $pmsg_size - 64`
if [ "$total_size" -gt "$max_size" ]; then
echo "$ERROR_MSG: total size too large: core size $core_size, msg size $msg_len" > /dev/pmsg0
diff --git a/recipes-google/kdump-core/files/gbmc-kexec-prepare.sh.in b/recipes-google/kdump-core/files/gbmc-kexec-prepare.sh.in
index 25d2a31..dc0951b 100644
--- a/recipes-google/kdump-core/files/gbmc-kexec-prepare.sh.in
+++ b/recipes-google/kdump-core/files/gbmc-kexec-prepare.sh.in
@@ -40,4 +40,4 @@
kexec "$TMPDIR/zImage" -p -d @ARGS@ \
--initrd="$TMPDIR/kdumpinitrd" \
--dtb="$TMPDIR/mini.dtb" \
- --append="root=/dev/ram nosmp nr_cpus=1 reset_devices" || exit 1
+ --append="root=/dev/ram nosmp nr_cpus=1 reset_devices swiotlb=0" || exit 1
diff --git a/recipes-kernel/kdump-dts/kdump-dts.bb b/recipes-kernel/kdump-dts/kdump-dts.bb
index c2a7cc0..c9f1385 100644
--- a/recipes-kernel/kdump-dts/kdump-dts.bb
+++ b/recipes-kernel/kdump-dts/kdump-dts.bb
@@ -2,7 +2,7 @@
PR = "r1"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
-DEPENDS = "linux-gbmc"
+DEPENDS = "${@bb.utils.contains('PREFERRED_PROVIDER_virtual/kernel', 'linux-gbmc', 'linux-gbmc', 'linux-nuvoton', d)}"
FILESEXTRAPATHS:prepend:= "${THISDIR}/files:"
SRC_URI:npcm7xx += " file://gbmc-mini_npcm7xx.dts"