2

I'm a gentoo user and I've become I a bit tired of copying my kernel config file when a new kernel comes out. I wonder if it's possible to pipe the configuration file to genkernel directly. Something like this:

sudo genkernel --install --clean --kernel-config=$(gunzip/proc/config.gz) --menuconfig all

or this:

zcat /proc/config.gz | sudo genkernel --install --clean --kernel-config=- --menuconfig all

But I can't get it to work since I'm not really that good at piping/shell scripting. Any ideas?

EDIT: with $(gunzip /proc/config.gz) it says gzip: /proc/config: No such file or directory. But it's untrue since zcat /proc/config.gz prints all my settings

0

Your shell invocation is wrong.

$(gunzip /proc/config.gz) -> this tries to /proc/config.gz to /proc/config. Nothing is sent to stdout, but stderr does get triggered in this case, because it's not permitted to make new files in /proc (that's the no such file or directory error).

You have to tell genkernel to read a file descriptor (it doesn't support - as a shortcut for stdin) for the config, so you have two options:

  1. Pipes:
zcat /proc/config.gz | sudo genkernel --install \
--clean --kernel-config=/dev/stdin --menuconfig all
  1. Process substitution:
sudo genkernel --install --clean \
--kernel-config=<(zcat /proc/config.gz) --menuconfig all

I'd suggest the latter, but would also like to point out that by default, genkernel saves every kernel config to /etc/kernels/, and you can source them from there:

sudo genkernel --install --clean \
--kernel-config=/etc/kernels/kernel-config-$(uname -m)-$(uname -r) \
--menuconfig all

(beware if you change config options and rebuild the same kernel, it overwrites the previous file in that directory, by design).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.