OpenWrt Forum Archive

Topic: [SOLVED] How to replace kernel .config with mine?

The content of this topic has been archived on 21 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello,

I was wondering whether it is possible to load a preconfigured version of the kernel in openWRT or not. I mean, I have enabled some features on the openWRT kernel and I would like to import them ( through its .config) so that if I wanted to recompile my kernel on a different machine I only had to copy and paste the kernel .config.  However, I have seen that the folder where to place the file build_dir is just created after compilation, so, do I have to compile at least once before being able to copy my kernel .config to the proper folder?

Thanks in advance!

regards

(Last edited by ndarkness on 8 Nov 2013, 10:36)

hnyman wrote:

Why not patch the kernel config source directly?
Generic: https://dev.openwrt.org/browser/trunk/t … onfig-3.10
then platform: https://dev.openwrt.org/browser/trunk/t … onfig-3.10

Do a patch for needed changes there.

Wowo! I didn´t know that I could patch the kernel config directly. But, how do I do it? I mean, I do know how to patch packages files or kernel files, but not the config source. Is in the same way? I mean, firstly I have to issue some command akin to

~$make /target/linux/{clean,prepare} V=s QUILT=1

and then how I patch the source? And what is even more important, where should I place the patch, once I get it, on the new machine?

Thanks in advance!

You may also want to check "make kernel_menuconfig"

Zajec wrote:

You may also want to check "make kernel_menuconfig"

that's the point, I want to avoid making the kernel selection each time, since I have already the .conf of the kernel.

Thanks in advance!

quilt is used to create patched, if you read on it explains how to do that.

FriedZombie wrote:

quilt is used to create patched, if you read on it explains how to do that
http://wiki.openwrt.org/doc/devel/patch … .new.patch

Thanks for replying,

I do know how to create patches, but I do not know how I should modify the .conf of the kernel with the patch. For instance, If I want to enable the following option

# CONFIG_USB_NET_CDCETHER is not set

in the generic configuration given by hnyman geberic kernel config

What should I do with QUILT, modify that line in order to resemble something like this

# CONFIG_USB_NET_CDCETHER=y

Thanks in advance!

You could just first "make clean" to clear built files, and edit that file with a text editor. Uncomment the line (remove # ) and change the end to "=y"
# CONFIG_USB_NET_CDCETHER is not set
-->
CONFIG_USB_NET_CDCETHER=y

If I understand right, the generic config is evaluated first, then then platform-specific config is added to that. So, you could just add that line to your platform confic defaults file.

It might also work if you just include that line in your .config. (I don't currently have any kernel modifications, so I am not quite sure how the kernel options behave there.)

Ps.
After you have configured the system as you like, look at the output of "./scripts/diffconfig.sh". It should list all your deviations from the defaults. You can use that file as the .config template. E.g. I use the following file that I expand to full .config with "make defconfig".  http://koti.welho.com/hnyman1/Openwrt/t … diffconfig

(Last edited by hnyman on 7 Nov 2013, 09:45)

hnyman wrote:

You could just first "make clean" to clear built files, and edit that file with a text editor. Uncomment the line (remove # ) and change the end to "=y"
# CONFIG_USB_NET_CDCETHER is not set
-->
CONFIG_USB_NET_CDCETHER=y

If I understand right, the generic config is evaluated first, then then platform-specific config is added to that. So, you could just add that line to your platform confic defaults file.

It might also work if you just include that line in your .config. (I don't currently have any kernel modifications, so I am not quite sure how the kernel options behave there.)

Ps.
After you have configured the system as you like, look at the output of "./scripts/diffconfig.sh". It should list all your deviations from the defaults. You can use that file as the .config template. E.g. I use the following file that I expand to full .config with "make defconfig".  http://koti.welho.com/hnyman1/Openwrt/t … diffconfig

Thanks again hnyman, I hardcore my modifications in the Config-3.10 and it works perfectly, now the packages I wanted are by default selected.

Thanks

The discussion might have continued from here.