Some scripts for extracting and re-packing e2jffs2.img files.

  • Since I usually run my images from my NFS server instead of from flash, I found myself quite often having to extract e2jffs2.img files. So, I found a script which did most of what I wanted and made some mods. I don't remember where I found the original script (was a couple of years ago...) otherwise, I would give the original author credit.


    The first script mounts the e2jffs2.img file using a loop device and copies the filesystem to a local directory. Then copies the uImage file to the boot directory in the extracted filesystem. (My NFS boot scripts automatically look for the kernel there...)


    Usage: ./extract_jffs2.sh e2jffs2.img Destination_Dir
    (Full or relative paths can be used)


    Example: Assuming you have unzipped/untarred the image to /home/user/download/image_x/ and you want to extract it to /data/alien/images/new_image:


    Code
    1. ./extract_jffs2.sh /home/user/download/image_x/enigma2/e2jffs2.img /data/alien/images/new_image




    Second script is for re-packing backup images. It mounts the backup e2jffs2.img file using a loop device and then uses mkfs.jffs2 to create a new image file.


    Usage: ./repack_e2jffs2.sh e2jffs2.img
    (Full or relative paths can be used)


    Example: Assuming you have unzipped/untarred the backup image to /home/user/download/image_x/


    Code
    1. ./repack_e2jffs2.sh /home/user/download/image_x/enigma2/e2jffs2.img


    It will rename the original e2jffs2.img file to e2jffs2.orig and create a new repacked e2jffs2.img file.



    I use Debian and already had all tools installed, so I am not sure exactly which packages you will need. I know for sure mtd-utils is necessary. Of course it depends on which Linux distribution you are using.


    You can try running the scripts with:

    Code
    1. bash -x extract_e2jffs2.sh /home/user/download/image_x/enigma2/e2jffs2.img /data/alien/images/new_image


    to see what is going on if there is a problem.


    The scripts are not fool-proof and not much error checking is done, so take care with what you are doing...

  • Please login to see this link.

    I need help with something similar to this.

    I have many enigma 2 images for internal flash. These images are compiled into e2jffs2.img formate. I prefer to install images on a usb so i have more freedom and keep my internal flash from any fatal error. As a result, I need those images to be compiled into Tar.gz formate to be able to install them on external usb flash. Would you please give me a clue to do so? If there is a software can decompile internal images and recompile them into external images , that would be great. Any suggestion Mr. Expert??