0

I want to test the functionality of a custom ubifs filesystem on an android emulator (avd- Nexus 5). I have compiled and deployed a goldfish kernel(3.4) with ubifs support. But not finding the correct steps to mount a ubifs onto the emulator. I have tried using adb's mount command but no use. Any ideas on how to proceed ? or if you have idea on mounting a ubifs onto a real Nexus 5 device, Please do share.

Thanks in advance..

artless noise
  • 21,212
  • 6
  • 68
  • 105
AvK
  • 75
  • 1
  • 9
  • This question appears to be off-topic because it is not directly related to programming and asking on http://android.stackexchange.com is probably a better idea. – Eugene Mayevski 'Callback Jun 05 '14 at 10:33
  • @artlessnoise while one can push certain questions to SO, it often turns our that there are just not enough specialists here to answer and such questions die unanswered. Also SO has 13 questions tagged "ubifs" so "often" is an overstatement. – Eugene Mayevski 'Callback Jun 05 '14 at 15:13
  • 1
    @artlessnoise From my experience there are many tags on SO which were initially created and accepted, then became offtopic due to new sites (such as Android site I mentioned) being created on StackExchange network. On the other hand you are right that UBIFS is not exactly about user experience with Android, so it's equally inappropriate (IMHO!) there as well. Maybe you are right and it's exclusively programmers who use UBIFS. – Eugene Mayevski 'Callback Jun 05 '14 at 15:22

1 Answers1

0

UbiFs requires UBI to work. UBI in turn requires a flash device or MTD (memory technology device). In order to mount it, you can use the nand_sim driver. The following are some commands to setup a UbiFs filesystem,

# nandsim emulating Micron 3.3V 256MiB, 2048 bytes page.
modprobe nandsim first_id_byte=0x2c second_id_byte=0xda third_id_byte=0x90 \
  fourth_id_byte=0x95
flash_erase /dev/mtd0 0 0
ubiformat /dev/mtd0
modprobe ubi mtd=0
ubiupdatevol /dev/ubi0_0 ubi.img
mount -t ubifs -o ro /dev/ubi0_0 /mnt/ubifs

This requires that nand_sim as a module; it is probably helpful to have ubi, ubifs, and mtd as modules. At least the above commands work on Debian/Ubuntu systems to verify UbiFs images as well as to diagnose corrupt images. There will probably be some Android simulator specific way to create modules. Alternatively, you can build nand_sim into the kernel and give it parameters to create a dummy flash device.

See the UBI Wiki entry for more information and resources. At least the concepts given should get you on the correct path.

Note: You ubi.img will have been created with some flash parameters such as erase block size. This is a property of the NAND device. You need to give nand_sim parameters for a device that matches those for your test image. The Linux kernel file nand_ids.c has tables with acceptable values for first_id_byte, second_id_byte, etc. There is a NAND hardware command to id flash which nand_sim will emulate to create the proper NAND geometry. The first byte is the manufacturer id.Ref: UbiFs on nand_sim.

Community
  • 1
  • 1
artless noise
  • 21,212
  • 6
  • 68
  • 105