What is the difference between the srcpackage kernel-default the package kernel-source

In my understanding, a package of type srcpackage is a package, which contains source code. When I do

zypper se kernel

, if find

   | kernel-default                         | The Standard Kernel                                      | srcpackage

and

i+ | kernel-source                          | The Linux Kernel Sources                                 | package

Which one do I need to install in order to compile the kernel? Why is kernel-source not a source package?

In easy words:

kernel-source is where the kernel will be build from. On every distribution.

kernel-src.rpm is an rpm with all the source, patches and so on to build all kernel.rpm
Download it and unzip it, you will see. So the kernel-source.rpm will can be build from inside the kernel.src.rpm.
Also kernel.devel.rpm, kernel-default.rpm and some more.

Try ‘zypper in kernel-source’. The command wants to install the following three packages:


[FONT=monospace]**erlangen:~ #** zypper if kernel-default-devel kernel-devel kernel-source 
Loading repository data... 
Reading installed packages... 


Information for package kernel-default-devel: 
--------------------------------------------- 
Repository     : openSUSE-Tumbleweed-Oss 
Name           : kernel-default-devel 
Version        : 5.15.2-1.1 
Arch           : x86_64 
Vendor         : openSUSE 
Installed Size : 4.7 MiB 
Installed      : No 
Status         : not installed 
Source package : kernel-default-5.15.2-1.1.nosrc 
Summary        : Development files necessary for building kernel modules 
Description    :  
    **This package contains files necessary for building kernel modules (and 
    kernel module packages) against the default flavor of the kernel. **


    Source Timestamp: 2021-11-13 14:10:12 +0000 
    GIT Revision: 26a203b53de5bda52f512344a49e138964e43912 
    GIT Branch: stable 


Information for package kernel-devel: 
------------------------------------- 
Repository     : openSUSE-Tumbleweed-Oss 
Name           : kernel-devel 
Version        : 5.15.2-1.1 
Arch           : noarch 
Vendor         : openSUSE 
Installed Size : 58.4 MiB 
Installed      : No 
Status         : not installed 
Source package : kernel-source-5.15.2-1.1.src 
Summary        : Development files needed for building kernel modules 
Description    :  
    **Kernel-level headers and Makefiles required for development of 
    external kernel modules.** 

    Source Timestamp: 2021-11-13 14:10:12 +0000 
    GIT Revision: 26a203b53de5bda52f512344a49e138964e43912 
    GIT Branch: stable 


Information for package kernel-source: 
-------------------------------------- 
Repository     : openSUSE-Tumbleweed-Oss 
Name           : kernel-source 
Version        : 5.15.2-1.1 
Arch           : noarch 
Vendor         : openSUSE 
Installed Size : 972.0 MiB 
Installed      : No 
Status         : not installed 
Source package : kernel-source-5.15.2-1.1.src 
Summary        : The Linux Kernel Sources 
Description    :  
   ** Linux kernel sources with many fixes and improvements.** 


    Source Timestamp: 2021-11-13 14:10:12 +0000 
    GIT Revision: 26a203b53de5bda52f512344a49e138964e43912 
    GIT Branch: stable 

**erlangen:~ #**

[/FONT]

The sources are what they are. The src packages are used to generate rpms, such as kernel-default-devel kernel-devel and kernel-source. They reside in a different repo:

[FONT=monospace]**erlangen:~ #** zypper se -s kernel-source 
Loading repository data... 
Reading installed packages... 

S | Name                  | Type       | Version    | Arch   | Repository 
--+-----------------------+------------+------------+--------+--------------------------- 
  | kernel-source         | package    | 5.15.2-1.1 | noarch | openSUSE-Tumbleweed-Oss 
  | kernel-source         | srcpackage | 5.15.2-1.1 | noarch | openSUSE-Tumbleweed-Source 
  | kernel-source-vanilla | package    | 5.15.2-1.1 | noarch | openSUSE-Tumbleweed-Oss 
  | openafs-kernel-source | package    | 1.8.8-2.8  | x86_64 | openSUSE-Tumbleweed-Oss 
  | openafs-kernel-source | package    | 1.8.8-2.8  | i586   | openSUSE-Tumbleweed-Oss 
**erlangen:~ #**[/FONT]