Building ROMs & Kernels? I've been using customs ROMs and Kernels on my GS5 for a while now, but I want to get a clear explanation about how it works. Here are a few questions:

What is 'building' in Android? I heard that the build system is different from other Linux systems.
What's the difference between a ROM and a Kernel?
Is the 'ROM part' and 'Kernel part' separated? So, can I build them separately and install them separately?
How do I add device drivers(such as WiFi dongles) to my Kernel?
Inside a custom ROM zip file, is the Kernel included alongside with the ROM?
Are kernels compatible with different ROMs? (E.g. Using a Kernel built from the official stock sources on CyanogenMod)

These may be very newbie-ish questions but I'm really, really curious.
1) Building in Android could mean: 
 - building a deliverable in the android build tree
 - building a deliverable on an android platform having build tools installed
 - building the AOSP (Android OpenSource Project)
A little bit more context may help. According to the following question 'the build system is different from other Linux systems' it could be the AOSP one. Actually Android is a distro for phone. Then building an android firmware for a mobile platform is equivalent to building a linux distribution for a desktop computer. You build the bootloader, the kernel, the root filesystem and some extra deliverables (ex. recovery filesystem that is a special android system, vendor filesystem image, SDK, NDK, Android CTS, etc...). The way to build all this is different from any other existing build system. All this is very well documented in source Android web site Android Source web site. Have a look at it :)

2) A ROM is not a very precise term. It could mean several things. Generally ROM designates the SYSTEM part of the android complete firmware for a mobile platform, the kernel being another part of this firmware. But sometimes, a ROM contains the whole: the SYSTEM, the DATA, the BOOTLOADER, the BOOTLOADER Params, the RECOVERY and the KERNEL part.

3) If ROM designates the complete firmware, Kernel is part of it, then kernel is included in ROM and build of ROM => build of kernel. If ROM designates the SYSTEM part of android, then both are separate and they can be built and installed separately.

4) Android is a mobile platform and as such runs on phones. Installing device drivers is possible but is a little bit complicated as it greatly depends on the hardware platform design. For reference boards (development platforms), these procedures are well documented by manufacturers, allowing developers to do this by themselves. For a closed platform (as a HTC or SAMSUNG phone), the documentation is far more difficult to obtain (most often it requires at least a NDA, and sometimes no documentation at all is available as it remains company confidential informations).

5) I assume that, by ROM zip file, you mean the OTA update package. This package may contain anything the platform need to update and this includes (but is not limited to) kernel, bootloader, radio firmware, TEE firmware etc. These packages are based on a scripting language (named edify) that allow to do some very complex operations for updating.

6) Kernel is linked to the hardware platform (a phone &lt;=> a kernel). However some SYSTEM may requires some specific features to be enabled at kernel level. Then generally yes, kernels are compatibles with any SYSTEM partitions (assuming term ROM is used here with the meaning of the android SYSTEM partition).

Hope this helped ;-)