Filesystems (yaffs2, jffs2 and nfs)

357 views
Skip to first unread message

Markus

unread,
Nov 6, 2008, 10:18:05 AM11/6/08
to android-porting
Hi,

as I wrote in Android Internals, we ported Android to an i.MX31.
Unfortunately, we have some issues with the file system.
If I use NFS as file system with a modified init.rc config, everything
seems to work well, but this is no option for us as permanent file
system, so we decided to use yaffs2 as file system. As this did not
work (Android was not able to boot), we changed to jffs2. jffs2 boots
fine as long as we use a read-only file system. After booting, we can
start many applications, but it seems that those requiring file write
operations fail to start, e.g. the webbrowser. If we change init.rc
config to give file-write permissions, Android is not able to boot
anymore.

So we have decided to use a mixture of yaffs2 and jffs2, after we saw
this idea at the armv4 port. The basic idea is, that all mmap
operations are done on yaffs2, as jffs2 does not support them. At the
moment, we split the file system to two parts: /data is located on our
yaffs2 partition, everything else on our jffs2 partition. The system
boots fine and we can run every application. But now, it is getting
confusing: As soon as Android has finished booting, it is impossible
to write/delete files in /data/app - if we do, we get a kernel panic,
which reports FileObserver to fail. This does not happen, if we do
file accesses before Android has finished its booting process.

Remembering that we had some cases, in which it was necessary to start
the system with strace running in the background (and discarding the
log), I booted the yaffs2/jffs2 system with strace in the background.
Now, I am able to access files in /data/app, I just get "syscall:
unknown syscall trap 0xe1a00000" reported to my debug console. In this
mode, it is also possible to run applications directly from Eclipse on
the target device.

So can anybody tell me what is going wrong, if I use a yaffs2 only
file system? And why does strace heal those problems with a yaffs2/
jffs2 system? It just makes the system slower...

bye
Markus

Gergely Kis

unread,
Nov 6, 2008, 11:22:09 AM11/6/08
to android...@googlegroups.com
Hi,

Could you give more information regarding "Android was not able to
boot on yaffs2". What were the actual error messages? Did the kernel
hang, or the init process?

Best Regards,
Gergely

Markus

unread,
Nov 6, 2008, 4:39:15 PM11/6/08
to android-porting
Hi,

it is the init process, that cannot start. The kernel is always
booting fine and only the Android init process is not able to do its
job. For yaffs2, the booting process stops like in
http://groups.google.com/group/android-porting/browse_thread/thread/d6892a27749bac21
- I'm sorry, that I can't post my own message at the moment, but I do
not have access to the hardware right now to flash everything...

Like in the link above, we get the same problem about the magic
number, while Android tries to load the core.jar file. After 4 tries,
Android resigns and reboots.

bye
Markus

On 6 Nov., 17:22, "Gergely Kis" <gergely....@gmail.com> wrote:
> Hi,
>
> Could you give more information regarding "Android was not able to
> boot onyaffs2". What were the actual error messages? Did the kernel
> hang, or the init process?
>
> Best Regards,
> Gergely
>
> On Thu, Nov 6, 2008 at 4:18 PM, Markus <v...@in.tum.de> wrote:
>
> > Hi,
>
> > as I wrote in Android Internals, we ported Android to an i.MX31.
> > Unfortunately, we have some issues with the file system.
> > If I use NFS as file system with a modified init.rc config, everything
> > seems to work well, but this is no option for us as permanent file
> > system, so we decided to useyaffs2as file system. As this did not
> > work (Android was not able to boot), we changed to jffs2. jffs2 boots
> > fine as long as we use a read-only file system. After booting, we can
> > start many applications, but it seems that those requiring file write
> > operations fail to start, e.g. the webbrowser. If we change init.rc
> > config to give file-write permissions, Android is not able to boot
> > anymore.
>
> > So we have decided to use a mixture ofyaffs2and jffs2, after we saw
> > this idea at the armv4 port. The basic idea is, that all mmap
> > operations are done onyaffs2, as jffs2 does not support them. At the
> > moment, we split the file system to two parts: /data is located on our
> >yaffs2partition, everything else on our jffs2 partition. The system
> > boots fine and we can run every application. But now, it is getting
> > confusing: As soon as Android has finished booting, it is impossible
> > to write/delete files in /data/app - if we do, we get a kernel panic,
> > which reports FileObserver to fail. This does not happen, if we do
> > file accesses before Android has finished its booting process.
>
> > Remembering that we had some cases, in which it was necessary to start
> > the system with strace running in the background (and discarding the
> > log), I booted theyaffs2/jffs2 system with strace in the background.

mvniekerk

unread,
Nov 9, 2008, 4:16:07 AM11/9/08
to android-porting
Your answer lies in UBIFS. There is a port for kernel 2.6.24 up to
2.6.27. UBIFS is JFFS3 if you like - and it does support mmap. If your
flash chip is of the NOR-type then YAFFS2 will not work - that is what
makes UBIFS so sweet!
To set up a UBI volume for UBIFS is bit of a schlep, but once done it
is a cool piece of equipment.

On Nov 6, 11:39 pm, Markus <v...@in.tum.de> wrote:
> Hi,
>
> it is the init process, that cannot start. The kernel is always
> booting fine and only the Android init process is not able to do its
> job. For yaffs2, the booting process stops like inhttp://groups.google.com/group/android-porting/browse_thread/thread/d...

Markus

unread,
Nov 10, 2008, 9:10:53 AM11/10/08
to android-porting
Hi,

yes, we might change to a different file system, but actually, Android
uses yaffs2 as main file system or at least it seems like this if you
hack into its configuration files. To be honest, we do not know, if
this problem is caused by the file system or something else as we are
able to do file operations in /data/app during the booting process.
The kernel panic occurs after Android finished the booting process. So
our guess is that Android starts something, that watches the file
system (especially /data/app) and that this service is causing our
problem. Unfortunately, we could not yet locate, which tool is
responsible... any guess, what is started in the end of the booting
process, that might cause our problem?

Below, a log of the kernel panic.

Bye
Markus

busybox cp ApiDemos.apk test
Unable to handle kernel paging request at virtual address 00100104
pgd = c70a4000
[00100104] *pgd=870a2031, *pte=857180dd, *ppte=8571880e
Internal error: Oops: 81f [#1] PREEMPT
Modules linked in:
CPU: 0 Not tainted (2.6.24-140-g68eb4b4 #77)
PC is at android_unlock_suspend+0x60/0x170
LR is at android_unlock_suspend+0x34/0x170
pc : [<c01ff8b4>] lr : [<c01ff888>] psr: 60000193
sp : c711bea8 ip : c039bac4 fp : c711bee4
r10: c711a000 r9 : 000001e0 r8 : 60000113
r7 : c7de20a0 r6 : c039babc r5 : c039babc r4 : c7de20e0
r3 : c7c35da8 r2 : 00100100 r1 : 00200200 r0 : c7de20e0
Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user
Control: 00e5387f Table: 870a4000 DAC: 00000015
Process FileObserver (pid: 1675, stack limit = 0xc711a260)
Stack: (0xc711bea8 to 0xc711c000)
bea0: c710401c c7cfac40 c711bed4 c711bec0 c00603cc
c006035c
bec0: c73dc3c0 00000000 c73dc3d0 c7de20a0 c73dc3c0 c711a000 c711befc
c711bee8
bee0: c00c4f90 c01ff860 c73dc3c0 46a2cba4 c711bf4c c711bf00 c00c57d0
c00c4f30
bf00: c003f92c 46a2cb84 c7cfac70 00000000 c7cfac40 c005b298 c711bf18
c711bf18
bf20: c02bfa58 c7043ea0 46a2cb84 c711bf78 00000200 c0025004 c711a000
41046fc0
bf40: c711bf74 c711bf50 c00961a4 c00c5634 c711bf74 c711bf60 c7043ea0
fffffff7
bf60: 00000000 00000000 c711bfa4 c711bf78 c00965ec c00960fc 00000000
00000000
bf80: 001ce0b0 00000001 00000f4c ad352cd8 001cf5b8 00000003 00000000
c711bfa8
bfa0: c0024e80 c00965b4 00000f4c ad352cd8 0000001e 46a2cb84 00000200
fd1fafed
bfc0: 00000f4c ad352cd8 001cf5b8 00000003 46a2cda0 41046fd4 41046fc0
00000001
bfe0: ad353458 46a2cb48 ad3414c9 afe0b50c 00000010 0000001e 00ff00ff
00ff00ff
Backtrace:
[<c01ff854>] (android_unlock_suspend+0x0/0x170) from [<c00c4f90>]
(remove_kevent+0x6c/0x94)
[<c00c4f24>] (remove_kevent+0x0/0x94) from [<c00c57d0>] (inotify_read
+0x1a8/0x1e4)
r4:46a2cba4
[<c00c5628>] (inotify_read+0x0/0x1e4) from [<c00961a4>] (vfs_read
+0xb4/0x144)
[<c00960f0>] (vfs_read+0x0/0x144) from [<c00965ec>] (sys_read
+0x44/0x70)
r7:00000000 r6:00000000 r5:fffffff7 r4:c7043ea0
[<c00965a8>] (sys_read+0x0/0x70) from [<c0024e80>] (ret_fast_syscall
+0x0/0x2c)
r7:00000003 r6:001cf5b8 r5:ad352cd8 r4:00000f4c
Code: e5965000 e5812000 e5843000 e59c3000 (e5821004)
Kernel panic - not syncing: Fatal exception

David Given

unread,
Nov 10, 2008, 9:27:30 AM11/10/08
to android...@googlegroups.com
Markus wrote:
[...]

> The basic idea is, that all mmap
> operations are done on yaffs2, as jffs2 does not support them.

How many things actually use writeable mmap'd areas? Would it be
particularly hard to change those things to use read() and write()
instead? jffs2 is a very useful file system, particularly on small
devices, as it stores data efficiently and with compression, which yaffs
doesn't; it would be nice to support it.

--
David Given
d...@cowlark.com

mvniekerk

unread,
Nov 11, 2008, 7:42:06 AM11/11/08
to android-porting
Well, I can help you with this much - jffs2 + Android = No Go. It will
run a few apps until the actual zygote stuff needs to run. mmap is the
thing that will screw you over - you only get mmap with read only
jffs2.
yaffs2 + NOR = No Go. It will fall over and flop.
UBIFS + NOR + Android = Works well actually. Got it running on our
iMX31 board with NOR. I'll post some instructions to get UBIFS working
if you need it. UBIFS = JFFS3. It has compression and a lot of other
cool stuff. It also scales well.

Sean McNeil

unread,
Nov 11, 2008, 7:56:14 AM11/11/08
to android...@googlegroups.com
mvniekerk wrote:
> Well, I can help you with this much - jffs2 + Android = No Go. It will
>

Not true. Android runs perfectly on the Openmoko Freerunner using JFFS2
for root and system. You need to qualify your statement as the only real
partition that needs mmap is the /data partition. What I did for that is
to split the sdcard into 2 partitions: fat for user data like music,
videos, etc, and ext3 for the /data partition.

Misael Lopez

unread,
Nov 11, 2008, 10:15:44 AM11/11/08
to android...@googlegroups.com
> What I did for that is
> to split the sdcard into 2 partitions: fat for user data like music,
> videos, etc, and ext3 for the /data partition.

Did you do something else apart from creating/formatting the
partitions? I tried the
same but Music application never accepted the card (even it the fat partition is
mounted manually/automatically), it complained about SD card not mounted.

Misa

2008/11/11 Sean McNeil <seanm...@gmail.com>:

mvniekerk

unread,
Nov 12, 2008, 2:49:50 AM11/12/08
to android-porting
Cool. I couldn't get Android and JFFS2 running. I know it is possible
to loop-mount ext3 on JFFS2 to bridge the mmap problem with the data
partition. UBIFS is an all-inclusive solution for me at the moment and
is quite simple and as oppose to ext3 knows how to handle flash with
all its gotchas. As far as I know it is JFFS2, YAFFS2 and UBIFS that
is tailored for flash devices.

Well, the options are legio it seems but do yourself a favour and look
into UBIFS. I'll be sitting in the corner and eat my humble pie...

Markus

unread,
Nov 12, 2008, 8:11:31 AM11/12/08
to android-porting
Hi,

we managed to get the kernel panic located. It is caused by
PackageManagerService.java, line 477. Just by commenting it
//mAppInstallObserver.startWatching();
Android is able to do Filechanges in /data/app without crashing our
system. We investigated deaper into this problem and got to the
inotify-driver in the kernel as a top candidate for our kernel panic.
Does anybody know, if this inotify-driver needs anything, that is not
supported in yaffs2?

We also reinvestigated to use a yaffs2 only file system. We have a
partition with /data, everything else is in a second partition. We
tried to mount this second partition read-only, giving all
permissions, but nothing helps. Android tries to start 4 times, and
dies with this log:

D/AndroidRuntime( 1690): >>>>>>>>>>>>>> AndroidRuntime START
<<<<<<<<<<<<<<
D/AndroidRuntime( 1690): CheckJNI is ON
D/AndroidRuntime( 1690): --- registering native functions ---
I/Zygote ( 1690): Preloading classes...
E/dalvikvm-gc( 1690): Could not create 176128-byte ashmem mark stack
I/DEBUG ( 1635): *** *** *** *** *** *** *** *** *** *** *** *** ***
*** *** ***
I/DEBUG ( 1635): Build fingerprint: 'generic/generic/generic/:1.0/
TC3/eng.mvill.20081029.135723:eng/test-keys'
I/DEBUG ( 1635): pid: 1690, tid: 1690 >>> zygote <<<
I/DEBUG ( 1635): signal 11 (SIGSEGV), fault addr fffffffc
I/DEBUG ( 1635): r0 00000000 r1 400117f8 r2 00000000 r3 fffffffc
I/DEBUG ( 1635): r4 ad07fa78 r5 400091e8 r6 00072430 r7 00059aa0
I/DEBUG ( 1635): r8 00000000 r9 00059a60 10 00072470 fp beec26d0
I/DEBUG ( 1635): ip 400091e8 sp beec26c0 lr ad07edf8 pc
ad0161b8 cpsr 00000010
I/DEBUG ( 1635): #00 pc ad0161b8 /system/lib/libdvm.so
I/DEBUG ( 1635): #01 pc ad01482c /system/lib/libdvm.so
I/DEBUG ( 1635): #02 pc ad0481ac /system/lib/libdvm.so
I/DEBUG ( 1635): #03 pc ad03bc00 /system/lib/libdvm.so
I/DEBUG ( 1635): #04 pc ad0434b8 /system/lib/libdvm.so
I/DEBUG ( 1635): #05 pc ad012748 /system/lib/libdvm.so
I/DEBUG ( 1635): #06 pc ad02a92c /system/lib/libdvm.so
I/DEBUG ( 1635): #07 pc ad0169d0 /system/lib/libdvm.so
I/DEBUG ( 1635): #08 pc ad051f40 /system/lib/libdvm.so
I/DEBUG ( 1635): #09 pc ad03f8aa /system/lib/libdvm.so
I/DEBUG ( 1635): #10 pc ad030b96 /system/lib/libdvm.so
I/DEBUG ( 1635): #11 pc ad326500 /system/lib/
libandroid_runtime.so
I/DEBUG ( 1635): #12 pc ad326f90 /system/lib/
libandroid_runtime.so
I/DEBUG ( 1635): #13 pc 00008bf2 /system/bin/app_process
I/DEBUG ( 1635): #14 pc afe1e042 /system/lib/libc.so
I/DEBUG ( 1635): #15 pc afe0b010 /system/lib/libc.so
I/DEBUG ( 1635): #16 pc b0000d70 /system/bin/linker
I/DEBUG ( 1635): stack:
I/DEBUG ( 1635): beec2680 afe35d78
I/DEBUG ( 1635): beec2684 00002040
I/DEBUG ( 1635): beec2688 00002bb4
I/DEBUG ( 1635): beec268c beec26d0 [stack]
I/DEBUG ( 1635): beec2690 ad07edf8
I/DEBUG ( 1635): beec2694 40009200
I/DEBUG ( 1635): beec2698 00059aa0 [heap]
I/DEBUG ( 1635): beec269c ad049839 /system/lib/libdvm.so
I/DEBUG ( 1635): beec26a0 beec26d0 [stack]
I/DEBUG ( 1635): beec26a4 ad049851 /system/lib/libdvm.so
I/DEBUG ( 1635): beec26a8 400091e8
I/DEBUG ( 1635): beec26ac ad07fa78
I/DEBUG ( 1635): beec26b0 400091e8
I/DEBUG ( 1635): beec26b4 00000320
I/DEBUG ( 1635): beec26b8 df002777
I/DEBUG ( 1635): beec26bc e3a070ad
I/DEBUG ( 1635): #00 beec26c0 00000320
I/DEBUG ( 1635): beec26c4 ad07edf8
I/DEBUG ( 1635): beec26c8 00000010
I/DEBUG ( 1635): beec26cc 00000320
I/DEBUG ( 1635): beec26d0 00072430 [heap]
I/DEBUG ( 1635): beec26d4 00072470 [heap]
I/DEBUG ( 1635): beec26d8 00000080
I/DEBUG ( 1635): beec26dc 7fffffff
I/DEBUG ( 1635): beec26e0 00000320
I/DEBUG ( 1635): beec26e4 00000000
I/DEBUG ( 1635): beec26e8 00000000
I/DEBUG ( 1635): beec26ec 400091e8
I/DEBUG ( 1635): beec26f0 00000000
I/DEBUG ( 1635): beec26f4 ad07edf8
I/DEBUG ( 1635): beec26f8 00000320
I/DEBUG ( 1635): beec26fc 00002710
I/DEBUG ( 1635): beec2700 00000001
I/DEBUG ( 1635): beec2704 ad014830 /system/lib/libdvm.so
I/DEBUG ( 1635): #01 beec2708 00000001
I/DEBUG ( 1635): beec270c afe0df4c /system/lib/libc.so
I/DEBUG ( 1635): beec2710 4108e230
I/DEBUG ( 1635): beec2714 00000001
I/DEBUG ( 1635): beec2718 ad07fd54
I/DEBUG ( 1635): beec271c 00000001
I/DEBUG ( 1635): beec2720 ad03bbf9 /system/lib/libdvm.so
I/DEBUG ( 1635): beec2724 4001f080
I/DEBUG ( 1635): beec2728 ad07edf8
I/DEBUG ( 1635): beec272c 000010f8
I/DEBUG ( 1635): beec2730 0000bb00 [heap]
I/DEBUG ( 1635): beec2734 4104af40
I/DEBUG ( 1635): beec2738 00000000
I/DEBUG ( 1635): beec273c ad0481af /system/lib/libdvm.so
init: critical process 'servicemanager' exited 4 times in 4 minutes;
rebooting into recovery mode

any idea, what might cause this problem?

bye
Markus

sungjun.lee

unread,
Nov 13, 2008, 1:07:27 AM11/13/08
to android-porting
> D/AndroidRuntime( 1690): --- registering native functions ---
> I/Zygote ( 1690): Preloading classes...
> E/dalvikvm-gc( 1690): Could not create 176128-byte ashmem mark stack

Hi, Markus

I had similar DEBUG messages, and i fix that problem with following.

1. Check /dev/ashmem device file's permission. (Change permission in
order to make runtime process accessible(rw). )
2. /init.rc script seems to remount / as read only. To deactivate read-
only remounting, just comment out the mount command line.

Hope it helps.

See this thread more detail
- http://www.mail-archive.com/linux...@vger.kernel.org/msg05631.html
> > Cool. I couldn't get Android andJFFS2running. I know it is possible
> > to loop-mount ext3 onJFFS2to bridge the mmap problem with the data
> > partition. UBIFS is an all-inclusive solution for me at the moment and
> > is quite simple and as oppose to ext3 knows how to handle flash with
> > all its gotchas. As far as I know it isJFFS2, YAFFS2 and UBIFS that
> > is tailored for flash devices.
>
> > Well, the options are legio it seems but do yourself a favour and look
> > into UBIFS. I'll be sitting in the corner and eat my humble pie...
>
> > On Nov 11, 2:56 pm, Sean McNeil <seanmcne...@gmail.com> wrote:
>
> > > mvniekerk wrote:
> > > > Well, I can help you with this much -jffs2+ Android = No Go. It will
> > > >> [<c01ff854>]- 따온 텍스트 숨기기 -
>
> - 따온 텍스트 보기 -...
>
> 추가 정보 >>

Markus

unread,
Nov 13, 2008, 6:46:13 AM11/13/08
to android-porting
Hi,

thank you for that advice, the error changed to

D/AndroidRuntime
( 1647):
D/AndroidRuntime( 1647): >>>>>>>>>>>>>> AndroidRuntime START
<<<<<<<<<<<<<<
D/AndroidRuntime( 1647): CheckJNI is
ON
W/dalvikvm( 1647): DexOpt: incorrect opt magic number (0xff ff ff
ff)
D/dalvikvm( 1647): Stale deps in cache file; removing and
retrying
D/dalvikvm( 1647): DexOpt: --- BEGIN 'core.jar' (bootstrap=1)
---
D/dalvikvm( 1654): Ignoring duplicate verify attempt on Ljava/lang/
Object;
init: untracked pid 1647
exited
init: untracked pid 1654 exited

What might cause this error? I changed the whole file system to rwx
permission for all users (so 777) just to see, if it is some rights
issue again. It did not help.

bye
Markus

On 13 Nov., 07:07, "sungjun.lee" <sungjun80....@gmail.com> wrote:
> > D/AndroidRuntime( 1690): --- registering native functions ---
> > I/Zygote ( 1690): Preloading classes...
> > E/dalvikvm-gc( 1690): Could not create 176128-byte ashmem mark stack
>
> Hi, Markus
>
> I had similar DEBUG messages, and i fix that problem with following.
>
> 1. Check /dev/ashmem device file's permission. (Change permission in
> order to make runtime process accessible(rw). )
> 2. /init.rc script seems to remount / as read only. To deactivate read-
> only remounting, just comment out the mount command line.
>
> Hope it helps.
>
> See this thread more detail
> - http://www.mail-archive.com/linux-o...@vger.kernel.org/msg05631.html
> ...
>
> Erfahren Sie mehr >>

sungjun.lee

unread,
Nov 13, 2008, 7:39:24 AM11/13/08
to android-porting

Your progress is very similar with me. :)
Clean "/data/cache" directory, and try again.

As I remember, it will fix the problem.

Bye
> > > > > >> Below, a log of the kernel panic.- 따온 텍스트 숨기기 -

sungjun.lee

unread,
Nov 13, 2008, 7:41:15 AM11/13/08
to android-porting
Oops!
Sorry, not "/data/cache", it is "/data/dalvik-cache".
> > > > > > >> this problem is caused by the file system or something else as we are- 따온 텍스트 숨기기 -

Markus

unread,
Nov 13, 2008, 8:38:31 AM11/13/08
to android-porting
Hi,

thank you, but unfortunately, this results in no real progress:
D/AndroidRuntime( 1678):
D/AndroidRuntime( 1678): >>>>>>>>>>>>>> AndroidRuntime START
<<<<<<<<<<<<<<
D/AndroidRuntime( 1678): CheckJNI is ON
D/dalvikvm( 1678): DexOpt: --- BEGIN 'core.jar' (bootstrap=1) ---
D/dalvikvm( 1687): Ignoring duplicate verify attempt on Ljava/lang/
Object;
D/dalvikvm( 1687): Ignoring duplicate verify attempt on Ljava/lang/
Class;
D/AndroidRuntime( 1694):
D/AndroidRuntime( 1694): >>>>>>>>>>>>>> AndroidRuntime START
<<<<<<<<<<<<<<
D/AndroidRuntime( 1694): CheckJNI is ON
W/dalvikvm( 1694): DexOpt: incorrect opt magic number (0xff ff ff ff)
D/dalvikvm( 1694): Stale deps in cache file; removing and retrying
D/dalvikvm( 1694): DexOpt: --- BEGIN 'core.jar' (bootstrap=1) ---
D/dalvikvm( 1703): Ignoring duplicate verify attempt on Ljava/lang/
Object;
D/dalvikvm( 1703): Ignoring duplicate verify attempt on Ljava/lang/
Class;
init: critical process 'servicemanager' exited 4 times in 4 minutes;
rebooting into recovery mode

Any idea, if there is something else to be changed?
bye
Markus
> ...
>
> Erfahren Sie mehr >>

Benno

unread,
Nov 17, 2008, 2:36:39 AM11/17/08
to android-porting
On Nov 11, 11:56 pm, Sean McNeil <seanmcne...@gmail.com> wrote:
> mvniekerk wrote:
> > Well, I can help you with this much - jffs2 + Android = No Go. It will
>
> Not true. Android runs perfectly on the Openmoko Freerunner using JFFS2
> for root and system. You need to qualify your statement as the only real
> partition that needs mmap is the /data partition. What I did for that is
> to split the sdcard into 2 partitions: fat for user data like music,
> videos, etc, and ext3 for the /data partition.

I concur. It also works fine on Neo1973. I took a different approach
of partioning the flash and using yaffs (not yaffs2) on the second
partition. This approach seems to work fine.

Cheers,

Benno

Wang Xiaoguang

unread,
Nov 17, 2008, 7:04:45 AM11/17/08
to android...@googlegroups.com
Yep, I think that's really a good idea to make rootfs as jffs2, because usually it's difficulty to make some operations on a yaffs2 partition.
 
I am using jffs2(rootfs) + yaffs2(data), too.

edwardlee lee

unread,
Nov 17, 2008, 8:17:46 AM11/17/08
to android...@googlegroups.com
Would you please provide detail steps that made jffs2 as rootfs?

Thanks!

Wang Xiaoguang

unread,
Nov 17, 2008, 10:02:10 PM11/17/08
to android...@googlegroups.com
I only modified /init, change a string '/system_prop...' to '/tmp/sy_prop....' , as most guides said. 
(Now I am wondering whether is necessory ... maybe there can be other better way.)

Then the kernel boot options is : mem=64M console=ttyS0,115200 root=/dev/mtdblock0 rw rootfstype=jffs2 init=/init

You don't need to use /init.rc to 'mount mtd@system ....'.

Then jffs2 should work.

Maxime Petazzoni

unread,
Nov 18, 2008, 6:00:46 PM11/18/08
to android-porting
I may have a similar problem here. I'm trying to run Android entirely
off the SD card (actually, microSD, on the Zoom). I made three
partitions :

- /dev/mmcblk0p1, vfat, 1G, to be mounted as /sdcard for media data
- /dev/mmcblk0p2, msdos, 10M, to host the uImage for U-Boot (i could
have put it on the first partition, but here it's hidden from the
user)
- /dev/mmcblk0p3, ext3, 1.99G, to be mounted as the entire Android
root filesystem

Using the following bootargs : 'console=ttyS2,115200n8 ip=none rw
rootwait root=/dev/mmcblk0p3 init=/init' and the following bootcmd :
'mmcinit;fatload mmc 0:2 0x81600000 uImage;bootm 0x81600000'. The
system boots and runs fine, but there's nothing mounted in /sdcard.

Did you ever got something similar ? How did you get the sdcard to be
mounted by Android when not using NFS root ? When booting from NFS
with the card already inserted, it works and /dev/block/mmcblk0p1 gets
mounted as /sdcard.

Thanks,
- Maxime

On Nov 11, 7:15 am, "Misael Lopez" <mesa...@gmail.com> wrote:
> > What I did for that is
> > to split the sdcard into 2 partitions: fat for user data like music,
> > videos, etc, and ext3 for the /data partition.
>
> Did you do something else apart from creating/formatting the
> partitions? I tried the
> same but Music application never accepted the card (even it the fat partition is
> mounted manually/automatically), it complained about SD card not mounted.
>
> Misa
>
> 2008/11/11 Sean McNeil <seanmcne...@gmail.com>:

Jay Freeman (saurik)

unread,
Nov 18, 2008, 6:52:01 PM11/18/08
to android...@googlegroups.com
In my experience, using any part of the SD card makes /sdcard not work.
Example: if, after the system has already booted up and /sdcard is mounted,
I mount a second partition off the SD card, everything is fine until I next
need /sdcard to mount. Specifically, if I plug in the USB cable it works, if
I ask the G1 to mount over USB that even works (and /sdcard is unmounted),
but when I unplug the USB cable nothing happens: I need to unmount my second
partition to get Android to understand that the card isn't in use anymore.
Maybe its doing something like checking the number of active usages of the
base card rather than the one partition it wants or something (or maybe its
something weird in mountd: I haven't even looked into how /sdcard works
yet). -J

--------------------------------------------------
From: "Maxime Petazzoni" <maxime.p...@gmail.com>
Sent: Tuesday, November 18, 2008 3:00 PM
To: "android-porting" <android...@googlegroups.com>
Subject: [android-porting] Re: Filesystems (yaffs2, jffs2 and nfs)

Mike Lockwood

unread,
Nov 18, 2008, 7:48:59 PM11/18/08
to android...@googlegroups.com
If you boot from the SD card, do you have the files /dev/block/mmcblk0
and /dev/block/mmcblk0p1? If those files are missing, then mountd
will not attempt to mount the SD card.

You might want to turn on:

#define ENABLE_LOG_MOUNT
#define ENABLE_LOG_SERVER

in system/core/mountd/mountd.h to enable some extra logcat diagnostics
in mountd so you can see what's going on.

Mike
--
Mike Lockwood
Google android team

Maxime Petazzoni

unread,
Nov 19, 2008, 5:22:27 PM11/19/08
to android-porting
Yes, I have all that. In fact, I can even mount the SD card myself
from the command line. Unfortunately though, Android needs a certain
event or system property to recognize that the sdcard is actually
mounted.

I'll look into that and see if we can get Android to recognize the
first SD card partition when booting off the SD Card.

- Maxime

On Nov 18, 4:48 pm, "Mike Lockwood" <lockw...@android.com> wrote:
> If you boot from the SD card, do you have the files /dev/block/mmcblk0
> and /dev/block/mmcblk0p1?  If those files are missing, then mountd
> will not attempt to mount the SD card.
>
> You might want to turn on:
>
> #define ENABLE_LOG_MOUNT
> #define ENABLE_LOG_SERVER
>
> in system/core/mountd/mountd.h to enable some extra logcat diagnostics
> in mountd so you can see what's going on.
>
> Mike
>
> On Tue, Nov 18, 2008 at 6:52 PM, Jay Freeman (saurik) <sau...@saurik.com> wrote:
>
>
>
> > In my experience, using any part of the SD card makes /sdcard not work.
> > Example: if, after the system has already booted up and /sdcard is mounted,
> > I mount a second partition off the SD card, everything is fine until I next
> > need /sdcard to mount. Specifically, if I plug in the USB cable it works, if
> > I ask the G1 to mount over USB that even works (and /sdcard is unmounted),
> > but when I unplug the USB cable nothing happens: I need to unmount my second
> > partition to get Android to understand that the card isn't in use anymore.
> > Maybe its doing something like checking the number of active usages of the
> > base card rather than the one partition it wants or something (or maybe its
> > something weird in mountd: I haven't even looked into how /sdcard works
> > yet). -J
>
> > --------------------------------------------------
> > From: "Maxime Petazzoni" <maxime.petazz...@gmail.com>
> ...
>
> read more »

Jay Freeman (saurik)

unread,
Nov 19, 2008, 5:48:39 PM11/19/08
to android...@googlegroups.com
Ok, I've got it!!! I had to change "mmcblk0" to "mmcblk0p1" in
/etc/mountd.conf. This will probably fix Maxime's problem as well.

I have uploaded this change to Gerrit at:
http://review.source.android.com/r/7507ee976e1c

For the record, in case this clarifies things, here is complete order of
events I was experiencing before I made that change:

1) boot device
2) notice that /sdcard mounted fine
3) plug in USB cable
4) select "mount" from USB notification
5) notice that /sdcard correctly unmounted
6) unplug USB cable
7) /sdcard is immediately remounted
8) repeat steps 3-7 a few times to verify sanity

Ok, so far, so good. This is what I expect from an un-messed with device.

9) plug in USB cable
10) mount /dev/block/mmcblk0p2 to /mnt (we now have:)
/dev/block/mmcblk0p1 /sdcard vfat rw,dirsync,... 0 0
/dev/block/mmcblk0p2 /mnt ext2 rw,errors=continue 0 0
11) select "mount" from USB notification
12) notice that /sdcard correctly unmounted
13) unplug USB cable
14) wait and wait and wait... no /sdcard

This is not what I expected, and maid me frowny pants. :(

15) plug in USB cable (for adb shell)
16) unmount /mnt
17) unplug USB cable
18) still no /sdcard

It was this part I wasn't expecting even going into this e-mail, which made
me think that maybe I should go seriously scan over the mountd configuration
to make certain it wasn't broken (and it was). Yay!

Sincerely,
Jay Freeman (saurik)
sau...@saurik.com
http://www.saurik.com/

--------------------------------------------------
From: "Mike Lockwood" <lock...@android.com>
Sent: Tuesday, November 18, 2008 4:48 PM
To: <android...@googlegroups.com>

Mike Lockwood

unread,
Nov 19, 2008, 6:18:49 PM11/19/08
to android...@googlegroups.com
Changing mountd.conf to mount mmcblk0p1 is a fine workaround for your
problem, but won't work as a general solution. In particular, it will
not work with SD cards that have a FAT file system starting at the
first sector (with no partition map at all).

I think the real problem is somewhere in mountd. Could you enable
mountd logging by turning on ENABLE_LOG_MOUNT and ENABLE_LOG_SERVER in
mountd.h and send me a logcat? Send me a dmesg too. Then I might be
able to figure out a better solution.

thanks,
Mike

Jay Freeman (saurik)

unread,
Nov 19, 2008, 7:26:17 PM11/19/08
to android...@googlegroups.com
Ok, thanks for the information on how to debug this. ;P Here's what's going
on:

Normally we get this when the USB cable is unplugged:

D/mountd ( 30): RequestMount /sdcard
D/mountd ( 30): mounting /dev/block/mmcblk0 at /sdcard
D/mountd ( 30): mount returned -1 errno: 22
D/mountd ( 30): mount failed, errno: 22
D/mountd ( 30): mounting /dev/block/mmcblk0p1 at /sdcard
D/mountd ( 30): mount returned 0 errno: 0
D/mountd ( 30): Write: media_mounted:/sdcard

If we remove have mmcblk0p2 mounted, we get only this:

D/mountd ( 30): RequestMount /sdcard
D/mountd ( 30): mounting /dev/block/mmcblk0 at /sdcard
D/mountd ( 30): mount returned -1 errno: 16

For those of us who don't have these error numbers memorized, which for the
sake of all that is right in the world I hope is all of us ;P:

#define EBUSY 16 /* Device or resource busy */
#define EINVAL 22 /* Invalid argument */

The code that is handling these error messages is here, in AutoMount.c:

255 if (result == 0) {
256 NotifyMediaState(mountPoint, MEDIA_MOUNTED, (flags &
MS_RDONLY) != 0);
257 } else if (errno == EBUSY) {
258 // ignore EBUSY, since it usually means the device is already
mounted
259 result = 0;
260 } else {
261 #if CREATE_MOUNT_POINTS
262 rmdir(mountPoint);
263 #endif
264 LOG_MOUNT("mount failed, errno: %d\n", errno);
265 }

Removing lines 257-259 does, in fact, fix the problem. When mmcblk0 is
specified instead of mmcblk0p1, this function needs to fail for it to bother
scanning partitions of the main device. Frankly, I disagree with mountd's
assumption that EBUSY there should mean "already mounted" (especially with
this counter example), and even if it were true I still believe it to be a
mistake: if I have mountd managing this mount, I would prefer it to either
know or not whether it is mounted and if I do so manually it should be an
error.

With this change I now get:

D/mountd ( 32): RequestMount /sdcard
D/mountd ( 32): mounting /dev/block/mmcblk0 at /sdcard
D/mountd ( 32): mount returned -1 errno: 16
D/mountd ( 32): mount failed, errno: 16
D/mountd ( 32): mounting /dev/block/mmcblk0p1 at /sdcard
D/mountd ( 32): mount returned 0 errno: 16
D/mountd ( 32): Write: media_mounted:/sdcard

Which seems perfectly reasonable to me and makes everything work correctly,
including the "someone formatted an SD card without a partition map" case
(which I didn't realize would ever come up: sorry about that).

I have submitted this as this new patch:
http://review.source.android.com/r/1964942af0f1

Sincerely,
Jay Freeman (saurik)
sau...@saurik.com
http://www.saurik.com/

--------------------------------------------------
From: "Mike Lockwood" <lock...@android.com>
Sent: Wednesday, November 19, 2008 3:18 PM

Sean McNeil

unread,
Nov 20, 2008, 12:44:40 AM11/20/08
to android...@googlegroups.com
This is a well-known problem with splitting the sdcard up. You need to
do the following for system/core:

diff --git a/mountd/AutoMount.c b/mountd/AutoMount.c
index bfe8ad1..09e9759 100644
--- a/mountd/AutoMount.c
+++ b/mountd/AutoMount.c
@@ -254,9 +254,6 @@ static int DoMountDevice(const char* device, const
char* mou

if (result == 0) {
NotifyMediaState(mountPoint, MEDIA_MOUNTED, (flags & MS_RDONLY)
!= 0);
- } else if (errno == EBUSY) {
- // ignore EBUSY, since it usually means the device is already mounted
- result = 0;
} else {
#if CREATE_MOUNT_POINTS
rmdir(mountPoint);

Sean McNeil

unread,
Nov 20, 2008, 12:49:18 AM11/20/08
to android...@googlegroups.com
The problem is that mountd treats EBUSY as a no error condition. When
you have mmcblk0p2 mounted and you try to mount mmcblk0, then you get an
EBUSY which it then thinks it successfully finished. It prevents the
logic to check partitions from kicking in and nothing gets mounted.

Jay Freeman (saurik)

unread,
Nov 20, 2008, 12:49:39 AM11/20/08
to android...@googlegroups.com
Thanks. That is exactly the patch that I submitted and linked to, and is
what I meant by "Removing lines 257-259". If this is a well known problem,
btw, why wasn't it already fixed? ;P -J

--------------------------------------------------
From: "Sean McNeil" <seanm...@gmail.com>
Sent: Wednesday, November 19, 2008 9:44 PM


To: <android...@googlegroups.com>
Subject: [android-porting] Re: Filesystems (yaffs2, jffs2 and nfs)

> This is a well-known problem with splitting the sdcard up. You need to


> do the following for system/core:

...

Sean McNeil

unread,
Nov 20, 2008, 1:54:23 AM11/20/08
to android...@googlegroups.com
Android has a very tough review process which requires changes to be
broken down and explained in better terms than my original set of
patches (which included this). I have been busy on other things and
haven't had the opportunity to break down or explain in more detail my
changes. So it is well-known by a few, but not adequately explained to
Google to get them to accept the change. I hope to have time to go
through these changes and make the adjustments asked of me to get them
accepted, but honestly at this time I'm not sure when that will be.

Jay Freeman (saurik)

unread,
Nov 20, 2008, 2:16:31 AM11/20/08
to android...@googlegroups.com
Thanks very much, btw, for referring me to your changeset. ;P It would have
been quite useful had I known about that before spending hours on this
problem. (That's awesome work the Freerunner, btw!)

I'm looking through it now to see if there's anything else that would be
helpful in the work that I'm doing, and will keep it in mind if I run into
any problems. In case anyone else is interested in doing the same, I managed
to root up the URL for it in Gerrit:

http://review.source.android.com/1684

(As for the Android review process: I know, it can be rough. I've gotten a
few changes accepted and am currently in the review process with a few more.
I try to keep all of my changes in complete isolation of each other, and
document each one. Example: when I submitted this one, not knowing you
already had in your mega-patch, I attached a couple paragraphs to the commit
log in addition to linking to this e-mail thread.)

-J

--------------------------------------------------
From: "Sean McNeil" <seanm...@gmail.com>

Sent: Wednesday, November 19, 2008 10:54 PM

Mike Lockwood

unread,
Nov 20, 2008, 9:50:39 AM11/20/08
to android...@googlegroups.com
Hi Jay,

Thanks for the patch! I just approved the change.

Mike

Maxime Petazzoni

unread,
Nov 22, 2008, 8:21:09 AM11/22/08
to android-porting
Thanks, that made it work great. Now we have a somewhat more "mobile"
demonstration (although to Ethernet still needs no network when no
WiFi is available ;p)

- Maxime
> > From: "Mike Lockwood" <lockw...@android.com>
> >>> From: "Mike Lockwood" <lockw...@android.com>
> >>>>> From: "Maxime Petazzoni" <maxime.petazz...@gmail.com>
> ...
>
> plus de détails »
Reply all
Reply to author
Forward
0 new messages