OpenWrt Forum Archive

Topic: Find the .config file to duplicate a specific .bin from the trunk

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

I'm going to try to make this as specific as possible because I've seen people try to ask this question and not get particularly satisfying answers.

I'm a relative noob to the the OpenWRT scene but do know my way around an embedded linux system and building kernels.

I have a TP-Link WR703N and so downloaded the latest binary "factory" image from trunk:

openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin

This installed easily and I was up and running in no time: Kudos to all involved with making it so easy.

The problem starts when I'd like to make a small change to what gets built and put on the initial squashfs...

I checked out r29844 from the source as this is the release used to build the bin. This has an empty config filled with thousands of options that make little sense to my noob eyes.
What I really want is the .config that was used to build openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin so that I can make my small change and then make a new .bin.

So here's the question:
#########################################################################################
Where can I find the *specific* .config that will allow me to duplicate the .bin that I downloaded for my box?
#########################################################################################

As a noob, I need this to see how my image was put together and start to make small changes so that I can see what the various options do. At my level of knowledge, it is virtually impossible to successfully choose all of the right options among the thousands of possibilities that will even result in a bootable build for my specific box.

I'm a REALLY noob on build, but i think make menuconfig and selecting your model should build that config...

anyway, i suggest reading here:

http://wiki.openwrt.org/doc/howto/build

(Last edited by nebbia88 on 26 Jan 2012, 23:53)

I'm talking about having a .config to *load into* menuconfig that has all of the options checked that match the "factory" bin so that I can choose a single additional checked item and build an essentially matching image with the addition of that one change.

Selecting the correct model is just the very beginning  (and the easy part) of making a working config with the basic software that's in the prebuilt bins.

Hi, that's something I think so, but after a couple of tests I can assure you it is less complex than it seems, most of the options are selected by default (knowing the hardware components of your machine, the wiki is very useful for that). A simple "opkg list" (before update, on first telnet), shows the packages that are included in the compilation by default and usually not many. Regards.

I think that nebbia88 was already correct. If you just checkout the sources, go to the menuconfig and select the correct router model, the default packages should be selected.

To play it safe, select the model, exit menuconfig, make defconfig (to set all the defaults acording to that model), and then go to menuconfig to add that one module.

One of the developers, jow, explained the build process of the snapshots here:
https://forum.openwrt.org/viewtopic.php … 84#p153984

I am generating my .config from a 20-line recipe (with all the modifications I want) by using 'make defconfig':
https://forum.openwrt.org/viewtopic.php … 78#p147078

Ps. 'factory' firmware was for the initial install of Openwrt, but you might need to use the 'sysupgrade' version for upgrading an existing Openwrt router.

(Last edited by hnyman on 27 Jan 2012, 07:09)

hnyman wrote:

I think that nebbia88 was already correct. If you just checkout the sources, go to the menuconfig and select the correct router model, the default packages should be selected.

Thanks, I was about to delete my post and kill myself XD XD

hnyman wrote:

Ps. 'factory' firmware was for the initial install of Openwrt, but you might need to use the 'sysupgrade' version for upgrading an existing Openwrt router.

is it true only for GUI flashing or also in case of "mtd -r write" etc etc?

Thanks

(Last edited by nebbia88 on 27 Jan 2012, 13:47)

Mod parent up!

It may be that an experienced developer can deduce the contents of .config file from knowledge of the device it was built from, but the actual info is in the .config file!

It is the most convenient form for certain information. If one is interested in make one itsy-bity change from a .bin, the .config is the logical place to start.

"The source code for a work means the preferred form of the work for
making modifications to it." -- GPLv2

Therefore, it is a source file and should be published! Not to publish it borders on a GPL violation.

Perhaps this info can be extracted with a series of mount loopback commands and decompress commands! If so, the method should be published. Otherwise it should be published with the .bin.

It is true that one can get this info by booting and looking at /proc/config.gz, but it is not always easy to boot. perhaps one has lost the hardware!

Someone please publish a method of extracting a .config from a .bin!

If the image he got was from the official repository, I´m sure it what he would get from just selecting his model.
If he got it from somewhere else, maybe he should ask whoever published the image?

BTW, I could be wrong since my router is gone and haven´t replaced it yet, but I think /proc/config.gz was removed from the OpenWRT kernel to save space, since I couldn´t find it.

Also, I believe /proc/config.gz is created by a normal Linux kernel at runtime, so there´s no way to extract from a .bin.

Feel free to correct me if I´m wrong. I haven´t used Linux much the past few years.

I'd like to re-raise this issue.  I think pelliott has an excellent point.

The ".config" files for the binary downloads on openwrt.org are important source code.  And any other files/scripts necessary to reproduce those binaries are also source code.

For one recent example, I've been unable to reproduce the 14.07 ubi-factory binaries for wndr3700v4 and wndr4300v1.  Selecting the right subtargets and such in menuconfig doesn't get close to the official .config, and also, there is some UBI step that doesn't seem to happen.

By the way, thank you very much to the OpenWrt developers.  I have been enjoying OpenWrt since the days of White Russian rc, and currently am running several units of 4 different WNDR models.  I'm very much looking forward to being able to easily reproduce the builds.

I honestly don't understand whats the issue to begin with. You can find the snapshot build config here: https://downloads.openwrt.org/snapshots … ric/config

That file is contained in each target folder. For 14.07 you can find it here:
https://downloads.openwrt.org/barrier_b … xx_generic

In 15.05-rc1 we switched to diffconfig, that basically contains only deviations from the default (only those symbols which you would select in menuconfig to reach the goal):
https://downloads.openwrt.org/chaos_cal … iff_config

Claiming GPL violations here is quite far stretched.

Thank you, jow.  I tried that config file again, and this time was able to build an image.  I'm very happy with OpenWrt's open source spirit.

In case anyone else reading this is having trouble, below are some notes on the attempt that worked for WNDR4300v1.  This does not include making sure you have all the build prerequisites; see OpenWrt wiki.  The "grep" is to disable building packages, since you can spend days on that, and not all packages will build (some upstream distribution servers were down or files missing, strange prerequisite packages on the host not listed in the OpenWrt wiki, one package didn't like the protobuf compiler version in Debian stable, some unexplained C compile errors, possible concurrency/dependency issues when using parallel make "-j 8", etc.)  Even if you don't build most of the packages, you might need a lot more than 4GB of space.  Overall, I'm happy, though I wish I had added the "grep" step a day earlier.

git clone git://git.openwrt.org/14.07/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
wget [url]http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/nand/config.ar71xx_nand[/url]
cp config.ar71xx_nand .config
make menuconfig

Target System (Atheros AR7xxx/AR9xxx)  --->
Subtarget (Generic devices with NAND flash)  --->
Target Profile (NETGEAR WNDR3700v4/WNDR4300)  --->
Target Images  --->
  [*] ramdisk  --->
      *** Root filesystem archives ***
  [ ] cpio.gz
  [ ] tar.gz
      *** Root filesystem images ***
  [ ] ext4  --->
  [ ] jffs2
  [*] squashfs  --->
      *** Image Options ***

grep -v "^CONFIG_PACKAGE_.*=m" .config > config-no-m
cp config-no-m .config
time make
ls bin/ar71xx/

The discussion might have continued from here.