DaveR
DaveR

Reputation: 1435

How to change kernel version string with Buildroot

Is there some way in Buildroot to change the kernel version string displayed with the "uname -a" command? For example:

# uname -a
Linux buildroot 5.1.0 #1 PREEMPT Wed Nov 6 13:10:04 MST 2019 armv5tejl GNU/Linux

I would like to append something so the version look like: "5.1.0-xxxx-xx".

I check this post but it doesn't make sense to me. Which .config file does it refer to? I see 4 in my Buildroot directory, the default one at the root and three more under "./output", which come from other repos.

Thanks, Dave.

Upvotes: 4

Views: 5259

Answers (2)

DaveR
DaveR

Reputation: 1435

Arnout was kind enough to give me steps and pointers to the information I needed to figure this out but for completeness, I'll list all the steps I did to make this happen. I used Buildroots "make xconfig" to set the BR_* variables:

  1. Set BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y

  2. As recommended in Recommended Directory Structure,I created a <BR_ROOT>/board/<company>/<board-name> directory and created an empty linux.config file in that directory.

  3. Set BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE equal to the path in Step 2 i.e BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE=board/<company>/<board-name>/linux.config

  4. Executed the command "make linux-update-defconfig" to store my Linux configuration in the file I created in Step 3.

  5. Followed the steps Arnout listed in his response to my original question.

  6. Rebuilt my kernel and rootfs with "make".

Once I verified that everything was correct, I saved my new configuration with "make savedefconfig".

Upvotes: 0

Luca Ceresoli
Luca Ceresoli

Reputation: 1661

You need to set the LOCALVERSION configuration parameter of the Linux kernel (the kernel version string is a kernel feature, not a Buildroot feature).

  1. from Buildroot enter the Linux configuration interface: make linux-menuconfig
  2. Go in General setup and set Local version - append to kernel release to -foo-bar
  3. Exit menuconfig saving your changes
  4. Build the whole Buildroot image: make

Now uname -a will show: Linux buildroot 5.1.0-foo-bar #1 PREEMPT Wed Nov 6 13:10:04 MST 2019 armv5tejl GNU/Linux.

To know how to make these changes persistent, read "Storing the configuration of other components" in the Buildroot user manual.

Upvotes: 4

Related Questions