From eeab2cc1b5874acd2694855795cdfedcd9002282 Mon Sep 17 00:00:00 2001 From: ferrreo Date: Sat, 25 Feb 2023 15:09:56 +0000 Subject: [PATCH] Try to fix linux-tools generation --- patches/0000-linux-tools.patch | 145 --------------------------------- scripts/build.sh | 2 +- scripts/patch.sh | 3 - 3 files changed, 1 insertion(+), 149 deletions(-) delete mode 100644 patches/0000-linux-tools.patch diff --git a/patches/0000-linux-tools.patch b/patches/0000-linux-tools.patch deleted file mode 100644 index fd4791c..0000000 --- a/patches/0000-linux-tools.patch +++ /dev/null @@ -1,145 +0,0 @@ -Signed-off-by: Joerg Roedel ---- - scripts/package/builddeb | 93 +++++++++++++++++++++++++++++++++++++++++++++- - 1 files changed, 92 insertions(+), 1 deletions(-) - -diff --git a/scripts/package/builddeb b/scripts/package/builddeb -index eee5f8e..d474736 100644 ---- a/scripts/package/builddeb -+++ b/scripts/package/builddeb -@@ -78,17 +78,20 @@ tmpdir="$objtree/debian/tmp" - fwdir="$objtree/debian/fwtmp" - kernel_headers_dir="$objtree/debian/hdrtmp" - libc_headers_dir="$objtree/debian/headertmp" -+tools_dir="$objtree/debian/toolstmp" -+tmp_build_dir="$objtree/debian/toolsbuild" - packagename=linux-image-$version - fwpackagename=linux-firmware-image - kernel_headers_packagename=linux-headers-$version - libc_headers_packagename=linux-libc-dev -+tools_packagename=linux-tools-$version - - if [ "$ARCH" = "um" ] ; then - packagename=user-mode-linux-$version - fi - - # Setup the directory structure --rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" -+rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$tools_dir" "$tmp_build_dir" - mkdir -m 755 -p "$tmpdir/DEBIAN" - mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" - mkdir -m 755 -p "$fwdir/DEBIAN" -@@ -98,6 +101,10 @@ mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" - mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" - mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename" - mkdir -p "$kernel_headers_dir/lib/modules/$version/" -+mkdir -m 755 -p "$tools_dir/DEBIAN" -+mkdir -p "$tools_dir/usr/share/doc/$tools_packagename" -+mkdir -p "$tools_dir/usr/bin/" -+mkdir -p "$tmp_build_dir" - if [ "$ARCH" = "um" ] ; then - mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" - fi -@@ -120,6 +127,75 @@ else - fi - fi - -+# Build the tools -+num_tools="0" -+tools_flavour_abi=${version#*-} -+tools_flavour=${tools_flavour_abi#*-} -+tools_version=${version%-$tools_flavour} -+debian_tools_version="${version%%-*}" -+debian_tools_version="${version%.*}" -+if grep -q '^CONFIG_PERF_EVENTS=y' .config ; then -+ # Build and install perf -+ ( -+ unset MAKEFLAGS -+ unset MFLAGS -+ unset MAKEOVERRIDES -+ -+ mkdir -p $objtree/tools/perf -+ cd "$srctree/tools/perf" -+ $MAKE DESTDIR="$tools_dir/usr/" LDFLAGS= O=$objtree/tools/perf/ install -+ mv "$tools_dir/usr/bin/perf" "$tools_dir/usr/bin/perf_$debian_tools_version" -+ ln -s "/usr/bin/perf_$debian_tools_version" "$tools_dir/usr/bin/perf_$tools_version" -+ mv "$tools_dir/usr/libexec/perf-core" "$tools_dir/usr/share/perf_$debian_tools_version-core" -+ rmdir "$tools_dir/usr/libexec" -+ -+ # Documentation can't be built out-of-tree so copy source -+ # over to objtree and build man pages there -+ mkdir -p $tmp_build_dir/perf -+ cp -a "$srctree/tools/perf/Documentation" "$tmp_build_dir/perf/" -+ cd "$tmp_build_dir/perf/Documentation" -+ $MAKE man -+ $MAKE DESTDIR="$tools_dir/usr/" install -+ for manpage in `find $tools_dir/usr/share/man/ -type f`; do -+ mv $manpage ${manpage/perf/perf_$debian_tools_version} -+ gzip -9 ${manpage/perf/perf_$debian_tools_version} -+ done -+ ) -+ num_tools=$(($num_tools+1)) -+fi -+ -+if [[ "$ARCH" = "i386" || "$ARCH" = "x86_64" ]]; then -+ # Build turbostat -+ ( -+ cp -a $srctree/tools/power/x86/turbostat "$tmp_build_dir" -+ cd "$tmp_build_dir/turbostat/" -+ unset MAKEFLAGS -+ unset MFLAGS -+ unset MAKEOVERRIDES -+ $MAKE LDFLAGS= -+ cp turbostat "$tools_dir/usr/bin/turbostat_$debian_tools_version" -+ ln -s "/usr/bin/turbostat_$debian_tools_version" "$tools_dir/usr/bin/turbostat_$tools_version" -+ mkdir -p "$tools_dir/usr/share/man/man8" -+ cp turbostat.8 "$tools_dir/usr/share/man/man8/turbotstat_${debian_tools_version}.8" -+ gzip -9 "$tools_dir/usr/share/man/man8/turbotstat_${debian_tools_version}.8" -+ ) -+ -+ # Build x86_energy_perf_policy -+ ( -+ cp -a $srctree/tools/power/x86/x86_energy_perf_policy "$tmp_build_dir" -+ cd "$tmp_build_dir/x86_energy_perf_policy" -+ unset MAKEFLAGS -+ unset MFLAGS -+ unset MAKEOVERRIDES -+ $MAKE LDFLAGS= -+ cp x86_energy_perf_policy "$tools_dir/usr/bin/x86_energy_perf_policy_$debian_tools_version" -+ ln -s "/usr/bin/x86_energy_perf_policy_$debian_tools_version" "$tools_dir/usr/bin/x86_energy_perf_policy_$tools_version" -+ cp x86_energy_perf_policy.8 "$tools_dir/usr/share/man/man8/x86_energy_perf_policy_${debian_tools_version}.8" -+ gzip -9 "$tools_dir/usr/share/man/man8/x86_energy_perf_policy_${debian_tools_version}.8" -+ ) -+ num_tools=$(($num_tools+2)) -+fi -+ - if grep -q '^CONFIG_MODULES=y' .config ; then - INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install - rm -f "$tmpdir/lib/modules/$version/build" -@@ -291,9 +367,24 @@ Description: Linux support headers for userspace development - are used by the installed headers for GNU glibc and other system libraries. - EOF - -+cat <> debian/control -+ -+Package: $tools_packagename -+Section: devel -+Architecture: $arch -+Depends: \${shlibs:Depends} -+Description: Linux kernel tools for version $version -+ This package provides the architecture dependant parts for kernel -+ version locked tools for version $version -+EOF -+ - if [ "$ARCH" != "um" ]; then - create_package "$kernel_headers_packagename" "$kernel_headers_dir" - create_package "$libc_headers_packagename" "$libc_headers_dir" -+ if [ "$num_tools" > "0" ]; then -+ dpkg-shlibdeps $tools_dir/usr/bin/* -+ create_package "$tools_packagename" "$tools_dir" -+ fi - fi - - create_package "$packagename" "$tmpdir" --- -1.7.5.4 diff --git a/scripts/build.sh b/scripts/build.sh index 8a48730..a5b69b9 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -2,4 +2,4 @@ echo "Pika Kernel - Building" -make -j`nproc` bindeb-pkg LOCALVERSION=-pikaos \ No newline at end of file +make -j`nproc` bindeb-pkg LOCALVERSION=-pikaos do_tools=true \ No newline at end of file diff --git a/scripts/patch.sh b/scripts/patch.sh index 7ef53bd..acee8b9 100755 --- a/scripts/patch.sh +++ b/scripts/patch.sh @@ -2,9 +2,6 @@ echo "Pika Kernel - Applying patches" -# WE want linux-tools so patch em in -patch -Np1 < "../patches/0000-linux-tools.patch" - # Cachy patches are here: https://github.com/CachyOS/kernel-patches/ # orig patch from cachy - 0001-cachyos-base-all.patch patch -Np1 < "../patches/0001-cachy-all.patch"