Please try this,
# Creating .flash file for the project
elf2flash --base=0x00000000 --end=0xffffff --reset=0x0 --input=zImage --output=ext_flash.flash --boot=$SOPC_KIT_NIOS2/components/altera_nios2/boot_loader_cfi.srec# Programming flash with the project
nios2-flash-programmer --base=0x00000000 ext_flash.flash
Please note, the zImage does not relocate itself.
On reset, the altera cfi boot loader will load the zImage program to sdram+boot link offset .
Then the uncompressing program in zImage will uncompress the kernel code vmlinux to the start of sdram.
You can use `nios2-elf-objdump -h` to find out the location and size of both
1. the original kernel image, vmlinux in your kernel root dir
2. the compress image, zImage
They should not overlap.
In flash, the zImage should not overlap with fpga config data or others.