View previous topic :: View next topic |
Author |
Message |
awdas n00b
Joined: 20 Dec 2016 Posts: 4
|
Posted: Tue Dec 20, 2016 2:28 am Post subject: Genkernel runs as root? |
|
|
Hello, I have a question concerning genkernel, does it run as root?
Is there any known way to build the kernel via portage? I'd love to use the sandbox it provides (and unprivileged user). |
|
Back to top |
|
|
The Doctor Moderator
Joined: 27 Jul 2010 Posts: 2678
|
Posted: Tue Dec 20, 2016 4:03 am Post subject: |
|
|
Yes, genkernel is designed to run as root. So does portage.
If you really want to build the kernel as a user you can do so. You will either have to download the sources yourself or chown the portage installed sources (at your own risk). There is no way for portage to build the kernel by itself because it has no way of knowing what features you want. Genkernel can't because it requires root privileges to install the kernel. _________________ First things first, but not necessarily in that order.
Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box. |
|
Back to top |
|
|
Jaglover Watchman
Joined: 29 May 2005 Posts: 8291 Location: Saint Amant, Acadiana
|
|
Back to top |
|
|
mv Watchman
Joined: 20 Apr 2005 Posts: 6747
|
Posted: Tue Dec 20, 2016 7:47 am Post subject: |
|
|
The Doctor wrote: | build the kernel as a user [...] You will either have to download the sources yourself or chown the portage installed sources (at your own risk). |
Neither is necessary: You just have to define an output directory which belongs to portage:portage and set KBUILD_OUTPUT to that directory. Set KERNEL_DIR to /usr/src/linux.
Then you can compile as portage. There is a kernel script (can be installed over portage from the mv overlay) which does this if the above variables are set up:
It must be called as root, but will drop permissions for compilation to "portage"; then it restores root permissions for installation and setting symlinks.
It is written to match my personal kernel management, but if you prefer a different one and write patches to the script which support both, I will gladly extend the script... |
|
Back to top |
|
|
awdas n00b
Joined: 20 Dec 2016 Posts: 4
|
Posted: Tue Dec 20, 2016 11:35 pm Post subject: |
|
|
mv wrote: | The Doctor wrote: | build the kernel as a user [...] You will either have to download the sources yourself or chown the portage installed sources (at your own risk). |
Neither is necessary: You just have to define an output directory which belongs to portage:portage and set KBUILD_OUTPUT to that directory. Set KERNEL_DIR to /usr/src/linux.
Then you can compile as portage. There is a kernel script (can be installed over portage from the mv overlay) which does this if the above variables are set up:
It must be called as root, but will drop permissions for compilation to "portage"; then it restores root permissions for installation and setting symlinks.
It is written to match my personal kernel management, but if you prefer a different one and write patches to the script which support both, I will gladly extend the script... |
This is what I was looking for, thanks! I'll look at it, and might send some push request if I have time.
I also thought about making an ebuild for hardened-sources that calls portage's make functions with USE flags to determine the configuration mechanism (ex USE=menuconfig), I'll see if that feasible. |
|
Back to top |
|
|
mv Watchman
Joined: 20 Apr 2005 Posts: 6747
|
Posted: Wed Dec 21, 2016 12:19 am Post subject: |
|
|
awdas wrote: | I also thought about making an ebuild for hardened-sources that calls portage's make functions with USE flags to determine the configuration mechanism (ex USE=menuconfig), I'll see if that feasible. |
I prefer a separate script, because reconfiguring/recompiling the kernel and installing the sources are two separate things and the latter does not always have to be repeated before the former. Also note that an interactive ebuild is usually always a bad idea. Yet another argument against it: A script is somewhat distribution independent (though the mentioned kernel scripts supports many gentoo-specific features [like using the portage user by default], these features are optional). |
|
Back to top |
|
|
awdas n00b
Joined: 20 Dec 2016 Posts: 4
|
Posted: Wed Dec 21, 2016 1:32 am Post subject: |
|
|
mv wrote: | awdas wrote: | I also thought about making an ebuild for hardened-sources that calls portage's make functions with USE flags to determine the configuration mechanism (ex USE=menuconfig), I'll see if that feasible. |
I prefer a separate script, because reconfiguring/recompiling the kernel and installing the sources are two separate things and the latter does not always have to be repeated before the former. Also note that an interactive ebuild is usually always a bad idea. Yet another argument against it: A script is somewhat distribution independent (though the mentioned kernel scripts supports many gentoo-specific features [like using the portage user by default], these features are optional). |
Hmm, I think you're right, portage doesn't even seem to support interactive ebuild.
I don't know if it's a bug, but it won't redirect your input to the config utilities, probably because of a combination of sandbox + chroot?.
Although a script is fun because it's distribution independent, a full integration of the kernel building and initramfs building into portage would be awesome. |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3131
|
Posted: Wed Dec 21, 2016 9:08 pm Post subject: |
|
|
Quote: | portage doesn't even seem to support interactive ebuild. |
It does.
I recall there are some ebuilds for games that require you to copy data files into some specific location. You could probably use it to let the user know it's time for menuconfig (or set USE=savedconfig and try building new kernel with config stored in /etc - non-interactively) |
|
Back to top |
|
|
|