summaryrefslogtreecommitdiff
path: root/readme.txt
blob: 42bdb50a03c050efdc7f3cf209f8815b37a99ac7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
*Copyright (c) 2018, Arm Limited.*

This readme describes how to download, build and run software demonstrating Tiny Linux and a Google IoT
Cloud client running on Arm’s Cortex-A5 FVP (Fixed Virtual Platform) model.

1. Software Components:

	1. Boot-wrapper: bare minimum bootloader.
	2. Linux: Based on kernel 4.15 with some patches.
	3. Busybox
	4. Device tree
	5. ramdisk
	6. Build scripts: Building SW stack and packaging ramdisk image.
	7. Run scripts: Simple script to run the fast model.
	8. iot-client: Simple C application to send message to google IoT core cloud and dependent libraries.
	9. tools: ARM cross compile toolchain

2. Prerequisites: Recommended to run on an Ubuntu 16.04 LTS system with following packages installed.

	(*) git
	(*) gcc-arm-linux-gnueabihf
	(*) repo
	(*) cmake
	(*) ninja-build
	(*) build-essential
	(*) libtool
	(*) libssl-dev
	(*) make
	(*) bridge-utils
	(*) autoconf

3. Getting the source:

	(*) Download the Software Bundle from the publicly hosted linaro git repositories as follows
              $ repo init -u https://git.linaro.org/landing-teams/working/arm/manifest -b tinylinux_giot_demo -m a5ve.xml
              $ repo sync

	(*) Download the ARM 32 bit cross compiler, go inside the top directory of source tree.
              $ mkdir tools
	      $ cd tools
	      $ mkdir gcc
	      $ cd gcc
              $ wget http://releases.linaro.org/components/toolchain/binaries/6.2-2016.11/arm-linux-gnueabihf/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf.tar.xz
              $ tar -xvf gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf.tar.xz

	(*) Download the associated Cortex-A5 FVP from https://developer.arm.com/products/system-design/fixed-virtual-platforms.
		-Arm are working to release the model as soon as possible, following the publication of this demo.

	(*) Installing FVP: Extract and run FVP_VE_Cortex-A5*.sh for installing the FVP and pass "<TOP_DIR>/run-scripts/fastmodel" as installation directory.

	(*) Use the "Evaluate FVP" link to obtain an evaluation license for a Cortex-A5 based model.

	(*) Install the FVP license: Configure an ARMLMD_LICENSE_FILE environment variable to point to your evaluation license file.

	(*) Go through google documentation to create device, registry and topic to communicate with google IoT Core Cloud.
		https://cloud.google.com/iot/docs/quickstart

	(*) To understand mqtt_ciotc application and its dependencies refer to
		https://github.com/GoogleCloudPlatform/cpp-docs-samples/tree/master/iot/mqtt-ciotc

	(*) Following changes needs to be done to get application communicate with your topic
		- In mqtt_ciotc.c file(iot-client/mqtt_capp/iot/mqtt-ciotc/) change
			.topic = <your topic name>
			JWT_ALG_ES256 to JWT_ALG_RS256 if RSA algorithm used.


4. Building the software stack

	(*) Go to the top directory where you synced the source tree.
		$ ./build-scripts/build-all.sh all
		*For first time build above command is recommended, refer to build-scripts help for components build.

	(*) Build script will generate output directory inside top directory having xipImage(kernel) and busybox ramdisk with iot application and dependent libraries.

5. Running the Fast Model

	(*) We need bridge network to be enabled on host machine, follow below steps to create bridge network on Ubuntu
		https://developer.arm.com/products/system-design/fast-models/docs/100964/latest/introduction/network-set-up/taptun-networking

	(*) In our script the bridge interface name is "tiny", if you have different name please change it in run_model.sh script.

	(*) Running the model
		$ cd run_scripts
		$ ./run_model.sh

	(*) Once the console is up, verify if network is up.(failing which may cause model to hang).

6. Demo with Google IOT client and IOT Core

	(*) Preparing the Google IOT client application
		Google IoT client application and required libraries are build with software stack and packaged with busybox image.
		You only need to copy rsa_private.pem and roots.pem to your target for connecting to cloud.
		Application: mqtt_ciotc present inside /usr/bin
			Static Libraries : jansson, libjwt and paho-mqttcs libraries.
			Dynamic libraries already present in /lib.

	(*) Private key and roots key:
		rsa_private.pem and roots.pem files required for connecting to google Cloud.
		rsa_private.pem: your private key pair, public key is uploaded while creating topic on google IoT core
		roots.pem: from host machine run "wget https://pki.google.com/roots.pem"
		Use ftp to get these files from Host machine to target.
		run following command from target
			# cd /usr/bin (where mqtt_ciotc application)
			# ftpget <your host ip> rsa_private.pem rsa_private.pem
			# ftpget <your host ip> roots.pem roots.pem

	(*) Running the client application and connecting with the cloud
	        Once model has booted and comes to prompt, do following to make sure network is up and able to resolve name servers.
		# ifconfig
		# nslookup google.com
		# cd /usr/bin
		# ./mqtt_ciotc "Hello_Fast_model!" --projectid <> --deviceid <> --region <> --registryid <> --ecpath rsa_private.pem --rootpath roots.pem

		  - If message delivered properly you will see something like "Message with delivery token 1 delivered"
		  - You can see last delivered message on google IoT core console or subscribe to topic and pull the message.