Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12693 Discussions

repack(decompress) / pack zImage

Altera_Forum
Honored Contributor II
2,459 Views

Hi all, 

 

is any way and tools, how to repack zImage and view/edit the files in zImage - /bin, /dev, /etc, /home, /lib, /mnt, /proc, /sbin, /sys, /tmp, /usr, /var ? 

 

And after editing for example rc in /etc is any way, how to pack into zImage (without make) ? 

 

Thank you very much. 

 

Jan Naceradsky, Czech Republic
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
1,386 Views

You will need to search the gzip magic 1F 8B, gunzip, then you get the kernel. Next search the gzip magic again for initramfs, zcat and cpio. Not a easy job. 

 

- Hippo
0 Kudos
Altera_Forum
Honored Contributor II
1,386 Views

Oh no...:( 

 

I found that there is two commands, which is possible to run in NIOSII EDS Command line: 

/>nios2-elf-readelf -a zImage // which reports: 

Elf header: 

Magic: xxx 

Class: xxx 

xxx 

Type: EXEC 

Machine: Altera Nios II 

xx 

 

etc. 

/>nios2-elf-ar  

which should be able to delete, replace, extract or add file etc., but when i run  

/>nios2-elf-ar p zImage 

nios2-elf-ar:zImage:File format not recognized 

/> 

 

Why ???? 

Is anywhere some manual for this command (nios2-elf-ar) ? 

 

When I start from other side, is any way, how "repair" uClinux zImage, when i only want to edit and compile my user program, edit some etc/rc and *.conf files and after this create zImage or any way upgrade or modify my zImage on Altera fpga without install whole package:  

- download the tar file nios2-linux-20090730.tar, which take 1.6GB and after install, how you write on nioswiki about 6GB or more free disk space. 

 

I found, that i can install nios2-gcc compiler, which has 69MB on http://www.niosftp.com/pub/gnutools/...080203.tar.bz2 (http://www.niosftp.com/pub/gnutools/...080203.tar.bz2

but after this i will need to have some parts of uClinux instalation ...  

 

Thank you for some answers. 

 

Jan Naceradsky
0 Kudos
Reply