Rom hacking

  • Antworten:3
  • OffenNicht stickyNicht beantwortet

16.01.2011 23:27:01 via Website

Well fellow same model tablet owners sorry for the English, my German is quite rusty.
So I got the brother of this tablet, the Bluepanther Thunder, and I'm trying to start a custom rom. I have been working with roms for android before but these are different they use ubifs and I'm having quite some troubles mounting them. Any of you had any more success ?

24.07.2011 08:59:11 via Website

Alexandru Stoian
I have been working with roms for android before but these are different they use ubifs and I'm having quite some troubles mounting them.

I found a nice overview here at infradead

People are often confused about what UBI is, which was the reason for creating this section. Please, realize that:
UBI is not a Flash Translation Layer (FTL), and it has nothing to do with FTL;
UBI works with bare flashes, and it does not work with consumer flashes like MMC, RS-MMC, eMMC, SD, mini-SD, micro-SD, CompactFlash, MemoryStick, USB flash drive, etc; instead, UBI works with raw flash devices, which are mostly found in embedded devices like mobile phones, etc.

UBIFS is a new flash file system developed by Nokia engineers with help of the University of Szeged. In a way, UBIFS may be considered as the next generation of the JFFS2 file-system.

JFFS2 file system works on top of MTD devices, but UBIFS works on top of UBI volumes and cannot operate on top of MTD devices. In other words, there are 3 subsystems involved:

MTD subsystem, which provides uniform interface to access flash chips. MTD provides an notion of MTD devices (e.g., /dev/mtd0) which basically represents raw flash;

UBI subsystem, which is a wear-leveling and volume management system for flash devices; UBI works on top of MTD devices and provides a notion of UBI volumes; UBI volumes are higher level entities than MTD devices and they are devoid of many unpleasant issues MTD devices have (e.g., wearing and bad blocks); see here for more information;

UBIFS file system, which works on top of UBI volumes.

Check this slide here as well please

How do I attach an MTD device?

Each MTD device has a name and a number, which you may find out by examining the /proc/mtd file. The preferable way to attach MTD devices is to attach them by name, not by number, because MTD device numbers may change if you change the layout of your flash, while the names will supposedly stay the same.

If UBI is compiled as a kernel module, it is enough to specify the MTD device name or number to attach in the module arguments, e.g.
$ modprobe ubi mtd=rootfs
$ modprobe ubi mtd=0

loads the UBI kernel module and attaches MTD device named "rootfs" or with number 3 (mtd3). And
$ modprobe ubi mtd=config mtd=rootfs
$ modprobe ubi mtd=3 mtd=5

command loads UBI kernel module and attaches MTD devices named "config" and "rootfs", or mtd3 and mtd5.

If UBI is compiled into the kernel, the mtd device to attach may be specified in the ubi.mtd=kernel boot parameter, e.g.,
ubi.mtd=rootfs
ubi.mtd=0

command makes UBI attach MTD device named "rootfs" or mtd3 when the kernel is booting. And
ubi.mtd=config ubi.mtd=rootfs
ubi.mtd=3 ubi.mtd=5

command makes UBI attach MTD devices named "config" and "rootfs", or mtd3 and mtd5.

And finally, MTD devices may be attached or detached at any time with the ubiattach and ubidetach utilities; For example,
$ ubiattach /dev/ubi_ctrl -m 3

attaches mtd3. But these utilities will work with kernel versions starting from version 2.6.25. And someone should update them and teach to accept MTD device names, not only MTD device numbers.

— geändert am 24.07.2011 10:18:21

24.07.2011 10:39:13 via Website

How do I extract files from an UBI/UBIFS image?

Unfortunately, at the moment there are no user-space tools which can unwrap UBI and UBIFS images. UBIFS cannot be loop-back mounted as well, because it does not work with block devices.

However, there is a hacky way to unwrap UBI/UBIFS images. But you have to make sure you have UBIFS support in your host machine. UBIFS is a relatively new file system and is not supported by all Linux distributions. But at least Fedora 11 does include it.

Let's consider a simple example. Suppose you have an ubi.img file. This is an UBI image, which contains a single UBI volume, which in turn contains UBIFS file-system. In other words, this is an image which was created using the mkfs.ubifs and ubinize tools, just like it is described in this section (the image is created for a 256MiB NAND flash with 2KiB NAND page size and which supports sub-pages). Here is what you can do:
# Create an 256MiB emulated NAND flash with 2KiB NAND page size
# (you should see the new MTD device in /proc/mtd)
modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa \
third_id_byte=0x00 fourth_id_byte=0x15

# MTD is not LDM-enabled and udev does not create device
# MTD device nodes automatically, so create /dev/mtd0
# (we assume that you do not have other MTD devices)
mknod /dev/mtd0 c 90 0

# Copy the contents of your image to the emulated MTD device
dd if=ubi.img of=/dev/mtd0 bs=2048

# Load UBI module and attach mtd0
modprobe ubi mtd=0

# Mount UBIFS
mount -t ubifs /dev/ubi0_0 /mnt/ubifs

Now you have the file-system in /mnt/ubifs. Use the following to get rid of it:
umount /mnt/ubifs
rmmod ubifs ubi nandsim