How to extract the secondstage.bin from FLASH

  • I would like to extract the secondstage.bin from the FLASH memory of my Dreambox DM7025. How should I do that?


    I want to write a little plug-in that creates an .nfi file from an installed image. Writing this .nfi file to another Dreambox should make a clone of the original Dreambox.


    Creating a boot.jffs2 and a root.jffs2 file is possible with mkfs.jffs2 . If I can extract secondstage.bin then I have everything I need to build an new .nfi file with the buildimage tool.


    Regards, Frits

  • be careful, making a jffs2 from your running rootfs will almost certainly not give you the desired effect.
    Especially now with unionfs, I don't expect this to work.

  • Well mechatron's backup scripts do exactly what you currently develop already (using also mkfs.jffs2 and buildimage) - I think it is even posted here in the forum somewhere, if not Google is your friend.


    And the latest version of this script supports all boxes with nfi images (600/7020/7025) and also the new OE 1.5 Images on the 7025 with squashfs.


    The same tools and nfi backup functionality is also available within my own Barry Allen Plugin (also available for 600/7020/7025) - backup into nfi images for Images in Flash and/or Multiboot devices like CF/USB/HDD.


    The only exception to your approach is that mechatron (and me too)prefere to download the secondstage.bin from the DMM development server or extract it from an original nfi image !


    And I think we have good reasons to do this, because the secondstageloader is not in the jffs2 filesystem, meaning you have to get it directly from the Unix device.


    This is possible (dd with the right blocksize is probably your friend), but this is not a clean way, and if there would be bad blocks skipped during Flash your extracted binary would be probably corrupt, so it is not really a good idea either.


    PS: I even implemented the possibility to update the secondstage loader as a hidden feature of Multiboot on the 7025, but again this is not supported or recommended, because usind dd to copy it into Flash will bypass the checks to prevent corruption of the Flash Memory.

    4 Mal editiert, zuletzt von Lost in Translation ()