diff --git a/dtb-aarch64.changes b/dtb-aarch64.changes index 3d9f1ec1..dcc6ac54 100644 --- a/dtb-aarch64.changes +++ b/dtb-aarch64.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/dtb-aarch64.spec b/dtb-aarch64.spec index 636c5025..8971df34 100644 --- a/dtb-aarch64.spec +++ b/dtb-aarch64.spec @@ -31,7 +31,7 @@ Name: dtb-aarch64 Version: 5.13.12 %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif diff --git a/dtb-armv6l.changes b/dtb-armv6l.changes index 3d9f1ec1..dcc6ac54 100644 --- a/dtb-armv6l.changes +++ b/dtb-armv6l.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/dtb-armv6l.spec b/dtb-armv6l.spec index 50fa18dc..c8674044 100644 --- a/dtb-armv6l.spec +++ b/dtb-armv6l.spec @@ -31,7 +31,7 @@ Name: dtb-armv6l Version: 5.13.12 %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif diff --git a/dtb-armv7l.changes b/dtb-armv7l.changes index 3d9f1ec1..dcc6ac54 100644 --- a/dtb-armv7l.changes +++ b/dtb-armv7l.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/dtb-armv7l.spec b/dtb-armv7l.spec index 935fe7b8..aace3adb 100644 --- a/dtb-armv7l.spec +++ b/dtb-armv7l.spec @@ -31,7 +31,7 @@ Name: dtb-armv7l Version: 5.13.12 %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif diff --git a/dtb-riscv64.changes b/dtb-riscv64.changes index 3d9f1ec1..dcc6ac54 100644 --- a/dtb-riscv64.changes +++ b/dtb-riscv64.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/dtb-riscv64.spec b/dtb-riscv64.spec index 72867576..bd9b7fc9 100644 --- a/dtb-riscv64.spec +++ b/dtb-riscv64.spec @@ -31,7 +31,7 @@ Name: dtb-riscv64 Version: 5.13.12 %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif diff --git a/kernel-64kb.changes b/kernel-64kb.changes index 3d9f1ec1..dcc6ac54 100644 --- a/kernel-64kb.changes +++ b/kernel-64kb.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/kernel-64kb.spec b/kernel-64kb.spec index d6199a81..cd8d4ac8 100644 --- a/kernel-64kb.spec +++ b/kernel-64kb.spec @@ -68,13 +68,27 @@ %define install_vdso 0 %endif +# TW is usrmerged +%if %{undefined usrmerged} && 0%{?suse_version} >= 1550 +%define usrmerged 1 +%endif + +%if 0%{?usrmerged} +%define modules_dir /usr/lib/modules/%kernelrelease-%build_flavor +%define systemmap %{modules_dir}/System.map +%else +%define modules_dir /lib/modules/%kernelrelease-%build_flavor +%define systemmap /boot/System.map-%kernelrelease-%build_flavor +%endif + + Name: kernel-64kb Summary: Kernel with 64kb PAGE_SIZE License: GPL-2.0-only Group: System/Kernel Version: 5.13.12 %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif @@ -191,10 +205,10 @@ Conflicts: hyper-v < 4 Conflicts: libc.so.6()(64bit) %endif Provides: kernel = %version-%source_rel -Provides: kernel-%build_flavor-base-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 -Provides: kernel-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: kernel-%build_flavor-base-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 +Provides: kernel-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 # END COMMON DEPS -Provides: %name-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: %name-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 %obsolete_rebuilds %name Source0: http://www.kernel.org/pub/linux/kernel/v5.x/linux-%srcversion.tar.xz Source2: source-post.sh @@ -616,6 +630,14 @@ done %install +%if 0%{?usrmerged} +# add symlink for usrmerge so install scripts will just follow the +# link and end up placing files in /usr/lib. The link will be +# removed later and is not packaged here. +mkdir -p %{buildroot}/usr/lib +ln -s usr/lib %{buildroot}/lib +%endif + # get rid of /usr/lib/rpm/brp-strip-debug # strip removes too much from the vmlinux ELF binary export NO_BRP_STRIP_DEBUG=true @@ -711,11 +733,19 @@ add_vmlinux() # sign the modules, firmware and possibly the kernel in the buildservice BRP_PESIGN_FILES="" %if "%CONFIG_EFI_STUB" == "y" +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %ifarch s390x ppc64 ppc64le +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %if "%CONFIG_MODULE_SIG" == "y" BRP_PESIGN_FILES="$BRP_PESIGN_FILES *.ko" %endif @@ -777,6 +807,13 @@ for sub in '' '-extra' \ -e "s:@RPM_TARGET_CPU@:%_target_cpu:g" \ -e "s:@CPU_ARCH_FLAVOR@:%cpu_arch_flavor:g" \ -e "s:@SRCVARIANT@:%variant:g" \ + -e "s:@MODULESDIR@:%modules_dir:g" \ + -e "s:@SYSTEMMAP@:%systemmap:g" \ +%if 0%{?usrmerged} + -e "s:^@USRMERGE@::" \ +%else + -e "/^@USRMERGE@/d" \ +%endif %_sourcedir/$script.sh > %my_builddir/$script$sub.sh if test "$base_package" -eq 1 -a "${#certs[@]}" -gt 0; then case "$script" in @@ -983,6 +1020,10 @@ if [ %CONFIG_MODULES = y ]; then fi rm -rf %{buildroot}/lib/firmware +%if 0%{?usrmerged} +# remove usrmerge aid +rm %{buildroot}/lib +%endif add_dirs_to_filelist() { sed -rn ' @@ -995,7 +1036,7 @@ add_dirs_to_filelist() { # print all parents :a # skip directories owned by other packages - s:^%%dir (/boot|/etc|/lib/(modules|firmware)|/usr/src)/[^/]+$:: + s:^%%dir (/boot|/etc|(/usr)?/lib/(modules|firmware)|/usr/src)/[^/]+$:: s:/[^/]+$::p ta ' "$@" | sort -u @@ -1012,10 +1053,23 @@ fi %endif shopt -s nullglob dotglob > %my_builddir/kernel-devel.files -for file in %buildroot/boot/symtypes* %buildroot/lib/modules/*/{build,source}; do - f=${file##%buildroot} - echo "$f" -done | add_dirs_to_filelist >%my_builddir/kernel-devel.files +{ + echo "%modules_dir/build" + echo "%modules_dir/source" + cd %buildroot + for file in boot/symtypes*; do +%if 0%{?usrmerged} + l="${file##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" + mv "$file" "%{buildroot}$l" + ln -s "..$l" $file + echo "$l" + echo "%%ghost /$file" +%else + echo "/$file" +%endif + done +} | add_dirs_to_filelist >%my_builddir/kernel-devel.files ( cd %buildroot ; find .%obj_install_dir/%cpu_arch_flavor -type f ; ) | \ sed -e 's/^[.]//' | grep -v -e '[.]ipa-clones$' -e '/Symbols[.]list$' -e '/ipa-clones[.]list$'| \ add_dirs_to_filelist >> %my_builddir/kernel-devel.files @@ -1024,6 +1078,8 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files echo %ghost /boot/initrd$suffix cd %buildroot for f in boot/*; do + l="${f##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" if test -L "$f"; then echo "%%ghost /$f" continue @@ -1039,24 +1095,46 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files ;; boot/vmlinux-*) if $ghost_vmlinux; then - echo "%%ghost /$f" - continue + # fall through to mark next echo as %ghost + echo -n "%%ghost " fi ;; +%if 0%{?usrmerged} + boot/vmlinuz-*) + echo -n "%%attr(0644, root, root) " + ;; +%endif boot/symtypes*) +%if 0%{?usrmerged} + echo "%exclude $l" +%endif continue ;; esac +%if 0%{?usrmerged} + mv "$f" "./$l" + ln -s "..$l" $f + # the find in the CONFIG_MODULES condition below also finds the files + # but there's sort -u later, so this is ok + echo "$l" # note: must be first after case statement above + echo "%%ghost /$f" +%else echo "%%attr(0644, root, root) /$f" +%endif done if [ %CONFIG_MODULES = y ]; then - find lib/modules/%kernelrelease-%build_flavor \ + find %{?usrmerged:usr/}lib/modules/%kernelrelease-%build_flavor \ -type d -o \ \( -path '*/modules.*' ! -path '*/modules.order' \ ! -path '*/modules.builtin' \ ! -path '*/modules.builtin.modinfo' \) -printf '%%%%ghost /%%p\n' \ - -o -name '*.ko' -prune -o -type f -printf '/%%p\n' + -o -name '*.ko' -prune \ +%if 0%{?usrmerged} + -o \( -type f ! -path '*/symtypes*' ! -path '*/vmlinu*' \) -printf '/%%p\n' +%else + -o -type f -printf '/%%p\n' +%endif cat %my_builddir/base-modules fi if test %CONFIG_MODULE_SIG = "y" -a -d etc/uefi/certs; then @@ -1117,15 +1195,15 @@ for f in %my_builddir/*-kmp-modules; do done if [ %CONFIG_MODULES = y ]; then - install -m 644 %_sourcedir/modules.fips %{buildroot}/lib/modules/%kernelrelease-%build_flavor/modules.fips - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-base.files - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-main.files + install -m 644 %_sourcedir/modules.fips %{buildroot}%modules_dir/modules.fips + echo %modules_dir/modules.fips >> %my_builddir/kernel-base.files + echo %modules_dir/modules.fips >> %my_builddir/kernel-main.files fi # Hardlink duplicate files automatically (from package fdupes): It doesn't save # much, but it keeps rpmlint from breaking the package build. Note that we skip # /usr/src/linux-obj intentionally, to not accidentally break timestamps there -%fdupes $RPM_BUILD_ROOT/lib +%fdupes %buildroot%modules_dir %preun -f preun.sh @@ -1311,7 +1389,7 @@ static, unlike the %{patch_package}--flavor package names. %files %{livepatch} # rpmlint complains about empty packages, so lets own something %defattr(-, root, root) -%dir /lib/modules/%kernelrelease-%build_flavor +%dir %modules_dir %endif %if 0%{?klp_symbols} && "%livepatch" != "" diff --git a/kernel-binary.spec.in b/kernel-binary.spec.in index 89f4e437..33b72671 100644 --- a/kernel-binary.spec.in +++ b/kernel-binary.spec.in @@ -68,6 +68,20 @@ %define install_vdso 0 %endif +# TW is usrmerged +%if %{undefined usrmerged} && 0%{?suse_version} >= 1550 +%define usrmerged 1 +%endif + +%if 0%{?usrmerged} +%define modules_dir /usr/lib/modules/%kernelrelease-%build_flavor +%define systemmap %{modules_dir}/System.map +%else +%define modules_dir /lib/modules/%kernelrelease-%build_flavor +%define systemmap /boot/System.map-%kernelrelease-%build_flavor +%endif + + Name: kernel-@FLAVOR@ Summary: @SUMMARY@ License: GPL-2.0-only @@ -471,6 +485,14 @@ done %install +%if 0%{?usrmerged} +# add symlink for usrmerge so install scripts will just follow the +# link and end up placing files in /usr/lib. The link will be +# removed later and is not packaged here. +mkdir -p %{buildroot}/usr/lib +ln -s usr/lib %{buildroot}/lib +%endif + # get rid of /usr/lib/rpm/brp-strip-debug # strip removes too much from the vmlinux ELF binary export NO_BRP_STRIP_DEBUG=true @@ -566,11 +588,19 @@ add_vmlinux() # sign the modules, firmware and possibly the kernel in the buildservice BRP_PESIGN_FILES="" %if "%CONFIG_EFI_STUB" == "y" +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %ifarch s390x ppc64 ppc64le +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %if "%CONFIG_MODULE_SIG" == "y" BRP_PESIGN_FILES="$BRP_PESIGN_FILES *.ko" %endif @@ -632,6 +662,13 @@ for sub in '' '-extra' \ -e "s:@RPM_TARGET_CPU@:%_target_cpu:g" \ -e "s:@CPU_ARCH_FLAVOR@:%cpu_arch_flavor:g" \ -e "s:@SRCVARIANT@:%variant:g" \ + -e "s:@MODULESDIR@:%modules_dir:g" \ + -e "s:@SYSTEMMAP@:%systemmap:g" \ +%if 0%{?usrmerged} + -e "s:^@USRMERGE@::" \ +%else + -e "/^@USRMERGE@/d" \ +%endif %_sourcedir/$script.sh > %my_builddir/$script$sub.sh if test "$base_package" -eq 1 -a "${#certs[@]}" -gt 0; then case "$script" in @@ -838,6 +875,10 @@ if [ %CONFIG_MODULES = y ]; then fi rm -rf %{buildroot}/lib/firmware +%if 0%{?usrmerged} +# remove usrmerge aid +rm %{buildroot}/lib +%endif add_dirs_to_filelist() { sed -rn ' @@ -850,7 +891,7 @@ add_dirs_to_filelist() { # print all parents :a # skip directories owned by other packages - s:^%%dir (/boot|/etc|/lib/(modules|firmware)|/usr/src)/[^/]+$:: + s:^%%dir (/boot|/etc|(/usr)?/lib/(modules|firmware)|/usr/src)/[^/]+$:: s:/[^/]+$::p ta ' "$@" | sort -u @@ -867,10 +908,23 @@ fi %endif shopt -s nullglob dotglob > %my_builddir/kernel-devel.files -for file in %buildroot/boot/symtypes* %buildroot/lib/modules/*/{build,source}; do - f=${file##%buildroot} - echo "$f" -done | add_dirs_to_filelist >%my_builddir/kernel-devel.files +{ + echo "%modules_dir/build" + echo "%modules_dir/source" + cd %buildroot + for file in boot/symtypes*; do +%if 0%{?usrmerged} + l="${file##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" + mv "$file" "%{buildroot}$l" + ln -s "..$l" $file + echo "$l" + echo "%%ghost /$file" +%else + echo "/$file" +%endif + done +} | add_dirs_to_filelist >%my_builddir/kernel-devel.files ( cd %buildroot ; find .%obj_install_dir/%cpu_arch_flavor -type f ; ) | \ sed -e 's/^[.]//' | grep -v -e '[.]ipa-clones$' -e '/Symbols[.]list$' -e '/ipa-clones[.]list$'| \ add_dirs_to_filelist >> %my_builddir/kernel-devel.files @@ -879,6 +933,8 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files echo %ghost /boot/initrd$suffix cd %buildroot for f in boot/*; do + l="${f##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" if test -L "$f"; then echo "%%ghost /$f" continue @@ -894,24 +950,46 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files ;; boot/vmlinux-*) if $ghost_vmlinux; then - echo "%%ghost /$f" - continue + # fall through to mark next echo as %ghost + echo -n "%%ghost " fi ;; +%if 0%{?usrmerged} + boot/vmlinuz-*) + echo -n "%%attr(0644, root, root) " + ;; +%endif boot/symtypes*) +%if 0%{?usrmerged} + echo "%exclude $l" +%endif continue ;; esac +%if 0%{?usrmerged} + mv "$f" "./$l" + ln -s "..$l" $f + # the find in the CONFIG_MODULES condition below also finds the files + # but there's sort -u later, so this is ok + echo "$l" # note: must be first after case statement above + echo "%%ghost /$f" +%else echo "%%attr(0644, root, root) /$f" +%endif done if [ %CONFIG_MODULES = y ]; then - find lib/modules/%kernelrelease-%build_flavor \ + find %{?usrmerged:usr/}lib/modules/%kernelrelease-%build_flavor \ -type d -o \ \( -path '*/modules.*' ! -path '*/modules.order' \ ! -path '*/modules.builtin' \ ! -path '*/modules.builtin.modinfo' \) -printf '%%%%ghost /%%p\n' \ - -o -name '*.ko' -prune -o -type f -printf '/%%p\n' + -o -name '*.ko' -prune \ +%if 0%{?usrmerged} + -o \( -type f ! -path '*/symtypes*' ! -path '*/vmlinu*' \) -printf '/%%p\n' +%else + -o -type f -printf '/%%p\n' +%endif cat %my_builddir/base-modules fi if test %CONFIG_MODULE_SIG = "y" -a -d etc/uefi/certs; then @@ -972,15 +1050,15 @@ for f in %my_builddir/*-kmp-modules; do done if [ %CONFIG_MODULES = y ]; then - install -m 644 %_sourcedir/modules.fips %{buildroot}/lib/modules/%kernelrelease-%build_flavor/modules.fips - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-base.files - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-main.files + install -m 644 %_sourcedir/modules.fips %{buildroot}%modules_dir/modules.fips + echo %modules_dir/modules.fips >> %my_builddir/kernel-base.files + echo %modules_dir/modules.fips >> %my_builddir/kernel-main.files fi # Hardlink duplicate files automatically (from package fdupes): It doesn't save # much, but it keeps rpmlint from breaking the package build. Note that we skip # /usr/src/linux-obj intentionally, to not accidentally break timestamps there -%fdupes $RPM_BUILD_ROOT/lib +%fdupes %buildroot%modules_dir %preun -f preun.sh @@ -1163,7 +1241,7 @@ static, unlike the %{patch_package}--flavor package names. %files %{livepatch} # rpmlint complains about empty packages, so lets own something %defattr(-, root, root) -%dir /lib/modules/%kernelrelease-%build_flavor +%dir %modules_dir %endif %if 0%{?klp_symbols} && "%livepatch" != "" diff --git a/kernel-debug.changes b/kernel-debug.changes index 3d9f1ec1..dcc6ac54 100644 --- a/kernel-debug.changes +++ b/kernel-debug.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/kernel-debug.spec b/kernel-debug.spec index 3183db52..7416fe1b 100644 --- a/kernel-debug.spec +++ b/kernel-debug.spec @@ -68,13 +68,27 @@ %define install_vdso 0 %endif +# TW is usrmerged +%if %{undefined usrmerged} && 0%{?suse_version} >= 1550 +%define usrmerged 1 +%endif + +%if 0%{?usrmerged} +%define modules_dir /usr/lib/modules/%kernelrelease-%build_flavor +%define systemmap %{modules_dir}/System.map +%else +%define modules_dir /lib/modules/%kernelrelease-%build_flavor +%define systemmap /boot/System.map-%kernelrelease-%build_flavor +%endif + + Name: kernel-debug Summary: A Debug Version of the Kernel License: GPL-2.0-only Group: System/Kernel Version: 5.13.12 %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif @@ -191,10 +205,10 @@ Conflicts: hyper-v < 4 Conflicts: libc.so.6()(64bit) %endif Provides: kernel = %version-%source_rel -Provides: kernel-%build_flavor-base-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 -Provides: kernel-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: kernel-%build_flavor-base-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 +Provides: kernel-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 # END COMMON DEPS -Provides: %name-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: %name-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 %ifarch ppc64 Provides: kernel-kdump = 2.6.28 Obsoletes: kernel-kdump <= 2.6.28 @@ -622,6 +636,14 @@ done %install +%if 0%{?usrmerged} +# add symlink for usrmerge so install scripts will just follow the +# link and end up placing files in /usr/lib. The link will be +# removed later and is not packaged here. +mkdir -p %{buildroot}/usr/lib +ln -s usr/lib %{buildroot}/lib +%endif + # get rid of /usr/lib/rpm/brp-strip-debug # strip removes too much from the vmlinux ELF binary export NO_BRP_STRIP_DEBUG=true @@ -717,11 +739,19 @@ add_vmlinux() # sign the modules, firmware and possibly the kernel in the buildservice BRP_PESIGN_FILES="" %if "%CONFIG_EFI_STUB" == "y" +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %ifarch s390x ppc64 ppc64le +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %if "%CONFIG_MODULE_SIG" == "y" BRP_PESIGN_FILES="$BRP_PESIGN_FILES *.ko" %endif @@ -783,6 +813,13 @@ for sub in '' '-extra' \ -e "s:@RPM_TARGET_CPU@:%_target_cpu:g" \ -e "s:@CPU_ARCH_FLAVOR@:%cpu_arch_flavor:g" \ -e "s:@SRCVARIANT@:%variant:g" \ + -e "s:@MODULESDIR@:%modules_dir:g" \ + -e "s:@SYSTEMMAP@:%systemmap:g" \ +%if 0%{?usrmerged} + -e "s:^@USRMERGE@::" \ +%else + -e "/^@USRMERGE@/d" \ +%endif %_sourcedir/$script.sh > %my_builddir/$script$sub.sh if test "$base_package" -eq 1 -a "${#certs[@]}" -gt 0; then case "$script" in @@ -989,6 +1026,10 @@ if [ %CONFIG_MODULES = y ]; then fi rm -rf %{buildroot}/lib/firmware +%if 0%{?usrmerged} +# remove usrmerge aid +rm %{buildroot}/lib +%endif add_dirs_to_filelist() { sed -rn ' @@ -1001,7 +1042,7 @@ add_dirs_to_filelist() { # print all parents :a # skip directories owned by other packages - s:^%%dir (/boot|/etc|/lib/(modules|firmware)|/usr/src)/[^/]+$:: + s:^%%dir (/boot|/etc|(/usr)?/lib/(modules|firmware)|/usr/src)/[^/]+$:: s:/[^/]+$::p ta ' "$@" | sort -u @@ -1018,10 +1059,23 @@ fi %endif shopt -s nullglob dotglob > %my_builddir/kernel-devel.files -for file in %buildroot/boot/symtypes* %buildroot/lib/modules/*/{build,source}; do - f=${file##%buildroot} - echo "$f" -done | add_dirs_to_filelist >%my_builddir/kernel-devel.files +{ + echo "%modules_dir/build" + echo "%modules_dir/source" + cd %buildroot + for file in boot/symtypes*; do +%if 0%{?usrmerged} + l="${file##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" + mv "$file" "%{buildroot}$l" + ln -s "..$l" $file + echo "$l" + echo "%%ghost /$file" +%else + echo "/$file" +%endif + done +} | add_dirs_to_filelist >%my_builddir/kernel-devel.files ( cd %buildroot ; find .%obj_install_dir/%cpu_arch_flavor -type f ; ) | \ sed -e 's/^[.]//' | grep -v -e '[.]ipa-clones$' -e '/Symbols[.]list$' -e '/ipa-clones[.]list$'| \ add_dirs_to_filelist >> %my_builddir/kernel-devel.files @@ -1030,6 +1084,8 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files echo %ghost /boot/initrd$suffix cd %buildroot for f in boot/*; do + l="${f##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" if test -L "$f"; then echo "%%ghost /$f" continue @@ -1045,24 +1101,46 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files ;; boot/vmlinux-*) if $ghost_vmlinux; then - echo "%%ghost /$f" - continue + # fall through to mark next echo as %ghost + echo -n "%%ghost " fi ;; +%if 0%{?usrmerged} + boot/vmlinuz-*) + echo -n "%%attr(0644, root, root) " + ;; +%endif boot/symtypes*) +%if 0%{?usrmerged} + echo "%exclude $l" +%endif continue ;; esac +%if 0%{?usrmerged} + mv "$f" "./$l" + ln -s "..$l" $f + # the find in the CONFIG_MODULES condition below also finds the files + # but there's sort -u later, so this is ok + echo "$l" # note: must be first after case statement above + echo "%%ghost /$f" +%else echo "%%attr(0644, root, root) /$f" +%endif done if [ %CONFIG_MODULES = y ]; then - find lib/modules/%kernelrelease-%build_flavor \ + find %{?usrmerged:usr/}lib/modules/%kernelrelease-%build_flavor \ -type d -o \ \( -path '*/modules.*' ! -path '*/modules.order' \ ! -path '*/modules.builtin' \ ! -path '*/modules.builtin.modinfo' \) -printf '%%%%ghost /%%p\n' \ - -o -name '*.ko' -prune -o -type f -printf '/%%p\n' + -o -name '*.ko' -prune \ +%if 0%{?usrmerged} + -o \( -type f ! -path '*/symtypes*' ! -path '*/vmlinu*' \) -printf '/%%p\n' +%else + -o -type f -printf '/%%p\n' +%endif cat %my_builddir/base-modules fi if test %CONFIG_MODULE_SIG = "y" -a -d etc/uefi/certs; then @@ -1123,15 +1201,15 @@ for f in %my_builddir/*-kmp-modules; do done if [ %CONFIG_MODULES = y ]; then - install -m 644 %_sourcedir/modules.fips %{buildroot}/lib/modules/%kernelrelease-%build_flavor/modules.fips - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-base.files - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-main.files + install -m 644 %_sourcedir/modules.fips %{buildroot}%modules_dir/modules.fips + echo %modules_dir/modules.fips >> %my_builddir/kernel-base.files + echo %modules_dir/modules.fips >> %my_builddir/kernel-main.files fi # Hardlink duplicate files automatically (from package fdupes): It doesn't save # much, but it keeps rpmlint from breaking the package build. Note that we skip # /usr/src/linux-obj intentionally, to not accidentally break timestamps there -%fdupes $RPM_BUILD_ROOT/lib +%fdupes %buildroot%modules_dir %preun -f preun.sh @@ -1325,7 +1403,7 @@ static, unlike the %{patch_package}--flavor package names. %files %{livepatch} # rpmlint complains about empty packages, so lets own something %defattr(-, root, root) -%dir /lib/modules/%kernelrelease-%build_flavor +%dir %modules_dir %endif %if 0%{?klp_symbols} && "%livepatch" != "" diff --git a/kernel-default.changes b/kernel-default.changes index 3d9f1ec1..dcc6ac54 100644 --- a/kernel-default.changes +++ b/kernel-default.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/kernel-default.spec b/kernel-default.spec index caffc275..569152e9 100644 --- a/kernel-default.spec +++ b/kernel-default.spec @@ -68,13 +68,27 @@ %define install_vdso 0 %endif +# TW is usrmerged +%if %{undefined usrmerged} && 0%{?suse_version} >= 1550 +%define usrmerged 1 +%endif + +%if 0%{?usrmerged} +%define modules_dir /usr/lib/modules/%kernelrelease-%build_flavor +%define systemmap %{modules_dir}/System.map +%else +%define modules_dir /lib/modules/%kernelrelease-%build_flavor +%define systemmap /boot/System.map-%kernelrelease-%build_flavor +%endif + + Name: kernel-default Summary: The Standard Kernel License: GPL-2.0-only Group: System/Kernel Version: 5.13.12 %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif @@ -191,10 +205,10 @@ Conflicts: hyper-v < 4 Conflicts: libc.so.6()(64bit) %endif Provides: kernel = %version-%source_rel -Provides: kernel-%build_flavor-base-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 -Provides: kernel-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: kernel-%build_flavor-base-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 +Provides: kernel-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 # END COMMON DEPS -Provides: %name-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: %name-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 %ifarch %ix86 Provides: kernel-smp = 2.6.17 Obsoletes: kernel-smp <= 2.6.17 @@ -665,6 +679,14 @@ done %install +%if 0%{?usrmerged} +# add symlink for usrmerge so install scripts will just follow the +# link and end up placing files in /usr/lib. The link will be +# removed later and is not packaged here. +mkdir -p %{buildroot}/usr/lib +ln -s usr/lib %{buildroot}/lib +%endif + # get rid of /usr/lib/rpm/brp-strip-debug # strip removes too much from the vmlinux ELF binary export NO_BRP_STRIP_DEBUG=true @@ -760,11 +782,19 @@ add_vmlinux() # sign the modules, firmware and possibly the kernel in the buildservice BRP_PESIGN_FILES="" %if "%CONFIG_EFI_STUB" == "y" +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %ifarch s390x ppc64 ppc64le +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %if "%CONFIG_MODULE_SIG" == "y" BRP_PESIGN_FILES="$BRP_PESIGN_FILES *.ko" %endif @@ -826,6 +856,13 @@ for sub in '' '-extra' \ -e "s:@RPM_TARGET_CPU@:%_target_cpu:g" \ -e "s:@CPU_ARCH_FLAVOR@:%cpu_arch_flavor:g" \ -e "s:@SRCVARIANT@:%variant:g" \ + -e "s:@MODULESDIR@:%modules_dir:g" \ + -e "s:@SYSTEMMAP@:%systemmap:g" \ +%if 0%{?usrmerged} + -e "s:^@USRMERGE@::" \ +%else + -e "/^@USRMERGE@/d" \ +%endif %_sourcedir/$script.sh > %my_builddir/$script$sub.sh if test "$base_package" -eq 1 -a "${#certs[@]}" -gt 0; then case "$script" in @@ -1032,6 +1069,10 @@ if [ %CONFIG_MODULES = y ]; then fi rm -rf %{buildroot}/lib/firmware +%if 0%{?usrmerged} +# remove usrmerge aid +rm %{buildroot}/lib +%endif add_dirs_to_filelist() { sed -rn ' @@ -1044,7 +1085,7 @@ add_dirs_to_filelist() { # print all parents :a # skip directories owned by other packages - s:^%%dir (/boot|/etc|/lib/(modules|firmware)|/usr/src)/[^/]+$:: + s:^%%dir (/boot|/etc|(/usr)?/lib/(modules|firmware)|/usr/src)/[^/]+$:: s:/[^/]+$::p ta ' "$@" | sort -u @@ -1061,10 +1102,23 @@ fi %endif shopt -s nullglob dotglob > %my_builddir/kernel-devel.files -for file in %buildroot/boot/symtypes* %buildroot/lib/modules/*/{build,source}; do - f=${file##%buildroot} - echo "$f" -done | add_dirs_to_filelist >%my_builddir/kernel-devel.files +{ + echo "%modules_dir/build" + echo "%modules_dir/source" + cd %buildroot + for file in boot/symtypes*; do +%if 0%{?usrmerged} + l="${file##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" + mv "$file" "%{buildroot}$l" + ln -s "..$l" $file + echo "$l" + echo "%%ghost /$file" +%else + echo "/$file" +%endif + done +} | add_dirs_to_filelist >%my_builddir/kernel-devel.files ( cd %buildroot ; find .%obj_install_dir/%cpu_arch_flavor -type f ; ) | \ sed -e 's/^[.]//' | grep -v -e '[.]ipa-clones$' -e '/Symbols[.]list$' -e '/ipa-clones[.]list$'| \ add_dirs_to_filelist >> %my_builddir/kernel-devel.files @@ -1073,6 +1127,8 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files echo %ghost /boot/initrd$suffix cd %buildroot for f in boot/*; do + l="${f##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" if test -L "$f"; then echo "%%ghost /$f" continue @@ -1088,24 +1144,46 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files ;; boot/vmlinux-*) if $ghost_vmlinux; then - echo "%%ghost /$f" - continue + # fall through to mark next echo as %ghost + echo -n "%%ghost " fi ;; +%if 0%{?usrmerged} + boot/vmlinuz-*) + echo -n "%%attr(0644, root, root) " + ;; +%endif boot/symtypes*) +%if 0%{?usrmerged} + echo "%exclude $l" +%endif continue ;; esac +%if 0%{?usrmerged} + mv "$f" "./$l" + ln -s "..$l" $f + # the find in the CONFIG_MODULES condition below also finds the files + # but there's sort -u later, so this is ok + echo "$l" # note: must be first after case statement above + echo "%%ghost /$f" +%else echo "%%attr(0644, root, root) /$f" +%endif done if [ %CONFIG_MODULES = y ]; then - find lib/modules/%kernelrelease-%build_flavor \ + find %{?usrmerged:usr/}lib/modules/%kernelrelease-%build_flavor \ -type d -o \ \( -path '*/modules.*' ! -path '*/modules.order' \ ! -path '*/modules.builtin' \ ! -path '*/modules.builtin.modinfo' \) -printf '%%%%ghost /%%p\n' \ - -o -name '*.ko' -prune -o -type f -printf '/%%p\n' + -o -name '*.ko' -prune \ +%if 0%{?usrmerged} + -o \( -type f ! -path '*/symtypes*' ! -path '*/vmlinu*' \) -printf '/%%p\n' +%else + -o -type f -printf '/%%p\n' +%endif cat %my_builddir/base-modules fi if test %CONFIG_MODULE_SIG = "y" -a -d etc/uefi/certs; then @@ -1166,15 +1244,15 @@ for f in %my_builddir/*-kmp-modules; do done if [ %CONFIG_MODULES = y ]; then - install -m 644 %_sourcedir/modules.fips %{buildroot}/lib/modules/%kernelrelease-%build_flavor/modules.fips - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-base.files - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-main.files + install -m 644 %_sourcedir/modules.fips %{buildroot}%modules_dir/modules.fips + echo %modules_dir/modules.fips >> %my_builddir/kernel-base.files + echo %modules_dir/modules.fips >> %my_builddir/kernel-main.files fi # Hardlink duplicate files automatically (from package fdupes): It doesn't save # much, but it keeps rpmlint from breaking the package build. Note that we skip # /usr/src/linux-obj intentionally, to not accidentally break timestamps there -%fdupes $RPM_BUILD_ROOT/lib +%fdupes %buildroot%modules_dir %preun -f preun.sh @@ -1426,7 +1504,7 @@ static, unlike the %{patch_package}--flavor package names. %files %{livepatch} # rpmlint complains about empty packages, so lets own something %defattr(-, root, root) -%dir /lib/modules/%kernelrelease-%build_flavor +%dir %modules_dir %endif %if 0%{?klp_symbols} && "%livepatch" != "" diff --git a/kernel-docs.changes b/kernel-docs.changes index 3d9f1ec1..dcc6ac54 100644 --- a/kernel-docs.changes +++ b/kernel-docs.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/kernel-docs.spec b/kernel-docs.spec index 3fe5bacf..3b5084a0 100644 --- a/kernel-docs.spec +++ b/kernel-docs.spec @@ -33,7 +33,7 @@ License: GPL-2.0-only Group: Documentation/Man Version: 5.13.12 %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif @@ -64,7 +64,7 @@ BuildRequires: texlive-zapfding %endif Url: http://www.kernel.org/ Provides: %name = %version-%source_rel -Provides: %name-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: %name-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build Source0: http://www.kernel.org/pub/linux/kernel/v5.x/linux-%srcversion.tar.xz diff --git a/kernel-kvmsmall.changes b/kernel-kvmsmall.changes index 3d9f1ec1..dcc6ac54 100644 --- a/kernel-kvmsmall.changes +++ b/kernel-kvmsmall.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/kernel-kvmsmall.spec b/kernel-kvmsmall.spec index ab92ffd2..d9ba1640 100644 --- a/kernel-kvmsmall.spec +++ b/kernel-kvmsmall.spec @@ -68,13 +68,27 @@ %define install_vdso 0 %endif +# TW is usrmerged +%if %{undefined usrmerged} && 0%{?suse_version} >= 1550 +%define usrmerged 1 +%endif + +%if 0%{?usrmerged} +%define modules_dir /usr/lib/modules/%kernelrelease-%build_flavor +%define systemmap %{modules_dir}/System.map +%else +%define modules_dir /lib/modules/%kernelrelease-%build_flavor +%define systemmap /boot/System.map-%kernelrelease-%build_flavor +%endif + + Name: kernel-kvmsmall Summary: The Small Developer Kernel for KVM License: GPL-2.0-only Group: System/Kernel Version: 5.13.12 %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif @@ -191,10 +205,10 @@ Conflicts: hyper-v < 4 Conflicts: libc.so.6()(64bit) %endif Provides: kernel = %version-%source_rel -Provides: kernel-%build_flavor-base-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 -Provides: kernel-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: kernel-%build_flavor-base-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 +Provides: kernel-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 # END COMMON DEPS -Provides: %name-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: %name-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 %obsolete_rebuilds %name Source0: http://www.kernel.org/pub/linux/kernel/v5.x/linux-%srcversion.tar.xz Source2: source-post.sh @@ -620,6 +634,14 @@ done %install +%if 0%{?usrmerged} +# add symlink for usrmerge so install scripts will just follow the +# link and end up placing files in /usr/lib. The link will be +# removed later and is not packaged here. +mkdir -p %{buildroot}/usr/lib +ln -s usr/lib %{buildroot}/lib +%endif + # get rid of /usr/lib/rpm/brp-strip-debug # strip removes too much from the vmlinux ELF binary export NO_BRP_STRIP_DEBUG=true @@ -715,11 +737,19 @@ add_vmlinux() # sign the modules, firmware and possibly the kernel in the buildservice BRP_PESIGN_FILES="" %if "%CONFIG_EFI_STUB" == "y" +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %ifarch s390x ppc64 ppc64le +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %if "%CONFIG_MODULE_SIG" == "y" BRP_PESIGN_FILES="$BRP_PESIGN_FILES *.ko" %endif @@ -781,6 +811,13 @@ for sub in '' '-extra' \ -e "s:@RPM_TARGET_CPU@:%_target_cpu:g" \ -e "s:@CPU_ARCH_FLAVOR@:%cpu_arch_flavor:g" \ -e "s:@SRCVARIANT@:%variant:g" \ + -e "s:@MODULESDIR@:%modules_dir:g" \ + -e "s:@SYSTEMMAP@:%systemmap:g" \ +%if 0%{?usrmerged} + -e "s:^@USRMERGE@::" \ +%else + -e "/^@USRMERGE@/d" \ +%endif %_sourcedir/$script.sh > %my_builddir/$script$sub.sh if test "$base_package" -eq 1 -a "${#certs[@]}" -gt 0; then case "$script" in @@ -987,6 +1024,10 @@ if [ %CONFIG_MODULES = y ]; then fi rm -rf %{buildroot}/lib/firmware +%if 0%{?usrmerged} +# remove usrmerge aid +rm %{buildroot}/lib +%endif add_dirs_to_filelist() { sed -rn ' @@ -999,7 +1040,7 @@ add_dirs_to_filelist() { # print all parents :a # skip directories owned by other packages - s:^%%dir (/boot|/etc|/lib/(modules|firmware)|/usr/src)/[^/]+$:: + s:^%%dir (/boot|/etc|(/usr)?/lib/(modules|firmware)|/usr/src)/[^/]+$:: s:/[^/]+$::p ta ' "$@" | sort -u @@ -1016,10 +1057,23 @@ fi %endif shopt -s nullglob dotglob > %my_builddir/kernel-devel.files -for file in %buildroot/boot/symtypes* %buildroot/lib/modules/*/{build,source}; do - f=${file##%buildroot} - echo "$f" -done | add_dirs_to_filelist >%my_builddir/kernel-devel.files +{ + echo "%modules_dir/build" + echo "%modules_dir/source" + cd %buildroot + for file in boot/symtypes*; do +%if 0%{?usrmerged} + l="${file##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" + mv "$file" "%{buildroot}$l" + ln -s "..$l" $file + echo "$l" + echo "%%ghost /$file" +%else + echo "/$file" +%endif + done +} | add_dirs_to_filelist >%my_builddir/kernel-devel.files ( cd %buildroot ; find .%obj_install_dir/%cpu_arch_flavor -type f ; ) | \ sed -e 's/^[.]//' | grep -v -e '[.]ipa-clones$' -e '/Symbols[.]list$' -e '/ipa-clones[.]list$'| \ add_dirs_to_filelist >> %my_builddir/kernel-devel.files @@ -1028,6 +1082,8 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files echo %ghost /boot/initrd$suffix cd %buildroot for f in boot/*; do + l="${f##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" if test -L "$f"; then echo "%%ghost /$f" continue @@ -1043,24 +1099,46 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files ;; boot/vmlinux-*) if $ghost_vmlinux; then - echo "%%ghost /$f" - continue + # fall through to mark next echo as %ghost + echo -n "%%ghost " fi ;; +%if 0%{?usrmerged} + boot/vmlinuz-*) + echo -n "%%attr(0644, root, root) " + ;; +%endif boot/symtypes*) +%if 0%{?usrmerged} + echo "%exclude $l" +%endif continue ;; esac +%if 0%{?usrmerged} + mv "$f" "./$l" + ln -s "..$l" $f + # the find in the CONFIG_MODULES condition below also finds the files + # but there's sort -u later, so this is ok + echo "$l" # note: must be first after case statement above + echo "%%ghost /$f" +%else echo "%%attr(0644, root, root) /$f" +%endif done if [ %CONFIG_MODULES = y ]; then - find lib/modules/%kernelrelease-%build_flavor \ + find %{?usrmerged:usr/}lib/modules/%kernelrelease-%build_flavor \ -type d -o \ \( -path '*/modules.*' ! -path '*/modules.order' \ ! -path '*/modules.builtin' \ ! -path '*/modules.builtin.modinfo' \) -printf '%%%%ghost /%%p\n' \ - -o -name '*.ko' -prune -o -type f -printf '/%%p\n' + -o -name '*.ko' -prune \ +%if 0%{?usrmerged} + -o \( -type f ! -path '*/symtypes*' ! -path '*/vmlinu*' \) -printf '/%%p\n' +%else + -o -type f -printf '/%%p\n' +%endif cat %my_builddir/base-modules fi if test %CONFIG_MODULE_SIG = "y" -a -d etc/uefi/certs; then @@ -1121,15 +1199,15 @@ for f in %my_builddir/*-kmp-modules; do done if [ %CONFIG_MODULES = y ]; then - install -m 644 %_sourcedir/modules.fips %{buildroot}/lib/modules/%kernelrelease-%build_flavor/modules.fips - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-base.files - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-main.files + install -m 644 %_sourcedir/modules.fips %{buildroot}%modules_dir/modules.fips + echo %modules_dir/modules.fips >> %my_builddir/kernel-base.files + echo %modules_dir/modules.fips >> %my_builddir/kernel-main.files fi # Hardlink duplicate files automatically (from package fdupes): It doesn't save # much, but it keeps rpmlint from breaking the package build. Note that we skip # /usr/src/linux-obj intentionally, to not accidentally break timestamps there -%fdupes $RPM_BUILD_ROOT/lib +%fdupes %buildroot%modules_dir %preun -f preun.sh @@ -1323,7 +1401,7 @@ static, unlike the %{patch_package}--flavor package names. %files %{livepatch} # rpmlint complains about empty packages, so lets own something %defattr(-, root, root) -%dir /lib/modules/%kernelrelease-%build_flavor +%dir %modules_dir %endif %if 0%{?klp_symbols} && "%livepatch" != "" diff --git a/kernel-lpae.changes b/kernel-lpae.changes index 3d9f1ec1..dcc6ac54 100644 --- a/kernel-lpae.changes +++ b/kernel-lpae.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/kernel-lpae.spec b/kernel-lpae.spec index 9891090e..25c81d82 100644 --- a/kernel-lpae.spec +++ b/kernel-lpae.spec @@ -68,13 +68,27 @@ %define install_vdso 0 %endif +# TW is usrmerged +%if %{undefined usrmerged} && 0%{?suse_version} >= 1550 +%define usrmerged 1 +%endif + +%if 0%{?usrmerged} +%define modules_dir /usr/lib/modules/%kernelrelease-%build_flavor +%define systemmap %{modules_dir}/System.map +%else +%define modules_dir /lib/modules/%kernelrelease-%build_flavor +%define systemmap /boot/System.map-%kernelrelease-%build_flavor +%endif + + Name: kernel-lpae Summary: Kernel for LPAE enabled systems License: GPL-2.0-only Group: System/Kernel Version: 5.13.12 %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif @@ -191,10 +205,10 @@ Conflicts: hyper-v < 4 Conflicts: libc.so.6()(64bit) %endif Provides: kernel = %version-%source_rel -Provides: kernel-%build_flavor-base-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 -Provides: kernel-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: kernel-%build_flavor-base-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 +Provides: kernel-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 # END COMMON DEPS -Provides: %name-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: %name-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 %obsolete_rebuilds %name Source0: http://www.kernel.org/pub/linux/kernel/v5.x/linux-%srcversion.tar.xz Source2: source-post.sh @@ -614,6 +628,14 @@ done %install +%if 0%{?usrmerged} +# add symlink for usrmerge so install scripts will just follow the +# link and end up placing files in /usr/lib. The link will be +# removed later and is not packaged here. +mkdir -p %{buildroot}/usr/lib +ln -s usr/lib %{buildroot}/lib +%endif + # get rid of /usr/lib/rpm/brp-strip-debug # strip removes too much from the vmlinux ELF binary export NO_BRP_STRIP_DEBUG=true @@ -709,11 +731,19 @@ add_vmlinux() # sign the modules, firmware and possibly the kernel in the buildservice BRP_PESIGN_FILES="" %if "%CONFIG_EFI_STUB" == "y" +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %ifarch s390x ppc64 ppc64le +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %if "%CONFIG_MODULE_SIG" == "y" BRP_PESIGN_FILES="$BRP_PESIGN_FILES *.ko" %endif @@ -775,6 +805,13 @@ for sub in '' '-extra' \ -e "s:@RPM_TARGET_CPU@:%_target_cpu:g" \ -e "s:@CPU_ARCH_FLAVOR@:%cpu_arch_flavor:g" \ -e "s:@SRCVARIANT@:%variant:g" \ + -e "s:@MODULESDIR@:%modules_dir:g" \ + -e "s:@SYSTEMMAP@:%systemmap:g" \ +%if 0%{?usrmerged} + -e "s:^@USRMERGE@::" \ +%else + -e "/^@USRMERGE@/d" \ +%endif %_sourcedir/$script.sh > %my_builddir/$script$sub.sh if test "$base_package" -eq 1 -a "${#certs[@]}" -gt 0; then case "$script" in @@ -981,6 +1018,10 @@ if [ %CONFIG_MODULES = y ]; then fi rm -rf %{buildroot}/lib/firmware +%if 0%{?usrmerged} +# remove usrmerge aid +rm %{buildroot}/lib +%endif add_dirs_to_filelist() { sed -rn ' @@ -993,7 +1034,7 @@ add_dirs_to_filelist() { # print all parents :a # skip directories owned by other packages - s:^%%dir (/boot|/etc|/lib/(modules|firmware)|/usr/src)/[^/]+$:: + s:^%%dir (/boot|/etc|(/usr)?/lib/(modules|firmware)|/usr/src)/[^/]+$:: s:/[^/]+$::p ta ' "$@" | sort -u @@ -1010,10 +1051,23 @@ fi %endif shopt -s nullglob dotglob > %my_builddir/kernel-devel.files -for file in %buildroot/boot/symtypes* %buildroot/lib/modules/*/{build,source}; do - f=${file##%buildroot} - echo "$f" -done | add_dirs_to_filelist >%my_builddir/kernel-devel.files +{ + echo "%modules_dir/build" + echo "%modules_dir/source" + cd %buildroot + for file in boot/symtypes*; do +%if 0%{?usrmerged} + l="${file##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" + mv "$file" "%{buildroot}$l" + ln -s "..$l" $file + echo "$l" + echo "%%ghost /$file" +%else + echo "/$file" +%endif + done +} | add_dirs_to_filelist >%my_builddir/kernel-devel.files ( cd %buildroot ; find .%obj_install_dir/%cpu_arch_flavor -type f ; ) | \ sed -e 's/^[.]//' | grep -v -e '[.]ipa-clones$' -e '/Symbols[.]list$' -e '/ipa-clones[.]list$'| \ add_dirs_to_filelist >> %my_builddir/kernel-devel.files @@ -1022,6 +1076,8 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files echo %ghost /boot/initrd$suffix cd %buildroot for f in boot/*; do + l="${f##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" if test -L "$f"; then echo "%%ghost /$f" continue @@ -1037,24 +1093,46 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files ;; boot/vmlinux-*) if $ghost_vmlinux; then - echo "%%ghost /$f" - continue + # fall through to mark next echo as %ghost + echo -n "%%ghost " fi ;; +%if 0%{?usrmerged} + boot/vmlinuz-*) + echo -n "%%attr(0644, root, root) " + ;; +%endif boot/symtypes*) +%if 0%{?usrmerged} + echo "%exclude $l" +%endif continue ;; esac +%if 0%{?usrmerged} + mv "$f" "./$l" + ln -s "..$l" $f + # the find in the CONFIG_MODULES condition below also finds the files + # but there's sort -u later, so this is ok + echo "$l" # note: must be first after case statement above + echo "%%ghost /$f" +%else echo "%%attr(0644, root, root) /$f" +%endif done if [ %CONFIG_MODULES = y ]; then - find lib/modules/%kernelrelease-%build_flavor \ + find %{?usrmerged:usr/}lib/modules/%kernelrelease-%build_flavor \ -type d -o \ \( -path '*/modules.*' ! -path '*/modules.order' \ ! -path '*/modules.builtin' \ ! -path '*/modules.builtin.modinfo' \) -printf '%%%%ghost /%%p\n' \ - -o -name '*.ko' -prune -o -type f -printf '/%%p\n' + -o -name '*.ko' -prune \ +%if 0%{?usrmerged} + -o \( -type f ! -path '*/symtypes*' ! -path '*/vmlinu*' \) -printf '/%%p\n' +%else + -o -type f -printf '/%%p\n' +%endif cat %my_builddir/base-modules fi if test %CONFIG_MODULE_SIG = "y" -a -d etc/uefi/certs; then @@ -1115,15 +1193,15 @@ for f in %my_builddir/*-kmp-modules; do done if [ %CONFIG_MODULES = y ]; then - install -m 644 %_sourcedir/modules.fips %{buildroot}/lib/modules/%kernelrelease-%build_flavor/modules.fips - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-base.files - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-main.files + install -m 644 %_sourcedir/modules.fips %{buildroot}%modules_dir/modules.fips + echo %modules_dir/modules.fips >> %my_builddir/kernel-base.files + echo %modules_dir/modules.fips >> %my_builddir/kernel-main.files fi # Hardlink duplicate files automatically (from package fdupes): It doesn't save # much, but it keeps rpmlint from breaking the package build. Note that we skip # /usr/src/linux-obj intentionally, to not accidentally break timestamps there -%fdupes $RPM_BUILD_ROOT/lib +%fdupes %buildroot%modules_dir %preun -f preun.sh @@ -1305,7 +1383,7 @@ static, unlike the %{patch_package}--flavor package names. %files %{livepatch} # rpmlint complains about empty packages, so lets own something %defattr(-, root, root) -%dir /lib/modules/%kernelrelease-%build_flavor +%dir %modules_dir %endif %if 0%{?klp_symbols} && "%livepatch" != "" diff --git a/kernel-obs-build.changes b/kernel-obs-build.changes index 3d9f1ec1..dcc6ac54 100644 --- a/kernel-obs-build.changes +++ b/kernel-obs-build.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/kernel-obs-build.spec b/kernel-obs-build.spec index 621c4c18..e9a7248d 100644 --- a/kernel-obs-build.spec +++ b/kernel-obs-build.spec @@ -45,7 +45,7 @@ BuildRequires: util-linux %endif %endif %endif -BuildRequires: kernel%kernel_flavor-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +BuildRequires: kernel%kernel_flavor-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 %if 0%{?rhel_version} BuildRequires: kernel @@ -66,7 +66,7 @@ License: GPL-2.0-only Group: SLES Version: 5.13.12 %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif diff --git a/kernel-obs-qa.changes b/kernel-obs-qa.changes index 3d9f1ec1..dcc6ac54 100644 --- a/kernel-obs-qa.changes +++ b/kernel-obs-qa.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/kernel-obs-qa.spec b/kernel-obs-qa.spec index 8621bc33..0ca8da63 100644 --- a/kernel-obs-qa.spec +++ b/kernel-obs-qa.spec @@ -38,7 +38,7 @@ License: GPL-2.0-only Group: SLES Version: 5.13.12 %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif @@ -60,7 +60,7 @@ projects and runs basic tests. # and called here. krel=$(uname -r) -if test ! -d "/lib/modules/$krel/kernel"; then +if test ! -d "/lib/modules/$krel/kernel" && test ! -d "/usr/lib/modules/$krel/kernel"; then echo "Kernel package for $krel not installed; exiting" exit 0 fi diff --git a/kernel-obs-qa.spec.in b/kernel-obs-qa.spec.in index 85d05ee3..f0e648df 100644 --- a/kernel-obs-qa.spec.in +++ b/kernel-obs-qa.spec.in @@ -60,7 +60,7 @@ projects and runs basic tests. # and called here. krel=$(uname -r) -if test ! -d "/lib/modules/$krel/kernel"; then +if test ! -d "/lib/modules/$krel/kernel" && test ! -d "/usr/lib/modules/$krel/kernel"; then echo "Kernel package for $krel not installed; exiting" exit 0 fi diff --git a/kernel-pae.changes b/kernel-pae.changes index 3d9f1ec1..dcc6ac54 100644 --- a/kernel-pae.changes +++ b/kernel-pae.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/kernel-pae.spec b/kernel-pae.spec index 7dba00ed..c640af62 100644 --- a/kernel-pae.spec +++ b/kernel-pae.spec @@ -68,13 +68,27 @@ %define install_vdso 0 %endif +# TW is usrmerged +%if %{undefined usrmerged} && 0%{?suse_version} >= 1550 +%define usrmerged 1 +%endif + +%if 0%{?usrmerged} +%define modules_dir /usr/lib/modules/%kernelrelease-%build_flavor +%define systemmap %{modules_dir}/System.map +%else +%define modules_dir /lib/modules/%kernelrelease-%build_flavor +%define systemmap /boot/System.map-%kernelrelease-%build_flavor +%endif + + Name: kernel-pae Summary: Kernel with PAE Support License: GPL-2.0-only Group: System/Kernel Version: 5.13.12 %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif @@ -191,10 +205,10 @@ Conflicts: hyper-v < 4 Conflicts: libc.so.6()(64bit) %endif Provides: kernel = %version-%source_rel -Provides: kernel-%build_flavor-base-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 -Provides: kernel-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: kernel-%build_flavor-base-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 +Provides: kernel-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 # END COMMON DEPS -Provides: %name-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: %name-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 %ifarch %ix86 Provides: kernel-bigsmp = 2.6.17 Obsoletes: kernel-bigsmp <= 2.6.17 @@ -642,6 +656,14 @@ done %install +%if 0%{?usrmerged} +# add symlink for usrmerge so install scripts will just follow the +# link and end up placing files in /usr/lib. The link will be +# removed later and is not packaged here. +mkdir -p %{buildroot}/usr/lib +ln -s usr/lib %{buildroot}/lib +%endif + # get rid of /usr/lib/rpm/brp-strip-debug # strip removes too much from the vmlinux ELF binary export NO_BRP_STRIP_DEBUG=true @@ -737,11 +759,19 @@ add_vmlinux() # sign the modules, firmware and possibly the kernel in the buildservice BRP_PESIGN_FILES="" %if "%CONFIG_EFI_STUB" == "y" +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %ifarch s390x ppc64 ppc64le +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %if "%CONFIG_MODULE_SIG" == "y" BRP_PESIGN_FILES="$BRP_PESIGN_FILES *.ko" %endif @@ -803,6 +833,13 @@ for sub in '' '-extra' \ -e "s:@RPM_TARGET_CPU@:%_target_cpu:g" \ -e "s:@CPU_ARCH_FLAVOR@:%cpu_arch_flavor:g" \ -e "s:@SRCVARIANT@:%variant:g" \ + -e "s:@MODULESDIR@:%modules_dir:g" \ + -e "s:@SYSTEMMAP@:%systemmap:g" \ +%if 0%{?usrmerged} + -e "s:^@USRMERGE@::" \ +%else + -e "/^@USRMERGE@/d" \ +%endif %_sourcedir/$script.sh > %my_builddir/$script$sub.sh if test "$base_package" -eq 1 -a "${#certs[@]}" -gt 0; then case "$script" in @@ -1009,6 +1046,10 @@ if [ %CONFIG_MODULES = y ]; then fi rm -rf %{buildroot}/lib/firmware +%if 0%{?usrmerged} +# remove usrmerge aid +rm %{buildroot}/lib +%endif add_dirs_to_filelist() { sed -rn ' @@ -1021,7 +1062,7 @@ add_dirs_to_filelist() { # print all parents :a # skip directories owned by other packages - s:^%%dir (/boot|/etc|/lib/(modules|firmware)|/usr/src)/[^/]+$:: + s:^%%dir (/boot|/etc|(/usr)?/lib/(modules|firmware)|/usr/src)/[^/]+$:: s:/[^/]+$::p ta ' "$@" | sort -u @@ -1038,10 +1079,23 @@ fi %endif shopt -s nullglob dotglob > %my_builddir/kernel-devel.files -for file in %buildroot/boot/symtypes* %buildroot/lib/modules/*/{build,source}; do - f=${file##%buildroot} - echo "$f" -done | add_dirs_to_filelist >%my_builddir/kernel-devel.files +{ + echo "%modules_dir/build" + echo "%modules_dir/source" + cd %buildroot + for file in boot/symtypes*; do +%if 0%{?usrmerged} + l="${file##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" + mv "$file" "%{buildroot}$l" + ln -s "..$l" $file + echo "$l" + echo "%%ghost /$file" +%else + echo "/$file" +%endif + done +} | add_dirs_to_filelist >%my_builddir/kernel-devel.files ( cd %buildroot ; find .%obj_install_dir/%cpu_arch_flavor -type f ; ) | \ sed -e 's/^[.]//' | grep -v -e '[.]ipa-clones$' -e '/Symbols[.]list$' -e '/ipa-clones[.]list$'| \ add_dirs_to_filelist >> %my_builddir/kernel-devel.files @@ -1050,6 +1104,8 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files echo %ghost /boot/initrd$suffix cd %buildroot for f in boot/*; do + l="${f##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" if test -L "$f"; then echo "%%ghost /$f" continue @@ -1065,24 +1121,46 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files ;; boot/vmlinux-*) if $ghost_vmlinux; then - echo "%%ghost /$f" - continue + # fall through to mark next echo as %ghost + echo -n "%%ghost " fi ;; +%if 0%{?usrmerged} + boot/vmlinuz-*) + echo -n "%%attr(0644, root, root) " + ;; +%endif boot/symtypes*) +%if 0%{?usrmerged} + echo "%exclude $l" +%endif continue ;; esac +%if 0%{?usrmerged} + mv "$f" "./$l" + ln -s "..$l" $f + # the find in the CONFIG_MODULES condition below also finds the files + # but there's sort -u later, so this is ok + echo "$l" # note: must be first after case statement above + echo "%%ghost /$f" +%else echo "%%attr(0644, root, root) /$f" +%endif done if [ %CONFIG_MODULES = y ]; then - find lib/modules/%kernelrelease-%build_flavor \ + find %{?usrmerged:usr/}lib/modules/%kernelrelease-%build_flavor \ -type d -o \ \( -path '*/modules.*' ! -path '*/modules.order' \ ! -path '*/modules.builtin' \ ! -path '*/modules.builtin.modinfo' \) -printf '%%%%ghost /%%p\n' \ - -o -name '*.ko' -prune -o -type f -printf '/%%p\n' + -o -name '*.ko' -prune \ +%if 0%{?usrmerged} + -o \( -type f ! -path '*/symtypes*' ! -path '*/vmlinu*' \) -printf '/%%p\n' +%else + -o -type f -printf '/%%p\n' +%endif cat %my_builddir/base-modules fi if test %CONFIG_MODULE_SIG = "y" -a -d etc/uefi/certs; then @@ -1143,15 +1221,15 @@ for f in %my_builddir/*-kmp-modules; do done if [ %CONFIG_MODULES = y ]; then - install -m 644 %_sourcedir/modules.fips %{buildroot}/lib/modules/%kernelrelease-%build_flavor/modules.fips - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-base.files - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-main.files + install -m 644 %_sourcedir/modules.fips %{buildroot}%modules_dir/modules.fips + echo %modules_dir/modules.fips >> %my_builddir/kernel-base.files + echo %modules_dir/modules.fips >> %my_builddir/kernel-main.files fi # Hardlink duplicate files automatically (from package fdupes): It doesn't save # much, but it keeps rpmlint from breaking the package build. Note that we skip # /usr/src/linux-obj intentionally, to not accidentally break timestamps there -%fdupes $RPM_BUILD_ROOT/lib +%fdupes %buildroot%modules_dir %preun -f preun.sh @@ -1375,7 +1453,7 @@ static, unlike the %{patch_package}--flavor package names. %files %{livepatch} # rpmlint complains about empty packages, so lets own something %defattr(-, root, root) -%dir /lib/modules/%kernelrelease-%build_flavor +%dir %modules_dir %endif %if 0%{?klp_symbols} && "%livepatch" != "" diff --git a/kernel-source.changes b/kernel-source.changes index 3d9f1ec1..dcc6ac54 100644 --- a/kernel-source.changes +++ b/kernel-source.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/kernel-source.rpmlintrc b/kernel-source.rpmlintrc index a87aabb4..ac455866 100644 --- a/kernel-source.rpmlintrc +++ b/kernel-source.rpmlintrc @@ -2,10 +2,10 @@ addFilter("zero-length /usr/src/linux-.*-obj/.*/include/config.*h") addFilter("zero-length /usr/src/linux-.*-obj/.*/include/config/.*") # vdsos are special -addFilter("shared-lib-without-dependency-information /lib/modules/[1-9].*/vdso/.*") -addFilter("missing-PT_GNU_STACK-section /lib/modules/[1-9].*/vdso/.*") +addFilter("shared-lib-without-dependency-information .*/lib/modules/[1-9].*/vdso/.*") +addFilter("missing-PT_GNU_STACK-section .*/lib/modules/[1-9].*/vdso/.*") # This is a stale symlink until the kernel-source package is installed: -addFilter("dangling-symlink /lib/modules/[1-9].*/source") +addFilter("dangling-symlink .*/lib/modules/[1-9].*/source") # These hidden files are fine: addFilter("hidden-file-or-dir /usr/src/linux-.*-obj/.*/.config") addFilter("hidden-file-or-dir /usr/src/linux-.*-obj/.*/.kernel-binary.spec.buildenv") diff --git a/kernel-source.spec b/kernel-source.spec index e5e58632..34600bf3 100644 --- a/kernel-source.spec +++ b/kernel-source.spec @@ -32,7 +32,7 @@ License: GPL-2.0-only Group: Development/Sources Version: 5.13.12 %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif @@ -43,7 +43,7 @@ BuildRequires: fdupes BuildRequires: sed Requires(post): coreutils sed Provides: %name = %version-%source_rel -Provides: %name-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: %name-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 Provides: linux Provides: multiversion(kernel) Source0: http://www.kernel.org/pub/linux/kernel/v5.x/linux-%srcversion.tar.xz diff --git a/kernel-subpackage-build b/kernel-subpackage-build index f44e2225..93c2d696 100644 --- a/kernel-subpackage-build +++ b/kernel-subpackage-build @@ -11,7 +11,7 @@ set -o pipefail install -d -m 0755 $RPM_BUILD_ROOT/boot $scriptdir/splitflist $kernel_package_name kernel.flist kernel-ghost.flist -echo Missing files: +echo Ghost files: cat kernel-ghost.flist rpm -q --qf '%{PREIN}' $kernel_package_name | sed -e "s/$kernel_nvrq/$package_nvr/g" > prein.sh @@ -21,7 +21,8 @@ rpm -q --qf '%{POSTUN}' $kernel_package_name | sed -e "s/$kernel_nvrq/$package_n [ -z "$(rpm -q --triggers $kernel_package_name)" ] # not handled -KREL=$(cat kernel.flist | grep ^/lib/modules | { sort -r ||: ;} | head -n 1 | sed -e s,^/lib/modules/,, -e 's,/.*,,') +KREL=$(sed -rne '/^(\/usr)?\/lib\/modules\/([^/]+)$/{s,.*/,,;p;q}' < kernel.flist) +grep -q /usr/lib/modules/ kernel.flist && USR=/usr $scriptdir/mergedep $KREL > modules.dep @@ -29,13 +30,13 @@ $scriptdir/mergedep $KREL > modules.dep $scriptdir/moddep modules.dep request-modules modules $scriptdir/modflist kernel.flist modules modules.flist /lib/modules/$KREL/modules.builtin -cat kernel.flist | grep -v ^/lib/modules >> modules.flist -[ -d /lib/modules/$KREL/vdso ] && echo /lib/modules/$KREL/vdso >> modules.flist ||: -echo /lib/modules/$KREL/modules.* | tr ' ' '\n' >> modules.flist +grep -v "^$USR/lib/modules/$KREL\\(\$\\|/kernel\\)" < kernel.flist >> modules.flist || : tar -C / -cf- -T modules.flist | tar -C $RPM_BUILD_ROOT -xvf- +[ -z "$USR" ] || ln -s usr/lib $RPM_BUILD_ROOT/lib moderr="$(/usr/sbin/depmod -b $RPM_BUILD_ROOT -e -F /boot/System.map-$KREL $KREL 2>&1 > /dev/null)" +[ -z "$USR" ] || rm $RPM_BUILD_ROOT/lib if [ "$moderr" ] ; then echo Picked modules have errors: @@ -44,35 +45,27 @@ exit 1 fi echo "%defattr(-,root,root)" > subpackage.flist -cat kernel.flist | grep -v ^/lib/modules >> subpackage.flist -echo /lib/modules/$KREL >> subpackage.flist -cat kernel-ghost.flist | sed -e 's/^/%ghost /' >> subpackage.flist - -cat kernel-ghost.flist | while read ghost ; do - case $ghost in - /boot/image-%build_flavor | /boot/vmlinux-%build_flavor | /boot/vmlinuz-%build_flavor | \ - /boot/Image-%build_flavor | /boot/initrd-%build_flavor) - ;; - /boot/vmlinux | /boot/vmlinuz | /boot/zImage | /boot/Image | /boot/image | /boot/initrd) - ;; - /boot/vmlinux-$KREL) - [ -f /boot/vmlinux-$KREL.gz ] && touch vmlinux-$KREL - ;; - /boot/initrd-$KREL | /boot/initrd-$KREL-kdump) - # Create a dummy initrd with roughly the size the real one will have. - # That way, YaST will know that this package requires some additional - # space in /boot. - dd if=/dev/zero of=$RPM_BUILD_ROOT$ghost \ - bs=1024 seek=2047 count=1 - chmod 0600 $RPM_BUILD_ROOT$ghost - ;; - /lib/modules/$KREL/modules.*) - [ -f $RPM_BUILD_ROOT$ghost ] - ;; - *) - echo Missing file "$ghost" not handled. - exit 1; - ;; - esac -done +echo "%dir $USR/lib/modules/$KREL" >> subpackage.flist +grep -v "^$USR/lib/modules/$KREL\\(\$\\|/kernel\\)" < kernel.flist >> subpackage.flist || : +echo $USR/lib/modules/$KREL/kernel >> subpackage.flist +while read name rest; do +echo "%ghost $name" +done < kernel-ghost.flist >> subpackage.flist +# recreate ghost files in build root +while read name mode size mtime link; do + t=$(( mode&0170000 )) + p="${mode:0-4:4}" + (( p != 0 )) || p='' + if (( t == 0100000 )); then + install -D -m "${p:-0644}" /dev/null "$RPM_BUILD_ROOT$name" + dd if=/dev/null bs=1 count=0 status=none seek="$size" of="$RPM_BUILD_ROOT$name" + touch -h --date="@$mtime" "$RPM_BUILD_ROOT$name" + elif (( t == 0040000 )); then + install -d -m "${p:-0755}" "$RPM_BUILD_ROOT$name" + touch -h -date="@$mtime" "$RPM_BUILD_ROOT$name" + elif (( t == 0120000 )); then + ln -s "$link" "$RPM_BUILD_ROOT$name" + touch -h --date="@$mtime" "$RPM_BUILD_ROOT$name" + fi +done < kernel-ghost.flist diff --git a/kernel-syms.changes b/kernel-syms.changes index 3d9f1ec1..dcc6ac54 100644 --- a/kernel-syms.changes +++ b/kernel-syms.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/kernel-syms.spec b/kernel-syms.spec index be6b60c7..5878ff45 100644 --- a/kernel-syms.spec +++ b/kernel-syms.spec @@ -27,7 +27,7 @@ Group: Development/Sources Version: 5.13.12 %if %using_buildservice %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif @@ -52,7 +52,7 @@ Requires: kernel-pae-devel = %version-%source_rel %endif Requires: pesign-obs-integration Provides: %name = %version-%source_rel -Provides: %name-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: %name-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 Provides: multiversion(kernel) Source: README.KSYMS Requires: kernel-devel%variant = %version-%source_rel diff --git a/kernel-vanilla.changes b/kernel-vanilla.changes index 3d9f1ec1..dcc6ac54 100644 --- a/kernel-vanilla.changes +++ b/kernel-vanilla.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/kernel-vanilla.spec b/kernel-vanilla.spec index a515c357..7fdc86d1 100644 --- a/kernel-vanilla.spec +++ b/kernel-vanilla.spec @@ -68,13 +68,27 @@ %define install_vdso 0 %endif +# TW is usrmerged +%if %{undefined usrmerged} && 0%{?suse_version} >= 1550 +%define usrmerged 1 +%endif + +%if 0%{?usrmerged} +%define modules_dir /usr/lib/modules/%kernelrelease-%build_flavor +%define systemmap %{modules_dir}/System.map +%else +%define modules_dir /lib/modules/%kernelrelease-%build_flavor +%define systemmap /boot/System.map-%kernelrelease-%build_flavor +%endif + + Name: kernel-vanilla Summary: The Standard Kernel - without any SUSE patches License: GPL-2.0-only Group: System/Kernel Version: 5.13.12 %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif @@ -191,10 +205,10 @@ Conflicts: hyper-v < 4 Conflicts: libc.so.6()(64bit) %endif Provides: kernel = %version-%source_rel -Provides: kernel-%build_flavor-base-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 -Provides: kernel-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: kernel-%build_flavor-base-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 +Provides: kernel-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 # END COMMON DEPS -Provides: %name-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: %name-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 %obsolete_rebuilds %name Source0: http://www.kernel.org/pub/linux/kernel/v5.x/linux-%srcversion.tar.xz Source2: source-post.sh @@ -613,6 +627,14 @@ done %install +%if 0%{?usrmerged} +# add symlink for usrmerge so install scripts will just follow the +# link and end up placing files in /usr/lib. The link will be +# removed later and is not packaged here. +mkdir -p %{buildroot}/usr/lib +ln -s usr/lib %{buildroot}/lib +%endif + # get rid of /usr/lib/rpm/brp-strip-debug # strip removes too much from the vmlinux ELF binary export NO_BRP_STRIP_DEBUG=true @@ -708,11 +730,19 @@ add_vmlinux() # sign the modules, firmware and possibly the kernel in the buildservice BRP_PESIGN_FILES="" %if "%CONFIG_EFI_STUB" == "y" +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %ifarch s390x ppc64 ppc64le +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %if "%CONFIG_MODULE_SIG" == "y" BRP_PESIGN_FILES="$BRP_PESIGN_FILES *.ko" %endif @@ -774,6 +804,13 @@ for sub in '' '-extra' \ -e "s:@RPM_TARGET_CPU@:%_target_cpu:g" \ -e "s:@CPU_ARCH_FLAVOR@:%cpu_arch_flavor:g" \ -e "s:@SRCVARIANT@:%variant:g" \ + -e "s:@MODULESDIR@:%modules_dir:g" \ + -e "s:@SYSTEMMAP@:%systemmap:g" \ +%if 0%{?usrmerged} + -e "s:^@USRMERGE@::" \ +%else + -e "/^@USRMERGE@/d" \ +%endif %_sourcedir/$script.sh > %my_builddir/$script$sub.sh if test "$base_package" -eq 1 -a "${#certs[@]}" -gt 0; then case "$script" in @@ -980,6 +1017,10 @@ if [ %CONFIG_MODULES = y ]; then fi rm -rf %{buildroot}/lib/firmware +%if 0%{?usrmerged} +# remove usrmerge aid +rm %{buildroot}/lib +%endif add_dirs_to_filelist() { sed -rn ' @@ -992,7 +1033,7 @@ add_dirs_to_filelist() { # print all parents :a # skip directories owned by other packages - s:^%%dir (/boot|/etc|/lib/(modules|firmware)|/usr/src)/[^/]+$:: + s:^%%dir (/boot|/etc|(/usr)?/lib/(modules|firmware)|/usr/src)/[^/]+$:: s:/[^/]+$::p ta ' "$@" | sort -u @@ -1009,10 +1050,23 @@ fi %endif shopt -s nullglob dotglob > %my_builddir/kernel-devel.files -for file in %buildroot/boot/symtypes* %buildroot/lib/modules/*/{build,source}; do - f=${file##%buildroot} - echo "$f" -done | add_dirs_to_filelist >%my_builddir/kernel-devel.files +{ + echo "%modules_dir/build" + echo "%modules_dir/source" + cd %buildroot + for file in boot/symtypes*; do +%if 0%{?usrmerged} + l="${file##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" + mv "$file" "%{buildroot}$l" + ln -s "..$l" $file + echo "$l" + echo "%%ghost /$file" +%else + echo "/$file" +%endif + done +} | add_dirs_to_filelist >%my_builddir/kernel-devel.files ( cd %buildroot ; find .%obj_install_dir/%cpu_arch_flavor -type f ; ) | \ sed -e 's/^[.]//' | grep -v -e '[.]ipa-clones$' -e '/Symbols[.]list$' -e '/ipa-clones[.]list$'| \ add_dirs_to_filelist >> %my_builddir/kernel-devel.files @@ -1021,6 +1075,8 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files echo %ghost /boot/initrd$suffix cd %buildroot for f in boot/*; do + l="${f##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" if test -L "$f"; then echo "%%ghost /$f" continue @@ -1036,24 +1092,46 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files ;; boot/vmlinux-*) if $ghost_vmlinux; then - echo "%%ghost /$f" - continue + # fall through to mark next echo as %ghost + echo -n "%%ghost " fi ;; +%if 0%{?usrmerged} + boot/vmlinuz-*) + echo -n "%%attr(0644, root, root) " + ;; +%endif boot/symtypes*) +%if 0%{?usrmerged} + echo "%exclude $l" +%endif continue ;; esac +%if 0%{?usrmerged} + mv "$f" "./$l" + ln -s "..$l" $f + # the find in the CONFIG_MODULES condition below also finds the files + # but there's sort -u later, so this is ok + echo "$l" # note: must be first after case statement above + echo "%%ghost /$f" +%else echo "%%attr(0644, root, root) /$f" +%endif done if [ %CONFIG_MODULES = y ]; then - find lib/modules/%kernelrelease-%build_flavor \ + find %{?usrmerged:usr/}lib/modules/%kernelrelease-%build_flavor \ -type d -o \ \( -path '*/modules.*' ! -path '*/modules.order' \ ! -path '*/modules.builtin' \ ! -path '*/modules.builtin.modinfo' \) -printf '%%%%ghost /%%p\n' \ - -o -name '*.ko' -prune -o -type f -printf '/%%p\n' + -o -name '*.ko' -prune \ +%if 0%{?usrmerged} + -o \( -type f ! -path '*/symtypes*' ! -path '*/vmlinu*' \) -printf '/%%p\n' +%else + -o -type f -printf '/%%p\n' +%endif cat %my_builddir/base-modules fi if test %CONFIG_MODULE_SIG = "y" -a -d etc/uefi/certs; then @@ -1114,15 +1192,15 @@ for f in %my_builddir/*-kmp-modules; do done if [ %CONFIG_MODULES = y ]; then - install -m 644 %_sourcedir/modules.fips %{buildroot}/lib/modules/%kernelrelease-%build_flavor/modules.fips - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-base.files - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-main.files + install -m 644 %_sourcedir/modules.fips %{buildroot}%modules_dir/modules.fips + echo %modules_dir/modules.fips >> %my_builddir/kernel-base.files + echo %modules_dir/modules.fips >> %my_builddir/kernel-main.files fi # Hardlink duplicate files automatically (from package fdupes): It doesn't save # much, but it keeps rpmlint from breaking the package build. Note that we skip # /usr/src/linux-obj intentionally, to not accidentally break timestamps there -%fdupes $RPM_BUILD_ROOT/lib +%fdupes %buildroot%modules_dir %preun -f preun.sh @@ -1302,7 +1380,7 @@ static, unlike the %{patch_package}--flavor package names. %files %{livepatch} # rpmlint complains about empty packages, so lets own something %defattr(-, root, root) -%dir /lib/modules/%kernelrelease-%build_flavor +%dir %modules_dir %endif %if 0%{?klp_symbols} && "%livepatch" != "" diff --git a/kernel-zfcpdump.changes b/kernel-zfcpdump.changes index 3d9f1ec1..dcc6ac54 100644 --- a/kernel-zfcpdump.changes +++ b/kernel-zfcpdump.changes @@ -640,11 +640,16 @@ Wed Aug 11 08:39:05 CEST 2021 - jslaby@suse.cz ------------------------------------------------------------------- Wed Aug 11 06:36:51 CEST 2021 - jslaby@suse.cz +- Revert "Revert "UsrMerge the kernel (boo#1184804)"" + This reverts commit 999e6048a4cc6accd2653c9dccaaaff2f4ae8f86. By that, + we reverted the original commit 6f5ed044f52a. But the selinux problem is + hopefully fixed in the meantime, so it's time to try UsrMerge for kernel + again. - Revert "Revert "UsrMerge the kernel (boo#1184804)"" This reverts commit b6ab3ded319fca797d007c541a190a308f940cf7. By that, we reverted the original commit 6f5ed044f52a. But the two problems were adressed in the meantime, so it's time to try UsrMerge for kernel again. -- commit 2e9639b +- commit 33df9c6 ------------------------------------------------------------------- Mon Aug 9 13:13:03 CEST 2021 - ludwig.nussel@suse.de diff --git a/kernel-zfcpdump.spec b/kernel-zfcpdump.spec index 7c901da4..105aafeb 100644 --- a/kernel-zfcpdump.spec +++ b/kernel-zfcpdump.spec @@ -68,13 +68,27 @@ %define install_vdso 0 %endif +# TW is usrmerged +%if %{undefined usrmerged} && 0%{?suse_version} >= 1550 +%define usrmerged 1 +%endif + +%if 0%{?usrmerged} +%define modules_dir /usr/lib/modules/%kernelrelease-%build_flavor +%define systemmap %{modules_dir}/System.map +%else +%define modules_dir /lib/modules/%kernelrelease-%build_flavor +%define systemmap /boot/System.map-%kernelrelease-%build_flavor +%endif + + Name: kernel-zfcpdump Summary: The IBM System Z zfcpdump Kernel License: GPL-2.0-only Group: System/Kernel Version: 5.13.12 %if 0%{?is_kotd} -Release: .gaa9e1af +Release: .g33df9c6 %else Release: 0 %endif @@ -191,10 +205,10 @@ Conflicts: hyper-v < 4 Conflicts: libc.so.6()(64bit) %endif Provides: kernel = %version-%source_rel -Provides: kernel-%build_flavor-base-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 -Provides: kernel-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: kernel-%build_flavor-base-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 +Provides: kernel-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 # END COMMON DEPS -Provides: %name-srchash-aa9e1af89e8989efb091a5b1376efff529fab886 +Provides: %name-srchash-33df9c651d0aa37cce1275bd9528ea5cb9196022 %obsolete_rebuilds %name Source0: http://www.kernel.org/pub/linux/kernel/v5.x/linux-%srcversion.tar.xz Source2: source-post.sh @@ -616,6 +630,14 @@ done %install +%if 0%{?usrmerged} +# add symlink for usrmerge so install scripts will just follow the +# link and end up placing files in /usr/lib. The link will be +# removed later and is not packaged here. +mkdir -p %{buildroot}/usr/lib +ln -s usr/lib %{buildroot}/lib +%endif + # get rid of /usr/lib/rpm/brp-strip-debug # strip removes too much from the vmlinux ELF binary export NO_BRP_STRIP_DEBUG=true @@ -711,11 +733,19 @@ add_vmlinux() # sign the modules, firmware and possibly the kernel in the buildservice BRP_PESIGN_FILES="" %if "%CONFIG_EFI_STUB" == "y" +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %ifarch s390x ppc64 ppc64le +%if 0%{?usrmerged} +BRP_PESIGN_FILES="%modules_dir/$image" +%else BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor" %endif +%endif %if "%CONFIG_MODULE_SIG" == "y" BRP_PESIGN_FILES="$BRP_PESIGN_FILES *.ko" %endif @@ -777,6 +807,13 @@ for sub in '' '-extra' \ -e "s:@RPM_TARGET_CPU@:%_target_cpu:g" \ -e "s:@CPU_ARCH_FLAVOR@:%cpu_arch_flavor:g" \ -e "s:@SRCVARIANT@:%variant:g" \ + -e "s:@MODULESDIR@:%modules_dir:g" \ + -e "s:@SYSTEMMAP@:%systemmap:g" \ +%if 0%{?usrmerged} + -e "s:^@USRMERGE@::" \ +%else + -e "/^@USRMERGE@/d" \ +%endif %_sourcedir/$script.sh > %my_builddir/$script$sub.sh if test "$base_package" -eq 1 -a "${#certs[@]}" -gt 0; then case "$script" in @@ -983,6 +1020,10 @@ if [ %CONFIG_MODULES = y ]; then fi rm -rf %{buildroot}/lib/firmware +%if 0%{?usrmerged} +# remove usrmerge aid +rm %{buildroot}/lib +%endif add_dirs_to_filelist() { sed -rn ' @@ -995,7 +1036,7 @@ add_dirs_to_filelist() { # print all parents :a # skip directories owned by other packages - s:^%%dir (/boot|/etc|/lib/(modules|firmware)|/usr/src)/[^/]+$:: + s:^%%dir (/boot|/etc|(/usr)?/lib/(modules|firmware)|/usr/src)/[^/]+$:: s:/[^/]+$::p ta ' "$@" | sort -u @@ -1012,10 +1053,23 @@ fi %endif shopt -s nullglob dotglob > %my_builddir/kernel-devel.files -for file in %buildroot/boot/symtypes* %buildroot/lib/modules/*/{build,source}; do - f=${file##%buildroot} - echo "$f" -done | add_dirs_to_filelist >%my_builddir/kernel-devel.files +{ + echo "%modules_dir/build" + echo "%modules_dir/source" + cd %buildroot + for file in boot/symtypes*; do +%if 0%{?usrmerged} + l="${file##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" + mv "$file" "%{buildroot}$l" + ln -s "..$l" $file + echo "$l" + echo "%%ghost /$file" +%else + echo "/$file" +%endif + done +} | add_dirs_to_filelist >%my_builddir/kernel-devel.files ( cd %buildroot ; find .%obj_install_dir/%cpu_arch_flavor -type f ; ) | \ sed -e 's/^[.]//' | grep -v -e '[.]ipa-clones$' -e '/Symbols[.]list$' -e '/ipa-clones[.]list$'| \ add_dirs_to_filelist >> %my_builddir/kernel-devel.files @@ -1024,6 +1078,8 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files echo %ghost /boot/initrd$suffix cd %buildroot for f in boot/*; do + l="${f##*/}" + l="%modules_dir/${l//-%kernelrelease-%build_flavor}" if test -L "$f"; then echo "%%ghost /$f" continue @@ -1039,24 +1095,46 @@ add_dirs_to_filelist >> %my_builddir/kernel-devel.files ;; boot/vmlinux-*) if $ghost_vmlinux; then - echo "%%ghost /$f" - continue + # fall through to mark next echo as %ghost + echo -n "%%ghost " fi ;; +%if 0%{?usrmerged} + boot/vmlinuz-*) + echo -n "%%attr(0644, root, root) " + ;; +%endif boot/symtypes*) +%if 0%{?usrmerged} + echo "%exclude $l" +%endif continue ;; esac +%if 0%{?usrmerged} + mv "$f" "./$l" + ln -s "..$l" $f + # the find in the CONFIG_MODULES condition below also finds the files + # but there's sort -u later, so this is ok + echo "$l" # note: must be first after case statement above + echo "%%ghost /$f" +%else echo "%%attr(0644, root, root) /$f" +%endif done if [ %CONFIG_MODULES = y ]; then - find lib/modules/%kernelrelease-%build_flavor \ + find %{?usrmerged:usr/}lib/modules/%kernelrelease-%build_flavor \ -type d -o \ \( -path '*/modules.*' ! -path '*/modules.order' \ ! -path '*/modules.builtin' \ ! -path '*/modules.builtin.modinfo' \) -printf '%%%%ghost /%%p\n' \ - -o -name '*.ko' -prune -o -type f -printf '/%%p\n' + -o -name '*.ko' -prune \ +%if 0%{?usrmerged} + -o \( -type f ! -path '*/symtypes*' ! -path '*/vmlinu*' \) -printf '/%%p\n' +%else + -o -type f -printf '/%%p\n' +%endif cat %my_builddir/base-modules fi if test %CONFIG_MODULE_SIG = "y" -a -d etc/uefi/certs; then @@ -1117,15 +1195,15 @@ for f in %my_builddir/*-kmp-modules; do done if [ %CONFIG_MODULES = y ]; then - install -m 644 %_sourcedir/modules.fips %{buildroot}/lib/modules/%kernelrelease-%build_flavor/modules.fips - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-base.files - echo /lib/modules/%kernelrelease-%build_flavor/modules.fips >> %my_builddir/kernel-main.files + install -m 644 %_sourcedir/modules.fips %{buildroot}%modules_dir/modules.fips + echo %modules_dir/modules.fips >> %my_builddir/kernel-base.files + echo %modules_dir/modules.fips >> %my_builddir/kernel-main.files fi # Hardlink duplicate files automatically (from package fdupes): It doesn't save # much, but it keeps rpmlint from breaking the package build. Note that we skip # /usr/src/linux-obj intentionally, to not accidentally break timestamps there -%fdupes $RPM_BUILD_ROOT/lib +%fdupes %buildroot%modules_dir %preun -f preun.sh @@ -1311,7 +1389,7 @@ static, unlike the %{patch_package}--flavor package names. %files %{livepatch} # rpmlint complains about empty packages, so lets own something %defattr(-, root, root) -%dir /lib/modules/%kernelrelease-%build_flavor +%dir %modules_dir %endif %if 0%{?klp_symbols} && "%livepatch" != "" diff --git a/post.sh b/post.sh index 64c6aec0..c2d31e13 100644 --- a/post.sh +++ b/post.sh @@ -10,6 +10,23 @@ for x in /boot/@IMAGE@ /boot/initrd; do rm -f $x$suffix ln -s ${x##*/}-@KERNELRELEASE@-@FLAVOR@ $x$suffix done +@USRMERGE@# compat stuff for /boot. +@USRMERGE@# if /boot is not a speparate partition we can just link the kernel +@USRMERGE@# there to save space. Otherwise copy. +@USRMERGE@if mountpoint -q /boot; then +@USRMERGE@ copy_or_link="cp -a" +@USRMERGE@else +@USRMERGE@ copy_or_link="ln -sf" +@USRMERGE@fi +@USRMERGE@# XXX: need to fix suse-module-tools for sysctl.conf and System.map +@USRMERGE@for x in @IMAGE@ sysctl.conf System.map; do +@USRMERGE@ if [ ! -e /boot/$x-@KERNELRELEASE@-@FLAVOR@ ]; then +@USRMERGE@ $copy_or_link ..@MODULESDIR@/$x /boot/$x-@KERNELRELEASE@-@FLAVOR@ +@USRMERGE@ if [ -e @MODULESDIR@/.$x.hmac ]; then +@USRMERGE@ $copy_or_link ..@MODULESDIR@/.$x.hmac /boot/.$x-@KERNELRELEASE@-@FLAVOR@.hmac +@USRMERGE@ fi +@USRMERGE@ fi +@USRMERGE@done # Add symlinks of compatible modules to /lib/modules/$krel/weak-updates/, # run depmod and mkinitrd @@ -56,7 +73,7 @@ if [ -f /etc/fstab -a ! -e /.buildenv ] ; then if [ @FLAVOR@ = rt ]; then default=force-default fi - if [ -e /boot/$initrd -o ! -e /lib/modules/@KERNELRELEASE@-@FLAVOR@ ] && \ + if [ -e /boot/$initrd -o ! -e @MODULESDIR@ ] && \ run_bootloader ; then [ -e /boot/$initrd ] || initrd= if [ -x /usr/lib/bootloader/bootloader_entry ]; then diff --git a/postun.sh b/postun.sh index 2606371b..90eefacf 100644 --- a/postun.sh +++ b/postun.sh @@ -6,7 +6,7 @@ rm -f /boot/do_purge_kernels wm2=/usr/lib/module-init-tools/weak-modules2 nvr=@SUBPACKAGE@-@RPM_VERSION_RELEASE@ -if [ -e /boot/System.map-@KERNELRELEASE@-@FLAVOR@ ]; then +if [ -e @SYSTEMMAP@ ]; then # the same package was reinstalled or just rebuilt, otherwise the files # would have been deleted by now # do not remove anything in this case (bnc#533766) @@ -21,7 +21,7 @@ if [ @BASE_PACKAGE@ = 0 ]; then rm -f /var/run/rpm-$nvr-modules exit 0 fi -# Remove symlinks from /lib/modules/$krel/weak-updates/. +# Remove symlinks from @MODULESDIR@/weak-updates/. if [ -x $wm2 ]; then /bin/bash -${-/e/} $wm2 --remove-kernel @KERNELRELEASE@-@FLAVOR@ fi diff --git a/source-timestamp b/source-timestamp index 76fc034f..8da24eda 100644 --- a/source-timestamp +++ b/source-timestamp @@ -1,3 +1,3 @@ -2021-08-18 12:54:53 +0000 -GIT Revision: aa9e1af89e8989efb091a5b1376efff529fab886 +2021-08-20 07:04:28 +0000 +GIT Revision: 33df9c651d0aa37cce1275bd9528ea5cb9196022 GIT Branch: stable diff --git a/split-modules b/split-modules index ef00c191..c9aa90eb 100644 --- a/split-modules +++ b/split-modules @@ -77,7 +77,7 @@ while read mod path; do no) ;; "") - echo "warning: ${path#/lib/modules/*/kernel/} not listed in supported.conf" >&2 + echo "warning: $mod not listed in supported.conf" >&2 ;; *) echo "error: invalid support flag for $mod: $support" >&2 @@ -119,11 +119,13 @@ join -j 1 -o 2.2 "$tmp/base" "$tmp/all" >"$opt_out/base-modules" # base firmware kver=$(make $MAKE_ARGS -s -C "$opt_builddir" kernelrelease) -if test -d "$opt_dir/lib/firmware/$kver"; then +fw_dir=/lib/firmware/$kver +test -d $opt_dir/usr$fw_dir && fw_dir=/usr$fw_dir +if test -d "$opt_dir$fw_dir"; then join <(/sbin/modinfo -F firmware \ $(sed "s:^:$opt_dir:" "$opt_out/base-modules") | sort) \ - <(find "$opt_dir/lib/firmware/$kver" -type f -printf '%P\n' | sort) -fi | sed "s:^:/lib/firmware/$kver/:" >"$opt_out/base-firmware" + <(find "$opt_dir$fw_dir" -type f -printf '%P\n' | sort) +fi | sed "s:^:$fw_dir:" >"$opt_out/base-firmware" # kmps for f in "$opt_builddir"/Module.*-kmp; do diff --git a/splitflist b/splitflist index 7c78214d..041011bf 100644 --- a/splitflist +++ b/splitflist @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/bash -e package="$1" present="$2" @@ -10,6 +10,7 @@ rpm -ql --noghost "$package" | while read x ; do [ -e "$x" -o -L "$x" ] && echo "$x" >> "$present" || echo Missing file "$x" done -rpm -ql "$package" | while read x ; do - grep "^$x\$" $present >/dev/null || echo "$x" >> $ghost -done +rpm -q --qf '[%{FILEFLAGS} %{FILENAMES} 0%{FILEMODES:octal} %{FILESIZES} %{FILEMTIMES} %{FILELINKTOS}\n]' $package | while read -a line; do + [ $[line[0]&64] = 64 ] || continue + echo "${line[@]:1}" +done > "$ghost"