diff --git a/kpatch.spec b/kpatch.spec index 465ddd6..e5bee95 100644 --- a/kpatch.spec +++ b/kpatch.spec @@ -3,7 +3,7 @@ Name: kpatch Epoch: 1 Version: %{raw_version} -Release: 2 +Release: 3 Summary: A Linux dynamic kernel patching infrastructure License: GPLv2 @@ -95,6 +95,12 @@ popd %{_mandir}/man1/*.1.gz %changelog +* Sat Aug 29 2020 Yeqing Peng -1:0.9.1-3 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:adapt kernel source path and name + * Wed Apr 22 2020 Zhipeng Xie -1:0.9.1-2 - Type:bugfix - ID:NA diff --git a/make_hotpatch b/make_hotpatch index fb8c37a..8c06051 100644 --- a/make_hotpatch +++ b/make_hotpatch @@ -690,24 +690,28 @@ function fn_main() function fn_prepare() { + local src_dir="" kerver=`uname -r` - kerver=${kerver%.x86_64} - kerver=${kerver%.aarch64} + if [ ! -d /usr/src/linux-$kerver ];then + kerver=${kerver%.x86_64} + kerver=${kerver%.aarch64} + src_dir="kernels" + fi echo kernel version:$kerver if [ ! -L kernel-source ];then if [ -d /arm/arm_kernel ];then ln -s /arm/arm_kernel/linux-$kerver kernel-source else - ln -s /usr/src/kernels/linux-$kerver kernel-source - cp /lib/modules/`uname -r`/build/Makefile /usr/src/kernels/linux-$kerver + ln -s /usr/src/$src_dir/linux-$kerver kernel-source + cp /lib/modules/`uname -r`/build/Makefile /usr/src/$src_dir/linux-$kerver fi fi if [ ! -L .config ];then if [ -d /arm/arm_kernel ];then ln -s /arm/arm_kernel/linux-$kerver/.config .config else - ln -s /usr/src/kernels/linux-$kerver/.config .config - cp /lib/modules/`uname -r`/build/.config /usr/src/kernels/linux-$kerver + ln -s /usr/src/$src_dir/linux-$kerver/.config .config + cp /lib/modules/`uname -r`/build/.config /usr/src/$src_dir/linux-$kerver fi fi rm -rf $G_KPATCH_FLAGS