Run Ubuntu and Android simultaneosly on ARM using LXC.

Discussion in 'Server Operation' started by marietto, Feb 9, 2012.

  1. marietto

    marietto New Member

    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.
     
  2. marietto

    marietto New Member

    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... ?
     

    Attached Files:

  3. marietto

    marietto New Member

    I'm still waiting for a reply.
     
  4. marietto

    marietto New Member

    Still waiting.

    I'm still waiting for someone who wants to help me.
     

Share This Page