From a246464833a05ab4936cae5a1bb47c25f9ae1c37 Mon Sep 17 00:00:00 2001 From: huangwenhua Date: Mon, 29 Apr 2024 16:50:28 +0800 Subject: [PATCH 1/2] Fix "grep: warning: stray \ before -" --- kdump-lib.sh | 10 +++++----- kdumpctl | 4 ++-- kexec-tools.spec | 5 ++++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/kdump-lib.sh b/kdump-lib.sh index b079f27..04429ef 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -44,7 +44,7 @@ is_nfs_dump_target() return 0; fi - if is_fs_type_nfs $(get_dracut_args_fstype "$(grep "^dracut_args .*\-\-mount" /etc/kdump.conf)"); then + if is_fs_type_nfs $(get_dracut_args_fstype "$(grep "^dracut_args .*--mount" /etc/kdump.conf)"); then return 0 fi @@ -127,7 +127,7 @@ get_user_configured_dump_disk() _target=$(egrep "^ext[234]|^xfs|^btrfs|^minix|^raw" /etc/kdump.conf 2>/dev/null |awk '{print $2}') [ -n "$_target" ] && echo $_target && return - _target=$(get_dracut_args_target "$(grep "^dracut_args .*\-\-mount" /etc/kdump.conf)") + _target=$(get_dracut_args_target "$(grep "^dracut_args .*--mount" /etc/kdump.conf)") [ -b "$_target" ] && echo $_target } @@ -448,19 +448,19 @@ is_wdt_mod_omitted() { # its correctness). is_mount_in_dracut_args() { - grep -q "^dracut_args .*\-\-mount" /etc/kdump.conf + grep -q "^dracut_args .*--mount" /etc/kdump.conf } # If $1 contains dracut_args "--mount", return get_dracut_args_fstype() { - echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f3 + echo $1 | grep "\--mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f3 } # If $1 contains dracut_args "--mount", return get_dracut_args_target() { - echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f1 + echo $1 | grep "\--mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f1 } check_crash_mem_reserved() diff --git a/kdumpctl b/kdumpctl index 00c0064..fc50b2a 100755 --- a/kdumpctl +++ b/kdumpctl @@ -227,7 +227,7 @@ check_config() return 1 } - nr=$(grep "^dracut_args .*\-\-mount" $KDUMP_CONFIG_FILE | grep -o "\-\-mount" | wc -l) + nr=$(grep "^dracut_args .*--mount" $KDUMP_CONFIG_FILE | grep -o "\--mount" | wc -l) [ $nr -gt 1 ] && { echo "Multiple mount targets specified in one \"dracut_args\"." return 1 @@ -492,7 +492,7 @@ check_dump_fs_modified() # if --mount argument present then match old and new target, mount # point and file system. If any of them mismatches then rebuild - echo $_dracut_args | grep "\-\-mount" &> /dev/null + echo $_dracut_args | grep "\--mount" &> /dev/null if [[ $? -eq 0 ]];then set -- $(echo $_dracut_args | awk -F "--mount '" '{print $2}' | cut -d' ' -f1,2,3) _old_dev=$1 diff --git a/kexec-tools.spec b/kexec-tools.spec index ea846c9..9048a09 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -4,7 +4,7 @@ Name: kexec-tools Version: 2.0.26 -Release: 2 +Release: 4 License: GPLv2 Summary: The kexec/kdump userspace component URL: https://www.kernel.org/ @@ -284,6 +284,9 @@ done %endif %changelog +* Mon Apr 29 2024 huangwenhua - 2.0.26-4 +- Fix "grep: warning: stray \ before -" + * Mon Jan 30 2023 chenhaixiang - 2.0.26-3 - update makedumpfile to makedumpfile-1.7.3 -- Gitee From ffe01a7985c35ab04836d1995d7a86a9d34c01e1 Mon Sep 17 00:00:00 2001 From: huangwenhua Date: Mon, 13 May 2024 16:17:55 +0800 Subject: [PATCH 2/2] Add loongarch iomem.h Fix "grep: warning: stray \ before -" --- Add-loongarch-iomem.h.patch | 29 +++++++++++++++++++++++++++++ kdump-lib.sh | 10 +++++----- kdumpctl | 4 ++-- kexec-tools.spec | 12 +++++++++++- 4 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 Add-loongarch-iomem.h.patch diff --git a/Add-loongarch-iomem.h.patch b/Add-loongarch-iomem.h.patch new file mode 100644 index 0000000..137ed9b --- /dev/null +++ b/Add-loongarch-iomem.h.patch @@ -0,0 +1,29 @@ +From 7a26c60ffa31f54606063855348a4c6aaeabfe13 Mon Sep 17 00:00:00 2001 +From: huangwenhua +Date: Mon, 13 May 2024 11:43:20 +0800 +Subject: [PATCH] Add loongarch/iomem.h + +--- + kexec/arch/loongarch/iomem.h | 10 ++++++++++ + 1 file changed, 10 insertions(+) + create mode 100644 kexec/arch/loongarch/iomem.h + +diff --git a/kexec/arch/loongarch/iomem.h b/kexec/arch/loongarch/iomem.h +new file mode 100644 +index 0000000..7671e26 +--- /dev/null ++++ b/kexec/arch/loongarch/iomem.h +@@ -0,0 +1,10 @@ ++#ifndef IOMEM_H ++#define IOMEM_H ++ ++#define SYSTEM_RAM "System RAM\n" ++#define KERNEL_CODE "Kernel code\n" ++#define KERNEL_DATA "Kernel data\n" ++#define CRASH_KERNEL "Crash kernel\n" ++#define IOMEM_RESERVED "Reserved\n" ++ ++#endif +-- +2.43.0 + diff --git a/kdump-lib.sh b/kdump-lib.sh index b079f27..04429ef 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -44,7 +44,7 @@ is_nfs_dump_target() return 0; fi - if is_fs_type_nfs $(get_dracut_args_fstype "$(grep "^dracut_args .*\-\-mount" /etc/kdump.conf)"); then + if is_fs_type_nfs $(get_dracut_args_fstype "$(grep "^dracut_args .*--mount" /etc/kdump.conf)"); then return 0 fi @@ -127,7 +127,7 @@ get_user_configured_dump_disk() _target=$(egrep "^ext[234]|^xfs|^btrfs|^minix|^raw" /etc/kdump.conf 2>/dev/null |awk '{print $2}') [ -n "$_target" ] && echo $_target && return - _target=$(get_dracut_args_target "$(grep "^dracut_args .*\-\-mount" /etc/kdump.conf)") + _target=$(get_dracut_args_target "$(grep "^dracut_args .*--mount" /etc/kdump.conf)") [ -b "$_target" ] && echo $_target } @@ -448,19 +448,19 @@ is_wdt_mod_omitted() { # its correctness). is_mount_in_dracut_args() { - grep -q "^dracut_args .*\-\-mount" /etc/kdump.conf + grep -q "^dracut_args .*--mount" /etc/kdump.conf } # If $1 contains dracut_args "--mount", return get_dracut_args_fstype() { - echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f3 + echo $1 | grep "\--mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f3 } # If $1 contains dracut_args "--mount", return get_dracut_args_target() { - echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f1 + echo $1 | grep "\--mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f1 } check_crash_mem_reserved() diff --git a/kdumpctl b/kdumpctl index 00c0064..fc50b2a 100755 --- a/kdumpctl +++ b/kdumpctl @@ -227,7 +227,7 @@ check_config() return 1 } - nr=$(grep "^dracut_args .*\-\-mount" $KDUMP_CONFIG_FILE | grep -o "\-\-mount" | wc -l) + nr=$(grep "^dracut_args .*--mount" $KDUMP_CONFIG_FILE | grep -o "\--mount" | wc -l) [ $nr -gt 1 ] && { echo "Multiple mount targets specified in one \"dracut_args\"." return 1 @@ -492,7 +492,7 @@ check_dump_fs_modified() # if --mount argument present then match old and new target, mount # point and file system. If any of them mismatches then rebuild - echo $_dracut_args | grep "\-\-mount" &> /dev/null + echo $_dracut_args | grep "\--mount" &> /dev/null if [[ $? -eq 0 ]];then set -- $(echo $_dracut_args | awk -F "--mount '" '{print $2}' | cut -d' ' -f1,2,3) _old_dev=$1 diff --git a/kexec-tools.spec b/kexec-tools.spec index 70c4646..334ed96 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -4,7 +4,7 @@ Name: kexec-tools Version: 2.0.26 -Release: 4 +Release: 6 License: GPLv2 Summary: The kexec/kdump userspace component URL: https://www.kernel.org/ @@ -84,6 +84,10 @@ Patch0006: kexec-tools-Add-riscv-support.patch Patch0007: riscv-makedumpfile-1.7.3.patch %endif +%ifarch loongarch64 +Patch0008: Add-loongarch-iomem.h.patch +%endif + %description kexec-tools provides /sbin/kexec binary that facilitates a new kernel to boot using the kernel's kexec feature either on a @@ -295,6 +299,12 @@ done %endif %changelog +* Fri May 17 2024 Wenhua Huang - 2.0.26-6 +- Fix "grep: warning: stray \ before -" + +* Mon May 13 2024 Wenhua Huang - 2.0.26-5 +- Add loongarch iomem.h + * Thu Apr 18 2024 Mingzheng Xing - 2.0.26-4 - Add riscv64 support -- Gitee