I'm learnning to build my customized image from the source.
But I don't know the correct executing order of these three steps at very first of the building process:
make defconfig
Is this to generate a default .config file at the building root folder? But how does the make-scripts know which target/platform/device I'm expecting?
make kernel_menuconfig
Is this to generate a kernel config file at target/linux/<platform>/<device> directory? and whether or not it will change the .config at top most of source tree at same time?
make menuconfig
Should this step be done before or after make defconfig? Why did I see "before" in some docs? If "before" is right, does make defconfig make any sense?
Make sure you have your buildroot setup properly with all required dependancies.
I would strongly recommend you make a first build using just a basic build for your device if you have never built from source. If this is your case, you probably will NOT need make kernel_menuconfig at this point, so I will not refer to it now.
Yes. You will need to generate a .config. After cloning the OpenWrt source you need to setup your Target/Platform/Device. (you can also use a config.buildinfo file - see the wiki)
make nconfig/menuconfig # enter your Target
# and SubTarget
# and Target Profile
# escape out of nconfig/menuconfig and save your changes
./scripts/diffconfig.sh > configdiff # create configdiff from created .config
cp configdiff .config # and copy to .config
make defconfig # make a default config for the selected Target/Release
# I would suggest copying the .config as a backup.
# This should create a default .config for your Target device.
Once you have a good build that you are happy with, you should also update your current .config to reflect it's current state before you run your next build.
./scripts/diffconfig.sh > configdiff # create configdiff from latest .config`
cp configdiff .config # and copy to .config
make defconfig