On Thu, May 05, 2011 at 02:04:49PM -0400, Jeff Mahoney wrote:
This patch adds support for per-kernel sysctl.conf files installed in /boot/sysctl.conf-$(uname -r).
Since we don't really want to maintain yet another tree of mostly identical files, I implemented simple inheritance.
The order of operation is, for flavor x86_64-desktop: - sysctl/defaults - sysctl/x86_64/arch-defaults - sysctl/x86_64/desktop
I didn't bother implementing filtering, so using the example files below: - All flavors will get kernel.hung_task_timeout=0. - All x86_ flavors will also get vm.dirty_ratio=40. - x86-desktop will /also/ get vm.dirty_ratio=20.
Nice.
diff --git a/scripts/tar-up.sh b/scripts/tar-up.sh index ffa4532..7ee43f3 100755 --- a/scripts/tar-up.sh +++ b/scripts/tar-up.sh @@ -311,6 +311,26 @@ done echo "kabi.tar.bz2" stable_tar $build_dir/kabi.tar.bz2 kabi
+echo "sysctl.tar.bz2" +for config in $(scripts/guards --list < config.conf); do + arch=${config%%/*} + flavor=${config##*/} + + mkdir -p $tmpdir/sysctl/$arch + for file in sysctl/defaults sysctl/$arch/arch-defaults \ + sysctl/$arch/$flavor; do + if [ -f "$file" ]; then + cat $file + fi + done > $tmpdir/sysctl/$arch/$flavor +done + +# We don't need to ship empty files or directories +find $tmpdir/sysctl -size 0 -exec rm -f {} \; +rmdir $tmpdir/sysctl/* 2> /dev/null + +stable_tar -C $tmpdir $build_dir/sysctl.tar.bz2 sysctl
I would do this at build time and only tar up the sysctl dir here. This would make life easier for those that work on the kernel-source package instead of git. What do you think? Michal diff --git a/rpm/kernel-binary.spec.in b/rpm/kernel-binary.spec.in index 3a82dee..b25bf4b 100644 --- a/rpm/kernel-binary.spec.in +++ b/rpm/kernel-binary.spec.in @@ -452,6 +452,15 @@ ln -s $image$suffix %buildroot/boot/$image$suffix ln -s initrd$suffix %buildroot/boot/initrd$suffix cp -p .config %buildroot/boot/config-%kernelrelease-%build_flavor +sysctl_file=%buildroot/boot/sysctl.conf-%kernelrelease-%build_flavor +for file in %my_builddir/sysctl/{defaults,%cpu_arch/arch-defaults,%cpu_arch_flavor}; do + if [ -f "$file" ]; then + cat "$file" + fi +done >$sysctl_file +if [ ! -s $sysctl_file ]; then + rm $sysctl_file +fi %if %install_vdso # Install the unstripped vdso's that are linked in the kernel image diff --git a/rpm/kernel-source.spec.in b/rpm/kernel-source.spec.in index 6560706..1156d2a 100644 --- a/rpm/kernel-source.spec.in +++ b/rpm/kernel-source.spec.in @@ -101,6 +101,7 @@ Source111: patches.rt.tar.bz2 Source112: patches.trace.tar.bz2 Source113: patches.kabi.tar.bz2 Source120: kabi.tar.bz2 +Source121: sysctl.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch Prefix: /usr/src diff --git a/scripts/check-cvs-add b/scripts/check-cvs-add index 592d4a4..577df98 100755 --- a/scripts/check-cvs-add +++ b/scripts/check-cvs-add @@ -38,7 +38,7 @@ if [ "$1" = "--committed" ]; then added="$(git ls-tree -r --name-only HEAD | grep '^patches\..*/' | sort -u)" not_in_git="$(join -v1 <(echo "$patches") <(echo "$added")) - $(git ls-files -d -o -m --directory --exclude-standard kabi/ | sort -u)" + $(git ls-files -d -o -m --directory --exclude-standard kabi/ sysctl/ | sort -u)" else # only if the patches are added added="$(git ls-files --cached | grep '^patches\..*/' | sort -u)" diff --git a/scripts/tar-up.sh b/scripts/tar-up.sh index ffa4532..cfbe5c4 100755 --- a/scripts/tar-up.sh +++ b/scripts/tar-up.sh @@ -311,6 +311,13 @@ done echo "kabi.tar.bz2" stable_tar $build_dir/kabi.tar.bz2 kabi +if grep -q '^Source.*\<sysctl\.tar\.bz2' "$build_dir/kernel-source.spec.in" +then + echo "sysctl.tar.bz2" + stable_tar $build_dir/sysctl.tar.bz2 sysctl +fi + + # Create empty dummys for any *.tar.bz2 archive mentioned in the spec file # not already created: patches.addon is empty by intention; others currently # may contain no patches. diff --git a/sysctl/defaults b/sysctl/defaults new file mode 100644 index 0000000..ac9d6d9 --- /dev/null +++ b/sysctl/defaults @@ -0,0 +1 @@ +kernel.hung_task_timeout=0 diff --git a/sysctl/x86_64/arch-defaults b/sysctl/x86_64/arch-defaults new file mode 100644 index 0000000..b6f94d4 --- /dev/null +++ b/sysctl/x86_64/arch-defaults @@ -0,0 +1 @@ +sys.vm.dirty_ratio=40 diff --git a/sysctl/x86_64/desktop b/sysctl/x86_64/desktop new file mode 100644 index 0000000..ef6e377 --- /dev/null +++ b/sysctl/x86_64/desktop @@ -0,0 +1 @@ +sys.vm.dirty_ratio=20 -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org