← Previous lessonFree lesson 3 of 3 · lesson 3 of 38

Unlock all 38 lessons of Linux Driver DevelopmentFull course ₹40,000 · paid

Price & syllabus
Free lesson · 23 min · no payment

Installing, Updating and Saving Kernel Configurations and Build Outputs

A free lesson from Skill-Lync's Linux Driver Development course, on Grow by Skill-Lync · Last updated 16 Nov 2026 · Session: “Week 1 Session 3”

What will you learn in this free Linux Driver Development lesson?

The instructor shows installing modules and the kernel image, then updating a kernel with patches and carrying the old .config forward. It covers reusing the distribution config, saving it with savedefconfig, restoring .config.old, the build output files, zImage versus bzImage, make clean and dmesg.

  • Updating kernel source with patches and oldconfig
  • Reusing a distribution config from /boot
  • Saving configurations with make savedefconfig
  • vmlinux, System.map, zImage and bzImage files

What comes after lesson 3?

Later in Skill-Lync's Linux Driver Development course (paid): lesson 4, Week 2 Session 1; lesson 5, Week 2 Session 2; lesson 6, Week 2 Session 3. The full course has 38 lessons (18 h 31 min of video); see the course overview or its price and syllabus.

Lesson transcript

Machine transcript of the lesson audio (lightly cleaned). Technical terms may contain errors; the video is the reference.

So, kernel installation is simple steps. So, only two commands. So, first install the modules and next install the kernel image. So, once it is done, so you can build using your newly built latest kernel source. So, applications and all will remain same. So, only kernel part of your Ubuntu PC will be upgraded to a newer kernel version. So, next thing is kernel updation. So, what this kernel updation means? So, during our development, so, we are using a stable kernel. So, let's say we are using 5.15.0 and during course of time. So, maybe our project runs one year or something. So, in the initial stage of our project, so, we use 5.15.0 and 6 months later, another newer stable version release 5.16.0. Then what we have to do? We have to update our driver development to the latest kernel.

So, what we have to do? Whether we have to download the entire source from the JIT or how we have to do it? So, there are easier procedures that are available. So, what we have to do is we can get patch around. Patch is a difference between two files. So, it is an recognized format. So, we can get the patch. So, website where kernel is released. So, they will also provide a patch for it. So, what we can do is we can get the patch between each version. So, 5.16 to 5.15. We can get the patch from it. And we can apply the patch to the existing source file. So, we have a patch command itself is there as a kernel application for a user application, user space application, patch command.

So, using this patch command and the patch file, what we downloaded from the net, we can apply to our source file. So, once it is applied, what we have to do is we have to carry forward our .config file. So, why we need to carry forward our .config file? So, since many features are added between 5.15 to 5.16. These features will correspond to newer configurations added. So, again, we need to configure our kernel accordingly. So, if you make old .config, what it does is it prints out all the configuration on the screen and apply our old .config file to the new kernel questions.

So, we don't want to do from the scratch. What we can do is just take the old .config and we are applying it into our new kernel. So, if I give make old .config, that is carry forwarded. So, next thing is one more option is also there, which is a silent .config. It is similar to old .config, but the simple difference is we will not print out the configurations on the screen. So, your terminal window will be very much clean, which will not have any print messages from it.

But in the background, both old .config and silent .config does the same job. It takes old .config from the older version of a kernel and apply it to the newer version of a kernel and if at all any new changes have happened, new configurations are added in your new kernel version, it will ask to select whether we need to include it or not include it or build as a module. So, it will print the messages. Y, N, N. We have to select it only for the newer configurations added from the old to new.

As I said before, so while configuring the kernel, so we have many features for it. So, one is makeconfig and another is makedefconfig. Defconfig is for maintainer's working configuration file, but he may use different PCs, different laptops with different configurations. It may not suit to our PC in which we are working. So, what we can do is, we can take the configuration which our distributor has provided. The distributor, in the sense, is a Ubuntu, OpenSUSE or anything else. So, that configuration file is already placed in the folder slash boot slash config dollar uname-r.

So, this is a .config file. Filename itself is a config-dollar 5.15. So, what we have to do is, copy this bootconfig-5.15 to the kernel source directory. So, kernel source directory is our Linux underscore source. So, what we are going to do is, we are copying this file to this Linux source directory as a .config file. So, what we are doing is, we are just copying .config already provided by distributor to this Linux source directly. And then, we are making use of this makevol.deb.config. So, this applies .config to this newer version.

And if at all any new additions have happened, then we have to select that particular features alone. So, configuration is done. Then, what we have to do is, we can build it. So, for building, we will be using make-j8. So, it takes some amount of a time. Once it is done, we will get the generated binary image which is ready for installation. So, next thing is how to save our configuration. So, we are doing make-menu-config and we have selected many things. So, many configurations, many modules.

We have added, deleted or modified from static to dynamic that means module compilation. So, we don't want our configuration to be lost or every time when you are building the kernel, we don't want to select it. So, we want to save it in a particular location so that we can reuse it. So, for this, make gives us one of the command calls save-def-config. So, make-save-def-config, use this command. What it will do is, so, it will create one file called def-config file. File name itself is a def-config.

So, what it will be having is the content the same as .config file. So, we will be having this def-config. Then, we can save it into a different location for our feature user. So, most config directory, it will be there for all the architecture. So, architecture, inside this, if it is an ARM or your ARM64 x86. So, that particular folder you have to move. So, in this case, I am moving to x86 and then config folder is there. Inside this, you can name to anything. So, in this case, I am just giving the name as custom underscore config.

So, move def-config to architecture slash your architecture x86 to config. And, you have to give any name. So, you can give custom underscore x86 config. A particular config, you enabled only i2c. In this case, you can give custom underscore i2c underscore config. So, you can give any name to it. So, once it is done. So, next is, if you want to reuse it or you are going to share with your team members, you can just give this def-config file. And, I want to apply that particular configuration.

So, what I can do is, I can make custom config. So, in this case, I am giving as custom underscore config. It can be your name of your choice. So, whatever the name. So, what it will do is, when I give this command, it will go to the particular architecture. So, in this default architecture x86, and it will search for the name in this folder, config folder. So, if it matches, then particular config file configuration will be applied. And, it starts building. This particular config file is not available.

Then, it will not build it. So, it will throw error that configuration file is not available. So, only configuration file is available. Configurations are applied. Then, we can start building our kernel. We are using make j4, j8. And then, we can go for install. So, this is one of the widely used and important features. This is a save def-config. Once we have done our configuration, we are saving it for a future use. If you have shared numbers, or if you are going to share with your customers.

Then, we cannot go on directly edit the .config file, or def-config file. So, we should not go on directly edit it using any editor. And, undoing the configuration changes. What happens? So, I have a working configuration. Went ahead and selected few configurations, and I tried to build the kernel. Unfortunately, kernel crashes, or it is not booting up. Then, I cannot go and change our .config. If I have forgotten something else, forgotten what are the things I have added, then it is a waste of our time.

Since we lost our working .config. So, for this, what our kernel uses a feature is, like our make build system user feature is, whenever a new .config file is generated, whenever we modify the kernel using make menu config, it saves our backup file as .config.old. So, it saves our config file. So, what we can do is, we can restore that, we can use the .config file. What we will do is, copy .config file old to .config. So, in this manner, we can restore our .config file, and then we can build it.

So, by this way, we will not lose our .config during a development. Once it is achieved or matured enough, and we are going to share it to our customers, or our team members, then we can go for make .config file. But, this is a scenario where we are developing, we are adding one config to another config, and in that scenario, during the addition, if a kernel is failing or crashing, then we can restore our old .config. We go to our old .config file. It is not a complete build sequence.

What are the steps, or what are the object files are created at the end. So, after all our source files and header files are compiled, this is the last stage of your build. So, the first file that is generated after all your source files are compiled, linked is vmlinet. So, this file is what we are calling a kernel proper file. Kernology itself is a kernel proper file, and this is in ELF format, executable linked file format. So, it is not directly, you cannot use it, and it has binary, plus some extra additional information, like symbol table debugging information.

So, everything will be there in this vmlinux. This will be huge. So, if your kernel size is like 200 MB or 300 MB. So, this will add, because of the symbol table debugging information, you can go into 1.5x of your kernel size. So, each file size is high in compared to kernel. So, next is a system.map file. So, this is a file where all the system symbol tables all be extracted from vmlinux. This is a text-based symbol table which will be extracted from our VM-Linux file.

So, symbol tables are our global variables, static functions, so these are will be stored in the system.map file. This is a very important file. Next, we will be having image. So, this image is one of the file contains only binary extracted from this VM-Linux. So, this VM-Linux is an ELF format. From this, only binary is extracted and all other things are stripped off like symbol tables, commands, nodes, which are all debug information, all are stripped out. So, only binary from this VM-Linux is extracted. Then, we have a head.o. So, head.o is a startup code file. This is architecture-specific startup code.

So, it varies from one architecture to another architecture. If you have ARM, so head.o is different and if you have PowerPC, that head.o is different. It is different for different architecture. So, this file is generated. Then, there is another file called piggy.gz. So, this is nothing but an image file. So, this is an image. It is compressed to reduce its size using gz, gzip algorithm. So, in order to reduce the size, compression algorithm is used. So, it is piggy.gz. And this piggy.gz file is again converted into piggy.o. So, piggy.o is nothing but an assembly format of this file.

So, this is a binary. This is an assembly format. So, why we need this assembly format? Because we are going to link with another object file. So, which is a misc.o file. For this, we need assembly part of this piggy.gz. So, what is this misc.o? So, since we have compressed a kernel or a kernel image to the piggy.o.gz, we need some routine to decompress it. So, there is a feature available in our kernel. The kernel can itself uncompress it. So, that decompression algorithm is run with this misc.o file. So, two things are there. So, first, an ELF file is there.

In ELF file, we are creating the image. The image is compressed with piggy.gz. So, this piggy.gz is added with decompression algorithm. So, it is misc.o. So, when all this two is in this decompression algorithm plus compressed image together is called as VM Linux. So, this is a composite kernel image, but this is in ELF format. So, don't confuse with this VM Linux, with this VM Linux. The name is same, but the content is different. So, this has both decompression algorithm plus compressed kernel image. So, then this ELF format is again converted into Z image or DS image. So, this has some headers or additional information required by the bootloader to boot it.

So, it is the final kernel image loaded by the bootloader. So, it has bootloader specific information. So, this is the final stage of our build sequence. So, we have VM Linux and from this VM Linux, system.map is retrieved and only binary is taken from VM Linux to image. From which this, this head.o is added. So, head.o is architecture specific startup core. Then the image is compressed and it is converted into object file. We have misc.o which has a decompression algorithm. All this together, we get VM Linux which is an ELF format.

This VM Linux is converted into Z image or DS image. So, it is the final kernel image which will be loaded by the bootloader. So, what is the difference between this Z image and DS image? So, Z image is a older format of a kernel. So, it is only a size is the biggest difference between them. So, this Z image can be used only for size of your kernel is less than 512 KB. So, cannot go for more than 512 KB. And for BZ image, there is no upper bound on kernel size. We can go for any size of it. And it is called as big Z image.

So, some people will think like this. BZ image is compressed image of the Z image using BZ algorithm. BZ is not related to any BZ algorithm. This B stands for big Z image. And this final image will be located in this folder. So, when you make, then Z image will be stored in this folder or architecture specific ARM or PowerPC or XATC and boot. So, inside this boot, you get this. You can find this image. And this is a top level folder. So, after building the kernel, I am just pressing LS.

So, this is LS. So, you can see VMLinux. VMLinux is there. And the system.map. So, these are the two files are generated as a result of a compilation. VMLinux, system.map file integer in the top level. So, this is our top level. From this source, I am just generating this VMLinux and system.map. Next is, so as I said, this is ARC or x86 is our architecture and boot folder. In this, you will be finding your images. So, I have built with this BZ image. So, you will be getting BZ image in this particular folder.

So, this is the image which will be installed in the make installation, kernel installation section. Next is some of the few commands. So, make use n number of options to go. So, if you go through the documentation, you will get n number of options from the Linux kernel using this make utility. So, in that, some unique things I have mentioned here. So, make VMLinux. So, what it does is, it will generate only uncompressed kernel image. So, it will not generate BZ image or Z-image anything. So, it will go for only uncompressed. So, build instruction will stop till the first step what you have mentioned.

So, it will just give the uncompressed kernel image, which is of ELF format with a system.map information. So, this is generated. Even if you give make a BZ image, VMLinux is always generated. Only from this VMLinux, you will be getting the compressed. So, if you don't want a compressed image, I want only VMLinux, then we can go with this make VMLinux. The next command is make clean. So, make clean when we will be using. So, if I have a work group for PowerPC configurations. So, I am just doing many additions and I am compiling it and it produces a number of compiled object files.

And I want to switch back, switch to another architecture with a different configuration file like BeagleBone. What I have to do is, I have to make my build environment very much clean. For this, we will be using command called make clean. So, make clean what it will do is, it will delete all the intermediate files generated during our build mechanism. Build environment, same as the source which we downloaded during the initial stage. So, the source from our source downloaded using git clone. So, that state we will be restoring it.

From that, we can now add new configurations like make BeagleBone config and we can go about building and installation. So, this is a important command when we are going to switch between the configurations. So, this is the overall picture what we have seen in this session like. So, we have to get the kernel source. So, just get the kernel source from the zip. Use a distributed configuration. Distribution configuration file is in the sense. So, if you are using Ubuntu. So, go to that boot config hyphen you name a hyphen r file and copy that file to your kernel source as a dot config file. So, configuration is done.

Next thing is we have to build it. You make hyphen j8. So, here 8 stands for number of cores into 2. So, depends upon your system we can make it as a make hyphen 8 or 4 or 2. So, it takes some 30 to 45 minutes to 1 hour. So, at the end of a successful compilation we will get vz image or z image and the modules. So, next thing is we have to install it. So, for installation. So, first we have to install modules. So, for this we will give sudo make modules hyphen install. So, this will take all your modules and copy it into the lib modules folder.

And each kernel version has its sub folder. Final step is make install. So, once you give make install kernel image which is generated in arc boot folder will be copied into slash boot folder. And the boot loader is intimated. So, this boot loader is nothing but a grub. It is intimated that new kernel has been installed. So, you have to list it in doing the boot procedure. So, where a user can select it. This is not related to any kernel build procedure. But I have added this one of the useful tools, dmessage. dmessage is nothing but a diagnostics message.

It will print what are the modules during the boot up. So, this is a kernel buffer. So, every modules when you are writing a driver, what we will do is we will add some debug messages. So, that user can go through it to check whether the module is correctly configured or not or if at all any error happens. They can go through this dmessage and look into it. This is a very useful tool. So, what it does is it will read the kernel ring buffer. So, by default it will display all the messages from the kernel buffer.

So, it isn't very huge. So, if you want a particular message to be filtered, you can go a piped with grep command. We can together dmessage. We can filter out only a particular message you want to filter it out. For example, if I want to filter only messages related to networking, then I can give dmessage piped with grep net. So, it will search for the net in dmessage buffer and print only the lines matching with the net. And one more option. So, if I new will display only user space messages. It will not print any kernel space messages. So, it will take the messages from the application layer.

And if I want to print only the kernel space messages, then I can give hyphen k. And this is hyphen t. I don't want the time. I want only the message. So, it will display the message without the time. And this time is related to kernel boot time. So, it is... But if I want the time to be in a human readable format with hours, minutes and time, then I can go with dmessage hyphen. So suggested readings are, so these are the two resources I have followed for this session.

One is Linux Kernel in a Nutshell by Craig Rohan Hartman. This is a very good book. So it tells what are the procedures for building the kernel and what are the configurations. It deeps into each configurations, like what's inside the character driver, what's inside the block driver, what's inside the networking driver, what are the configurations available for it. But it is slightly old book, but it's applicable for even a new configuration, newer kernel versions. This is a very good book. It starts with this kernel compilation procedure.

And next is, this is a Booklin. Booklin has some kernel development tutorials are available. They have open source slides are available. This is a tutorial to start with, to understand better about Linux kernels and its internals. So we are at the end of this session. So in this session, what we have learnt from the first, we have started with basics of Linux and history. Linus Torvalds has started this Linux as a hobby project. From this, it is imported from single core to multi-core and it's scalable from watch to big data centers.

So Linux provides very vast features from scalability, maintainability and community. It has all around the world makes Linux a successful, the biggest open source project. And from that we saw how to build the kernel for our PC. So it involves four major steps. So first thing is getting the source. So we use JIT for getting the source. And configuration. Configuration. So we have different configuration procedures that are available. One is from manually we can do it. Terminal based. We use maintenance defconfig or distributors defconfig. And we can do modification to it.

We can store it. This configuration file can be applied to the newer kernel versions. So we saw many things on this one. And then building. So we built depends upon our number of cores present in our PC. So in order to reduce the time taken for building. How to build only a particular portion of a kernel. Not the entire portion of the kernel. So we saw in that building steps. And installation. So once all the building procedures are successful. So we will get two images. One is module installation.

And it installs only dynamically loadable or runtime loadable features. And then we installed a final kernel image. And intimated the boot loader. For using the new kernel in the next booting cycle. So thank you. So this is the end of our first week.

Want the rest of Linux Driver Development?

Get the full course syllabus and fees.

The full course is paid (₹40,000). We'll send the syllabus and call you back within one working day.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Full course · paid

Unlock the full Linux Driver Development course

The remaining 35 lessons, mentor-reviewed projects and a certificate come with the paid course (₹40,000). Leave your details: we'll send the syllabus and fees and call you back.

Get the syllabus and fees

A counsellor calls you back within one working day.

By submitting you agree to our Terms and Privacy Policy.

Grow by Skill-Lync · free lesson

Start watching

Free, no payment. Leave your details once and every free lesson on Grow plays straight away. A Skill-Lync counsellor may call you about the full Linux Driver Development course.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.