I've gotten a port of UBIFS to the Android emulator far enough along 
that the UI comes up, with all three filesystems (system, data, cache) 
on UBIFS.  For the 2.6.25 kernel, this required 100+ patches from 
infradead.org, although 2.6.27 comes with these already merged upstream.

Also required is some generalization of mtd/devices/goldfish_nand.c, to 
handle less strictly aligned reads and writes.  For easy switching of 
the build from YAFFS to UBIFS (and back), I added a "ubifs" 
pseudo-target to the top-level Android makefiles.  A `make installclean` 
in between builds suffices to clear out the incompatible filesystem 
binaries.

At least one Android bug is exposed.  UBIFS reports variations on this 
error:

> UBIFS error (pid 1): ubifs_scan: corrupt empty space at LEB 1:49152
> UBIFS error (pid 1): ubifs_scanned_corruption: corrupted data at LEB 1:49152
> [<c0026680>] (dump_stack+0x0/0x14) from [<c00f9dfc>] 
> (ubifs_scanned_corruption+0x48/0xb8)
> [<c00f9db4>] (ubifs_scanned_corruption+0x0/0xb8) from [<c00fa344>] 
> (ubifs_scan+0x188/0x1d0)
>  r7:00000000 r6:00012fff r5:0000c000 r4:c685c000
> [<c00fa1bc>] (ubifs_scan+0x0/0x1d0) from [<c00f8ec4>] 
> (ubifs_read_master+0x70/0xd74)
> [<c00f8e54>] (ubifs_read_master+0x0/0xd74) from [<c00f1c28>] 
> (ubifs_fill_super+0x8dc/0xda8)
> [<c00f134c>] (ubifs_fill_super+0x0/0xda8) from [<c00f2bfc>] 
> (ubifs_get_sb+0x1d8/0x244)
> [<c00f2a24>] (ubifs_get_sb+0x0/0x244) from [<c0081eac>] 
> (vfs_kern_mount+0x58/0xb0)
> [<c0081e54>] (vfs_kern_mount+0x0/0xb0) from [<c0081f64>] 
> (do_kern_mount+0x40/0xdc)
>  r8:c02bd784 r7:c5e50000 r6:00000000 r5:c5e4e000 r4:00000001
> [<c0081f24>] (do_kern_mount+0x0/0xdc) from [<c00970dc>] 
> (do_new_mount+0x60/0x90)
>  r8:c5e4e000 r7:c5c17ef0 r6:00000000 r5:00000001 r4:c5e50000
> [<c009707c>] (do_new_mount+0x0/0x90) from [<c0097274>] (do_mount+0x168/0x190)
>  r7:c5c82000 r6:c5c17ef0 r5:00000000 r4:00000001
> [<c009710c>] (do_mount+0x0/0x190) from [<c0097328>] (sys_mount+0x8c/0xd4)
> [<c009729c>] (sys_mount+0x0/0xd4) from [<c0022940>] 
> (ret_fast_syscall+0x0/0x2c)
>  r7:00000015 r6:0001f024 r5:000201f8 r4:00000000
> first 4096 bytes from LEB 1:49152 at addr c685c000<7>
>  00000000: 2000004e 00000180 0000f9c0 000000bc 0000014e 2000008e 
00000180 0000fa80  N.. ............N...... ........
> 00000020: 000000bc 0000014e 200000ce 00000180 0000fb40 000000bc 0000014e 
> 2000010e  ....N...... ....@.......n......
> 00000040: 00000180 0000fc00 000000bc 0000014e 2000014e ffffffff 06101831 
> 1a0dfaba  ............N...N.. ....1.......
> 00000060: 000036f9 00000000 000000bc 00000009 00020008 00000180 0000fcc0 
> 000000bc  .6..............................
> 00000080: 0000014e 2000018e 00000180 0000fd80 000000bc 0000014f 2000003c 
> 00000180  N...... ............O...<.. ....
> 000000a0: 0000fe40 000000bc 00000150 2000000f 00000180 0000ff00 000000bc 
> 00000150  @.......P...... ............P...
> 000000c0: 2000004f 00000180 0000ffc0 000000bc 00000150 2000008f 00000180 
> 00010080  O.. ............P...... ........
> 000000e0: 000000bc 00000150 200000cf 00000180 00010140 000000bc 00000150 
> 2000010f  ....P...... ....@.......p......
> 00000100: 00000180 00010200 000000bc 00000150 2000014f ffffffff 06101831 
> 172acb3e  ............P...O.. ....1...>.*.
> 00000120: 000036fa 00000000 000000bc 00000009 00020008 00000180 000102c0 
> 000000bc  .6..............................
> 00000140: 00000150 2000018f 00000180 00010380 000000bc 00000150 200001cf 
> 00000180  P...... ............P...... ....
> 00000160: 00010440 000000bc 00000152 20000001 00000180 00010500 000000bc 
> 00000154  @.......R...... ............T...
> 00000180: 2000003c 00000180 000105c0 000000bc 00000155 2000002b 00000180 
> 00010680  <.. ............U...+.. ........
> 000001a0: 000000bc 00000155 2000006b 00000180 00010740 000000bc 00000155 
> 200000ab  ....U...k.. ....@.......u......
> 000001c0: 00000180 00010800 000000bc 00000155 200000eb ffffffff 06101831 
> 11834399  ............U...... ....1....C..
> 000001e0: 000036fb 00000000 000000bc 00000009 00020008 00000180 000108c0 
> 000000bc  .6..............................
> 00000200: 00000155 2000012b 00000180 00010980 000000bc 00000155 2000016b 
> 00000180  U...+.. ............U...k.. ....
> 00000220: 00010a40 000000bc 0000015b 20000004 00000180 00010b00 000000bc 
> 0000015b  @.......[...... ............[...
> 00000240: 20000044 00000180 00010bc0 000000bc 0000015c 4b95b0a3 00000180 
> 00010c80  D.. ............\......K........
> 00000260: 000000bc 00000166 20000001 00000180 00010d40 000000bc 00000174 
> 20000007  ....f...... ....@.......t......
> 00000280: 00000180 00010e00 000000bc 0000017e 20000009 ffffffff 06101831 
> 4a047ad1  ............~...... ....1....z.J
> 000002a0: 000036fc 00000000 0000006c 00000009 00020004 00000180 00010ec0 
> 000000bc  .6......l.......................
> 000002c0: 0000018f 20000008 00000180 00010f80 000000bc 00000193 20000024 
> 00000180  ....... ................$.. ....
> 000002e0: 00011040 000000bc 000001a9 20000000 00000180 00011100 00000058 
> 000001b3  @.............. ........X.......
> 00000300: 20000019 ffffffff 06101831 515361db 000036fd 00000000 000000bc 
> 00000009  ... ....1....aSQ.6..............
> 00000320: 00030008 00000180 00011158 000000bc 00000001 00000000 00000180 
> 00011218  ........X.......................
> 00000340: 000000bc 0000004c 2000001d 00000180 000112d8 000000bc 00000057 
> 20000044  ....L...... ............W...D..
> 00000360: 00000180 00011398 000000bc 0000005e 20000005 00000180 00011458 
> 000000bc  ............^...... ....X.......
> 00000380: 00000066 20000052 00000180 00011518 000000bc 0000006a 2000003e 
> 00000180  f...R.. ............j...>.. ....
> 000003a0: 000115d8 000000bc 0000006e 2000015e 00000180 00011698 000000bc 
> 00000075  ........n...^.. ............u...
> 000003c0: 200000e9 ffffffff 06101831 eaf614f1 000036fe 00000000 000000bc 
> 00000009  ... ....1........6..............
> 000003e0: 00030008 00000180 00011758 000000bc 00000075 200002e9 00000180 
> 00011818  ........X.......u...... ........
> 00000400: 000000bc 0000007f 200000ec 00000180 000118d8 000000bc 0000009c 
> 20000006  ........... ...................
> 00000420: 00000180 00011998 000000bc 000000c8 20000001 00000180 00011a58 
> 000000bc  ................... ....X.......
> 00000440: 000000e4 20000020 00000180 00011b18 000000bc 000000f8 20000168 
> 00000180  .... .. ................h.. ....
> 00000460: 00011bd8 000000bc 000000fc 2000000a 00000180 00011c98 000000bc 
> 00000109  ............... ................
> 00000480: 20000059 ffffffff 06101831 eb4413e4 000036ff 00000000 000000bc 
> 00000009  Y.. ....1.....D..6..............
> 000004a0: 00030008 00000180 00011d58 000000bc 00000113 20000086 00000180 
> 00011e18  ........X.............. ........
> 000004c0: 000000bc 0000011e 200000ca 00000180 00011ed8 000000bc 00000126 
> 200000a7  ........... ............&......
> 000004e0: 00000180 00011f98 000000bc 00000146 20000004 00000180 00012058 
> 000000bc  ............F...... ....X ......
> 00000500: 0000014e 2000018e 00000180 00012118 000000bc 00000150 2000018f 
> 00000180  N...... .....!......P...... ....
> 00000520: 000121d8 000000bc 00000155 2000012b 00000180 00012298 0000006c 
> 0000018f  .!......U...+.. ....."..l.......
> 00000540: 20000008 ffffffff 06101831 56d28478 00003700 00000000 00000058 
> 00000009  ... ....1...x..V.7......X.......
> 00000560: 00040003 00000180 00012308 000000bc 00000001 00000000 00000180 
> 000123c8  .........#...................#..
> 00000580: 000000bc 00000075 200002e9 00000180 00012488 000000bc 00000113 
> 20000086  ....u...... .....$.............
> 000005a0: 06101831 a62ad16f 00000000 00000000 0000001c 00000005 00000244 
> 00000000  1...o.*.................D.......
> 000005c0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 000005e0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 00000600: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 00000620: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 00000640: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 00000660: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 00000680: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 000006a0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 000006c0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 000006e0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 00000700: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 00000720: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 00000740: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 00000760: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 00000780: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 000007a0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 000007c0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 000007e0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 00000000  ................................
> 00000800: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 
> ffffffff  ................................
> 00000820: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 
> ffffffff  ................................
  ...
> 00000fc0: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 
> ffffffff  ................................
> 00000fe0: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 
> ffffffff  ................................
> UBIFS error (pid 1): ubifs_scan: LEB 1 scanning failed

These bytes should all be 0xff.  The number of bytes corrupted is always 
a multiple of 1024 (and aligned to 1024), therefore a multiple of QEMU's 
notion of the ARM page size.

Long story short, the corruption is due to QEMU's call 
nand_dev_read_file()->pmemcpy()->v2p() returning a bad pointer, from a 
stale TLB entry.  Backing out this Android-specific change to QEMU fixes it:

$ git-diff 413f05aaf54fa08c0ae7e997327a4f4a473c0a8d target-arm/helper.c
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 2ed46a2..b78f7d1 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
  ...
@@ -466,7 +475,7 @@ void helper_set_cp15(CPUState *env, uint32_t insn, 
uint32_t val)
              tlb_flush_page(env, val + 0x800);
              tlb_flush_page(env, val + 0xc00);
  #else
-            tlb_flush(env, 1);
+            //tlb_flush(env, 1);
  #endif
              break;
          default:

The UI does seem slower with the tlb_flush() restored, so perhaps the 
commenting-out was an optimization?

On the general subject of QEMU, any thoughts of rebasing Android to a 
newer version?  The QEMU Subversion repo now seems to have ARM v7 
support ...

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-kernel
-~----------~----~----~----~------~----~------~--~---

Reply via email to