Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a .img file that uses the yaffs2 filesystem (an Android partition image) that I want to mount. I can't seem to do it with the mount command. How can I do this? I'm using Ubuntu 12.04.

Also, I don't want to extract it (I know how to do that using unyaffs). I want to mount it.

share|improve this question
    
Is it a boot.img or system.img file? –  mfisch Dec 30 '12 at 4:33
    
@mfisch system.img file. boot.img isn't yaffs2. And I don't want to extract it, I want to mount it. –  gsingh2011 Dec 30 '12 at 5:12
add comment

3 Answers

Ubuntu currently does not support YAFFS2. There is a feature request to package the YAFFS2 kernel module, which would provide mount support for the filesystem: [needs-packaging] yaffs2.

Kernel support

Thus, currently, if you need mount support you will have to compile it yourself. The YAFFS website has instructions for compiling a Linux kernel with YAFFS support (using Precise 32-bit):

The Ubuntu wiki also has general information on compiling your own kernel.

Extract and rebuild

Alternatively, try using yaffs2utils to extract and rebuild the image.

Note that due to a bug, you must specify the --yaffs-ecclayout option or it will silently fail. So to extract, try something like

git clone https://code.google.com/p/yaffs2utils/
cd yaffs2utils && make && cd ..
./yaffs2utils/unyaffs2 --yaffs-ecclayout system.img tempdir

Theoretically you can also rebuild the image using mkyaffs2, but I couldn't get it to work (the result wasn't bootable).

Yaffey

I found a program, Yaffey, that lets you edit a YAFFS2 image using a GUI:

Yaffey

While the home page says it's Windows-only, with a trivial change it compiles on Ubuntu Precise. To do so:

  1. Install dependencies: sudo apt-get install qt-sdk
  2. hg clone https://code.google.com/p/yaffey/
  3. In the file yaffey/yaffs2/yaffs_guts.h, change the line

    typedef unsigned loff_t;
    

    to

    #include <stdlib.h>
    
  4. Compile: cd yaffey && qmake && make
  5. Run ./yaffey.
  6. Open your image, make your desired changes, and save (it refuses to overwrite; you have to select a different filename).

When I tried it, the resulting image booted successfully in the Android emulator.

share|improve this answer
    
Thanks for recommending Yaffey and providing details of the patch needed to compile it on Linux! –  qris Sep 9 '13 at 15:09
add comment

It's a sparse filesystem, I think you'll need to unsparsify it first using simg2img. You can download it as part of ext4_utils which I have posted on here for when I used it on the Nexus7 images. Unpack the image and mount as follows:

Unpack:

./simg2img rootfs.img rootfs.ext4

Mount:

sudo mount -o loop rootfs.ext4 tmpmnt/

Once you've unpacked it and hacked it, you rebuild it using make_ext4fs. You should probably read the blog entry I made about hacking the Nexus7 image as it covers most of this and the script it references may be useful.

share|improve this answer
    
Thanks for the answer but I don't think it will work. simg2img only outputs "Bad Magic". Googling told me that this happens when you use it on anything that's not a compressed ext4 image, and yaffs2 isn't a compressed ext4 image. –  gsingh2011 Dec 30 '12 at 6:09
1  
Sorry I completely missed that, did you try the unyaffs2 tool? code.google.com/p/unyaffs/downloads/… –  mfisch Dec 30 '12 at 16:16
    
Yea, I was able to extract it with unyaffs, but since that's not really mounting I can't accept this answer. I guess it's not currently possible. Btw, you have an interesting blog :) –  gsingh2011 Dec 30 '12 at 22:55
    
I've also read, but not tried, that you can compile yaffs2 support into your kernel and just mount it like that. Maybe the simplest solution here is to mount it on an Android device? –  mfisch Dec 31 '12 at 1:35
add comment

I thought I would update this with Ubuntu 13. I had to make some changes to get it to compile that I hope will help others.

  1. Edit yaffey.pro and under

    QT += core gui

    Add

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

  2. Edit MainWindow.cpp and search/replace:

    setResizeMode with setSectionResizeMode

  3. Edit YaffTreeView.cpp and under

    #include <QDebug>

    Add

    #include <QMimeData>

You should then be able to compile.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.