안녕하세요,

 

Android에서의 /system partition을 read-write로 mount하려고 하는데 잘 안되어서 이렇게 질문을 드립니다.

일단 사용하는 platform은 emulator이고요.

아래와 같이 해보았습니다.

 Process p = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(p.getOutputStream());

os.writeBytes("mount -o rw remount /dev/block/mtdblock0 /system\n");
os.writeBytes("exit\n");
os.flush();


그리고는 # adb shell을 이용해서 emulator로 login을 해 보았는데, emulator에서 mount 명령을 실행해 보면 여전히 /system partion이 read-only로 mount된 것으로 보이네요.

무엇이 잘못된 것인지 조언 주시면 감사하겠습니다.

 

이번에는 조금 다른 질문인데요, 이미 read-write로 mount되어 있는 /data partition에 file을 생성하려고 시도해보았습니다.

아래와 같이 해보았는데요.

 Process p = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(p.getOutputStream());

os.writeBytes("touch /data/zzz\n");
os.writeBytes("exit\n");
os.flush();


이번에도 # adb shell을 이용해서 emulator로 login을 해보았는데, /data 아래에 zzz라는 file이 생성이 되질 않아서요.

위와 같이 하면 file을 생성할 수 없는것인지,,질문 드립니다.

조언 주시면 감사하겠습니다.

 

그리고 아래에는 제가 사용하는 source code전체를 올립니다.

그럼,,조언 미리 감사드립니다. ~

 // *****
package com.example.helloubuntu;

import java.io.DataOutputStream;
import java.io.IOException;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloUbuntuActivity extends Activity {
   /** Called when the activity is first created. */

   private Boolean TryRootAccess()
   { 
      Boolean bReturn = false;

      try 
      {
         Process p = Runtime.getRuntime().exec("su");
         DataOutputStream os = new DataOutputStream(p.getOutputStream());

         os.writeBytes("mount -o rw remount /dev/block/mtdblock0 /system\n");
         os.writeBytes("touch /system/bin/zzz\n");
         os.writeBytes("/system/bin/touch /data/zzz\n");
         os.writeBytes("exit\n");
         os.flush();
      }
      catch(IOException e)
      {

      }
      return bReturn;
   }

   @Override
   public void onCreate(Bundle savedInstanceState) 
   {
      Boolean bRootAccess = TryRootAccess();

      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      TextView tv = new TextView(this);
      tv.setText("Hello, Android Developer \n Thank you, for using Ubuntu Linux");
      setContentView(tv);        
   }
}