Introduction to Yocto
There are a few ways to get a working kernel and a rootfs, for example buildroot(which provides makefiles and patches for kernel and packages to give you a kernel and a root file system, and has a kernel menuconfig like interface), and openembedded (this also helps you create a customized linux distribution).
Yocto is a linux foundation project which is contributed to by many companies and individuals to help developers create a complete linux system regardless of the hardware/architecture. With these, you can get a complete linux system for ARM/MIPS/PowerPC/x86/x86_64. Its core on is based on openembedded.
First of all you need a system running linux,you don’t need one (https://www.yoctoproject.org/documentation/build-appliance-manual) but work will be more difficult. This gives you a quick intro to how to get your environment setup etc. A 64-bit system with lots of RAM, fast cpu, and free disk space in the order of 50-100 GB is recommended.
After you do the . ./oe-init-build-env TargetDir step, you will be cd’d to that directory with a few scripts/program paths appended to your $PATH.
Now you can edit the local.conf file to setup paths and parallelism(for make and for bitbake) etc as is explained in the quick start guide. Now, you can do a bitbake core-image-minimal or some other target, which will start building the minimal image for the default architecture which is x86. Only do this if you target is x86, since it will take many hours for the download/compilation of sources even on a fast computer. Bitbake is a tool which reads metadata which is classes, configs and ‘recipes’, which are provided by yocto/oe, or by you, to perform tasks, which can be fetch/compile/deploy/testing… for packages that you want to build. It also performs dependency tracking and resolution, so it takes care of necessary packages automatically(they are described in the metadata). The other file that will be in the conf directory is bblayers.conf, which adds list ‘layers’ which should be enabled for the build.
To compile linux kernel do:
Here, ‘virtual/kernel’ is a ‘target’ which is ‘provided’ by some ‘recipe’, present in some ‘layer’; this should compile the kernel for you(which is chosen depending on your configuration in local.conf, and recipes inside your layers), with the patches that are present with yocto, or you can specify more to suit your custom board. To make yocto support a custom board, you can provide a BSP ‘layer’ (a layer is a collection of recipes basically, read all about it http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html). The image generated will usually be a zImage in binary, or if you have a custom BSP, it might be something else too, which enables your board to boot, for example manufacturer provided bootloader, or u-boot along with kernel binary(processor reference manual should have a section on booting). For example, freescale imx233 needs the image to have a specific encrypted format, and also a specific layout for it to boot through SD/MMC, so it provides a BSP layer for its processors https://github.com/Freescale/meta-fsl-arm. Other ways are also possible to boot it, and will probably need the image to be in a different way.
If you need to tune kernel build options yourself instead of accepting the default config; do that using:
bitbake -c menuconfig virtual/kernel
The kernel by itself won’t do much, you need to have a root file system, which it mounts on / when it boots. One minimal rootfs image defined by yocto is:
will contain a minimal working system. Yocto provides the generated file system(which will contain the directories and files that a typical linux system has like /var /sys /bin /usr etc.). Yocto will also package the things it builds for your filesystem so it is easy to add more software to your rootfs using a package manager, the default is rpm, but opkg is also available.
You need to find a way to make the kernel be able to mount the rootfs. For example, if you have the filesystem on a SD card on the system, you need the kernel to support, and use the SD card peripheral on your board. And you need to tell the kernel to mount the rootfs from there using the Kernel command line. If you are using a bootloader like u-boot, then it can pass a command line to the kernel, else it will have to be compiled inside the kernel. You can do this via the menuconfig to configure the kernel, or, it might be provided to you by your BSP via a patch.
If all goes well, you should have a running linux system within a few hours. The yocto documentation is available at http://www.yoctoproject.org/documentation.
If you are working on a recipe or layer, and want the changes to be reflected in the final build, you need to clean the working area for the recipe. Do that with bitbake -c clean <package> , there is also a bitbake -c cleansstate <package> for clean the sstate cache for a particular package(sstate caching can be enabled in local.conf, and it speeds up future build significantly).
Some useful commands to list packages or search are bitbake -e and bitbake -s , more about this in 
Some useful links:
http://www.aosabook.org/en/yocto.html overview of yocto architechture