Android-x86 을 XEN Guest(PV)로 부팅 with network

1. root.img 생성
 - [out/target/product/eeepc]# ls root
init  init.eeepc.rc  init.rc  install.img  proc  ramdisk.img  sbin  sys  system  system.img  ueventd.rc...
- $ out/host/linux-x86/bin/make_ext4fs -l 512M -a root out/target/product/eeepc/root.img out/target/product/eeepc/root

2. ramdisk의 init  스크립트 수정
- [out/target/product/eeepc/installer]# vi init
- 아래와 같이 수정
- 위의 root.img를 /dev/xvda로 연결
113 #while :; do
114     #for device in ${ROOT:-/dev/sr* /dev/xvd* /dev/[hs]d[a-z]*}; do
115     #   check_root $device && break 2
116     #   mountpoint -q /mnt && umount /mnt
117     #done
118 
119     # mount for pv guest in xen mode
120     mount -o loop /dev/xvda /mnt
121     mkdir /android/system
122     mount -o loop /mnt/system.img /android/system
123     zcat /mnt/ramdisk.img | cpio -id > /dev/null
124     mkdir cache mnt mnt/sdcard
125     mount -t tmpfs tmpfs cache
126 
127     sleep 1
128     echo -n .
129 #done
- ramdisk 생성
$ out/host/linux-x86/bin/mkbootfs out/target/product/eeepc/installer | gzip -9 > out/target/product/eeepc/initrd.img


3. DomU 생성 및 실행
sudo xm create and_xen.cfg

Appendix: and_xen.cfg 예제
import os, re
builder = 'linux'
kernel  = '/home/dkyun77/dev/android-sf-x86/out/target/product/eeepc/kernel'
extra    = "loglevel=7"
ramdisk = '/home/dkyun77/dev/android-sf-x86/out/target/product/eeepc/initrd.img'

vcpus = 1
memory = 1024
shadow_memory = 16
device_model = '/usr/lib/xen/bin/qemu-dm'

disk = [ 'file:/home/dkyun77/dev/android-sf-x86/out/target/product/eeepc/root.img,xvda,w' ]
name = 'xen_eeepc'
vfb=['type=vnc,vncunused=1']
vif = ['bridge=virbr0']

stdvga=0
serial='pty'
usbdevice='tablet'


4. DomU network 활성화
 - virt-manager를 이용해서 send-key로 'Ctrl+Alt+F1' 전송
- shell 얻음
- # netcfg -h
- # netcfg eth0 dhcp
- eth0 UP    192.168.122.146/24 xxx
- 고정 IP 사용하고 싶을 경우 mac Addr 고정
- 예: 위 xen 설정 파일의 아래와 같이 수정
vif=[ 'mac=00:16:3e:01:01:01,bridge=virbr0' ]

- adb 연결
- Host Ubuntu에서 실행
- # source build/envsetup.sh 
including device/amd/common/vendorsetup.sh
including device/asus/common/vendorsetup.sh
including device/hp/tx2500/vendorsetup.sh
including device/ibm/thinkpad/vendorsetup.sh
including device/lenovo/s103t/vendorsetup.sh
including device/tegatech/tegav2/vendorsetup.sh
including sdk/bash_completion/adb.bash
# lunch eeepc-eng
- # which adb
/home/dkyun77/dev/android-sf-eeepc/out/host/linux-x86/bin/adb
- # adb connect 192.168.122.146:5555
connected to 192.168.122.146:5555
- # adb shell
root@eeepc:/ # ls
acct
cache
....
 

댓글

이 블로그의 인기 게시물

SSH 연결 Delay 해결

[ELK] search guard를 이용한 보안 설정 (사용자 권한)

공공데이터(openapi) 사용법 (특정 정류소, 버스의 남은 좌석 확인 하기)