Building, changes to config not saving

In fact, I'm doing exactly this except for pulling down the newest code each time.

rm -rf openwrt-18.06
cp -r --preserve=links openwrt-18.06.org/ openwrt-18.06/
chown -R devs:devs openwrt (simlink to above)

cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
make

yep...

Here's a few more chari so I can respond and agree..

Maybe I'm not understanding something or missing it.
I posted exactly the method I'm using. Other than downloading the source all over, I'm doing the same as you posted no?

Are you exactly on the same platform as your friend?

SDK is build based, so is imagebuilder.

I'm not sure then to be honest. He set it up for me since he uses it to build a package. It has the option to include image builder when it completes so I assume this means SDK?

No, you've got two, very suspect things going on there (past not identifying just what is in openwrt-18.06.org/)

cp -r --preserve=links

and

chown -R devs:devs openwrt

Please take the time to understand how the build system is intended to be used. The build system makes several very reasonable assumptions based on it being a git checkout (or truly equivalent to one) and owned by the user running it.

Please also take the time to understand that neither the SDK nor the Image Builder are intended for compilation of an image.

If you want multiple work trees, you should read and understand man git-worktree. The use of cp --preserve=links, a non-standard argument, seems likely to get you into problems without any benefit.

No, you've got two, very suspect things going on

Ok, let me see if I can clarify some parts.

I made a copy of my builtroot so that if I mess it up, I can simply overwrite it.
The original is openwrt-18.06 and the backup is openwrt-18.06.org.
When I mess up the original, I remove it then copy the .org version again. I only use preserve links in case there are links in the build env.

cp -r --preserve=links openwrt-18.06.org openwrt-18.06

Then, you suggested I not build as root so I use the user I log in as which is 'devs'. Therefore, I change the permissions of the buildroot to that user otherwise, I don't have permission to do anything with it.

chown -R devs:devs openwrt

So, maybe I should simply use sudo when working with the buildroot.

I'm not trying to do anything special. I only want to build a ramips version for a device I'd like to use. A friend set up the build env for me which works just fine but I the resulting firmware has packages I'd like to remove. When I use make menuconfig and remove those packages, that's when things break again. If I don't remove any packages, then I get a full build, it runs all the way through.

This means to me, the build env is ok for the most part I suppose. I don't know since this is all new to me and I'm just trying to learn as I go.

Please also take the time to understand that neither the SDK nor the Image Builder are
intended for compilation of an image.

I'm trying to but am not there yet. When my friend put this together, it was to built a custom package. That resulting package was then installed onto devices where I had built an image using image builder. Recently, he told me that when we build using this env, there is also a resulting firmware file which is why I've been playing with this thinking I could kill two birds with one stone. Build the package and get a custom firmware file.

Obviously, there is something I am not understanding still. Maybe I need to download my own full buildroot using the git method just to play around and learn. However, it is still not clear why I would do that since it seems as mentioned above, I'm missing some understanding of what SDK is used for. For me, image builder was all I've ever needed until now. Now, I need the SDK because using image builder, I cannot get a small enough build to fit on an old device I'd like to use and was told I could get it only using SDK.

Hope this helps to clarify what I'm up to a bit better.

What happens if you strictly follow jeff's advice above (do everything as non-root user)?

1 Like

When you select a package, that package, plus its dependencies are added to the build. When you remove same, the dependencies will be left behind, so over time cruft will build up. Best to start from scratch, working towards your desired image. Useful tools in getting there are:

./scripts/diffconfig.sh > configdiffX
cp configdiffX .config
make defconfig

Set aside a configdiff of your friends .config, and imo start from scratch.

2 Likes

@tmomas
I have been building as non root since it was first mentioned in the thread. That's why I mentioned that I also changed the owner to non root.

@anomeome
I followed your directions then did make.

make[3] -C target/linux install
make -r world: build failed. Please re-run make with -j1 V=s or V=sc for a higher verbosity level to see what's going on
/clients/openwrt-18.06/include/toplevel.mk:216: recipe for target 'world' failed
make: *** [world] Error 1

I'll try downloading a whole new version and see what happens.

New git download, I removed a couple of packages and added curl. Countless warnings.

elf.hpp:267:44: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
       std::string get_version_file() const throw (std::bad_alloc);
                                            ^~~~~
elf.hpp:269:44: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
       std::string get_name_version() const throw (std::bad_alloc);
                                            ^~~~~
elf.hpp:308:29: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
       version_requirement() throw (std::bad_alloc);
                             ^~~~~

 make[3] -C tools/mpfr compile
+ curl -f --connect-timeout 20 --retry 5 --location --insecure https://mirror.csclub.uwaterloo.ca/gnu/mpfr/mpfr-4.0.2.tar.xz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0number.c: In function '_bc_rec_mul':

Just warnings so I'll go through the entire process and see what happens.

Those don't look to be "default" package selections.

Until you can get to the point that you can confirm that you can successfully build "vanilla" OpenWrt, you won't have a baseline to determine if the problems are with your friend's config and/or source or not.

As mentioned, I downloaded using git, I removed only two or three packages, added curl and am building. I also picked a type and then ran make. It's odd that I'm not getting results that seem to make sense to anyone. I don't think I'm doing anything unusual. Here is another error I'm watching if it means anything.

ar: `u' modifier ignored since `D' is the default (see `U')
configure: WARNING:
*** Makeinfo is missing or too old.
*** Info documentation will not be built.
Links are now set up to build a cross-compiler
 from x86_64-pc-linux-gnu to mipsel-openwrt-linux-musl.

It's still building :). I think I'll stop it now, remove the whole thing, download again and this time only make menuconfig, save as it is and make. See what happens.

Just so you all can be sure I'm doing what you're suggesting :).

$ git clone https://git.openwrt.org/openwrt/openwrt.git
Cloning into 'openwrt'...
remote: Enumerating objects: 464672, done.
remote: Counting objects: 100% (464672/464672), done.
remote: Compressing objects: 100% (128867/128867), done.
Receiving objects:  37% (175775/464672), 35.79 MiB | 96.00 KiB/s

Once done, I'm only going to run the script commands, go into make menuconfig, hit save, exit and run make.

Select a specific target, like the TP-Link Archer C7v2

Don’t use make -jN which it looks like you’ve been doing. For a multi-threaded build, you must have the build system fully initialized for effectively the same build, unless you sequence things yourself.

Edit: I have just re-confirmed that the steps I posted result in a complete, "error-free" build for the TP-Link Archer C7v2.

I've tried various combinations including -j but won't this time.

Wow, it finally completed. Ok, now what? Can I try removing a package or two and build again?

Now that you know your build environment is "good", then you can try adding or removing packages as you need.

I usually add to my config, either directly or through menuconfig and the developer section

CONFIG_DEVEL=y
CONFIG_BUILD_LOG=y
CONFIG_CCACHE=y

The first enables developer options (at all)
The second writes logs to ./logs/ that can help diagnose problems, especially if you are running a multi-threaded build.
The third is a time-saver that helps to avoid completely recompiling code, even if you've done a clean or the like.

Understand what the following does and why, before using it

make -jN clean download world

In many situations, it works because it makes sure that most of the build dependencies are resolved before another thread needs them. It is not "guaranteed" to build without errors! Yes, on an error, you need to go back to make or make V=s with no -j option. Yes, there are times you need to remove your complete ./build_dir/ and ./tmp/ folders from your OpenWrt build root.

I would make sure you are comfortable with make menuconfig and ./scripts/diffconfig (as well as using git) before starting back with your friend's source code and config.

Please keep in mind, I also mentioned that my current env also works, but only if I don't try removing packages. If I simply build, it completes just like the new code I just downloaded.

make -jN clean download world

If I understand this, it means clean first, then build the world package and download what ever is needed to do so. It also means -jN (number of simultaneous processes).

I'm not sure where to add what you are suggesting but I assume it is in the .config of the Config.in file. I've not added this yet.

I tried this 'make -j8 clean download world' and it completed.
Therefore, I did the same on my friends buildroot but without 'world' to see what happens and that worked also. The build actually completed. However, there are no files in the bin/targets/ramips I was trying to build so, maybe I lost something since testing so will revert back to the original and try again.

.config is the "master" config for OpenWrt in the top-level directory, It is what make menuconfig modifies.

Config.in is likely some part of the GNU-style autoconf system, perhaps from your friend's package.

make clean download doesn't build anything. make alone works only because it assumes the "world" target if no targets are entered ("world" is a convention that pretty much everyone uses to mean "build everything"). Hence why the command line I gave you ends with world

You're on your own with your friend's build root. You need to understand what has been configured there, then carefully add to your working build root only what you need. It is likely only a source directory and then selecting their additions in menuconfig. See the suggestions above on using ./scripts/diffconfig