Você está na página 1de 29

SierraOS: Build and Boot Guide -

ARM fast models

SierraOS Build and Boot Guide

SierraOS Build andmodels Boot Guide - for ARM Fast - for ARM Fast models

Page 1

SierraOS: Build and Boot Guide -

ARM fast models

Table of Contents
1 Booting SierraOS in Fastmodel (Single Guest) ................................................................................. 4 1.1 ARM Fastmodel Platform: ........................................................................................................ 4 1.1.1 Fastmodel Installation ......................................................................................................... 4 1.1.2 Starting the Fastmodel ....................................................................................................... 4 1.1.3 Loading a pre-existing project and debugging .................................................................... 6 1.1.4 Booting the image and debugging using Fastmodel ........................................................... 9 1.1.5 Testing SierraOS Stack ..................................................................................................... 14 1.2 Steps to build SierraOS SDK: ................................................................................................. 17 1.2.1 Steps to build the linux kernel: ......................................................................................... 17 1.2.2 Steps to build the secure kernel : ...................................................................................... 17 1.2.3 Steps to resolve the toolchain error in Ubuntu 12.x .......................................................... 18 SierraOS in Fastmodel (Dedicated TEE) .......................................... Error! Bookmark not defined. 2.1 Steps to boot SierraOS in Fastmodel(Dedicated TEE): ........... Error! Bookmark not defined. 2.2 Steps to build SierraOS SDK(Dedicated TEE): ....................... Error! Bookmark not defined. 2.2.1 Steps to build the linux kernel for dedicated tee: .............. Error! Bookmark not defined. 2.2.2 Steps to build the secure kernel : ....................................... Error! Bookmark not defined. SierraVisor in Fastmodel (Hypervisor) ............................................. Error! Bookmark not defined. 3.1 Steps to boot SierraVisor in Fastmodel(Multiple guests) ........ Error! Bookmark not defined. 3.2 Steps to Build SierraOS SDK(Multiple guests): ...................... Error! Bookmark not defined. 3.2.1 Steps to build the secure kernel : ....................................... Error! Bookmark not defined. 3.2.2 Steps to build multiple linux guests: .................................. Error! Bookmark not defined. Android as a Guest........................................................................................................................... 18 4.1.1 Steps to build Android SDK: ............................................................................................ 18 4.1.2 Steps to Build SierraOS SDK (Android supported kernel): ............................................. 20 4.1.3 Steps to build the secure kernel : ...................................................................................... 20 4.2 Steps to boot Android based kernel: ....................................................................................... 21 4.2.1 Create an SD card image:.................................................................................................. 21 4.2.2 Steps to boot SierraOS in Fastmodel (Single Android guest) ........................................... 21 4.2.3 Steps to boot SierraVisor in Fastmodel (Android guest and Vanilla kernel) ............. Error! Bookmark not defined. Steps for installing other packages: ................................................................................................. 24 Components description .................................................................................................................. 26 Configuration Flags ......................................................................................................................... 27 Additional Features:......................................................................................................................... 27 8.1 Neon Support: ......................................................................................................................... 27 8.2 Dynamic Modules Support: ..................................................... Error! Bookmark not defined. 8.2.1 Steps to enable the Dynamic modules support .................. Error! Bookmark not defined. 8.2.2 Steps to create task based on dynamic modules................. Error! Bookmark not defined. 8.2.3 Testing dynamic modules................................................... Error! Bookmark not defined.

5 6 7 8

Page 2

SierraOS: Build and Boot Guide 8.3 8.4 8.5

ARM fast models

DRM Plugin: ........................................................................................................................... 28 MMC: ...................................................................................................................................... 28 Shell: ....................................................................................................................................... 28

Page 3

SierraOS: Build and Boot Guide -

ARM fast models

1 Booting SierraOS in Fastmodel (Single Guest)


1.1 ARM Fast model Platform:
ARM Fast models provide a platform comparable to actual hardware in Performance and accuracy. It is an easy to use platform for application, firmware as well as early driver development. It can be used boot any high level OSes such as Linux, Android. It supports various ARM technologies such as caches, MMU, LPAE, virtualization, TrustZone and VFP. It also provides virtualized I/O components like Ethernet, LCD, keyboard and mouse. Fast model is the most versatile platform that is widely available, and easy to acquire without any need for complicated legal agreements and licenses.

1.1.1 Fastmodel Installation


Fast Model can be downloaded from the following link by. A valid ARM user account is required. (First time users need a registration). http://www.arm.com/products/tools/models/fast-models.php

From the DOWNLOAD NOW section, navigate to Select Development Tools-> Fast Models from the products and download Fast Models Evaluation, Fast Models Third Party IP and the license.

Install the Fast Model and the third party IP.

1.1.2 Starting the Fastmodel


Run the following commands in order to launch the fast model. #source <FastModelInstalled-Dir>/FastModelTools_7.1/source_all.sh #sgcanvas

Page 4

SierraOS: Build and Boot Guide -

ARM fast models

Screen Shot: SGCANVAS UI

Page 5

SierraOS: Build and Boot Guide -

ARM fast models

1.1.3 Loading a pre-existing project and debugging


Load the required project by selecting File -> Load Project For example, Project for Realview Eval board with cortex A15 is available in the following location.
<FastModel install dir>/ FastModelsPortfolio_7.1/examples/RTSM_VE/Build_Cortex-A15x1/ RTSM_VE_CortexA15x1.sgproj

Page 6

SierraOS: Build and Boot Guide -

ARM fast models

Screen Shot: RTSM_VE_CortexA15 Project components

Note about GCC Compatibility:


RTSM_VE_CortexA15 project may fail to build properly with GCC 4.7.2. Few .so files may fail to build, which will result in the Model Debugger to throw an error similar to the following. Cannot load model library '<Fastmodel-install dir>/FastModelsPortfolio_7.1/examples/RTSM_EB/Build_Cortex-A8/LinuxRelease-GCC-4.7/cadi_system_Linux-Release-GCC-4.7.so': Error while loading lib: <Fastmodel-install dir>/FastModelsPortfolio_7.1/examples/RTSM_EB/Build_Cortex-A8/Linux-Release-GCC4.7/cadi_system_Linux-Release-GCC-4.7.so: undefined symbol: _ZN2sg13ConnectorBase5emptyEv This error can be avoided by using GCC 4.6.3(or earlier versions) to carry out the build. The GCC version for building the project can be changed by selecting the Settings option and then by adding a new configuration.

Page 7

SierraOS: Build and Boot Guide -

ARM fast models

Screen Shot: GCC Cross compiler for a project

Page 8

SierraOS: Build and Boot Guide -

ARM fast models

1.1.4 Booting the image and debugging using Fastmodel


Click Debug From the Debug Simulation window load the required application Select SierraOS.elf and click ok.

Page 9

SierraOS: Build and Boot Guide -

ARM fast models

From the Configure Model Parameters window change the motherboard.mmc to point to the following root system image. <FastModelInstalldir>/FastModelsPortfolio_7.1/images/RTSM_EB_Linux/files ystems/armv5t_min_EB_V6_V7.image.

Page 10

SierraOS: Build and Boot Guide -

ARM fast models

Next the Select Targets window will appear. Use the pre-populated default values.

Page 11

SierraOS: Build and Boot Guide -

ARM fast models

After all the configuration has been done and proceeding forward by clicking final OK The Model Debugger window will be appear. From this window, choose run option to boot the system, reset will make the system to boot from the starting point.

Page 12

SierraOS: Build and Boot Guide -

ARM fast models

Login as root.

Page 13

SierraOS: Build and Boot Guide -

ARM fast models

1.1.5 Testing SierraOS Stack


Load the Trust-Zone kernel driver by executing the following instruction. #insmod /otz_client.ko Application 1: sierra test application. #otzapp.elf

Page 14

SierraOS: Build and Boot Guide -

ARM fast models

Application 2: TEE compliant app: #otz_tee_app.elf

Page 15

SierraOS: Build and Boot Guide -

ARM fast models

Application 3: Secure Neon/VFP Application


# otz_neon_app.elf

Page 16

SierraOS: Build and Boot Guide -

ARM fast models

1.2 Steps to build SierraOS SDK:


1.2.1 Steps to build the linux kernel:
i. ii. iii. Download linux-2.6.38.7 from linux kernel source. Copy the downloaded file to sierra/otz_linux as linux-2.6.38.7.tar.bz2 Create a soft link or copy the image <FastModelInstalldir>/FastModelsPortfolio_7.1/images/RTSM_EB_Linux/files ystems/armv5t_min_EB_V6_V7.image to sierra/otz_linux. Run make command from otz_linux path.

iv.

1.2.2 Steps to build the secure kernel :


i. Export the CROSS_COMPILE variable to point to the codesourcery toolchain. #export CROSS_COMPILE=<toolchain installed directory>/bin/arm-nonelinux-gnueabiii. Export the CROSS_COMPILE_NEWLIB variable to point to the supplied toolchain in case of building crypto application. In case of building crypto application, #export CROSS_COMPILE_NEWLIB=<supplied toolchain installed directory>/bin/arm-none-eabiOtherwise, #export CROSS_COMPILE_NEWLIB=<toolchain installed directory>/bin/arm-none-linux-gnueabi iii. iv. v. Run make command from SDK path. Binaries and library files are available in tzone_sdk/bin and tzone_sdk/lib respectively. Linux sierra api client application (otzapp.elf), Linux sierra client driver (otz_client.ko) and sierra api shared library (libtzapi.so) are copied to the root file system.

Page 17

SierraOS: Build and Boot Guide -

ARM fast models

1.2.3 Steps to resolve the toolchain error in Ubuntu 12.x


While building the secure kernel with crypto enabled in ubuntu 12.04, the tool chain might give some errors due to the missing of the required libraries. Run the following in order to fix this issue. apt-get install libmpc2:i386 apt-get install libmpfr4:i386 ln -s /usr/lib/i386-linux-gnu/libmpfr.so.4 /usr/lib/i386-linuxgnu/libmpfr.so.1 apt-get install libgmp10:i386 ln -s /usr/lib/i386-linux-gnu/libgmp.so.10 /usr/lib/i386-linuxgnu/libgmp.so.3 apt-get install libelf1:i386 ln -s /usr/lib/i386-linux-gnu/libelf.so.1 /usr/lib/i386-linuxgnu/libelf.so.0

Note: Supported toolchain version is arm-2010q1.

2 Android as a Guest
2.1.1 Steps to build Android SDK:
Download the script to build android from this link http://snapshots.linaro.org/android/~linaro-android/vexpressrtsm-ics-gcc46-armlt-stable-open-12.04-release/5/linaro_android_build_cmds.sh (ii) Comment out the last two lines in the script corresponding to the building of android #. build/envsetup.sh #make -j${CPUS} boottarball systemtarball userdatatarball (iii) Run the following script #android_install.sh (i)

Page 18

SierraOS: Build and Boot Guide (iv)

ARM fast models

Uncomment the last two lines in the android build script. . build/envsetup.sh make -j${CPUS} boottarball systemtarball userdatatarball Run the script #linaro_android_build_cmds.sh

(v)

Page 19

SierraOS: Build and Boot Guide -

ARM fast models

2.1.2 Steps to Build SierraOS SDK (Android supported kernel): 2.1.3 Steps to build the secure kernel :
1. Export the CROSS_COMPILE variable to point to the codesourcery toolchain that would be used. #export CROSS_COMPILE=<toolchain installed directory>/bin/armnone- linux-gnueabi2. Export the CROSS_COMPILE_NEWLIB variable to point to the supplied toolchain that would be used. This toolchain is used while building crypto application. #export CROSS_COMPILE_NEWLIB=<toolchain installed directory>/bin/arm-none-eabi3. Enable the CONFIG_ANDROID_GUEST variable in tzone_sdk/Makefile Modify the ANDROID_PATH variable to the corresponding Android install directory. Run make command from SDK path. #make 6. 7. Binary files are available in tzone_sdk/bin. Linux sierra client driver (otz_client.ko) is copied to the android root file system.

4.

5.

Page 20

SierraOS: Build and Boot Guide -

ARM fast models

2.2 Steps to boot Android based kernel:


2.2.1 Create an SD card image:
1. Untar the boot.tar.bz2 file in a directory. #cd <android_temp_extracted_directory> #tar -xvf boot.tar.bz2

2. Create mmc.bin by running this command. #bzr branch lp:linaro-image-tools #./linaro-image-tools/linaro-android-media-create --image_file mc.bin --image_size 2000M --dev vexpress-a9 --system system.tar.bz2 --userdata userdata.tar.bz2 --boot boot.tar.bz2

2.2.2 Steps to boot SierraOS in Fastmodel (Single Android guest)


1. Refer section 1 for building the Fastmodel. 2. Run on the A15 Simulator with semi-hosting.Give Additional Model Command Line Options at runtime as -C motherboard.mmc.p_mmc_file =<android_temp_extracted_directory>/mmc.bin -C cluster.cpu0.semihostingcmd_line="--kernel <android_temp_extracted_directory>/boot/uImagewithDT --initrd <android_temp_extracted_directory>/boot/Initrd -- console=ttyAMA mem=512M mem=512M@0x880000000 androidboot.console=ttyAMA0 earlyprintk init=/init"

Page 21

SierraOS: Build and Boot Guide -

ARM fast models

Click OK and then run the android supported SierraOS.elf image

Page 22

SierraOS: Build and Boot Guide -

ARM fast models

Page 23

SierraOS: Build and Boot Guide -

ARM fast models

3 Steps for installing other packages:


1. Experimental support for openssl has been added. To enable openssl support , the following changes need to be made. (i) Download openssl-1.0.1c from http://www.openssl.org/source/openssl-1.0.1c.tar.gz and place it in /sierra/package/storage folder. Set CONFIG_CRYPTO and CONFIG_NEWLIB to "y" in packages/config.package The variable CROSS_COMPILE_NEWLIB should be made to point to the appropriate path. #export CROSS_COMPILE_NEWLIB=<supplied toolchain installed directory>/bin/arm-none-eabi2. Load the image SierraTEE.elf , which would be available in the bin directory. 3. The app can be tested by launching otzapp.elf as discussed previously.

(ii)

(iii)

#otzapp.elf

Page 24

SierraOS: Build and Boot Guide 2.

ARM fast models

Experimental support for ffmpeg has been added. To enable ffmpeg support , the following changes need to be made. (i) Download ffmpeg-git-26th-April-2012.tar.bz2 and place it in /sierra/package/storage folder. Set CONFIG_LIBSDL, CONFIG_FFMPEG and CONFIG_NEWLIB to "y" in packages/config.package The variable CROSS_COMPILE_NEWLIB should be made to point to the appropriate path. #export CROSS_COMPILE_NEWLIB=<supplied toolchain installed directory>/bin/arm-none-eabi-

(ii)

(iii)

2.

Load the image SierraTEE.elf, which would be available in the bin directory. The app can be tested by launching otz_play_media.elf as discussed previously.

3.

#otz_play_media.elf

Page 25

SierraOS: Build and Boot Guide -

ARM fast models

4 Components description
Path /sierra/otz_linux /sierra/otz_linux/patches /sierra/otz_linux/patches /sierra/otz_linux/patches /sierra/package/patches /sierra/sierra_sdk/sierraos/src Component ov_android.patch otz_hyp_linux1.patch otz_hyp_linux2.patch otz_linux_async.patc h openssl.patch apps apps/test_suite /sierra/sierra_sdk/sierraos/src arch Description Patch to support the android with open virtualization Patch for linux kernel guest 1 Patch for linux kernel guest 2 Patch to support the asynchronous Patch to support the openssl Sample secure OS applications Sample test application for secure OS tasks and Global platform API Architecture dependent codes Core modules of the secure OS like memory management, task handler Supported driver code Library routines for memory, string, etc.. Library routines for kernel Library routines for user Routines common for both

/sierra/sierra_sdk/sierraos/src /sierra/sierra_sdk/sierraos/src /sierra/sierra_sdk/sierraos/src

core drivers lib lib/kernel lib/user lib/common

Page 26

SierraOS: Build and Boot Guide -

ARM fast models

5 Configuration Flags
Flag TIMER_NOT_DEFINED Description Disables the secure timer support Enables support for booting SMP kernels in non secure world, Number of CONFIG_SW_MULTICORE cores to be enabled is selected by MAX_CORES macro Enables support for directly running CONFIG_SW_NOBOOTLOADER the secure world OS on target without running a bootloader Enables the L2 cache controller support CONFIG_CACHE_L2x0 in Secure OS. Enables the PL310 L2 Cache controller CONFIG_CACHE_PL310 support CONFIG_NEON_SUPPORT Enables the Neon co-processor support Enables the asynchronous support in OTZONE_ASYNC_NOTIFY_SUPPORT secure world CONFIG_ANDROID_GUEST Enables to boot Android guest Enables the boot wrapper support for NON_SECURE_BOOTWRAPPER_SUPPORT non-secure kernel (e.g ARM Fastmodel) CONFIG_SHELL Enables shell support. CONFIG_CRYPTO Enables the crypto to build CONFIG_FFMPEG Enables the ffmpeg to build

6 Additional Features:
6.1 Neon Support:
Enable the CONFIG_NEON_SUPPORT in sierra_sdk/Makefile CONFIG_NEON_SUPPORT :=y

Enable the Target flags in sierra_sdk/sierraos/config/config.<board> Uncomment the line -DCONFIG_NEON_SUPPORT=1 in both ASMFLAGS and CCFLAGS.

Page 27

SierraOS: Build and Boot Guide -

ARM fast models

6.2 DRM Plugin:


DRM plugin supported for Android ICS based systems. This feature is not currently supported in Fastmodel VE platform.

6.3 MMC:
eMMC driver support is added. This feature is not currently supported in Fastmodel VE platform.

6.4 Shell:
Enable the flag CONFIG_SHELL in sierra_sdk/sierraos/config/config.<board> CONFIG_SHELL := y Enable the Target flags in sierra_sdk/sierraos/config/config.<board> Uncomment the line -D CONFIG_SHELL = 1 in both ASMFLAGS and CCFLAGS.

Page 28

SierraOS: Build and Boot Guide -

ARM fast models

Page 29

Você também pode gostar