Concept of Core Steps
The typical workflow of building a software could be generalized as 3 steps: collecting source code (including build dependencies), assembling (configuring, building, compiling, and linking), and deployment. When working on anything related to debian (or say debian packages), paying attention on how the files under debian
directory play the role of "assembling" will pay off.
For example, in Ubuntu, we use debian/rules
directly to build the corresponding Linux kernel. That is, fakeroot debian/rules binary-generic
, for example. See Ubuntu Wiki and this post. But in Debian, we use make
(and then invoke debian/rules
). See Debian Wiki.
When looking for documents, keep in mind which step of the 3 steps we are looking at will help you not get lost in different and variant commands. Several questions asking yourself may help:
- What is the command to configure the kernel deb building? Is it the command I am looking at?
- What is the command to build and/or compile the kernel deb building? Is it the command I am looking at?
- What is the command to link the kernel deb building? Is it the command I am looking at?
The Core Steps
According to Debian Wiki, I execute the core steps by the following commands:
- collecting the source
- copy from
`/usr/src
sudo apt install rsync
sudo apt-get install build-essential linux-source bc kmod cpio flex libncurses5-dev libelf-dev libssl-dev dwarves
- what I actually did: I use
apt-get source linux
- copy from
- configuring
- make
CONFIG_SYSTEM_TRUSTED_KEYS=""
indebian/config/config
anddebian/config/featureset-rt/config
. make oldconfig
to generate the configuration file- what I actually did
- enable edac debug. I did this for my on debugging purpose
- update
changelog
. I did this for myself to tell the installed kernel easier
- make
- building and compiling
- nice make -j`nproc` bindeb-pkg
- linking is done along with the same command used in "building and compiling"
- deployment
debian@bullseye:~/build-kernel$ sudo apt install linux-image-5.10.113_5.10.113-1_amd64.deb