Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

zImage

I have an Altera Cyclone Eval Brd with 16 MB cfi flash and 32 MB DDR RAM.

I successfully made a zImage and uploaded it to the DDR RAM with the command:

nios2-download -g zImage

This is working.

Offset is 0x800000.

Now I want to put the zImage into cfi flash.

What I tried so far is:

Convert the zImage elf format to bin format with:

nios2-elf-objcopy -o binary zimage zimage.bin

Then convert the bin into s19 flash format.

bin2flash --input=zimage.bin --output=zimage.flash --location=0x0

Then I upload this file with

nios2-flash-programmer --base=0x0 zimage.flash

When starting I see the message Uncompressing Linux and then system halted with some errormessage (not always the same)

My flash starts at 0x0

and DDR starts at 0x4000000

What I also tried is to change the link address to 0x0 and manually change the

nasys_program_mem address in vmlinux.lds.S also to 0x0 in order to link

the start segment to 0x0 for my flash.

It started but stopped with:

ran out of input data.

Does anyone know how to get the zImage into flash?

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thank you hippo,

    this works.

    I thought that I can decompress the zImage directly into RAM without an additional bootloader.

    After I posted my question I found out that you described how to program the zImage into flash in your buildroot guide, which is an excellent document.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Nacide,

    Thank you, too.

    You have a nice web site, and that is very helpful.

    It would be great if you can contibute to the Nios Wiki .

    Or can I copy some of the contents ?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    hippo,

    thank you for your invitation, I considered it already but did not want to maintain 2 sites, so for the moment I leave it up to you to maintain the Nios Wiki. Feel free to copy any contents you like from my website. I agree that in the long run the Nios Wiki should become the master documentation.