Compile kernel as a normal user
I just heard this trick from my friend, rae.
It is quite easy:
PS: However, there is a problem with this approach.
My original intention is to avoid touching the sources in /usr/src/linux and running as root.
But in fact, before you emerge kernel modules such as x11-drm, you still have to run 'make modules_prepare' in /usr/src/linux as root. Even I have used this command:
It is quite easy:
- make a dir, cd into it
- cp /boot/config .config (suppose you use "make install" to install kernel, :-D)
- make -C /usr/src/linux O=$PWD oldconfig, (and optionally make menuconfig to tweak a little bit)
- make && sudo make modules_install && sudo make install
PS: However, there is a problem with this approach.
My original intention is to avoid touching the sources in /usr/src/linux and running as root.
But in fact, before you emerge kernel modules such as x11-drm, you still have to run 'make modules_prepare' in /usr/src/linux as root. Even I have used this command:
sudo env KBUILD_OUTPUT=/home/zhangle/build emerge x11-drmWhat's worse, the hints given in the output of the above command can't solve the problem:
* Found kernel source directory:
* /usr/src/linux
* Found kernel object directory:
* /home/zhangle/build
* Found sources for kernel version:
* 2.6.17-suspend2-r4
* Please verify that your /usr/src/linux symlink is pointing
* to your current kernel sources, and that you did run:
*
* # make dep
Comments
很多内核相关的ebuild编译需要设置KBUILD_OUTPUT,但实际上这个值可以从/lib/modules/$(uname -r)/build这个符号链接上读出来,希望写ebuild时首先看一下这个值,在KBUILD_OUTPUT没有设置时不要简单的报警退出。