Accessing content of rootfs.img? (from Zaxxon-HF6.zip)


PatientFan

Still Fresh
Joined
Sep 1, 2011
Messages
29
Does anybody know how to access the content of rootfs.img extracted from Zaxxon-HF6.zip?


I would like to access the firmware of the Pandora on a Ubuntu Linux machine. Especially the libraries.


I don't get further than the error shown below.


What filesystem is used in rootfs.img?


Or am I going about this completely the wrong way?


$ sudo mount -o loop rootfs.img /mnt/pandorafirmware


mount: wrong fs type, bad option, bad superblock on /dev/loop0,


missing codepage or helper program, or other error


In some cases useful info is found in syslog - try


dmesg | tail or so
 
That is a RAW dump of a NAND chip, you can't simply mount an image from a non-block based device. You need to emulate a RAW memory chip. There's a kernel module for that, Google up nandsim. It will be much easier to simply search for a tarball, though.
 
That is a RAW dump of a NAND chip, you can't simply mount an image from a non-block based device. You need to emulate a RAW memory chip. There's a kernel module for that, Google up nandsim. It will be much easier to simply search for a tarball, though.

Thanks a lot for the good advice!


The best solution is indeed to get the data from here: http://openpandora.org/firmware/


A related question was discussed here: http://www.gp32x.de...e__hl__ubimkvol


A link about how to extract files from an UBIFS image: http://www.linux-mtd...L_ubifs_extract


I have invested quite some time trying to mount rootfs.img with ubifs but wiithout success.


If anybody figures it out, a reply to this thread would be appreciated.
 
Last edited by a moderator:
Successo!! I have finally figured out how to get at the contents of the raw Pandora NAND image!


I used a 64bit Ubuntu 11.10 system. I remember installing the following package, but maybe there were more:



Code:
sudo apt-get install mtd-utils



The procedure is as follows:



First you download the complete firmware image, probably from here. In the ZIP file there is the image: rootfs.img

The instructions below expect you to work in the directory where rootfs.img is.



Create a file called ubinize.cfg with the following content:



Code:
[ubifs]

mode=ubi

image=./rootfs.img

vol_id=0

vol_type=dynamic

vol_name=volrootfs

vol_flags=autoresize



Then use these commands:





Code:
ubinize -o rootfsubi.img -m 2048 -p 128KiB -s 512 ubinize.cfg


sudo modprobe nandsim first_id_byte=0x20 second_id_byte=0xac third_id_byte=0x00 fourth_id_byte=0x15 # 512MiB MTD device


sudo ubiformat /dev/mtd0 -f rootfsubi.img


sudo modprobe ubi


sudo ubiattach -d 0 -p /dev/mtd0  # creates /dev/ubi


sudo mount -t ubifs ubi0:volrootfs /mnt/pandorafirmware



The trick was that one first has to "ubinize" the raw NAND image that comes in the ZIP file.

And then ubiformat is the handy command to transfer the contents of the file to the simulated NAND /dev/mtd0.



EDIT:

For completeness, this is how you create your own NAND dump raw file on your Pandora:





Code:
sudo nanddump /dev/mtd4 -f /media/P1/my_rootfs.img


The output file my_rootfs.img can then be mounted on a (recent) Linux system with the procedure given above.
 
Last edited by a moderator:
is there any reason for needing to extract the contents of this?

No, not really. I just got carried away with ambition :)


As long as the files are provided together with the image, the whole exercise is pointless. But fascinating, nevertheless :rolleyes:


It might be useful one day if you make a "nanddump" on your Pandora (maybe as a backup) and later discover that you want to access individual files of the dump on your PC. But this is a far-fetched scenario, indeed.
 
Last edited by a moderator:
Back
Top