I am building the android source code and getting new system.img . I try to flash the new system.img on a device and I see that I need another file called boot.img. What is this file ? what is used for ? how can I get it for my device ?
boot.img contains the kernel and ramdisk, critical files necessary to load the device before the filesystem can be mounted. You have to generate the boot.img yourself using mkbootimg, a tool provided by AOSP.
All the details you need are available at this xda-developers thread.
This google discussion thread may also be useful