Enable kabi checking and adapt the check-kabi script

https://gitee.com/openeuler/kernel/issues/I8HR0P

Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
This commit is contained in:
Zheng Zengkai 2023-12-12 20:41:09 +08:00 committed by Jialin Zhang
parent 9e8860989c
commit 17c9729062
2 changed files with 13 additions and 9 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# #
# check-kabi - Red Hat kABI reference checking tool # check-kabi - Red Hat kABI reference checking tool
# #
@ -41,7 +41,7 @@ def load_symvers(symvers,filename):
break break
if in_line == "\n": if in_line == "\n":
continue continue
checksum,symbol,directory,type = in_line.split() checksum,symbol,directory,type,namespace = in_line.split('\t')
symvers[symbol] = in_line[0:-1] symvers[symbol] = in_line[0:-1]
@ -56,7 +56,7 @@ def load_kabi(kabi,filename):
break break
if in_line == "\n": if in_line == "\n":
continue continue
checksum,symbol,directory,type = in_line.split() checksum,symbol,directory,type,namespace = in_line.split('\t')
kabi[symbol] = in_line[0:-1] kabi[symbol] = in_line[0:-1]
@ -71,9 +71,9 @@ def check_kabi(symvers,kabi):
losted_symbols=[] losted_symbols=[]
for symbol in kabi: for symbol in kabi:
abi_hash,abi_sym,abi_dir,abi_type = kabi[symbol].split() abi_hash,abi_sym,abi_dir,abi_type,abi_namespace = kabi[symbol].split('\t')
if symbol in symvers: if symbol in symvers:
sym_hash,sym_sym,sym_dir,sym_type = symvers[symbole].split() sym_hash,sym_sym,sym_dir,sym_type,sym_namespace = symvers[symbol].split('\t')
if abi_hash != sym_hash: if abi_hash != sym_hash:
fail=1 fail=1
changed_symbols.append(symbol) changed_symbols.append(symbol)

View File

@ -1,5 +1,5 @@
%define with_signmodules 1 %define with_signmodules 1
%define with_kabichk 0 %define with_kabichk 1
%define modsign_cmd %{SOURCE10} %define modsign_cmd %{SOURCE10}
@ -64,6 +64,7 @@ Source15: process_pgp_certs.sh
%if 0%{?with_kabichk} %if 0%{?with_kabichk}
Source18: check-kabi Source18: check-kabi
Source20: Module.kabi_aarch64 Source20: Module.kabi_aarch64
Source21: Module.kabi_x86_64
%endif %endif
Source200: mkgrub-menu-aarch64.sh Source200: mkgrub-menu-aarch64.sh
@ -358,8 +359,7 @@ make ARCH=%{Arch} modules %{?_smp_mflags}
%if 0%{?with_kabichk} %if 0%{?with_kabichk}
chmod 0755 %{SOURCE18} chmod 0755 %{SOURCE18}
if [ -e $RPM_SOURCE_DIR/Module.kabi_%{_target_cpu} ]; then if [ -e $RPM_SOURCE_DIR/Module.kabi_%{_target_cpu} ]; then
##%{SOURCE18} -k $RPM_SOURCE_DIR/Module.kabi_%{_target_cpu} -s Module.symvers || exit 1 %{SOURCE18} -k $RPM_SOURCE_DIR/Module.kabi_%{_target_cpu} -s Module.symvers || exit 1
echo "**** NOTE: now don't check Kabi. ****"
else else
echo "**** NOTE: Cannot find reference Module.kabi file. ****" echo "**** NOTE: Cannot find reference Module.kabi file. ****"
fi fi
@ -473,7 +473,9 @@ popd
install -m 644 .config $RPM_BUILD_ROOT/boot/config-%{KernelVer} install -m 644 .config $RPM_BUILD_ROOT/boot/config-%{KernelVer}
install -m 644 System.map $RPM_BUILD_ROOT/boot/System.map-%{KernelVer} install -m 644 System.map $RPM_BUILD_ROOT/boot/System.map-%{KernelVer}
gzip -c9 < Module.symvers > $RPM_BUILD_ROOT/boot/symvers-%{KernelVer}.gz %if 0%{?with_kabichk}
gzip -c9 < Module.symvers > $RPM_BUILD_ROOT/boot/symvers-%{KernelVer}.gz
%endif
mkdir -p $RPM_BUILD_ROOT%{_sbindir} mkdir -p $RPM_BUILD_ROOT%{_sbindir}
install -m 755 %{SOURCE200} $RPM_BUILD_ROOT%{_sbindir}/mkgrub-menu-%{devel_release}.sh install -m 755 %{SOURCE200} $RPM_BUILD_ROOT%{_sbindir}/mkgrub-menu-%{devel_release}.sh
@ -801,7 +803,9 @@ fi
%ifarch aarch64 %ifarch aarch64
/boot/dtb-* /boot/dtb-*
%endif %endif
%if 0%{?with_kabichk}
/boot/symvers-* /boot/symvers-*
%endif
/boot/System.map-* /boot/System.map-*
/boot/vmlinuz-* /boot/vmlinuz-*
%ghost /boot/initramfs-%{KernelVer}.img %ghost /boot/initramfs-%{KernelVer}.img