How to extract files from jffs2 root filesystem image ?

[ Note: following commands has been tried on ubuntu 16.04, but should work on other Linux distros as well ]

Lets create a temporary device node in /tmp as,

 $ sudo mknod /tmp/mtdblock0 b 31 0 
 $ ls -l /tmp/mtdblock0  

brw-r–r– 1 root root 31, 0 Aug 23 00:21 /tmp/mtdblock0

 $ sudo modprobe mtdblock 
 $ sudo modprobe mtdram total_size=65536 erase_size=256 
 $ sudo modprobe jffs2 

Now lets use dd command to write jffs2 binary rootfs to temporary device node we created at /tmp as,

 $ sudo dd if=/home/myuser/Downloads/rootfs.jffs2 of=/tmp/mtdblock0 

37888+0 records in
37888+0 records out
19398656 bytes (19 MB, 18 MiB) copied, 0.295502 s, 65.6 MB/s

 $ sudo mkdir /media/jffs2-extracted 

Now we will use a mount command for mounting jffs2 rootfs at /media/jffs2-extracted folder as,

 $ sudo mount -t jffs2 /tmp/mtdblock0 /media/jffs2-extracted 
$ ls /media/jffs2-extracted/
bin  boot  dev  etc  home  lib  linuxrc  media  mnt  proc  sbin  sys  tmp  usr  var

This is how you can mount an jffs2 rootfs binary and extract the files from it.


lynxbee_ezoic

Subscribe with Valid Email Id to receive updates in Inbox. ( Secured by Google FeedBurner )

   


Leave a Comment

Android Android Applications Android Build system Android Commands Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development & Build Development, Debugging and Performance Tools Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web design and development Website Hosting Wordpress Yocto / Bitbake / Openembedded