# Build and Run ## 1. Clone away ``` $ mkdir $ cd $ git clone git://git.yoctoproject.org/meta-tensorflow $ git clone git://git.openembedded.org/meta-openembedded $ git clone git://git.openembedded.org/openembedded-core oe-core $ cd oe-core $ git clone git://git.openembedded.org/bitbake ``` ## 2. Prepare build ``` $ . /oe-core/oe-init-build-env # Build qemux86-64 which runqemu supports kvm. $ echo 'MACHINE = "qemux86-64"' >> conf/local.conf $ echo 'IMAGE_INSTALL:append = " tensorflow"' >> conf/local.conf Edit conf/bblayers.conf to include other layers BBLAYERS ?= " \ /oe-core/meta \ /meta-openembedded/meta-python \ /meta-openembedded/meta-oe \ /meta-tensorflow \ " ``` ## 3. Build image ``` cd $ bitbake core-image-minimal ``` ## 4. Start qemu with slrip + kvm + 5GB memory: ``` $ runqemu qemux86-64 core-image-minimal slirp kvm qemuparams="-m 5120" ``` ## 5. Verify the install ``` root@qemux86-64:~# python3 -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))" tf.Tensor(-3304.6208, shape=(), dtype=float32) ``` ## 6. Run tutorial case ### Refer: https://www.tensorflow.org/tutorials ``` root@qemux86-64:~# cat >code-v2.py <