also if I am able to emulate (anyone of the arm-s) can I compile programs in it if I install gcc and so on? and use that instead of cross compiling? (cross-compiling with sdk is realy confusing for a beginner like me, so much so I rather learn qemu emulation and compile on a virtual machine.)
btw can I directly edit wiki without consulting with anyone? so that I can update the old and buggy info?
You can easily run OpenWrt x86 or x86_64 under qemu-kvm, for other targets the situation is more difficult (yes, malta (mips) or armvirt (ARM) exist). None of these emulate a specific device, but are (more or less) their own device (partially with emulation/ virtio specifics). You can not use emulation to test an image for a particular device, only for testing generic features (that work on x86_64 or armvirt/ malta as well).
OpenWrt will always cross-compile, you can't change that without massive changes to the buildsystem. Yes, you can build OpenWrt on 'any' architecture (sans bugs, you're likely to encounter on more exotic combinations) - including full system emulation for a different one, but that won't really change anything, aside from being considerably slower than doing it natively.
I had a similar problem at the start and the short answer is, creating a openwrt sdk compatible makefile is the quickest and safest way to get a compatible cross binary that actually runs on your device and allows you to create a PR so it can be added to official packages.
If you are lucky the project uses a normal makefile/cmake itself and does not need any special handling.
The openwrt sdk will take care of all the cross-compile stuff automatically and you just need to copy&paste a basic makefile template. Ofc some projects need special fixes and defines/exports.
I am not familiar with this.
is this on my laptop (host?)
is this for debian and/or alpine?
and can I use this to create specific programs like the one I mentioned?
how does dependencied work for that.
if it is too complicated, I dont think I can do it.
I am not a developer.
I am trying to compile the program for openwrt but I am just use to copy paste from guides.
for example in that makefile you have :include $(INCLUDE_DIR)/package.mk which I dont know refers to what. where is the include_dir? and so on.
at best I have to find a simple makefile from openwrt and change that.
btw do I need the build enviroment from git master (or 19.07 or 18) or just sdk is enough for me?
what advantage the compiling from source provides that sdk doesn't for the end developer ,not someone that is debuging the openwrt itself?
I think the difference between imagebuilder (gets pre-built binary packages and combines them for a image) and sdk ( a pre-built build enviroment that can be used to create binaries packages, i think) and the from scratch build enviroment that can be hacked to change the defaults and debug the openwrt project ,this is mostly for openwrt developers that are creating the openwrt itself and not for someone like me that is trying to just compile one single package that has standard c make file and so on.
did I get this correctly? so I dont realy need this anymore https://openwrt.org/docs/guide-developer/build-system/install-buildsystem
and just need to have pre-build sdk from downloads section?
The basic template for a package makefile is the same for all packages. Things like $(INCLUDE_DIR) are set by the build system. The include statement reads in “boilerplate” definitions. They are generally in openwrt/include/ and below.
The install steps set the general place on the root file system where things will be installed, then the specific files to be installed. Package dependencies are use to “require” libraries and the like to be built and installed.
The SDK is sort of like 3/4 of the full build system, prebuilt. It is “frozen in time”. I only use the full build system as it is more flexible and equally simple or complex to use, depending on your point of view.
I remember from before that installing compilers and so on needed more space that I had.
do I have to use ext-root or this works with small spaces ? (not really small 1200ac linksys but I remember gcc and libs needed way more)
I will try it today and see what happens.
UPDATE: I saw at the top in commented section this : # armhf(native ipq806x) w usboverlay !500MB!
so I need the usboverlay?
I am familiar with ext-root but because it messes with firmware update and my router has more space I didn't use that on my new router.
so now I have to use that for this?
how about the way that someone described for installing packages in ram (or other specified space) temporarily?
which part exactly needs the ext-root ?
I have a usb attached but as a storage.
can I change /stretch to /mnt/usb/stretch and not need an actual ext-root?
P.S. thank you for the package. I will try to test it too. but I also want to test the procedure you explained here.
btw when you compiled libmill did you get an error? because it has an incampatibality with newer gcc compilers.
or did you not encounter that.
also is strech a debian versioning name? ( if i remember correctly)
using a newer version of debian would work too?
and this creates a chroot complete with all the libraries and so I can use it almost like a complete linux environment for some tasks (like this compiling that I asked here?)
I have used chroot only for fixing errors by booting from cd and chrooting so I am not good at concepts behind it.
and again.. thank you for great answer you provided here.