|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Copyright © 2016 Intel Corporation |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +git clone https://gerrit.zephyrproject.org/r/zephyr |
| 18 | +cd zephyr |
| 19 | +wget https://nexus.zephyrproject.org/content/repositories/releases/org/zephyrproject/zephyr-sdk/0.8-i686/zephyr-sdk-0.8-i686-setup.run |
| 20 | +chmod +x zephyr-sdk-0.8-i686-setup.run |
| 21 | +mkdir zephyr_uncompressed && cd zephyr_uncompressed |
| 22 | +../zephyr-sdk-0.8-i686-setup.run --target $(pwd) --noexec |
| 23 | +mkdir ../zephyr_sdk && cd ../zephyr_sdk |
| 24 | +export ZEPHYR_SDK_INSTALL_DIR=$(pwd) |
| 25 | +cd ../zephyr_uncompressed |
| 26 | +./setup.sh -d $ZEPHYR_SDK_INSTALL_DIR |
| 27 | +source ../zephyr-env.sh |
| 28 | +export ZEPHYR_GCC_VARIANT=zephyr |
| 29 | +cd ../.. |
| 30 | +sudo ln -s /usr/include/asm-generic /usr/include/asm |
| 31 | +make -f ./targets/arduino_101/Makefile.arduino_101 BOARD=qemu_x86 |
| 32 | +mkfifo path.in path.out |
| 33 | +./zephyr/zephyr_sdk/sysroots/i686-pokysdk-linux/usr/bin/qemu-system-i386 -m 32 -cpu qemu32 -no-reboot -nographic -vga none -display none -net none -clock dynticks -no-acpi -balloon none -L ./zephyr/zephyr_sdk/sysroots/i686-pokysdk-linux/usr/share/qemu -bios bios.bin -machine type=pc-0.14 -pidfile qemu.pid -serial pipe:path -kernel ./build/qemu_x86/zephyr/zephyr.elf & sleep 5 |
| 34 | +cat path.out > log.txt & sleep 5 |
| 35 | +printf "test\r\n" > path.in |
| 36 | +sleep 5 |
| 37 | +kill %1 |
| 38 | +cat log.txt |
| 39 | +if grep "Hi JS World!" log.txt > /dev/null; then echo -e "\n\nQapla'! (it means \"Success\" in Klingon)"; else echo -e "\n\nScript has failed"; fi |
| 40 | +grep "Hi JS World!" log.txt > /dev/null |
0 commit comments