How to extract files from jffs2 rootfilesystem 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.

Android Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Commands and Packages Compilation Content Management System - CMS Core Kernel C Programs Development & Build Development Environment Setup Errors & Failures Flutter git Go Language Programs Hardware Platforms HTML JAVA Programs Kernel & Device Drivers Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Monetization / Google AdSense Multimedia - Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized User Interface Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply / Ask Question