2012년 8월 1일 수요일

ODROID-X rooting & with GMS(11-14-2012) ICS


2012-11-14 이미지 입니다.
수정 사항

1. kernel
- kernel 3.0.51 merge
- PL2302(USB Serial driver) 추가
- TMU 지원
2. Global Actions에 Reboot item 추가
3. HDMI  UI 회전
4. Camera
- 5M pixel 촬영
- 720p 녹화
- AF 지원


2012-11-13 이미지 입니다.
1. PL2303 드라이버 built-in


https://www.dropbox.com/s/xrhzuaz7cqjjzz3/ODROID-X%281.6%29%20with%20GMS%28rooting%29.zip


2012-11-06 이미지 입니다.
1. Navigation Bar의 Shutdown시 reboot 추가




2012-10-24 이미지 입니다.

1. HDMI 화면 떨림 수정
2. Navigation Bar에 Volume Up/Down, Power Off, Screen Shot Button 추가
3. USB Mass Storage mount 안 된는 문제 수정.
4. ADK(Android Open accessory development Kit) 지원
5. 외장 USB GPS(ttyACM0, ttyUSB0) 지원
6. Settings -> Storage 버그 수정.
7. busybox 포함.

SD Card Image
https://www.dropbox.com/s/xrhzuaz7cqjjzz3/ODROID-X%281.6%29%20with%20GMS%28rooting%29.zip

eMMC Images
https://www.dropbox.com/sh/jplggdkpma6iac5/-QKlcw_qbP




2012-10-11 이미지 입니다.

https://www.dropbox.com/s/xrhzuaz7cqjjzz3/ODROID-X%281.6%29%20with%20GMS%28rooting%29.zip


kernel 3.0.42

http://odroid.foros-phpbb.com/t1159-kernel-v441-overclock-update-06-09-12-monitoring-app



2012/09/27 4x12 BSP

apk 포함
Terminal-v1.0.apk
ODROID-4.0-v1.9.apk
odroidInfo.apk
PowerOff.apk

enable static MAC Address.

kernel에 hdmi switch event 제거로 hdmi 연결 되어 있어도 volume 조절 가능 하도록 수정.

HDMI 동영상 aspect ratio 변경 가능

---------------------------------------------------------------------------------------------------------


1. Jelly Bean
2. Rooting
3. GMS installed
4. fat 파티션 줄임.

비디오 재생은 되나 화면과 정상적인 재생은 안됨
Wifi 없으면 Google 인증을 받을 수 없음

1.6GHz

https://www.dropbox.com/s/zj7hn7p52quvh2a/ODROID-X%281.6%29%20with%20GMS%28rooting%29%20JB.zip

1.8GHz

https://www.dropbox.com/s/r1lik3wgjlrrgxm/ODROID-X%281.8%29%20with%20GMS%28rooting%29%20JB.zip

ODROID-X Google Mobile Service를 포함하고 rooting이 되어 있는 복구 이미지 입니다.

여기에 rooting을 위한 파일이 있습니다.

http://www.unlockroot.com/

링크가 깨져 있어서 dropbox에 올렸습니다.

https://www.dropbox.com/s/7vxb7pfoq3453zm/unlockroot23.zip

Image Writer라는 open source project를 이용하여 ODROID-X 이미지를 SD Card에 write하면 됩니다.

https://launchpad.net/win32-image-writer/

복구 이미지 링크 입니다.

1.8GHz

https://www.dropbox.com/s/zjkyy9uktp5kcjj/ODROID-X%281.8%29%20with%20GMS%28rooting%29.zip

1.6 GHz

https://www.dropbox.com/s/xrhzuaz7cqjjzz3/ODROID-X%281.6%29%20with%20GMS%28rooting%29.zip

변경 사항

ttyACM0, ttyUSB0로 연결되는 외장 GPS 지원함

SD로 부팅 시 eMMC 인식 되지 않음

내부 저장 메모리 마운트 안 되는 문제 수정

Rooting

GMS 설치


About Kernel 4.2



There are some new stuff that must be defined on the config file. I've let my own config to compare and on odroidx_android_defconfig everything that changed is marked with 4.2 String. if you search the file for 4.2 you'll see the modifications on odroidx_android_defconfig.



Also, I've ommited on changelogs:



On my config you'll see an option to 1.8Ghz, one to 1.6Ghz and a Option to 533Mhz on Mali.







Here the current change list of the upcoming kernel version:





Improovments on s5p hdmi stuff

memcopy from glibc

string from glibc

scheduler performance: if the user sets it up it will power up all the 4 cores on switcching, if the user switchs off this he'll try to shutdown.

Added the CONFIG_MALI_GPU_OVERCLOCK_533MHZ to the config

Reduced the time that MALI takes to changed frequencies from 1sec to 100msec.

Merge error in cpupower driver

RCU: Joe's RCU

mm.h: increase readahead value from 128kb to 2048kb

sched: don't call task_group() many times in set_task_rq() - Improves performance, better if autogroup is enabled.

ARM: SMP: use a timing out completion for cpu hotplug - from Russel King

Little trick on slub.c to get some performance

Add dynamic writeback feature from 3.1

Added optimized ARM RWSEM algorithm.

lib/sha1: use the git implementation of SHA-1 (10 to 15% faster boot times)

Remove ARM sha1 routines (as the update above make's it obsolet)

Prevent aliased requests from starving other I/O

I/O-less dirty throttling, reduce filesystem writeback from page reclaim - backport from 3.2

writeback: Add a 'reason' to wb_writeback_work

fs/sync.c: add module_param to enable/disable fsync() calls. Its enabled by default. Let me explain this a little more.

- When you write something to disk either you just write and bye or you write and wait until the confirmation is made.

- By default I left this enable as its the default. If you disable it you'll get more performance but (HUGE WARNING).

- If you writed something to disk and you power off your board, you have a huge chance of data corruption. So, only turn this off if you can assure

- that you will turn off your board properly.



--- BELOW ARM PATCH's from Vicent Guittot!!! ---

ARM: 7011/1: Add ARM cpu topology definition

sched: Ensure cpu_power periodic update

ARM: topology: save cpu id of each core

ARM: topology: Update topology according to current sched_mc mode

ARM: 7182/1: ARM cpu topology: fix warning

ARM: topology: Add a cpu_power function

ARM: topology: Add a topology update notification

ARM: cpu topology: Add asym topology flag for using cpu0 1st

ARM: cpu topology: add debugfs

cpupower: update the cpu_power according to cpu load

sched: use cpu capacity to decide if a ILB is needed








2012-09-05 이미지 입니다.

What's new! (Changes against Alpha 3)

- EDID feature is removed and there are 2 ways of HDMI resolution setting for better monitor compatibility.   1) 1080p/720p selection with Jumper setting.   2) If you press down "USER" button(SW3) when you plug HDMI connector after booting, resolution will be 1080p regardless of Jumper setting.- Wrong SD/eMMC mounting issue is fixed.   1) If you boot from SD card, you can't access eMMC.   2) If you boot from eMMC, you can access SD card via /mnt/ext_sd- Bluetooth stereo headset issue is fixed- USB storage is mounted on /mnt/ext_usb automatically.- ODROID app is pre-installed. This app is useful for platform developement as well as system test. Special thanks to Alvaro.- DicePlayer app us pre-installed. This app is the greatest multimedia player which utilizes hardware acceleator.   If you want to know about it visit here :  https://play.google.com/store/apps/details?id=com.inisoft.mediaplayer.a&hl=en  There is a patch file for XBMC to work with this great app. Special thanks to INISOFT.



2012-08-28 이미지 입니다.

- mdrjr's Great Kernel v4.1 (3.0.41) merged

- CPU clock is set to 1.4Ghz (DVFS range is 200Mhz ~ 1400Mhz)

- GPU clock is changed to 440Mhz from 400Mhz

- eMMC clock is changed from 33Mhz to 50Mhz (U-boot & Kernel must be updated)

- SD clock is changed from 44Mhz to 50Mhz (U-boot & Kernel must be updated)

- HDMI overlay is implemented (Movie playback doesn't hide Android UI anymore)

- HDMI EDID feature returns with better compatibility (Software driven accurate I2C, 720p/1080p jumper setting is useless perhaps)

- HDMI flickering is almost gone even VDFS/CPU-Hotplug are enabled.

- USB mass storage is mountable on /mnt/ext_usb. (Supports FAT32/NTFS, But NTFS is read only)

- booted by eMMC,  SD Card Slot is External Storage, mounted /mnt/ext_sd. (Supports FAT32/NTFS, But NTFS is read only)

- Screen rotation lock is configurable in Settings. It makes better compatibility in HDMI display.

- Improved PMIC device driver

- Bluetooth stereo headset support (A2DP is implemented)

- Experimental MS Kinect driver (You can develop OpenCV/OpenGL/OpenNI stuff)

- uinput driver is built-in kernel image for various input method i.e. DroidMote.

- Rooting is default. (But, Preloaded GMS is not allowed legally by Google)

https://www.dropbox.com/s/n9cmddou12zd4x4/ODROID-X%20with%20GMS%28rooting%29.zip

2012년 7월 21일 토요일

ICS에서 mouse right click 시 back button 처럼 동작하기

Ginger Bread에서 USB Mouse에서 Right Click은 Back, Wheel은 Menu로 동작 하였습니다.

하지만 ICS부터는 모두 click으로 처리가 됩니다. Screen key(Navigation bar) 때문에 따로 mouse에 right가 Back button으로 동작하지 않아도 안드로이드를 사용할 수 있기 때문으로 판단됩니다.

그래도 Right Click이 Mouse Back Button 처럼 동작하는게 편합니다.
framework/base/services/input/InputReader.cpp를 아래와 같이 수정 하면 됩니다.

1077 void CursorButtonAccumulator::process(const RawEvent* rawEvent) {
1078     if (rawEvent->type == EV_KEY) {
1079         switch (rawEvent->scanCode) {
1080         case BTN_LEFT:
1081             mBtnLeft = rawEvent->value;
1082             break;
1083         case BTN_RIGHT:
1084             //codewalker
1085             //mBtnRight = rawEvent->value;
1086             mBtnBack = rawEvent->value;

2012년 7월 5일 목요일

android (Mass Storage)PC에 자동 마운트 하기

android에서 MTP가 아닌 Mass Storage 방식의 경우 USB 연결 시 자동으로 Mount하려고 합니다.

framework/base/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java

 95
 96     private void onUsbMassStorageConnectionChangedAsync(boolean connected) {
 97         mUmsAvailable = connected;
 98         /*
 99          * Even though we may have a UMS host connected, we the SD card
100          * may not be in a state for export.
101          */
102         String st = Environment.getExternalStorageState();
103
104         Slog.i(TAG, String.format("UMS connection changed to %s (media state %s)", connected, st));
105
106         if (connected && (st.equals(
107                 Environment.MEDIA_REMOVED) || st.equals(Environment.MEDIA_CHECKING))) {
108             /*
109              * No card or card being checked = don't display
110              */
111             connected = false;
112         }
113         updateUsbMassStorageNotification(connected);
114
115         mStorageManager.enableUsbMassStorage();
116     }

위와 같이 수정하면 USB 연결 시 자동으로 Mass Storage가 PC에 연결 됩니다.

2012년 6월 21일 목요일

부팅 후 동영상 재생 시키기


android에서 부팅 후 바로 동영상을 재생 시켜 보겠습니다.

BOOT_COMPLETED로 googling 하면 관련 내용을 많이 찾을 수 있습니다.
하지만 고생했던 이유가 Activity가 없이 처리하려고 하니 잘 되지 않았는데 찾았습니다.

아래 코드처럼 Activity가 없으면 receiver에 추가해 줘야 합니다.

<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
그렇지 않으면 application 자체가 등록되지 않아서 BOOT_COMPLETED를 받을 수 없습니다.


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.hardkernel.odroid"
    android:versionCode="1"
    android:versionName="1.0"
    android:installLocation="internalOnly">

    <uses-sdk android:minSdkVersion="10" />
    <uses-permission   android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >       
        <receiver
            android:name="com.hardkernel.odroid.BootReceiver" >
            <intent-filter>
            <action      android:name="android.intent.action.BOOT_COMPLETED"/>                       <action android:name="android.intent.action.WALLPAPER_CHANGED"/>                   <action android:name="android.intent.action.MAIN" />                  <category android:name="android.intent.category.LAUNCHER" />            </intent-filter>
        </receiver>
    </application>

</manifest>

그리고 매번 부팅하여 동작하는지 확인하기 힘들어서 아래 코드를 추가하여 배경화면을 바꿔도 동일하게 BootReceiver class의 onReceive()이 호출 되는 걸 확인 할 수 있습니다.
<action android:name="android.intent.action.WALLPAPER_CHANGED"/>

그리고 이제 동영상을 재생 시켜 보는 코드 입니다.

public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Intent tostart = new Intent(Intent.ACTION_VIEW);
File wonder_girls = new File("/sdcard/Wonder.mp4");
tostart.setDataAndType(Uri.fromFile(wonder_girls), "video/*");
tostart.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(tostart);
}
}

부팅 후 바로 Wonder.mp4란 동영상이 플레이 됩니다.
물론 배경화면을 바꿔도 동일하게 반응합니다.

2012년 5월 30일 수요일

LOCAL_MODULE_TAGS의 이해

Android.mk에 LOCAL_MODULE_TAGS가 보통 optional로 되어 있다.

LOCAL_MODULE_TAGS := eng user
LOCAL_MODULE_TAGS := eng optional
LOCAL_MODULE_TAGS := user optional
LOCAL_MODULE_TAGS := optional

이 정도의 조합이 가능 할 것이다.

그런데 optional 이 옵션은 어떻게 적용되는 것일까?

device.mk에 PRODUCT_PACKAGES에 영향을 받는다.
물론 build 폴더에 mk 파일들에도 PRODUCT_PACKAGES가 있고 거기에 영향을 받는다.

optional은 LOCAL_MODULE의 내용이 PRODUCT_PACKAGES에 포함되어 있으면 빌드를 하겠다는 의미이다.

LOCAL_MODULE_TAGS := eng optional 이 경우 eng면 반드시 빌드 하고 user면 PRODUCT_PACKAGES에 포함되어 있으면 빌드 한다는 뜻이다.

2012년 5월 15일 화요일

Ubuntu 12.04 on ODROID-PC

Linaro 12.04 Ubuntu를 ODROID-PC에 올려 보겠습니다.

마지막 버전이 12.05으로 X가 동작하지 않아서 12.04로 시도 했습니다.

http://releases.linaro.org/12.04/ubuntu/leb-origen/

아래 사이트에서 필요한 파일을 받습니다.

Download hwpack_linaro-leb-origen_20120426-45_armhf_supported.tar.gz and linaro-precise-ubuntu-desktop-20120426-119.tar.gz from the links below

이미지를 만들기 위해 linaro-media-create를 설치해야 합니다.

https://wiki.linaro.org/Platform/DevPlatform/Ubuntu/ImageInstallation


  $ sudo add-apt-repository ppa:linaro-maintainers/tools
  $ sudo apt-get update
  $ sudo apt-get install linaro-image-tools

  # t-flash를 넣고 sudo fdisk -l 을 통해 '/dev/sdX' node를 확인한다.
저의 환경은 /dev/sde입니다. 
  

Building a Custom Image 방법대로 f-flash에 복구합니다.


[~/projects/linaro_ubuntu]$ sudo linaro-media-create --mmc /dev/sde --dev origen --hwpack hwpack_linaro-leb-origen_20120327-1_armel_supported.tar.gz --binary linaro-o-ubuntu-desktop-tar-20120327-0.tar.gz
/usr/lib/pymodules/python2.6/argparse.py:1576: DeprecationWarning: The "version" argument to ArgumentParser is deprecated. Please use "add_argument(..., action='version', version="N", ...)" instead
  """instead""", DeprecationWarning)

I see...
Device           Mount point      Size
/dev/sda         none             610480MB
/dev/sda1        /                95366MB
/dev/sda2        none             515112MB
/dev/sda5        none             10869MB
/dev/sda6        /home            504243MB
/dev/sdb         none             476940MB
/dev/sdb1        none             476937MB
/dev/sdc         none             0MB
/dev/sdd         none             0MB
/dev/sde         none             7647MB
/dev/sde1        none             5827MB
/dev/sde2        none             515MB
/dev/sde3        none             1030MB
/dev/sde4        none             134MB
Are you 100% sure, on selecting [/dev/sde] (y/n)? y
...


복구가 끝나면 /dev/sde2를 mount하여 rootfs를 pc로 복사 시킵니다.

android uboot을 사용하지만 partition 확인하는 부분을 제거하여 fastboot가 가능합니다.

http://dev.odroid.com/projects/ics#s-6.3

아래 사이트에서 uboot 소스를 받으시고 아래와 같이 고칩니다.

http://com.odroid.com/sigong/nf_file_board/nfile_board_view.php?keyword=&tag=&bid=94


common/cmd_fastboot.c
...
  ptable[pcount].length = PART_SIZE_ROOTFS;
  ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MOVI_CMD;
  pcount++;
#if 0
  /* System */
  get_mmc_part_info(dev_num, 2, &start, &count, &pid);
  if (pid != 0x83)
...
  ptable[pcount].length = count * CFG_FASTBOOT_SDMMC_BLOCKSIZE;
  ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MMC_CMD;
  pcount++;
#endif

 #if 1 // Debug
  fastboot_flash_dump_ptn();



ODROID-PC는 LCD가 없고 HDMI만 있습니다.

따라서 HDMI 출력이 되도록 kernel에 작업해야 합니다.

Linaro에서 Origen 보드에 HDMI 출력이 가능하도록 작업을 하였습니다.

Origen의 kernel을 ODROID-PC의 H/W에 맞게 수정해 줘야 합니다.

tobetter님이 이 작업을 해주셨고 github에 올려 해 주셨습니다.

https://github.com/tobetter/hardkernel-linux


$ git clone git://github.com/tobetter/hardkernel-linux.git
Cloning into hardkernel-linux...


$make hardkernel_ubuntu_defconfig 

make -j6 후 만들어진 zImage를 fastboot를 이용하여 write합니다.

Linaro Ubuntu의 rootfs가 매우 크기 때문에 ODROID-PC의 partition table을 다시 만들어야 합니다.

[~/projects/linaro_ubuntu]$ sudo fdisk /dev/sde

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sde: 8018 MB, 8018460672 bytes
255 heads, 60 sectors/track, 1023 cylinders
Units = cylinders of 15300 * 512 = 7833600 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1             235        1014     5967000    c  W95 FAT32 (LBA)
/dev/sde2              10          78      527850   83  Linux
/dev/sde3              79         216     1055700   83  Linux
/dev/sde4             217         234      137700   83  Linux

Partition table entries are not in disk order

ODROID-A의 Partition입니다.


Command (m for help): d
Partition number (1-4): 1

Command (m for help): d
Partition number (1-4): 2

Command (m for help): d
Partition number (1-4): 3

Command (m for help): d
Selected partition 4

partition을 다 지웁니다.


Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1-1023, default 1): 11
Last cylinder, +cylinders or +size{K,M,G} (11-1023, default 1023): +4G

Command (m for help): p

Disk /dev/sde: 8018 MB, 8018460672 bytes
255 heads, 60 sectors/track, 1023 cylinders
Units = cylinders of 15300 * 512 = 7833600 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sde2              11         559     4199850   83  Linux

11번 cylinder부터 2번째 partition을 하나 만듭니다. 이 영역에 rootfs를 복사 할 것입니다.


Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1023, default 1): 560
Last cylinder, +cylinders or +size{K,M,G} (560-1023, default 1023): 
Using default value 1023

Command (m for help): p

Disk /dev/sde: 8018 MB, 8018460672 bytes
255 heads, 60 sectors/track, 1023 cylinders
Units = cylinders of 15300 * 512 = 7833600 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1             560        1023     3549600   83  Linux
/dev/sde2              11         559     4199850   83  Linux

그리고 vfat으로 만들 partition을 만듭니다.


Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): l

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris        
 1  FAT12           39  Plan 9          82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      3c  PartitionMagic  83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       40  Venix 80286     84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      41  PPC PReP Boot   85  Linux extended  c7  Syrinx         
 5  Extended        42  SFS             86  NTFS volume set da  Non-FS data    
 6  FAT16           4d  QNX4.x          87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS       4e  QNX4.x 2nd part 88  Linux plaintext de  Dell Utility   
 8  AIX             4f  QNX4.x 3rd part 8e  Linux LVM       df  BootIt         
 9  AIX bootable    50  OnTrack DM      93  Amoeba          e1  DOS access     
 a  OS/2 Boot Manag 51  OnTrack DM6 Aux 94  Amoeba BBT      e3  DOS R/O        
 b  W95 FAT32       52  CP/M            9f  BSD/OS          e4  SpeedStor      
 c  W95 FAT32 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi eb  BeOS fs        
 e  W95 FAT16 (LBA) 54  OnTrackDM6      a5  FreeBSD         ee  GPT            
 f  W95 Ext'd (LBA) 55  EZ-Drive        a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            56  Golden Bow      a7  NeXTSTEP        f0  Linux/PA-RISC b
11  Hidden FAT12    5c  Priam Edisk     a8  Darwin UFS      f1  SpeedStor      
12  Compaq diagnost 61  SpeedStor       a9  NetBSD          f4  SpeedStor      
14  Hidden FAT16 <3 63  GNU HURD or Sys ab  Darwin boot     f2  DOS secondary  
16  Hidden FAT16    64  Novell Netware  af  HFS / HFS+      fb  VMware VMFS    
17  Hidden HPFS/NTF 65  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE 
18  AST SmartSleep  70  DiskSecure Mult b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 75  PC/IX           bb  Boot Wizard hid fe  LANstep        
1c  Hidden W95 FAT3 80  Old Minix       be  Solaris boot    ff  BBT            
1e  Hidden W95 FAT1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))

vfat으로 변환합니다.


Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.

저장하고 나옵니다.


[~/projects/linaro_ubuntu]$ sudo mkfs.ext4 /dev/sde2
mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
262944 inodes, 1049962 blocks
52498 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1077936128
33 block groups
32768 blocks per group, 32768 fragments per group
7968 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[~/projects/linaro_ubuntu]$ sudo mkfs.vfat /dev/sde1
mkfs.vfat 3.0.7 (24 Dec 2009)
[~/projects/linaro_ubuntu]$ 

두 partition을 format합니다.


[~/projects/linaro_ubuntu]$ sudo mount /dev/sde2 /media/microSD/
[~/projects/linaro_ubuntu]$ sudo cp -a rootfs/* /media/microSD/

복사해 놓은 rootfs를 t-flash에 복사합니다.


uboot에서 bootargs와 bootcmd를 아래와 같이 수정 합니다.
EXYNOS4 # setenv bootcmd 'movi read kernel 0 40008000;bootm 40008000'
EXYNOS4 # setenv bootargs 'root=/dev/mmcblk0p2 rw rootfstype=ext4 init=/sbin/init console=ttySAC2,115200 rootdelay=1'
EXYNOS4 # sav

EXYNOS4 # pri
baudrate=115200
bootargs=root=/dev/mmcblk0p2 rw rootfstype=ext4 init=/sbin/init console=ttySAC21
bootcmd=movi read kernel 0 40008000;bootm 40008000
bootdelay=1
ethaddr=00:40:5c:26:0a:5b
gatewayip=192.168.0.1
ipaddr=192.168.0.20
netmask=255.255.255.0
serverip=192.168.0.10

Environment size: 309/16380 bytes
EXYNOS4 # boot










그리고 rootfs에 /etc/X11/xorg.conf를 아래와 같이 추가하여 주시면 됩니다.

Section "Device" 
Identifier "FBDEV" 
Driver  "fbdev" 
Option  "fbdev"  "/dev/fb1" 
EndSection 


Section "Screen" 
Identifier "HDMI Screen" 
Device  "FBDEV" DefaultDepth 16 
SubSection "Display" 
Virtual 1280 720
EndSubSection 
EndSection

추가로 SATA로 HDD에 rootfs를 넣어서 부팅해 보았습니다.

HDD의 첫번째 파티션을 ext4로 format하고 rootfs를 넣습니다.

github에 올라가 있는 커널에 SATA가 동작하도록 올렸습니다.


uboot에서 bootargs를 아래와 같이 /dev/sda1로 수정 합니다.


그리고 SATA Driver가 동작하기 위한 시간을 주기 위해 rootdelay=10 로 수정합니다.

setenv bootargs 'root=/dev/sda1 rw rootfstype=ext4 init=/sbin/init console=ttySAC1,115200 rootdelay=10'


2012년 4월 25일 수요일

ODROID-A에 Linaro Ubuntu 올리기...

ODROID-A에 Linaro Ubuntu를 올려보겠습니다.

http://www.linaro.org/downloads/1203

위 사이트에서 Ubuntu Origen을 선택합니다.

http://releases.linaro.org/12.03/ubuntu/leb-origen/


Building a Custom Image 방법대로 f-flash에 복구합니다.


[~/projects/linaro_ubuntu]$ sudo linaro-media-create --mmc /dev/sde --dev origen --hwpack hwpack_linaro-leb-origen_20120327-1_armel_supported.tar.gz --binary linaro-o-ubuntu-desktop-tar-20120327-0.tar.gz
/usr/lib/pymodules/python2.6/argparse.py:1576: DeprecationWarning: The "version" argument to ArgumentParser is deprecated. Please use "add_argument(..., action='version', version="N", ...)" instead
  """instead""", DeprecationWarning)

I see...
Device           Mount point      Size
/dev/sda         none             610480MB
/dev/sda1        /                95366MB
/dev/sda2        none             515112MB
/dev/sda5        none             10869MB
/dev/sda6        /home            504243MB
/dev/sdb         none             476940MB
/dev/sdb1        none             476937MB
/dev/sdc         none             0MB
/dev/sdd         none             0MB
/dev/sde         none             7647MB
/dev/sde1        none             5827MB
/dev/sde2        none             515MB
/dev/sde3        none             1030MB
/dev/sde4        none             134MB
Are you 100% sure, on selecting [/dev/sde] (y/n)? y
...

복구가 끝나면 /dev/sdx2를 mount하여 rootfs를 pc로 복사 시킵니다.

ODROID-A 복구한 t-flash를 준비하고 kernel을 수정하여 write해야 합니다.

ODROID-A 커널 폴더에서 make menuconfig합니다.
    Device Drivers  ---> 
        Character devices  --->      
            [*] Virtual terminal

CONFIG_VT를 체크합니다.

추가로 현재 ODROID-A에 CONFIG_HID가 빠져 있어서 USB Mouse와 keyboard를 사용하기 위해 같이 체크 해 주세요.

make -j6 후 만들어진 zImage를 fastboot를 이용하여 write합니다.

Linaro Ubuntu의 rootfs가 매우 크기 때문에 ODROID-A의 partition table을 다시 만들어야 합니다.

[~/projects/linaro_ubuntu]$ sudo fdisk /dev/sde

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sde: 8018 MB, 8018460672 bytes
255 heads, 60 sectors/track, 1023 cylinders
Units = cylinders of 15300 * 512 = 7833600 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1             235        1014     5967000    c  W95 FAT32 (LBA)
/dev/sde2              10          78      527850   83  Linux
/dev/sde3              79         216     1055700   83  Linux
/dev/sde4             217         234      137700   83  Linux

Partition table entries are not in disk order

ODROID-A의 Partition입니다.


Command (m for help): d
Partition number (1-4): 1

Command (m for help): d
Partition number (1-4): 2

Command (m for help): d
Partition number (1-4): 3

Command (m for help): d
Selected partition 4

partition을 다 지웁니다.


Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1-1023, default 1): 11
Last cylinder, +cylinders or +size{K,M,G} (11-1023, default 1023): +4G

Command (m for help): p

Disk /dev/sde: 8018 MB, 8018460672 bytes
255 heads, 60 sectors/track, 1023 cylinders
Units = cylinders of 15300 * 512 = 7833600 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sde2              11         559     4199850   83  Linux

11번 cylinder부터 2번째 partition을 하나 만듭니다. 이 영역에 rootfs를 복사 할 것입니다.


Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1023, default 1): 560
Last cylinder, +cylinders or +size{K,M,G} (560-1023, default 1023): 
Using default value 1023

Command (m for help): p

Disk /dev/sde: 8018 MB, 8018460672 bytes
255 heads, 60 sectors/track, 1023 cylinders
Units = cylinders of 15300 * 512 = 7833600 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1             560        1023     3549600   83  Linux
/dev/sde2              11         559     4199850   83  Linux

그리고 vfat으로 만들 partition을 만듭니다.


Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): l

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris        
 1  FAT12           39  Plan 9          82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      3c  PartitionMagic  83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       40  Venix 80286     84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      41  PPC PReP Boot   85  Linux extended  c7  Syrinx         
 5  Extended        42  SFS             86  NTFS volume set da  Non-FS data    
 6  FAT16           4d  QNX4.x          87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS       4e  QNX4.x 2nd part 88  Linux plaintext de  Dell Utility   
 8  AIX             4f  QNX4.x 3rd part 8e  Linux LVM       df  BootIt         
 9  AIX bootable    50  OnTrack DM      93  Amoeba          e1  DOS access     
 a  OS/2 Boot Manag 51  OnTrack DM6 Aux 94  Amoeba BBT      e3  DOS R/O        
 b  W95 FAT32       52  CP/M            9f  BSD/OS          e4  SpeedStor      
 c  W95 FAT32 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi eb  BeOS fs        
 e  W95 FAT16 (LBA) 54  OnTrackDM6      a5  FreeBSD         ee  GPT            
 f  W95 Ext'd (LBA) 55  EZ-Drive        a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            56  Golden Bow      a7  NeXTSTEP        f0  Linux/PA-RISC b
11  Hidden FAT12    5c  Priam Edisk     a8  Darwin UFS      f1  SpeedStor      
12  Compaq diagnost 61  SpeedStor       a9  NetBSD          f4  SpeedStor      
14  Hidden FAT16 <3 63  GNU HURD or Sys ab  Darwin boot     f2  DOS secondary  
16  Hidden FAT16    64  Novell Netware  af  HFS / HFS+      fb  VMware VMFS    
17  Hidden HPFS/NTF 65  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE 
18  AST SmartSleep  70  DiskSecure Mult b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 75  PC/IX           bb  Boot Wizard hid fe  LANstep        
1c  Hidden W95 FAT3 80  Old Minix       be  Solaris boot    ff  BBT            
1e  Hidden W95 FAT1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))

vfat으로 변환합니다.


Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.

저장하고 나옵니다.


[~/projects/linaro_ubuntu]$ sudo mkfs.ext4 /dev/sde2
mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
262944 inodes, 1049962 blocks
52498 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1077936128
33 block groups
32768 blocks per group, 32768 fragments per group
7968 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[~/projects/linaro_ubuntu]$ sudo mkfs.vfat /dev/sde1
mkfs.vfat 3.0.7 (24 Dec 2009)
[~/projects/linaro_ubuntu]$ 

두 partition을 format합니다.


[~/projects/linaro_ubuntu]$ sudo mount /dev/sde2 /media/microSD/
[~/projects/linaro_ubuntu]$ sudo cp -a rootfs/* /media/microSD/

복사해 놓은 rootfs를 t-flash에 복사합니다.


uboot에서 bootargs와 bootcmd를 아래와 같이 수정 합니다.
EXYNOS4 # setenv bootcmd 'movi read kernel 0 40008000;bootm 40008000'
EXYNOS4 # setenv bootargs 'root=/dev/mmcblk0p2 rw rootfstype=ext4 init=/sbin/init console=ttySAC2,115200 rootdelay=1'
EXYNOS4 # sav

EXYNOS4 # pri
baudrate=115200
bootargs=root=/dev/mmcblk0p2 rw rootfstype=ext4 init=/sbin/init console=ttySAC21
bootcmd=movi read kernel 0 40008000;bootm 40008000
bootdelay=1
ethaddr=00:40:5c:26:0a:5b
gatewayip=192.168.0.1
ipaddr=192.168.0.20
netmask=255.255.255.0
serverip=192.168.0.10

Environment size: 309/16380 bytes
EXYNOS4 # boot


오늘 Linaro 12.04가 release 되었네요.

동일한 방법으로 Ubuntu 12.04LTS 올렸습니다.

12.04에 HDMI가 가능하다고 하는데 kernel을 poriting 해야 합니다. 전 give up...



2012년 3월 27일 화요일

ODROID(ICS) screenshot 찍기

android Honeycomb부터 iOS 처럼 screenshot이 가능합니다.

Volume Down + Power Key 조합입니다.

하지만 ODROID는 Volume Up/Down키와 Power Key가 동시에 눌러지지 않는 형태입니다.



Screenshot으로 검색해 보면 PhoneWindowManager.java에 관련 코드가 찾아 집니다.

frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java


public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags, boolean isScreenOn) {
...


    switch (keyCode) {
            case KeyEvent.KEYCODE_VOLUME_DOWN:
            case KeyEvent.KEYCODE_VOLUME_UP:
            case KeyEvent.KEYCODE_VOLUME_MUTE: {
                if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
                    if (down) {
                        if (isScreenOn && !mVolumeDownKeyTriggered
                                && (event.getFlags() & KeyEvent.FLAG_FALLBACK) == 0) {
                            mVolumeDownKeyTriggered = true;
                            mVolumeDownKeyTime = event.getDownTime();
                            mVolumeDownKeyConsumedByScreenshotChord = false;
                            cancelPendingPowerKeyAction();
                            interceptScreenshotChord();
                        }
                    } else {

여기서 KEYCODE_VOLUME_DOWN -> KEYCODE_SEARCH으로 바꿉니다.



    switch (keyCode) {
            case KeyEvent.KEYCODE_SEARCH:
            case KeyEvent.KEYCODE_VOLUME_UP:
            case KeyEvent.KEYCODE_VOLUME_MUTE: {
                if (keyCode == KeyEvent.KEYCODE_SEARCH) {
                    if (down) {
                        if (isScreenOn && !mVolumeDownKeyTriggered
                                && (event.getFlags() & KeyEvent.FLAG_FALLBACK) == 0) {
                            mVolumeDownKeyTriggered = true;
                            mVolumeDownKeyTime = event.getDownTime();
                            mVolumeDownKeyConsumedByScreenshotChord = false;
                            cancelPendingPowerKeyAction();
                            interceptScreenshotChord();
                        }
                    } else {

그럼 Power Key와 Search Key를 동시에 1초 누르면 screenshot이 찍힙니다.





2012년 3월 26일 월요일

Android Build되지 않거나 killed될 때...


gingerbread까지는 android build시 종료되거나 build가 끝나지 않는 문제가 없었는데 ICS부터는 아래와 같이 killed되거나 끝나지 않는 문제가 발생합니다.

make: *** [out/target/common/obj/APPS/android.core.tests.libcore.package.com.no-core-tests-res_intermediates/noproguard.classes-with-local.dex] Killed

그래서 googling해보니 swap이 문제인것 같습니다.

Ubuntu 설치 시 partition을 자동으로 지정하면 swap이 1G로 잡히는 것 같습니다.
그런데 android build하기 위해서는 swap이 더 켜저야 하는 것 같습니다.

아래와 같이 하여 4G로 swap을 잡으니 문제가 없습니다. 참고하세요.


$sudo dd if=/dev/zero of=/boot/swapfile bs=1024 count=4194304

$sudo mkswap -v1 /boot/swapfile  

$sudo swapon /boot/swapfile 

$free
             total       used       free     shared    buffers     cached
Mem:       4041052    3717680     323372          0     724304    1923656
-/+ buffers/cache:    1069720    2971332
Swap:      4194296          0    4194296

4G swap을 확인

$sudo vi /etc/fstab

아래 줄 추가
/boot/swapfile swap swap defaults 1 1

2012년 3월 6일 화요일

android(ICS,JB)에서 Lock Screen 설정 None으로 만들기

JB에서부터는 아래 코드를 적용해서 default가 none으로 설정되지 않습니다.

def_lockscreen_disabled 값을 true로 주시면 코드 수정없이 됩니다.

overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml


<?xml version="1.0" encoding="utf-8"?>
<!--
/**
 * Copyright (c) 2009, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-->
<resources>
    <bool name="def_accelerometer_rotation">false</bool>
    <bool name="def_lockscreen_disabled">true</bool>
    <integer name="def_screen_off_timeout">604800000</integer>
    <bool name="def_install_non_market_apps">true</bool>
</resources>

---------------------------------------------------------------------------------------------------------


http://codewalkerster.blogspot.com/2011/11/android-lockscreen.html

gingerbread에서는 Screen lock을 PhoneWindowManager.java를 직접 수정하여 없앨 수 있었습니다.

ICS 부터는 아래와 같이 Screen lock - None이란 항목이 있습니다.



그런데 첫 부팅 후 default가 None으로 설정하려고 합니다.

framework/base/core/java/com/android/internal/widget/LockPatternUtils.java

    public boolean isLockScreenDisabled() {
        return !isSecure() && getLong(DISABLE_LOCKSCREEN_KEY, 1) != 0;
        //return !isSecure() && getLong(DISABLE_LOCKSCREEN_KEY, 0) != 0;
    }


    public int getKeyguardStoredPasswordQuality() {
        int quality =
                (int) getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
                //(int) getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
        // If the user has chosen to use weak biometric sensor, then return the backup locking
        // method and treat biometric as a special case.
        if (quality == DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK) {
            quality =
                (int) getLong(PASSWORD_TYPE_ALTERNATE_KEY,
                        DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
        }    
        return quality;
    }



2012년 2월 13일 월요일

android tablet ICS에서 Mass Storage UI가 나오지 않는 문제 해결

android tablet의 최초 OS는 Honeycomb이 였습니다.
Honeycomb은 MTP가 default입니다.
그래서 이전에 Mass Storage로 변경해도 USB Mass Storage connection Notification이 오지 않습니다.

그래서 Tablet인 경우 Mass Storage로 변경 시 PC와 연결하는 UMS를 사용할 수 없는 문제가 발생합니다.

원인을 찾아 보니 phone UI만 com.android.systemui.usb.StorageNotification에 대한 listener가 등록되어 있어서 tablet UI에서는 event를 받지 못하는 상황이 였습니다.

framework/base/packages/SystemUI/src/com/android/systemui/statusbar 폴더를 보시면
phone, tablet이란 폴더가 있습니다.

여기서 grep -nr mStorageManager를 검색하여 보시면 PhoneStatusBarPolicy class에서만 listener를 등록해 주도록 되어 있습니다.

tablet에서 적절한 위치에 mStorageManager.registerListener()를 추가해 주셔야 합니다.

아래 capture를 보시면 ui가 설렁합니다.
tablet UI에서 Mass Storage 연결에 대해 고민하지 않는 듯한 인상입니다.


2012년 2월 9일 목요일

android MTP <-> Mass Storage

android ICS부터 MTP를 지원합니다.
Gingerbread의 Mass Storage 방식으로 수정해 보겠습니다.


overlay/frameworks/base/core/res/xml/storage_list.xml 입니다.


<StorageList xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- removable is not set in nosdcard product -->
    <storage android:mountPoint="/mnt/sdcard"
        android:storageDescription="@string/storage_usb"
        android:primary="true"
        android:emulated="true"
        android:mtpReserve="100" />
</StorageList>

아래와 같이 바꿉니다.



<StorageList xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- removable is not set in nosdcard product -->
    <storage android:mountPoint="/mnt/sdcard"
        android:storageDescription="@string/storage_internal"
        android:primary="true"
        android:emulated="false"
        android:allowMassStorage="true" />
</StorageList>

init.[PRODUCT_NAME].rc

fuse 관련된 부분 삭제 합니다.


on post-fs-data
    # we will remap this as /mnt/sdcard with the sdcard fuse tool
    mkdir /data/media 0775 media_rw media_rw
    chown media_rw media_rw /data/media


on fs
    mount ext4 ...
    mount ext4 ...
    mount ext4 ...
    setprop ro.crypto.fuse_sdcard true

#/sdcard

    export EXTERNAL_STORAGE /mnt/sdcard
    mkdir /mnt/sdcard 0000 system system
    symlink /mnt/sdcard /sdcard



# create virtual SD card at /mnt/sdcard, based on the /data/media directory
# daemon will drop to user/group system/media_rw after initializing
# underlying files in /data/media will be created with user and group media_rw (1023)
service sdcard /system/bin/sdcard /data/media 1023 1023
    class late_start

init.[PRODUCT_NAME].usb.rc


on property:sys.usb.config=mtp
    write /sys/class/android_usb/android0/enable 0
    ...
    ...
    setprop sys.usb.state $sys.usb.config

on property:sys.usb.config=mtp,adb
    ...
    ...
    start adbd

mtp를 mass_storage로 바꿉니다.

그리고 vold.fstab을 만듭니다.


## Vold 2.0 Generic fstab
## - San Mehat (san@android.com)
##

#######################
## Regular device mount
##
## Format: dev_mount <label> <mount_point> <part> <sysfs_path1...>
## label        - Label for the volume
## mount_point  - Where the volume will be mounted
## part         - Partition # (1 based), or 'auto' for first usable partition.
## <sysfs_path> - List of sysfs paths to source devices, must start with '/' character
## flags        - (optional) Comma separated list of flags, must not contain '/' character
######################


dev_mount sdcard /mnt/sdcard auto [vfat mount 할 node] nonremovable,encryptable

그리고 BoardCongig.mk 또는 device.mk에 vold.fstab를 복사하는 문장 추가합니다.

PRODUCT_COPY_FILES += \
device/hardkernel/odroida4/vold.fstab:system/etc/vold.fstab \
        ...

persist.sys.usb.config=mtp를 mass_storage로 변경...


# Set default USB interface
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
    persist.sys.usb.config=mass_storage


이렇게 수정하면 ICS에서도 Gingerbread의 화면을 보실 수 있습니다.








http://source.android.com/devices/tech/storage/config-example.html

2012년 2월 5일 일요일

android와 MTP 그리고 Ubuntu

android Honeycomb부터 USB Mass Storage 방식에서 MTP(PTP)로 PC와 연결 방식이 바뀌었습니다.


android는 Froyo에서는 External Storage를 지원 하였습니다.
Nexus One의 경우 t-flash slot이 존재 합니다.



따라서 system partition은 /system와 /data /cache로 이루어져 있고 /mnt/sdcard란 폴더에 external storage를 mount하는 방식이 였습니다.

그래서 아래와 같이 sdcard를 android에서 umount후 PC로 mount하는 방식이였습니다.




Gingerbread(Nexus S)부터는 external storage를 지원하지 않고 iPhone 처럼 내부 nand에 system와 user data를 하나의 nand에 partition을 나누는 방식으로 바뀌었습니다.

/data partition이 고정 크기이고 작기 때문에 여러 문제점이 발생합니다.
/data를 크게 주면 한정된 nand에서 user data 영역이 줄어들기 때문에 제조사에서는 무조건 /data를 크게 잡지 못합니다.

Nexus One과 Motoroi의 경우 /data가 200Mbyte도 안되기 때문에 기본 설치된 app을 포함하면 사용자가 설치할 수 있는 공간의 더 작아 집니다.

그래서 app을 설치하고 /sdcard로 옮기기가 Gingerbread부터 지원하지만 보안 문제와 app 전체를 /sdcard로 설치하는 것이 아니라 일부 데이터만 /sdcard로 옮기기 때문에 이 역시 해결책이 아니였습니다.

그래서 Honeycomb부터 /sdcard를 /data 영역의 한 폴더로 지정하고 /data와 /sdcard를 통합하였습니다.

그런데 이렇게 하니 다른 문제가 발생합니다.

android는 linux 시스템이기 때문에 /data partition이 ext4란 linux에서 지원하는 file system을 사용합니다.

Window에서 지원하지 않는 file system이기 때문에 Window 사용자들은 볼 수가 없습니다.

그래서 MTP(PTP)를 통해 서로 다른 file system을 사용가능하도록 하것 입니다.

간단하게 설명 드리면 ftp나 samba를 이용하면 Window에서 linux의 file을 볼 수 있는 것과 같이 서로 다른 file system을 emulate하는 것이 MTP(PTP)입니다.

Apple은 iTune를 통해 위에 설명한 것과 같이 동작합니다.

여기서 android가 iPhone의 방식을 쫓아 간다고 볼 수 있겠죠.
Apple에서는 iTune를 통해 file sync를 하는지 알 수 있습니다.



그런데 MTP는 Microsoft에서 PTP를 이용하여 Window Media에서 사용하기 위해 만들 protocol입니다. 그래서 UbuntuMac에서 사용하기 위해서는 설정을 해줘아 합니다.

http://www.omgubuntu.co.uk/2011/12/how-to-connect-your-android-ice-cream-sandwich-phone-to-ubuntu-for-file-access/

위에 링크에 Ubuntu에서 MTP를 사용하는 방법이 설명되어 있습니다.

하지만 mtpfs에 버그가 있어서 저의 경우에도 두대의 Ubuntu(11.04와 10.04LTS)에서 완벽하게 동작하지 않습니다.

https://bugs.launchpad.net/ubuntu/+source/mtpfs/+bug/573524

그런데 PTP로 연결하지 문제가 없이 잘 됩니다.

Google에 Window Media를 계속 빌려 쓸지 iTune와 같이 sync Manager 프로그램을 만들지 궁금해집니다.



2012년 1월 16일 월요일

linux cp2104 driver

CP2104 USB to Serial를 사용하는데 ubuntu에서 minicom이 안되는 문제가 있다.

찾아 보니 CP210x driver에 baudrate 초기화 버그가 있는 듯...

http://www.spinics.net/lists/linux-usb/msg56969.html

그래서 driver patch를 적용하여 보겠습니다.

자신이 사용하는 kernel 버전을 확인한다.

커널 버전 확인
$uname -a
Linux codewalker-desktop 2.6.32-38-generic #83-Ubuntu SMP Wed Jan 4 11:12:07 UTC 2012 x86_64 GNU/Linux


synaptic에서 desktop kernel source를 받는다.

linux-source, linux-source-2.6.32

아래 path로 소스 파일이 받아 진다.

/usr/src/linux-source-2.6.32.tar.bz2

/usr/src/linux-source-2.6.32/drivers/usb/serial/cp210x.c 수정한다.

 diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 3835106..dcba930 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -201,6 +201,8 @@ static struct usb_serial_driver cp210x_device = {
 #define CP210X_EMBED_EVENTS 0x15
 #define CP210X_GET_EVENTSTATE 0x16
 #define CP210X_SET_CHARS 0x19
+#define CP210X_GET_BAUDRATE 0x1d
+#define CP210X_SET_BAUDRATE 0x1e
 
 /* CP210X_IFC_ENABLE */
 #define UART_ENABLE  0x0001
@@ -459,16 +461,12 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
  unsigned int *cflagp, unsigned int *baudp)
 {
  unsigned int cflag, modem_ctl[4];
- unsigned int baud;
+ u32 baud;
  unsigned int bits;
 
  dbg("%s - port %d", __func__, port->number);
 
- cp210x_get_config(port, CP210X_GET_BAUDDIV, &baud, 2);
- /* Convert to baudrate */
- if (baud)
-  baud = cp210x_quantise_baudrate((BAUD_RATE_GEN_FREQ + baud/2)/ baud);
-
+ cp210x_get_config(port, CP210X_GET_BAUDRATE, &baud, sizeof(baud));
  dbg("%s - baud rate = %d", __func__, baud);
  *baudp = baud;
 
@@ -580,7 +578,8 @@ static void cp210x_set_termios(struct tty_struct *tty,
   struct usb_serial_port *port, struct ktermios *old_termios)
 {
  unsigned int cflag, old_cflag;
- unsigned int baud = 0, bits;
+ u32 baud;
+ unsigned int bits;
  unsigned int modem_ctl[4];
 
  dbg("%s - port %d", __func__, port->number);
@@ -595,8 +594,8 @@ static void cp210x_set_termios(struct tty_struct *tty,
  /* If the baud rate is to be updated*/
  if (baud != tty_termios_baud_rate(old_termios) && baud != 0) {
   dbg("%s - Setting baud rate to %d baud", __func__, baud);
-  if (cp210x_set_config_single(port, CP210X_SET_BAUDDIV,
-     ((BAUD_RATE_GEN_FREQ + baud/2) / baud))) {
+  if (cp210x_set_config(port, CP210X_SET_BAUDRATE,
+       &baud, sizeof(baud))) {
    dbg("Baud rate requested not supported by device");
    baud = tty_termios_baud_rate(old_termios);
   }
-- 
 

$sudo make menuconfig


$sudo make -j10


kernel 빌드 시 에러가 발생 아래와 같이 수정.


ERROR-2
LD [M]  ubuntu/omnibook/omnibook.o
ld: /ubuntu/omnibook/sections.lds: No such file: No such file or directory
make[2]: *** [ubuntu/omnibook/omnibook.o] Error 1
make[1]: *** [ubuntu/omnibook] Error 2
make: *** [ubuntu] Error 2
SOLUTION-2
$ sudo vi /usr/src/linux/ubuntu/omnibook/Makefile
160: #EXTRA_LDFLAGS +=  $(src)/sections.lds
161: EXTRA_LDFLAGS += $(PWD)/ubuntu/omnibook/sections.lds


http://thangamaniarun.wordpress.com/2010/07/08/how-to-quickly-build-custom-kernel-on-ubuntu-10-04/




cp210x.ko module 만들기


$sudo make modules


$sudo make modules_install



[/lib/modules]$ ls -l
합계 20
drwxr-xr-x 4 root root 4096 2010-04-29 21:45 2.6.32-21-generic
drwxr-xr-x 5 root root 4096 2011-12-16 18:47 2.6.32-36-generic
drwxr-xr-x 5 root root 4096 2012-01-17 16:24 2.6.32-37-generic
drwxr-xr-x 5 root root 4096 2012-01-24 17:09 2.6.32-38-generic
drwxr-xr-x 3 root root 4096 2012-01-25 17:54 2.6.32.52+drm33.21



kernel 소스 Makefile에 EXTRAVERSION이 실제 설치된 kernel과 틀리다.


그래서 수동으로 cp210x.ko를 2.6.32-38-generic 폴더 밑에 파일로 바꿔주면 된다.


EXTRAVERSION이 다르지만 insmod나 hot-plugin시 문제 없이 module이 올라 간다.


혹시나 드라이버에 문제가 생기면 동일한 linux-image-generic를 synaptic에서 재설치해 주면 해결된다.


module의 EXTRAVERSION을 확인하기 위해서는 modinfo를 이용하면 된다.



alias:          usb:v0FCFp1004d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0FCFp1003d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BEDp1101d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BEDp1100d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v08FDp000Ad*dc*dsc*dp*ic*isc*ip*
alias:          usb:v08E6p5501d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0745p1000d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0489pE000d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0471p066Ad*dc*dsc*dp*ic*isc*ip*
alias:          usb:v045Bp0053d*dc*dsc*dp*ic*isc*ip*
depends:        usbserial
vermagic:       2.6.32.52+drm33.21 SMP mod_unload modversions 
parm:           debug:Enable verbose debugging messages (bool)
[/lib/modules/2.6.32-38-generic/kernel/drivers/usb/serial]$