I am very much new to Embedded Linux. We use poky build system. We just use bitbake linux-imx command to build the kernel. It generates some files zImage, rootfs, uboot and also a sdcard image. We just copy the sdcard image and run the linux on our custom board. My questions what does rootfs and zImage actually contain??
To understand what every file is responsible for you should understand how MPU starts up.
As I understood from your qestion you use NXP (Freescale) i.MX microprocessor family. It includes small ROM loader, which will make basic system setup (interfaces to memory, clock tree etc.), search for media to boot from (based on burned OTP bits or GPIO), find bootloader (u-boot in your case) in exact address which is specified in datasheet, load and start it. U-boot will init more interfaces (e.g. Ethernet), find arguments that should be passed to Kernel (screen settings, console, network settings if you use NFS), copy Kernel to DDR and pass all arguments. Kernel will load all drivers, and search for rootfs with all libraries, applications etc. After this Kernel will start init scripts, which will init all system and start your application.
- u-boot is the first thing that will start after ROM bootloader. You can replace it with your own code if you would like MPU to run bare-metal code without OS (like microcontroller).
- zImage is compressed version of the Linux kernel image that is self-extracting.
- rootfs is root file system, which contains all applications, libs and in most cases everything, including home folder.
- sdcard image is just all stuff mentioned above which can be copied (with dd) to the card, after copy you will see FAT partition with Kernel and device tree and EXT partition with rootfs, u-boot is in unpartitioned area before FAT (in case you use i.MX6 it's 0x80000). It's there just to make your life easier.
zImageis the actual binary image of the compiled kernel. It's what the boot loader will load and attempt to execute (I believe on embedded linux it's written to the boot sector directly somehow; consult your embedded linux distro manual for instructions)
rootfsis the so-called INITial RamDisk (also known as initrd) image that contains everything that the kernel will need to boot up into a state where the actual root filesystem can me mounted.
ubootis the boot loader used by embedded linux; it basically tells the BIOS to run
zImagewith the options that tell
zImagewhere to find the root filesystem so it knows how to start.
If I had to guess, I'd hazard that all these files are created in the process of generating the actual SDcard image, even if you no longer need to manually add the former three to the final image anymore.