2012년 6월 20일 수요일

When got os error no 38, function not implemented, on emulation environment

I had got an os error no 38, function not implemented, on emulation environment. This was about shared memory. For this, I made a simple test program.

[test.cpp]

#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

extern int errno;

int main()
{
    int fd;

    fd = shm_open("/Test/123456789", O_CREAT | O_CLOEXEC | O_RDWR, S_IRUSR | S_IWUSR);

    if (fd == -1)
        fprintf(stderr, "errno[%d] \n", errno);

    return 0;
}

$ gcc test.cpp -lrt
$ ./a.out
errno[38] // usually return 2, path problem

I first thought it is absurd because shm_open function is really basic function provided by glibc. Later, I got realized this was from emulation environment specifically mount problem.

There was '/dev/shm' linked to '/run/...' but actually '/run/...' path wasn't existed. So I mounted '/run' to virtual path on emulator like '/var/tmp/blahblah/run' and solved the problem. You can do like this 'sudo mount -o bind /run /var/tmp/blahblah/run'.

Hope this might help.

2012년 3월 4일 일요일

Setting some environment variables

We can avoid unnecessary conflict between two glib 2.0 (new one vs default) by setting env variables in bashrc.


export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

export LD_INCLUDE_PATH=/usr/local/include:$LD_INCLUDE_PATH

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

Using latest libsoup for WebKit EFL

WebKit EFL requires newer version of libsoup 2.4 than default in Ubuntu 11.10
Moreover, libsoup has strong dependency on glib 2.0 and more.
So I am writing here about my latest successful assembling.

2012년 1월 25일 수요일

2011년 12월 6일 화요일

How to use Android 4.0 ICS sdk manager on linux behind firewall

I am not 100% sure if there is other ways to use sdk manager on linux for ICS sdk manager.
My tips are:

pre-condition : suppose you have source code of ICS

1. Modify 'sdk/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SettingsController.java'
- In 'getForceHttp' method,
return true;
//return Boolean.parseBoolean(mProperties.getProperty(ISettingsPage.KEY_FORCE_HTTP));

2. 'sdk/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/UrlOpener.java'
- In 'openWithHttpClient' method
add 2 lines of import..

import org.apache.http.conn.params.ConnRoutePNames;
import org.apache.http.HttpHost;

and modify like below

// use the simple one
final DefaultHttpClient httpClient = new DefaultHttpClient();

// newly added
HttpHost proxy = new HttpHost("{proxy address}", {proxy port});
httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);

2011년 12월 5일 월요일

Get Android 4.0 ICS source code behind firewall

I've just pulled Android 4.0 ICS source code by using repo shell command behind firewall.
What I've done are:
1. In home directory
$ mkdir bin # create bin directory as Android recommends
$ vi .bashrc # add bin directory to PATH environment
2. Add below line to .bashrc file
export PATH=/home/{user_name}/bin:$PATH
3. Save and adapt changes
$ source .bashrc
4. Get repo shell
# install curl if you don't have it by using synaptic package installer or apt-get ...
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo
> ~/bin/repo --proxy {proxy_ip}:{proxy_port}
$ chmod a+x ~/bin/repo # add executable attribute to shell file
5. Create working directory and move into it
$ mkdir Android && cd Android
6. export http_proxy attribute
$ export http_proxy={proxy_ip}:{proxy_port}
7. Init repo branch
$ repo init -u https://android.googlesource.com/platform/manifest # for checking out other branches see android developer page
8. Finally you can get the source code
$ repo sync

Enjoy ICS!

2011년 11월 24일 목요일

Cherry-picking specific patch

Hmm.. this seems easier..
git diff commit_before..commit_iwant > path
patch -p1 < path

----
I needed to adapt specific WebKit open source patch while upversioning.
This was from side effect of one open source patch.
What I did are:

1. Get the commit ids of specific patch and just before of it.
For example, see the log by 'git log' then it might show like below..

commit f16c8bee1573c195750b68e4d500ab4982f0471a
Author: weinig@apple.com
Date: Wed Nov 2 02:24:50 2011 +0000
...
commit a1a74a31943577f1426a0fed52470cae064f3b31
Author: nduca@chromium.org
Date: Wed Nov 2 02:18:28 2011 +0000
...

Suppose my wanted commit is weinig's patch, but still I need commit id of (-1).
It can be nduca's patch id.

2. Save patch to the file system.
git format-patch -k --stdout a1a74a31943577f1426a0fed52470cae064f3b31..f16c8bee1573c195750b68e4d500ab4982f0471a > blahblah.patch

3. Adapt this patch to your local
Changes directory to your local git root and type.
git am -3 -k blahblah.patch

Then you can see the cherry-picked patch is on the top of the log list.
Enjoy git learning~