用buildroot qemu 運行 Android 系統

來源:互聯網
上載者:User

準備 qemu, 編譯 arm 的運行環境

  • $ wget http://wiki.qemu-project.org/download/qemu-2.0.0.tar.bz2
  • $ tar xzvf qemu-2.0.0.tar.bz2
  • $ mkdir ./qemu-2.0.0/bin
  • $ cd ./qemu-2.0.0/bin/
  • $ ../configure --target-list=arm-softmmu
  • $ make
    (system 模式,是類比整個硬體了,user 模式是只類比arm cpu, sys call 轉變為對 host linux-x86的調用)
    準備build root, build root 自動下載需要檔案編譯需要的 kernel, rootfs
    • $ wget http://buildroot.uclibc.org/downloads/buildroot-2014.05.tar.bz2
    • $ tar xjvf buildroot-2014.05.tar.bz2
    • $ cd buildroot-2014.05/
    • $ make qemu_arm_vexpress_defconfig
    • $ make menuconfig
      Toolchain -> C library -> eglibcToolchain -> Enable C++ supportSystem configuration -> Root filesystem overlay directories -> Target packages -> Show packages that are also provided by busyboxTarget packages -> Debugging, profiling and benchmark -> gdb -> full debuggerTarget packages -> Networking applications -> dhcpcdTarget packages -> Shell and utilities -> bashFilesystem images -> cpio the root filesystemFilesystem images -> tar the root filesystem
    • $ export BR2_JLEVEL=4
    • $ make linux-menuconfig
      Device Drivers -> (*) Staging drivers -> (*) Android -> (*) Android Binder IPC DriverFile systems -> (*) FUSE (Filesystem in Userspace) support
    • $ make

      可以指定自己的rootfs, 把 target arm 的可執行檔,放在此目錄/home/payne/qemu/rootfs_my/, 運行qemu-arm 的時候,就可以在shell 中執行了
      運行qemu, 使用的ZImage和rootfs 都是在buildroot中產生的
      • $ ./qemu-2.0.0/bin/system/arm-softmmu/qemu-system-arm -M vexpress-a9 -m 1G -kernel ./buildroot-2014.05/output/images/zImage -drive file=./buildroot-2014.05/output/images/rootfs.ext2,if=sd -append "console=ttyAMA0,115200 root=/dev/mmcblk0" -serial stdio -net nic,model=lan9118 -net user -redir tcp:5900::5900
      • Input "root" when you see the login prompt
      • # dhcpcd
      • #
        值得注意的是, qemu並不自動netwrok, 要運行dhcpcd獲得ip(更android 一樣,10.0.2.15是自己,10.0.2.2 是host), 在qemu中能訪問外部internet,但是要外部存取內部需要用連接埠轉寄-redir tcp:5900::5900,就是把guest os 的5900 和host os 的5900做map, 這樣訪問host os 5900就是訪問guest os 的5900

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.