who creates /dev/ashmem?

877 views
Skip to first unread message

yajin

unread,
Oct 12, 2009, 6:07:34 AM10/12/09
to android-porting
Hi all,

Now I am working on adding goldfish target support to MIPS target so
that the MIPS users can have a SDK to play with.

The kernel part works well until entering the userland. The init hangs
when calling ashmem_create_region. In function ashmem_create_region,
it will open /dev/ashmem and it return -1 and the errno is 19 which
means no such devices. I do not find where this device(/dev/ashmem) is
created? Can anyone tell me the code path of creating device /dev/
ashmem? Thanks very much.

int ashmem_create_region(const char *name, size_t size)
{
......
fd = open(ASHMEM_DEVICE, O_RDWR);
if (fd < 0)
return fd;

......
}


yajin
http://vm-kernel.org/blog

mizmit1222

unread,
Oct 12, 2009, 9:37:58 PM10/12/09
to android-porting
Hi,

MIPS SDK sounds very interesting project to me. Great job you are
working on.

ashmem is one of Android specific drivers. There's an android.txt
in Documentation directory.

Other than ashmen, some drivers should be ported like; binder,
lowmemorykiller, logger, yaffs2 and pmem.

Vanilla kernel 2.6.28 - 2.6.30 has staging/android drivers, but as
far as I know they are incomplete. It would be better to get codes
from http://android.git.kernel.org and checkout android-goldfish
branch.

Cheers,

Dennis.Yxun

unread,
Oct 12, 2009, 10:36:09 PM10/12/09
to android...@googlegroups.com
HI yajin:
   Glad to see that you are play with MIPS ;-)
   I spend a few times looking into the code, and find it will creat all the device nodes during
execution of init.
   system/core/init/ -> file devices.c -> handle_device_event ->make_device

Dennis

Dennis.Yxun

unread,
Oct 12, 2009, 10:38:13 PM10/12/09
to android...@googlegroups.com
Hi yajin:
   For the open fail err, it probably you didn't build in ashmem kernel driver
please check your kernel configuration.
   Hope helps.

Dennis

On Mon, Oct 12, 2009 at 6:07 PM, yajin <yaji...@vm-kernel.org> wrote:

hu zhangli

unread,
Oct 12, 2009, 10:47:25 PM10/12/09
to android...@googlegroups.com
have you run android on MIPS platform?

so great

yajin

unread,
Oct 13, 2009, 4:36:46 AM10/13/09
to android...@googlegroups.com
Hi Dennis,

Thanks for your instructions.
In fact, I have included the ashmem module in the kernel
configuration. I use the remote gdb to debug the kernel and find that
the ashmem_init is called. I find that ashmem is registered as a misc
device using misc_deregister(&ashmem_misc);

With your help, I find the code patch in init is:
device_init->
coldboot->
do_coldboot->
handle_device_fd->handle_device_event->handle_device_event ->make_device.

Then I use remote gdb to debug the init. However, the make_device
function are not called at all.

Any more suggestions?

yajin

http://vm-kernel.org

yajin

unread,
Oct 13, 2009, 5:02:53 AM10/13/09
to android...@googlegroups.com
Hi all,

I use the remote gdb to debug the ARM version init in emulator. When
calling coldboot(fd, "/sys/devices") it will call make_device to make
the devices. Following is the screenshot in remote gdb. But in MIPS
version of init, coldboot(fd, "/sys/devices") does NOT call
make_devides to create the devices. I will dig into this issue and
find the bugs behind......

(gdb) c
Continuing.

Breakpoint 3, make_device (path=0xbee5a754 "/dev/log/main", block=0, major=10,
minor=60) at system/core/init/devices.c:272
272 {
(gdb)


yajin

http://vm-kernel.org

Dennis.Yxun

unread,
Oct 13, 2009, 5:19:48 AM10/13/09
to android...@googlegroups.com
HI yajin:
   Not sure what's wrong since I haven't spent much time looking into this issue.
   I'm developing under real MIPS hardware platform, and it create ashmem device node
successuflly.
   The code base I'm using currently can be found at mips's webside[1],
and kernel branch is android-2.6.27 [2]
   Hope helps, and also keep me informed
   Thanks.

Dennis

[1] http://www.mipsandroid.org
[2] git://public.mipsandroid.com/kernel/common.git

yajin

unread,
Oct 15, 2009, 1:29:04 AM10/15/09
to android...@googlegroups.com
Hi all,

Finally I have find the reasons of this issue. Shortly it is because of the bug of msub instruction emulation in qemu, which causes the uevent passage passed from kernel to udev is not correct. As a result the /dev/ashmem is not created.

The long version is here.

yajin

http://vm-kernel.org
Reply all
Reply to author
Forward
0 new messages