Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
beginner questions re: bzImage
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Gen3Hunna
n00b
n00b


Joined: 31 Dec 2018
Posts: 27

PostPosted: Mon Dec 31, 2018 8:46 am    Post subject: beginner questions re: bzImage Reply with quote

Hello. New to Gentoo, not to Linux. (Arch was common in my days)

I've successfully complied my Kernel. I've found a clunky, haphazard way of rebuilding my kernel (or so I thought) but I have some questions about the build process and the resulting bzImage file.

So in the EFI stub kernel guide (which I use) it says

Still in the kernel directory, build the kernel and install the modules
root #cd /usr/src/linux
root #make && make modules_install. For that, I used
root #make -j9 && make modules_install instead. (8 cores, -j9 correct syntax?)

Up until here it is overlapping with the general amd64 install guide. However, the amd64 install guide says:

When the kernel has finished compiling, copy the kernel image to /boot/. This is handled by the make install command:
root #make install

This will copy the kernel image into /boot/ together with the System.map file and the kernel configuration file.


However, the EFI stub article only says to do the following:

Copy or move the kernel image to the right place adding version number and the .efi suffix.

root #mkdir -p /boot/EFI/Gentoo
root #cp arch/x86/boot/bzImage /boot/EFI/Gentoo/bzImage-4.9.76-r1.efi


my questions are as follows:

Where do the built files end up? Is it arch/x86 (or whatever)/boot? And is it just the bzImage or also the system.map file and the kernel configuration file that are also generated by the make -j9 && make modules_install command? If I run the command again to build the kernel in my installed Gentoo it didn't rename or ask to overwrite. It just appeared to overwrite the old kernel. I still used cp arch/x86/boot/bzImage /boot/EFI/Gentoo/bzImage-4.9.76-r1.efi and make install (after deleting everything in the /boot folder). Is this really the way to rebuild my kernel? I know it's a dangerous method because by deleting the old (known working) kernel I can't necessarily boot again if my new one doesn't work. But I'm not really worried about that, this is an experimental (hardware-based) installation. I liked what I did because I felt like I knew it was forcing the newly compiled kernel. Is this a valid method or can I do it a little better? I know if I install a bootloader like Grub I can boot specific kernel images and have it safer that way, but then do I have a whole mess of system.map file and kernel configuration files? Do I have to use the make install command? Because if it literally is just the act of copying a few files I'd rather just cp them myself like the EFI stub kernel article showed. (Although it didn't show how to move the kernel configuration files or the system.map file or where they are, so that's also got me confused)
Back to top
View user's profile Send private message
gentoo_ram
Guru
Guru


Joined: 25 Oct 2007
Posts: 413
Location: San Diego, California USA

PostPosted: Mon Dec 31, 2018 9:05 am    Post subject: Reply with quote

The instructions with "make install" are the kind of instructions that would be used if you are using Grub or some other Boot Manager to get your system booted. I use Grub 2 on my EFI system and I use those instructions. I have a kernel bzImage that is copied to /boot using "make install" and I use genkernel to create my initramfs. The only file used for booting in my EFI filesystem is the Grub 2 EFI boot loader. That file doesn't change when I make a new kernel. Instead, I use grub-mkconfig to generate a new Grub config file pointing to the updated kernel image in /boot.

The instruction about copying the kernel file to /boot/EFI looks more like what you would do if you aren't using Grub 2 or some other boot manager and are just using EFI to directly boot you kernel image file. I know this is possible, but I don't use this method.

So really it comes down to how you intend to set your system up. Are you using Grub 2 or are you booting the kernel directly from EFI? If you are using Grub 2, then you don't need to have anything in the EFI filesystem other than the Grub boot loader file. Grub will find the kernel based on its configuration.
Back to top
View user's profile Send private message
Gen3Hunna
n00b
n00b


Joined: 31 Dec 2018
Posts: 27

PostPosted: Mon Dec 31, 2018 9:15 am    Post subject: Reply with quote

Hi, sorry. I forgot to mention. I'm running without an initramfs or GRUB. So I am indeed asking about how I manage it in that case. (I'm already up and running) I'm asking if my method is the cleanest way to rebuild my kernel with my setup? Do the files overwrite each other and just stay in the same place each time I rebuild the kernel in the source directory?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43437
Location: 56N 3W

PostPosted: Mon Dec 31, 2018 1:15 pm    Post subject: Reply with quote

Gen3Hunna,

The compressed kernel binary, bzImage ends up in arch/<your_arch>/boot/
bzImage is not a useful name to you. Its likely that you will have several kernels in boot.
As all kernel binaries are called bzImage and you don't want to overwrite an old working kernel with a new one, that might not boot, its a good idea to rename them.

You can name the kernels anything, the names are just for you. You will find the version numbers useful when you want to delete old kernels.
As you use EFI stub booting, your boot file name, whatever it is, must end in .efi or the UEFI firmware won't find it.

Binary kernel modules are scattered throughout the kernel tree as they are built. That's the .ko files.
make modules_install puts them into /lib/modules/`uname -r`/ so that modules for one kernel don't get mixed up with modules for another kernel version.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7139
Location: Saint Amant, Acadiana

PostPosted: Mon Dec 31, 2018 1:47 pm    Post subject: Reply with quote

Whatever suits you. My kernel install routine is as follows:
1. rename running kernel to bzImage.old
2. copy over the new one as bzImage
3. reboot
The advantage of this method is you don't need to reconfigure the boot loader.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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