Building unmodified OpenWrt for a supported target (a first-time attempt)


I’m trying to (re)build an OpenWrt release the first time myself, for an already-supported target (TP-Link Archer C2 AC750 V1).

My goal at this point is just to confirm I am able to succesfully rebuild a standard OpenWrt release with no modifications and get it run on the supported target.

However, I seem to have a slight problem with this: after flashing the produced sysupgrade image, the device seems to boot OK (judging from the LEDs) but I get no life in the LAN ports (DHCP client cannot get an address and tcpdump shows there’s nothing going on except the traffic that the PC itself produces), and can then only do TFTP recovery to get things back to normal.

My first attempt after cloning the OpenWrt repository was:

git checkout v21.02.3
scripts/feeds update -a
scripts/feeds install -a
make menuconfig
# Here, I chose ramips / mt7620 / tplink_archer-c2-v1 and saved the config
make -j8 defconfig download clean world 

This produced an image file by the name openwrt-ramips-mt7620-tplink_archer-c2-v1-squashfs-sysupgrade.bin (note: no version number in the name), sized 4.7 MB, with the results described above.

My second attempt (after reading the build instructions a bit more thoroughly) was:

make clean && make config-clean
wget -O .config
scripts/feeds install -a
scripts/feeds update -a
make menuconfig
# ramips and mt760 were already pre-selected so I only needed 
# to choose tplink_archer-c2-v1 as the subtarget and save the config
make -j8 defconfig download clean world 

This produced an image file by the name openwrt-21.02.3-ramips-mt7620-tplink_archer-c2-v1-squashfs-sysupgrade.bin (with the version number included!), with a larger size (5.0 MB) but still not as large as the official 21.02.3 sysupgrade image for this device (5.2 MB).

Also, flashing this second attempt at an image gave the same result: the device seems to boot OK but there’s no life in the LAN ports after the boot has seemingly finished.

I’m obviously missing something since the size of the produced image is slightly smaller than the size of the official build but can’t figure out what.

Obviously, the next step would be checking out what is actually going on in the system console serial port but I don’t currently have the pin header soldered in on this board and would somehow expect to get a working build for a supported target (with the same configuration as the official build) even without needing to solder or debug anything just yet... so any ideas or suggestions would be welcome.

make defconfig is not quite a good choice after make menuconfig (make oldconfig never hurts, but that's neither necessary immediately after make menuconfig either).

While that is indeed the buildconfig used for the official builds, I wouldn't quite recommend using it for personal builds, as it builds way too much you don't need for your single device, taking way more build storage and time than necessary.

I would start with the following as .config:


followed by make -j$(($(nproc) + 1)) defconfig oldconfig download world (yes, here, starting with a minimal seed config, you do want make defconfig), check hnyman's r7800 builds for a nicely annotated seed config.init (yes, different target/ device, but still very useful).


Thank you. The defconfig target indeed was the culprit here; it somehow botched the official, copied config file and menuconfig configuration done on top of that.

Once I removed the defconfig target from the make command that begins the build, the resulting image grew to a size comparable to the official build and now works when flashed to the device.

(In my defense, I was just blindly copying the commands described on the “official” Build System Usage Wiki page, where they first run make menuconfig but then also make -j $(nproc) defconfig download clean world. Do you think these instructions in the Wiki could be improved somehow?)

Thanks for the tip. For now, I just wanted to make sure I can replicate the official build “as is” but that sort of optimization is useful information for the future.

defconfig itself is very useful, but only when called at the right time (for expanding a seed config, not after menuconfig or oldconfig).

The pasted seed config should get you a default image, but it will build considerably faster without having to build all the 'cruft' you don't need. It is recommended to add all the packages you'd usually install after flashing already at this build stage (using menuconfig).

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.