LoginSignup
3
3

More than 5 years have passed since last update.

[メモ] RaspberryPi向けyoctoのビルド (Vagrant,VirtualBox使用)

Last updated at Posted at 2017-03-28

概要

環境

  • ホスト: Windows 10 64bit
    • Vagrant
    • Virtualbox
    • Git for Windows
  • ゲスト仮想機:

    • ubuntu/xenial64
    • 120GBのディスクサイズに拡張してる(けど、80GBくらいでもだいじょうぶかも?)
  • Raspberry Pi 2/3実機

手順

  1. Vagrant, Virualbox, git for windowsを使えるようにする
  2. Vagrantのdisksizeプラグインを導入:
    vagrant plugin install vagrant-disksize
  3. Vagrantfile

    Vagrantfile
    # Vagrantfile
    # mt08
    
    #VB_NAME="build-VM"
    VM_MEMORY=8192
    VM_CORES=2
    #VM_HOSTNAME="build-yocto_poky-morty.local"
    
    Vagrant.configure("2") do |config|
        config.vm.box = "ubuntu/xenial64"
        #config.vm.network "public_network", bridge: 'Intel(R) Ethernet Connection I217-LM'
        config.ssh.username = 'ubuntu'
        config.disksize.size = '120GB'
    
        config.vm.provider "virtualbox" do |vb|
            vb.gui = true
            #vb.name = VB_NAME
            vb.memory = VM_MEMORY
            vb.cpus = VM_CORES
        end
    
        config.vm.provision "shell", inline: <<-SHELL
            #echo 'Acquire::http::Proxy "http://apt-cache-server:3142";' | tee /etc/apt/apt.conf.d/02proxy
    
            export DEBIAN_FRONTEND=noninteractive
    
            apt-get update
            apt-get -y upgrade
    
            apt-get -y install build-essential chrpath diffstat gawk git libncurses5-dev pkg-config subversion texi2html texinfo
            apt-get -y install bc python2.7
            ln -sf /usr/bin/python2.7 /usr/bin/python
            dpkg-reconfigure dash
        SHELL
    
        config.vm.provision "shell", privileged: false, inline: <<-SHELL
            cd ${HOME}
            git clone -b morty git://git.yoctoproject.org/poky.git poky-morty
            cd poky-morty
            git clone -b morty git://git.openembedded.org/meta-openembedded
            git clone -b morty https://github.com/meta-qt5/meta-qt5.git
            git clone -b morty git://git.yoctoproject.org/meta-raspberrypi
    
            cd ${HOME}
            mkdir rpi
            cd rpi
            git clone -b morty git://github.com/jumpnow/meta-rpi
    
            cd ${HOME}
            mkdir -p ${HOME}/rpi/build/conf
            source poky-morty/oe-init-build-env ${HOME}/rpi/build
    
            cd $HOME/rpi
            cp meta-rpi/conf/local.conf.sample build/conf/local.conf
            cp meta-rpi/conf/bblayers.conf.sample build/conf/bblayers.conf
        SHELL
    end
    
  4. 仮想機起動、再起動、sshログイン:
    vagrant up && vagrant reload && vagrant ssh

  5. ...待つ...

  6. 仮想機sshログイン

    1. 設定編集 bblayers.conf(編集する必要ないと思う):
      vi $HOME/rpi/build/conf/bblayers.conf
    2. 設定編集 local.conf:
      vi $HOME/rpi/build/conf/local.conf
      1. MACHINE : raspberrypi2(RPi2/3向け) or raspberrypi (1/Zero向け)
      2. DL_DIR : 指定しないと、$HOME/rpi/build/downloads
      3. SSTATE_DIR: 指定しないと、$HOME/rpi/build/sstate-cache
      4. TMPDIR: 指定しないと、$HOME/rpi/build/tmp
    3. ビルド開始

      ビルド
      cd $HOME
      source poky-morty/oe-init-build-env ~/rpi/build
      #time bitbake -c fetchall console-image   # ファイルの取得のみ行う
      time bitbake console-image
      
    4. 待つ

    5. $HOME/rpi/build/tmp/deploy中に成果物ができるはず。

その他

  • VM_CORESとVM_MEMORYはバランスよく。CPU増やしてもメモリが足りないと、落ちたり不安定になったりする。並列にビルド走るけど、ディスクアクセスも頻繁におこるようにもなるし、むずかしいね。
  • ビルド後: /dev/sda1 117G 46G 72G 39% /

  • (追記2017-0330)メモ : 2cores/8GBRAMで、fetchに137分、ビルドに309分

    ubuntu@ubuntu-xenial:~/rpi/build$ time bitbake -c fetchall console-image && time bitbake console-image
    Loading cache: 100% |##################################################################################################################| Time: 0:00:00
    Loaded 642 entries from dependency cache.
    Parsing recipes: 100% |################################################################################################################| Time: 0:02:12
    Parsing of 1969 .bb files complete (488 cached, 1481 parsed). 2665 targets, 349 skipped, 0 masked, 0 errors.
    NOTE: Resolving any missing task queue dependencies
    
    Build Configuration:
    BB_VERSION        = "1.32.0"
    BUILD_SYS         = "x86_64-linux"
    NATIVELSBSTRING   = "Ubuntu-16.04"
    TARGET_SYS        = "arm-poky-linux-gnueabi"
    MACHINE           = "raspberrypi2"
    DISTRO            = "poky"
    DISTRO_VERSION    = "2.2.1"
    TUNE_FEATURES     = "arm armv7ve vfp thumb neon vfpv4 callconvention-hard cortexa7"
    TARGET_FPU        = "hard"
    meta
    meta-poky         = "morty:924e576b8930fd2268d85f0b151e5f68a3c2afce"
    meta-oe
    meta-multimedia
    meta-networking
    meta-python       = "morty:fe5c83312de11e80b85680ef237f8acb04b4b26e"
    meta-qt5          = "morty:3601fd2c5306ac6d5d0d536e0be8cbb90da9b4c1"
    meta-raspberrypi  = "morty:cce6292e41493158c26f5b1b7fded97faacf10d7"
    meta-rpi          = "morty:fbf8e850d79ecb05e4de6debd8a8ab1b2c94255e"
    
    NOTE: Fetching uninative binary shim from http://downloads.yoctoproject.org/releases/uninative/1.4/x86_64-nativesdk-libc.tar.bz2;sha256sum=101ff8f2580c193488db9e76f9646fb6ed38b65fb76f403acb0e2178ce7127ca
    --2017-03-29 17:46:57--  http://downloads.yoctoproject.org/releases/uninative/1.4/x86_64-nativesdk-libc.tar.bz2
    Resolving downloads.yoctoproject.org (downloads.yoctoproject.org)... 198.145.20.127
    Connecting to downloads.yoctoproject.org (downloads.yoctoproject.org)|198.145.20.127|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 2473216 (2.4M) [application/octet-stream]
    Saving to: ‘/vagrant/oe-sources/uninative/101ff8f2580c193488db9e76f9646fb6ed38b65fb76f403acb0e2178ce7127ca/x86_64-nativesdk-libc.tar.bz2’
    
    2017-03-29 17:47:01 (2.15 MB/s) - ‘/vagrant/oe-sources/uninative/101ff8f2580c193488db9e76f9646fb6ed38b65fb76f403acb0e2178ce7127ca/x86_64-nativesdk-libc.tar.bz2’ saved [2473216/2473216]
    
    Initialising tasks: 100% |#############################################################################################################| Time: 0:00:07
    NOTE: Executing RunQueue Tasks
    WARNING: devmem2-1.0-r7 do_fetch: Failed to fetch URL http://www.lartmaker.nl/lartware/port/devmem2.c, attempting MIRRORS if available
    WARNING: libpng-native-1.6.24-r0 do_fetch: Failed to fetch URL http://distfiles.gentoo.org/distfiles/libpng-1.6.24.tar.xz, attempting MIRRORS if available
    WARNING: ossp-uuid-native-1.6.2-r2 do_fetch: Failed to fetch URL http://snapshot.debian.org/archive/debian/20160728T043443Z/pool/main/o/ossp-uuid/ossp-uuid_1.6.2.orig.tar.gz, attempting MIRRORS if available
    WARNING: nano-2.2.5-r3.0 do_fetch: Failed to fetch URL ftp://nano-editor.org/pub/nano/v2.2/nano-2.2.5.tar.gz, attempting MIRRORS if available
    NOTE: Tasks Summary: Attempted 271 tasks of which 0 didn't need to be rerun and all succeeded.
    
    Summary: There were 4 WARNING messages shown.
    
    real    137m7.929s
    user    20m40.524s
    sys     42m57.396s
    Parsing recipes: 100% |################################################################################################################| Time: 0:02:13
    Parsing of 1969 .bb files complete (0 cached, 1969 parsed). 2665 targets, 349 skipped, 0 masked, 0 errors.
    NOTE: Resolving any missing task queue dependencies
    
    Build Configuration:
    BB_VERSION        = "1.32.0"
    BUILD_SYS         = "x86_64-linux"
    NATIVELSBSTRING   = "universal"
    TARGET_SYS        = "arm-poky-linux-gnueabi"
    MACHINE           = "raspberrypi2"
    DISTRO            = "poky"
    DISTRO_VERSION    = "2.2.1"
    TUNE_FEATURES     = "arm armv7ve vfp thumb neon vfpv4 callconvention-hard cortexa7"
    TARGET_FPU        = "hard"
    meta
    meta-poky         = "morty:924e576b8930fd2268d85f0b151e5f68a3c2afce"
    meta-oe
    meta-multimedia
    meta-networking
    meta-python       = "morty:fe5c83312de11e80b85680ef237f8acb04b4b26e"
    meta-qt5          = "morty:3601fd2c5306ac6d5d0d536e0be8cbb90da9b4c1"
    meta-raspberrypi  = "morty:cce6292e41493158c26f5b1b7fded97faacf10d7"
    meta-rpi          = "morty:fbf8e850d79ecb05e4de6debd8a8ab1b2c94255e"
    
    Initialising tasks: 100% |#############################################################################################################| Time: 0:00:07
    NOTE: Executing SetScene Tasks
    NOTE: Executing RunQueue Tasks
    NOTE: Tasks Summary: Attempted 3133 tasks of which 274 didn't need to be rerun and all succeeded.
    
    real    309m16.858s
    user    473m40.400s
    sys     60m15.796s
    ubuntu@ubuntu-xenial:~/rpi/build$
    
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3