kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>
To: Gidi Gal <gidi.gal.linux@gmail.com>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: How to switch between installed kernel and developed kernel
Date: Mon, 22 Mar 2021 08:57:00 -0400	[thread overview]
Message-ID: <61165.1616417820@turing-police> (raw)
In-Reply-To: <CAB+0Vonjsn=WXP0nVay3ELVKN=fiNKV=iEvvL6esW0wkz8FjGg@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2502 bytes --]

On Mon, 22 Mar 2021 14:11:58 +0200, Gidi Gal said:

> I am new to kernel development, currently working on
> https://kernelnewbies.org/FirstKernelPatch. I reached the step "Install
> your changes" in "Modifying a driver on native Linux". I would like to
> separate my developed kernel and my installed kernel and to switch between
> the two in order to test my changes. I am not sure that my tutorial
> explains how to do that.

Well... the first rule of thumb is to make sure that your kernel release name
will be different one way or another.  CONFIG_LOCALVERSION is a good way to
ensure it, while linux-next kernels and git-bisect kernels have their own way
of naming themselves.  It's also what shows up in uname -r.

What I have in /boot at the moment:

[/boot] ls vmlinuz-*
vmlinuz-5.10.0-0.rc6.20201204git34816d20f173.92.fc34.x86_64  vmlinuz-5.10.0-rc4-next-20201117-dirty  vmlinuz-5.11.0-rc3-next-20210114-dirty
vmlinuz-5.10.0-next-20201215				     vmlinuz-5.10.0-rc6-next-20201203	     vmlinuz-5.12.0-rc1-next-20210302-dirty
vmlinuz-5.10.0-next-20201223-dirty			     vmlinuz-5.10.0-rc6-next-20201207	     vmlinuz-5.12.0-rc2-next-20210309-dirty
vmlinuz-5.10.0-rc1-00257-gcf9446cc8e6d-dirty		     vmlinuz-5.10.0-rc7-next-20201208	     vmlinuz-5.8.0-next-20200807
vmlinuz-5.10.0-rc1-next-20201030			     vmlinuz-5.11.0-rc2-next-20210105-dirty  vmlinuz-5.8.0-rc1-next-20200616

Each has a matching config-, System.map-, and initramfs- file in /boot, a grub2
config entry in /boot/loader/entries/, and the loadable modules in
subdirectories under /lib/modules/`uname -r`.  So if you back up /boot
and /lib/modules, you should be able to recover from any issues.  Note
that on many systems, /boot is ext4, but there's a /boot/efi that's vfat that
kernel installs shouldn't be touching, but you want a copy in case an update
of grub goes astray...

This is probably a good time to back up your *entire* system, because lots
of Bad Things can happen even when you're not testing a new kernel.

If you want to double-check what your just-built kernel is called, you can use
'make kernelrelease' to tell you.  As long as that's different from any
installed kernel, you shouldn't have any issues with files getting overlaid.

'make install' will look for a script 'installkernel' that does some of the
heavy lifting, like building an initramfs, adding grub entries, and the like.
That usually lives in /sbin/installkernel, but if you create your own and have
it before /sbin in $PATH, it will get used.


[-- Attachment #1.2: Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  parent reply	other threads:[~2021-03-22 12:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 12:11 How to switch between installed kernel and developed kernel Gidi Gal
2021-03-22 12:30 ` Bernd Petrovitsch
2021-03-22 12:57 ` Valdis Klētnieks [this message]
2021-03-22 12:59 ` Bjørn Mork
2021-03-22 17:53   ` Gidi Gal
2021-03-22 21:18     ` Aruna Hewapathirane
2021-03-22 21:19       ` Aruna Hewapathirane
2021-03-22 22:01         ` Gidi Gal
2021-03-23  1:17           ` Valdis Klētnieks
2021-03-23  4:29             ` Aruna Hewapathirane
2021-03-23 15:06               ` Valdis Klētnieks
2021-03-23 15:16                 ` Aruna Hewapathirane
2021-03-23 15:11               ` Gidi Gal
     [not found]               ` <CAB+0Vomu+EaW8N6VNMFcZBB29MxnYYvD=1bF98Tf+1YgwaRi2Q@mail.gmail.com>
2021-03-23 15:05                 ` Valdis Klētnieks
2021-03-23 15:23                 ` Aruna Hewapathirane
2021-03-23  8:53 ` Ahmad Fatoum
2021-03-25 15:42   ` jim.cromie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=61165.1616417820@turing-police \
    --to=valdis.kletnieks@vt.edu \
    --cc=gidi.gal.linux@gmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).