←  [EN] Third-Party Development

Forums

»

unpack openpli image on linux

Locked

kzayed's Photo kzayed 7 Dec 2012

Hi all
Are there specific scripts for unpacking and repacking openpli nfi image in linux
i used the attached scripts(succeeded in cvs image) but with openli the output extracted folder contains only boot directory

Attached Files


Edited by kzayed, 7 December 2012 - 08:15.
Quote

scruff1963's Photo scruff1963 7 Dec 2012

I would find it easier to load the image to the box then tar it up to the hdd then transfer to the computer by ftp.
You may get moaned at for the clone bootloaders as pli doesn't support clones.
Quote

Happysat's Photo Happysat 7 Dec 2012

You can use nfidump to extract PLi images under Linux.

Usage: ./nfidump *.nfi /path to extract/

Attached Files

Quote

DrData's Photo DrData 7 Dec 2012

Is there a Version for Mac OSX ? Or Source Code avaible ?
Quote

mfaraj57's Photo mfaraj57 7 Dec 2012

You can use nfidump to extract PLi images under Linux.

Usage: ./nfidump *.nfi /path to extract/

i used nfidump to extract image in ubunto 12 but this the result
nfidump: nfidump: cannot execute binary file
chmod 755 given and the path for image and the path for extraction
/bin$ sh nfidump original.nfi /image4
without sh give me this

No command 'nfidump' found, did you mean:
Command 'nfdump' from package 'nfdump' (universe)
nfidump: command not found
Quote

Happysat's Photo Happysat 7 Dec 2012

I just tried with todayś 3.0 image on Ubuntu 12,

#!/bin/sh
cd /home/happysat/Dreambox/image
nfidump *.nfi /home/happysat/Dreambox/image/extract
exit

happysat@happysat-VirtualBox ~ $ nfidump.sh
>>>>>> nfidump 0.4.1 by gutemine <<<<<<
based on code from tmbinc, noggie and others
extracting dm800se nfi image ...
extracting boot.jffs2 from nfi ...
extracting boot from boot.jffs2 ...
extracting root.jffs2 from nfi ...
extracting root from root.jffs2 ...
>>>>>> nfidump finished <<<<<<

Image was extracted okay no errors.

The binairy is placed in /usr/bin
Edited by Happysat, 7 December 2012 - 18:53.
Quote

mfaraj57's Photo mfaraj57 7 Dec 2012

i don not know what is wrong
but same result
/cobra/bin$ nfidump original.nfi /image4/
No command 'nfidump' found, did you mean:
Command 'nfdump' from package 'nfdump' (universe)
nfidump: command not found

i am sure nfidump in cobra/bin directory and attribute as excecutable
Edited by mfaraj57, 7 December 2012 - 19:06.
Quote

mfaraj57's Photo mfaraj57 7 Dec 2012

i don not know what is wrong
but same result
/cobra/bin$ nfidump original.nfi /image4/
No command 'nfidump' found, did you mean:
Command 'nfdump' from package 'nfdump' (universe)
nfidump: command not found

i am sure nfidump in cobra/bin directory and attribute as excecutable

i am not good in linux but no permission to add nfidump to usr/bin
Edited by mfaraj57, 7 December 2012 - 19:19.
Quote

Happysat's Photo Happysat 7 Dec 2012

Copy it as root user to /usr/bin e.g sudo cp nfidump(location) /usr/bin
Quote

mfaraj57's Photo mfaraj57 7 Dec 2012

thanks my friend
the binary should be in usr/bin,although this is not the case in dreambox linux
now ok
>>>>>> nfidump 0.4.1 by gutemine <<<<<<

based on code from tmbinc, noggie and others

extracting dm7020 nfi image ...

>>>>>> nfidump finished <<<<<<
Edited by mfaraj57, 7 December 2012 - 19:34.
Quote

Happysat's Photo Happysat 7 Dec 2012

Yes true , but when placed in /bin you can execute it anywhere :)
Quote

fairbird's Photo fairbird 18 Dec 2012

@Happysat
Hi friend...
about unpack it was done well from your nfidump binary file but the problem is pack it again "How to?"
I have tried with those scripts on start topic but an image freezed on boot step doesn't booted well .. Do you have any scripts or any way to pack to nfi again?
Edited by fairbird, 18 December 2012 - 01:16.
Quote

Happysat's Photo Happysat 18 Dec 2012

No not really im struggeling with it to :unsure:
Quote

hemispherical1's Photo hemispherical1 18 Dec 2012

Steal the required binaries (buildimage & mkfs.jffs2) & info from build-nfi-image.sh from nfibackup... Then Happysat can write a script to automate it... ;)

Something like:

mkfs.jffs2 --root=/path/to/boot --faketime --output=/path/where/I/want/boot.jffs2 --eraseblock=0x4000 -n -l
mkfs.jffs2 --root=/path/to/root-of-filesystem --faketime --output=/path/where/I/want/root.jffs2 --eraseblock=0x4000 -n -l

buildimage --brcmnand --arch dm800 -e 0x4000 -f 0x4000000 -s 512 -b 0x40000:/path/to/SSL.bin.gz -d 0x3C0000:$/path/to/boot.jffs2 -d 0x3C00000:/path/to/root.jffs2 > NewImage.nfi

--
hemi

Ps. IIRC recent versions of nfidump can extract the SSL also from orig image, making 1 less thing to track down...
Edited by hemispherical1, 18 December 2012 - 07:48.
Quote

fairbird's Photo fairbird 18 Dec 2012

@hemispherical1
I had tried before same as what you wrote but never succeed, Box doesn't complete booted...
Thank you
Quote

MostlyHarmless's Photo MostlyHarmless 18 Dec 2012

Strange, as gutemine can do this nicely :-)

But gutemine doesn't need to steal/borrow binaries ...
Edited by MostlyHarmless, 18 December 2012 - 20:28.
Quote

hemispherical1's Photo hemispherical1 18 Dec 2012

I tried it on my PC and sure enough the image did not boot, SSL loaded then it just hung. Of course that makes zero sense as it "should" work.

I repeated the whole procedure on my dm800 and the resulting image booted and runs. I guess something in the PC versions of either nfidump, buildimage, or mkfs.jffs2 does not play well with others. Since the PC versions of buildimage and mkfs.jffs2 work to build images from source, I'm leaning twords a problem with nfidump on pc. The version on my PC is 0.41 while the one on my DB is 0.42. Regardless, this worked on my DM800:

mkdir /hdd/tmp (make working directory)
cp desired_image /hdd/tmp (copy nfi image to work directory)
cd /hdd/tmp (change to work directory)
nfidump --loaderextract ./desired_image.nfi image (extract desired_image to /hdd/tmp/image & SSL to /hdd/tmp/secondstage-dm800.bin)
mv /hdd/tmp/image/boot /hdd/tmp (seperate /boot out of the root filesystem)
mkdir /hdd/tmp/image/boot (recreate /boot mountpoint in root filesystem)
(make any desired edits to image)
mkfs.jffs2 --root=boot --faketime --output=boot.jffs2 --eraseblock=0x4000 -n -l (create boot.jffs2 image)
mkfs.jffs2 --root=image --faketime --output=root.jffs2 --eraseblock=0x4000 -n -l (create root.jffs2 image)
buildimage --brcmnand --arch dm800 -e 0x4000 -f 0x4000000 -s 512 -b 0x40000:secondstage-dm800.bin -d 0x3C0000:boot.jffs2 -d 0x3C00000:root.jffs2 > NewImage.nfi (build NewImage.nfi)
Note the commands are identical to ones run on my PC that created a broken image....
--
hemi
Edited by hemispherical1, 18 December 2012 - 21:54.
Quote

fairbird's Photo fairbird 18 Dec 2012

will try and give feedback.... :)
Quote

gjstroom's Photo gjstroom 18 Dec 2012

Like Hemi already said, this should work:

mount /dev/mtdblock2 /tmp/boot -t jffs2
mount /dev/mtdblock3 /tmp/root -t jffs2

nfidump/bin/mkfs.jffs2 --root=/tmp/boot --faketime --compression-mode=size --output=boot.jffs2 --eraseblock=0x4000 -n -l
nfidump/bin/mkfs.jffs2 --root=/tmp/root --faketime --compression-mode=size --output=root.jffs2 --eraseblock=0x4000 -n -l
nfidump/bin/buildimage --brcmnand --arch dm800se -e 0x4000 -f 0x4000000 -s 512 -b 0x40000:ssl.bin -d 0x3C0000:boot.jffs2 -d 0x3C00000:root.jffs2 > "image.nfi"
Quote

fairbird's Photo fairbird 19 Dec 2012

@gjstroom
Try it also again doesn't booting...
Please and one can upload wright binary files for linux...
Quote
Locked