.config for specific build

Sorry, noob question:
I just downloaded a build (http://downloads.openwrt.org/releases/18.06.4/targets/ramips/mt76x8/openwrt-18.06.4-ramips-mt76x8-LinkIt7688-squashfs-sysupgrade.bin).

Now I need to compile a custom kernel module for it. So I downloaded the proper kernel source, but I'm now looking for the ".config" used to build the kernel in the above image, to be consistent in the cross compilation. Where can I find it out?
I found this http://downloads.openwrt.org/releases/18.06.4/targets/ramips/mt76x8/config.seed, but it does not look complete...
Or may be I'm taking a wrong approach?

Yes, the "config.seed" is what you are looking for; rename it to ".config", then run "make menuconfig".


Thanks for your answer.
Ok, but in this way I'm going to put my own config. I'd like to use the one used for the compilation of the squashfs image, since I'm not going to create a new one, but just compiling a custom kernel module.
Is there a way to get it?

Effectively not possible to build a kernel module for a different build. While it can be done, you might as well build a complete ROM from source.

Easiest for me is to run make menuconfig and select what I need. The default build config (from selecting the board) plus a LuCI collection is effectively what in a “release” build.

Next to where you downloaded the image there is a config.seed you can copy to your build directory. Then "make menuconfig" will start with the same settings as was used to build the image. You will still have to build everything, but the initial .config when you run menuconfig will be the same, and you only need to change the relevant settings you are after.

1 Like

First to all, thanks to everyone for the answers.

I need some guidance...:slight_smile: sorry, I'm a bit lost.
I tell you what I did before posting the message, to clarify a bit:

  • I downloaded and installed the new openwrt squashfs image (with kernel 4.14.131)
  • I downloaded the mips toolchain from the openwrt site
  • I downloaded the linux kernel source (4.14.131) from kernel.org, and then created the kernel headers with a "fake" (self-made) .config
  • I cross-compiled my module
    The module compiled OK, but when I was trying the insmod I got some errors about missing symbols, which was expected since my .config was different from the one used to create the original image.

Now, you suggest to rebuild everything. OK, but I think I shouldn't use the kernel source. Should I start from the openwrt download(git clone https://github.com/openwrt/openwrt.git)? Or something else?
Thanks a lot!

1 Like


OpenWrt patches and back ports quite a bit. The build system downloads the Linux source and manages the patches "transparently" for most users (developers aside). If you need to mess with changes to downloaded-on-the-fly source or kernel source, see also https://openwrt.org/docs/guide-developer/build-system/use-patches-with-buildsystem

My recent notes for Debian 10 (Buster) was to install

apt install build-essential git gitk libncurses5-dev gawk unzip wget curl ccache rsync zlib1g-dev

(gitk is not used by the build, ccache is optional, though I use it to speed development)


That will then download the correct kernel sources during the build prepare phase, and will then apply the OpenWrt specific patches to kernel code and kernel config, both the generic OpenWrt things and the target (like ath79, ipq806x, x86_64, ...) specific things.

The needed command: make target/linux/prepare

That will explode the kernel sources to build_dir/target-*/linux-*/linux-*

E.g for ipq806x:

First the (backport, pending, hack) patches are applied , and then the 4.14 config.

There are 200+ patches, plus about 6000 config items to be set.

note that everything in build_dir is temporary, so you should aim to make your changes to the permanent code into those places I indicated above.


this might be of use ... umodin.patch

apt-get install quilt
quilt init
quilt import umodin.patch
quilt push
chmod +x ./scripts/umodin.sh

you'll need to change what it does but it provides convenient hooks for your use case.

1 Like

Thanks to everyone here. I was able to compile, then with the toolchain build the module and inserting it. After that I got a kernel panic, but I think it's up to my module...:wink:
Thanks again.


If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.