I want to change the following before compiling the image from source code
root password (default value is empty, i want to change it to a specific password)
WiFi is enabled (default is that WiFi interfaces are disabled)
wifi SSID (default value is OpenWrt, I want to change it to another name)
I know that I can change the last two options through creating custom files under 'files/etc/config' folder as explained here, but I want to know where I can change those value in the main source code itself.
IIRC the wifi configuration is dynamically created at first boot. As such, adding a uci-defaults script to change the settings after they are created is probably the best way.
(It's also possible to set a root password this way, and then you can keep your customisations in a stack of uci-default scripts without having to edit the source every time you compile. You may not even have to compile from scratch at all, as uci-default scripts can be included with images built by the image builder, online or offline.)