Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Kernel build, what does "#make install" do?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
MickeJ
n00b
n00b


Joined: 29 May 2023
Posts: 13

PostPosted: Mon May 29, 2023 9:24 pm    Post subject: Kernel build, what does "#make install" do? Reply with quote

Hi, i am a newbee and planning a Gentoo install.

When reading the documentation https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel#Compiling_and_installing. It says
Quote:
When the kernel has finished compiling, copy the kernel image to /boot/. This is handled by the make install command: This will copy the kernel image into /boot/ together with the System.map file and the kernel configuration file.

Does it mean just copy bin and artifacts to /boot folder on root? Or does it do more fancy thing like copy to sda1 /boot/EFI/? Does it run efibootmgr? What does it do?
Back to top
View user's profile Send private message
saturnalia0
Apprentice
Apprentice


Joined: 13 Oct 2016
Posts: 163

PostPosted: Mon May 29, 2023 9:48 pm    Post subject: Reply with quote

I don't know if Gentoo does anything in particular, but looking at the kernel's Makefile it hints that the install target is handled by /sbin/installkernel:

Code:

# ---------------------------------------------------------------------------
# Install

# Many distributions have the custom install script, /sbin/installkernel.
# If DKMS is installed, 'make install' will eventually recurse back
# to this Makefile to build and install external modules.
# Cancel sub_make_done so that options such as M=, V=, etc. are parsed.

quiet_cmd_install = INSTALL $(INSTALL_PATH)
      cmd_install = unset sub_make_done; $(srctree)/scripts/install.sh


Which, in turn, seems to be borrowed from Debian. Glancing over that file it does not seem to call efibootmgr, but in the absence of a response from someone more knowledgeable take a look at it yourself to figure out what it does or does not do.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5429
Location: Bavaria

PostPosted: Mon May 29, 2023 10:22 pm    Post subject: Reply with quote

MickeJ,

Welcome to Gentoo Forums !

I can confirm that "make install" copies only 3 files to /boot (*): Your kernel, your .config-file and your system.map. With this copy it also adds a version string to them (and do a rename from .config to config; and a rename from bzImage to vmlinuz). AFAIK there is also a hook where you can configure more actions if you want.

Because you asked for efibootmgr ...

I am using UEFI as my bootmanager (no Grub) and I dont need a "make install" anymore; I am just "copying" my kernel to /boot/efi/USEDDIRECTORY/. after building my (new) kernel with (EXAMPLE):
Code:
 /usr/src/linux # sbsign --key /mnt/stick/keys/DB.key --cert /mnt/stick/keys/DB.crt --output /boot/efi/secure/bzImage.efi arch/x86/boot/bzImage


:lol:

(* For this you must have mounted your /boot BEFORE doing the "make install" ... ;-) )
Back to top
View user's profile Send private message
MickeJ
n00b
n00b


Joined: 29 May 2023
Posts: 13

PostPosted: Mon May 29, 2023 10:46 pm    Post subject: Reply with quote

Thx!

Greate news. Yepp i want the same, just use my hardware bootloader EFI app (Lenovo) and booting "direct" into a UKI kernel. Just manually copy and run efibootmgr.

I wish the "make install" output used "/usr/lib/kernel/version/" instead of "/boot" Makes no sense to use a "/boot" directory when the vmlinuz file is on another block device. Instead put it on /usr or /var.
Back to top
View user's profile Send private message
MickeJ
n00b
n00b


Joined: 29 May 2023
Posts: 13

PostPosted: Mon May 29, 2023 10:51 pm    Post subject: Reply with quote

And also thx for this example as inspiration :D

/usr/src/linux # sbsign --key /mnt/stick/keys/DB.key --cert /mnt/stick/keys/DB.crt --output /boot/efi/secure/bzImage.efi arch/x86/boot/bzImage
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23131

PostPosted: Tue May 30, 2023 12:42 am    Post subject: Reply with quote

For many many years, /boot has been traditional because it is a special-purpose filesystem, often kept unmounted, that exists solely to hold the early boot environment (kernel, initramfs, bootloader configuration). Putting it on /usr or /var would be unusable on typical encrypted-disk systems.

You can direct make install about where to write by setting INSTALL_PATH in the Make environment. You could also choose to skip make install entirely and manage copying the files through your own script, since there are few files and their names are predictable.
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2209

PostPosted: Tue May 30, 2023 8:39 am    Post subject: Reply with quote

The default installkernel will maintain symlinks "vmlinuz", etc and "vmlinuz.old" etc. This gives one advantage of having kernels on a modern filesystem (symlinks) rather than the antique floppy disk stuff used for the EFI partition, and means rather whimsically that you don't need to reconfigure GRUB to a new kernel every time you update it (whatever Ubuntu decides to the contrary), but annoyingly can't handle if you use the EFI stub in an EFI partition.

You can easily rewrite installkernel to rename your current kernel to "vmlinuz.old.efi" and copy your new kernel to "vmlinuz.efi", in which case you need just two fixed efibootmgr entries; the downside is you can't tell what versions the current and old kernels are from outside ("file vmlinuz.efi" works fine once Linux is running), and you have only one level of fallback.

(Me, I prefer to keep vmlinuz.new (just installed, testing), vmlinuz, vmlinuz.old (in case I rename .new as current too soon and then find a bug) and vmlinuz-V.R-1.foo if vmlinuz-V.R.bah is current - since the .foo releases are just fix levels, not different releases. So I have a hairy grub.cfg that can handle all of this without needing to reconfigure on a new release).
_________________
Greybeard
Back to top
View user's profile Send private message
MickeJ
n00b
n00b


Joined: 29 May 2023
Posts: 13

PostPosted: Tue May 30, 2023 1:55 pm    Post subject: Reply with quote

Ok, thx for feedback. I am educating me before installing because i think the install and daily use is sort of same thing in Gentoo. I think Portage makes it very flexible but with also simple when you have settled down and just want a defined world to be your regular daily driver. I just was curious before i spend time.

I put my Intel cpu firmware and I915 into two initrd located in a separate folder from the kernel in /EFI because they very seldom changes. And i reuse those initrds when booting other distros.
This is approx the efibootmgr i am planning to use. Its ok if manually create this, but long term a automated way would be better ofc. I am thinking about editing the cmake kernel make file, but that is a later issue. Agreed on keeping a old kernel to boot after a update.

Code:
efibootmgr --create --disk /dev/sda --part 1 --label "Gentoo 6.3.4" --loader \\EFI\\Gentoo\\vmlinuz-6.3.4 --unicode "root=UUID=00f79e37-5467-4c53-d987-7935269c4383 rootfstype=brtfs rootflags=subvol=root initrd=/EFI/initrd/intel-cpu-ucode.cpio initrd=/EFI/initrd/i915-firmware.cpio init=/usr/bin/systemd
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum