LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (http://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   Run Ubuntu and Android simultaneosly on ARM using LXC. (http://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/run-ubuntu-and-android-simultaneosly-on-arm-using-lxc-928534/)

marietto 02-09-2012 02:57 PM

Run Ubuntu and Android simultaneosly on ARM using LXC.
 
Hello to everyone. Some time ago I bought the PandaBoard ES. This new board is very very nice. It's fast and powerful,even if a little bit limited with the only ubuntu arm operating system supported. When I work on the board I miss the X86 system. Since that I have understood that I can't have it,I wonder if I can virtualize Android while Ubuntu is running. I'm very interested to have these 2 os's run simultaneusly. After having studied the case,I'm sure there is a way : using the codezero hypervisor (http://www.l4dev.org). The problem is that I haven't found any tutorial that explain how to do...on the net there is only a video,on youtube..another way could be using LXC (Linux Containers). Since I'm almost a newbie,I have documented myself a little bit : I found this tutorial :

http://www.techrepublic.com/blog/ope...tag=rbxccnbtr1

it seems to be very well written. He says the easiest way to set up an LXC-based container is to use an existing base operating system, such as the templates provided by the OpenVZ project,listed here :

http://wiki.openvz.org/Download/template/precreated

but what about if I create a specific template for Android ?. If someone of you is experienced with this,could give me an advice ? I would know if my idea could works. Thanks.

jefro 02-09-2012 08:55 PM

Did you see this page? http://www.l4dev.org/getting_started

marietto 02-10-2012 03:12 AM

2 Attachment(s)
yes. but that's a basic tutorial.

I tried to run Android 2.3 simultaneously with Ubuntu 11.10 using LXC.
Here is what I did. you can see what's happened on the pictures attached :

$ cat >> /etc/network/interfaces << EOF

> auto br0
>
> iface br0 inet static
> address 192.168.99.1
> broadcast 0.0.0.0
> netmask 255.255.255.0
> bridge_ports none
> bridge_fd 0
> bridge_maxwait 0
> bridge_hello 0
> bridge_maxage 12
> bridge_stp off
> post-up ip route add 192.168.99.201 dev br0
> EOF

$ ifup br0

mkdir -p /cgroup /media/system /media/cache /media/userdata
tar -xzvf sdcard-android-lxc-rootfs.tar.gz
mkdir -p /srv/lxc/android23
cd sdcard-android-lxc-rootfs
cp -r * /srv/lxc/android23
cd /srv/lxc/android23
nano android23.conf

lxc.utsname = android23
lxc.tty = 4
lxc.rootfs = /srv/lxc/android23

# network
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.ipv4 = 192.168.99.202 0.0.0.0
lxc.network.name = eth0
lxc.network.veth.pair = vethvm2

lxc.cgroup.devices.deny = a # deny all first

# mount points
lxc.mount.entry=none /srv/lxc/android23/proc proc
defaults 0 0
lxc.mount.entry=none /srv/lxc/android23/sys sysfs
defaults 0 0
lxc.mount.entry=/lib /srv/lxc/android23/lib
none ro,bind 0 0
lxc.mount.entry=/usr/share/locale /srv/lxc/android23/usr/share/locale
none rw,bind 0 0

# /dev/null and zero
lxc.cgroup.devices.allow = c 1:3 rwm
lxc.cgroup.devices.allow = c 1:5 rwm

# consoles
lxc.cgroup.devices.allow = c 5:* rwm
lxc.cgroup.devices.allow = c 4:* rwm

# /dev/{,u}random
lxc.cgroup.devices.allow = c 1:9 rwm
lxc.cgroup.devices.allow = c 1:8 rwm

# /dev/pts/* - pts namespaces
lxc.cgroup.devices.allow = c 136:* rwm
lxc.cgroup.devices.allow = c 5:2 rwm

# rtc
lxc.cgroup.devices.allow = c 254:0 rwm

# cpu and memory
#lxc.cgroup.cpuset.cpus = 0
#lxc.cgroup.cpu.shares = 1024
#lxc.cgroup.memory.limit_in_bytes = 512M
#lxc.cgroup.memory.memsw.limit_in_bytes = 512M

# 10:* devices
lxc.cgroup.devices.allow = c 10:0 rwm # dev/pmem
lxc.cgroup.devices.allow = c 10:1 rwm # dev/pmem_adsp
lxc.cgroup.devices.allow = c 10:2 rwm # dev/pmem_camera
lxc.cgroup.devices.allow = c 10:223 rwm # dev/uinput

lxc.cgroup.devices.allow = c 10:30 rwm
lxc.cgroup.devices.allow = c 10:31 rwm
lxc.cgroup.devices.allow = c 10:32 rwm
lxc.cgroup.devices.allow = c 10:33 rwm
lxc.cgroup.devices.allow = c 10:34 rwm
lxc.cgroup.devices.allow = c 10:35 rwm
lxc.cgroup.devices.allow = c 10:36 rwm
lxc.cgroup.devices.allow = c 10:37 rwm
lxc.cgroup.devices.allow = c 10:39 rwm

lxc.cgroup.devices.allow = c 10:40 rwm # /dev/keychord
lxc.cgroup.devices.allow = c 10:41 rwm
lxc.cgroup.devices.allow = c 10:42 rwm
lxc.cgroup.devices.allow = c 10:43 rwm
lxc.cgroup.devices.allow = c 10:44 rwm
lxc.cgroup.devices.allow = c 10:45 rwm
lxc.cgroup.devices.allow = c 10:46 rwm
lxc.cgroup.devices.allow = c 10:47 rwm
lxc.cgroup.devices.allow = c 10:48 rwm
lxc.cgroup.devices.allow = c 10:49 rwm

lxc.cgroup.devices.allow = c 10:50 rwm
lxc.cgroup.devices.allow = c 10:51 rwm
lxc.cgroup.devices.allow = c 10:52 rwm
lxc.cgroup.devices.allow = c 10:53 rwm
lxc.cgroup.devices.allow = c 10:54 rwm
lxc.cgroup.devices.allow = c 10:55 rwm
lxc.cgroup.devices.allow = c 10:56 rwm
lxc.cgroup.devices.allow = c 10:57 rwm
lxc.cgroup.devices.allow = c 10:58 rwm
lxc.cgroup.devices.allow = c 10:59 rwm

lxc.cgroup.devices.allow = c 10:60 rwm
lxc.cgroup.devices.allow = c 10:61 rwm
lxc.cgroup.devices.allow = c 10:62 rwm
lxc.cgroup.devices.allow = c 10:63 rwm

# dev/input/*
lxc.cgroup.devices.allow = c 13:64 rwm # event0 -> lightsensor-level
lxc.cgroup.devices.allow = c 13:65 rwm # event1 -> h2w headset
lxc.cgroup.devices.allow = c 13:66 rwm # event2 -> compass
lxc.cgroup.devices.allow = c 13:67 rwm # event3 -> synaptics-rmi-touchscreen
lxc.cgroup.devices.allow = c 13:68 rwm # event4 -> proximity
lxc.cgroup.devices.allow = c 13:69 rwm # event5 -> mahimahi-keypad
lxc.cgroup.devices.allow = c 13:70 rwm # event6 -> mahimahi-nav

lxc.cgroup.devices.allow = c 29:0 rwm # dev/fb0
lxc.cgroup.devices.allow = c 31:* rwm # dev/block/mtdblock*
lxc.cgroup.devices.allow = c 90:* rwm # dev/mtd
lxc.cgroup.devices.allow = c 108:0 rwm # dev/ppp
lxc.cgroup.devices.allow = c 179:* rwm # dev/block/mmcblk0*
lxc.cgroup.devices.allow = c 248:* rwm # control0, config0, frame0
lxc.cgroup.devices.allow = c 251:0 rwm # dev/q6venc
lxc.cgroup.devices.allow = c 252:0 rwm # dev/vdec
lxc.cgroup.devices.allow = c 250:0 rwm # dev/ttyHS0
lxc.cgroup.devices.allow = c 253:* rwm


lxc-create -f /srv/lxc/android23/android23.conf -n android23
lxc-start android23

I think that it worked and that I need to continue configuring
init.rc, init, DalvikVM, system_server, busybox (route), dns, etc... ?

marietto 02-12-2012 05:15 PM

I don't know.

specter007 06-02-2012 09:04 AM

If I try your solution, Android doesn't show up :confused:

Do you know why the init process ended on signal 11?

LXC log:
Code:

...
      lxc-start 1338642976.769 NOTICE  lxc_conf - 'android23' is setup.

      lxc-start 1338642976.775 NOTICE  lxc_start - exec'ing '/sbin/init'

      lxc-start 1338642976.783 NOTICE  lxc_start - '/sbin/init' started with pid '1145'

      lxc-start 1338642976.791 DEBUG    lxc_utmp - Added '/srv/android23/rootfs/var/run' to inotifywatch

      lxc-start 1338642977.088 DEBUG    lxc_start - container init process exited

      lxc-start 1338642977.321 INFO    lxc_error - child <1145> ended on signal (11)

      lxc-start 1338642977.340 DEBUG    lxc_cgroup - using cgroup mounted at '/cgroup'

      lxc-start 1338642977.348 DEBUG    lxc_cgroup - '/cgroup/android23' unlinked



All times are GMT -5. The time now is 05:30 PM.