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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
h2. License
The use of Juno software is subject to the terms of the Juno "End User License Agreement":https://releases.linaro.org/14.09/members/arm/openembedded/juno-lsk/#tabs-5.
h2. Building the Linaro Kernel
h3. Prerequisites
* Ubuntu 12.04 64 bit system. You can download Ubuntu from ubuntu.com
* git
bc. sudo apt-get install build-essential git
* toolchain
bc. mkdir -p ~/bin
cd ~/bin
wget http://releases.linaro.org/13.11/components/toolchain/binaries/gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux.tar.xz
tar xf gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux.tar.xz
PATH=$PATH:~/bin/gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux/bin
h3. Get the Linaro Kernel Source
bc. git clone https://git.linaro.org/landing-teams/working/arm/kernel-release.git
cd kernel
git checkout lsk-3.10-armlt-juno-20140911
h3. Create a kernel config
Do not use the arm64 defconfig, instead, build a config from the config fragments that Linaro provides:
bc. ARCH=arm64 scripts/kconfig/merge_config.sh \
linaro/configs/linaro-base.conf \
linaro/configs/distribution.conf \
linaro/configs/vexpress64.conf \
Note: the config fragments are part of the git repository and the source tarball.
h3. Build the kernel
To build the kernel Image and juno.dtb files, use the following command:
bc. make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image dtbs
h3. Install your kernel
Copy the kernel Image and the juno.dtb files to the BOOT partition on the USB drive created in the "Binary Installation tab":https://releases.linaro.org/14.09/members/arm/openembedded/juno-lsk/#tabs-2.
bc. cp arch/arm64/boot/Image /media/BOOT/Image
cp arch/arm64/boot/dts/juno.dtb /media/BOOT/juno/juno.dtb
h1. Building Firmware From Source
h2. Prerequisites
The following tools and environment are required:
* Ubuntu desktop OS and the following packages. ARM have only tested with Ubuntu 12.04.02 (64-bit).
** `git` package to obtain source code
** `ia32-libs` package
** `build-essential` and `uuid-dev` packages for building the UEFI and Firmware Image Package (FIP) tool
* Baremetal GNU GCC tools. Can be downloaded from Linaro
** "http://releases.linaro.org/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz":http://releases.linaro.org/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
* The instructions on this page below assume that the environment variable $JUNO_ROOT_DIR has been initialised to a working directory.
bc. $ export JUNO_ROOT_DIR=<path-to-working-dir>/<name-of-working-dir>
h2. SCP Firmware
The SCP Firmware is only available as a pre-built binary.
h2. ARM Trusted Firmware
The ARM trusted firmware consists of the following images:
| *Filename* | *Image Type* | *Image Name* |
|bl1.bin|BL1|ARM Trusted ROM image|
|bl2.bin|BL2|ARM Trusted Firmware|
|bl31.bin|BL3-1|EL3 runtime|
|bl32.bin (optional)|BL3-2|Test Secure Payload|
The bl2.bin, bl31.bin and bl32.bin images are inputs to the process of creating a Firmware Image Package.
h3. Obtaining sources
Clone the ARM Trusted Firmware repository from GitHub:
bc. $ cd $JUNO_ROOT_DIR
$ git clone https://github.com/ARM-software/arm-trusted-firmware.git
$ cd arm-trusted-firmware
$ git checkout v0.4-Juno-0.5
h3. Configuration
Set the compiler path
bc. $ export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf-
h3. Building
1. Change to the trusted firmware directory:
bc. $ cd $JUNO_ROOT_DIR/arm-trusted-firmware
2. Build the different firmware images:
bc. $ make PLAT=juno all
To build the optional bl3-2 Test Secure Payload component, use the following commands instead (the 'make realclean' is important):
bc. $ make realclean
$ make PLAT=juno SPD=tspd all
By default the preceding commands produce a release version of the build. To produce a debug version instead and make the build more verbose use:
bc. $ make PLAT=juno DEBUG=1 V=1 all
The build process creates products in a `build` directory tree, building the objects for each boot loader stage in separate sub-directories. The following boot loader binary files are created:
* @build/juno/<build-type>/bl1.bin@
* @build/juno/<build-type>/bl2.bin@
* @build/juno/<build-type>/bl31.bin@
* @build/juno/<build-type>/bl32.bin@ (if the 'SPD=tspd' flag is used)
... where @<build-type>@ is either `debug` or `release`.
To clean the ARM Trusted Firmware source tree (warning, this will remove the binaries too):
bc. $ make realclean
h2. UEFI
UEFI is a single bl33.bin image that is an input to the process of creating a Firmware Image Package.
h3. Obtaining sources
Clone the Juno UEFI Github repository:
bc. $ cd $JUNO_ROOT_DIR
$ git clone https://github.com/ARM-software/edk2.git -b juno
$ cd edk2
$ git checkout v1.0-rc0
h3. Configuration
1. Define the AArch64 GCC toolchain:
bc. $ export GCC48_AARCH64_PREFIX=<path-to-aarch64-gcc>/bin/aarch64-none-elf-
2. Configure Tianocore environment:
bc. $ cd $JUNO_ROOT_DIR/edk2
$ . edksetup.sh
$ make -C BaseTools
h3. Building
1. Change to the EDK2 directory:
bc. $ cd $JUNO_ROOT_DIR/edk2
2. To build DEBUG version of UEFI firmware:
bc. $ make -f ArmPlatformPkg/ArmJunoPkg/Makefile
The build produces the binary $JUNO_ROOT_DIR/edk2/Build/ArmJuno/DEBUG_GCC48/FV/BL33_AP_UEFI.fd that should be used as 'bl33.bin' when generating the Firmware Image Package binary.
To build RELEASE version of UEFI firmware:
bc. $ make -f ArmPlatformPkg/ArmJunoPkg/Makefile EDK2_BUILD=RELEASE
Use the release binary $JUNO_ROOT_DIR/edk2/Build/ArmJuno/RELEASE_GCC48/FV/BL33_AP_UEFI.fd as bl33.bin when generating the Firmware Image Package binary.
To clean EDK2 source tree:
bc. $ make -f ArmPlatformPkg/ArmJunoPkg/Makefile clean
h2. Packaging the binaries
ARM Trusted Firmware uses the Firmware Image Package (FIP) binary blob to load images into the system, so that the firmware can avoid managing lots of smaller images. The FIP will contain:
* BL2 and BL3-1 boot loader images
* Test Secure Payload (BL3-2 image - optional)
* UEFI firmware (BL3-3 image)
* SCP firmware (BL3-0 image)
Note: BL1 image is NOT part of the FIP.
h3. Building a FIP binary
The steps to create a FIP are as follows:
1. Build the 'fip_create' tool.
bc. $ cd $JUNO_ROOT_DIR/arm-trusted-firmware
$ make fiptool
2. Define the FIP environment. Specifically, include the FIP tool in the path.
bc. $ export PATH=$JUNO_ROOT_DIR/arm-trusted-firmware/tools/fip_create:$PATH
3. Download the "firmware image artefacts":https://wiki.linaro.org/ARM/Juno?action=AttachFile&do=get&target=juno-firmware-beta-0.8.1.zip and extract to a working directory (hereafter referred to as @"<path to prebuilt binary>"@).
4. Gather the binary files (the following example is for release builds only).
bc. $ cd $JUNO_ROOT_DIR
$ mkdir fip
$ cd fip
$ cp <path to prebuilt binary>/bl30.bin .
$ cp $JUNO_ROOT_DIR/arm-trusted-firmware/build/juno/release/bl2.bin .
$ cp $JUNO_ROOT_DIR/arm-trusted-firmware/build/juno/release/bl31.bin .
$ cp $JUNO_ROOT_DIR/arm-trusted-firmware/build/juno/release/bl32.bin .
$ cp $JUNO_ROOT_DIR/edk2/Build/ArmJuno/RELEASE_GCC48/FV/BL33_AP_UEFI.fd bl33.bin
If you wish to use the pre-built ARM trusted firmware and UEFI EDK2 images instead of building them from source, then the last four lines of the above block can independently be replaced with the following:
bc. $ cp <path to prebuilt binary>/bl2.bin .
$ cp <path to prebuilt binary>/bl31.bin .
$ cp <path to prebuilt binary>/bl32.bin .
$ cp <path to prebuilt binary>/bl33.bin .
5. Create the FIP file:
bc. $ fip_create --dump \
--bl2 bl2.bin \
--bl30 bl30.bin \
--bl31 bl31.bin \
--bl32 bl32.bin \ (if the optional bl32 image is present)
--bl33 bl33.bin \
fip.bin
The previous command will display the FIP layout:
bc. Firmware Image Package ToC:
---------------------------
- Trusted Boot Firmware BL2: offset=0xD8, size=0x5268
- SCP Firmware BL3-0: offset=0x5340, size=0x9C64
- EL3 Runtime Firmware BL3-1: offset=0xEFA4, size=0x82A0
- Non-Trusted Firmware BL3-3: offset=0x17244, size=0xF0000
---------------------------
Creating "fip.bin";
6. Optional: the `fip_create` tool can be used in the exact same way to update individual images inside an existing FIP file. For example, to update the SCP Firmware BL3-0 image:
bc. $ fip_create --dump --bl30 new_bl30.bin fip.bin
The previous command will again display the FIP layout:
bc. Firmware Image Package ToC:
---------------------------
- Trusted Boot Firmware BL2: offset=0xD8, size=0x5268
- SCP Firmware BL3-0: offset=0x5340, size=0x9C64
file: 'new_bl30.bin'
- EL3 Runtime Firmware BL3-1: offset=0xEFA4, size=0x82A0
- Non-Trusted Firmware BL3-3: offset=0x17244, size=0xF0000
---------------------------
Updating "fip.bin"
For more details and options about the `fip_create` tool:
bc. $ fip_create --help
h2. Installing the binaries
Please refer to the section titled "Firmware update" on the "Binary Image Installation tab":https://releases.linaro.org/14.09/members/arm/openembedded/juno-lsk/#tabs-2.
|