Getting Genode with TrustZone on the i.MX53 Quick Start Board

DSC_0124

First download the toolchain for ARM compilation, and then the Genode OS itself, all listed here:

http://sourceforge.net/projects/genode/files/

Details description of Genode and its installation are found here:

http://genode.org/documentation/developer-resources/getting_started

http://genode.org/documentation/release-notes/14.11

https://github.com/genodelabs/genode/blob/master/doc/getting_started.txt

Install all the necessary packages for Ubuntu 14.04 (present host):

apt-get install libSDL-dev
apt-get install libsdl1.2-dev -> shows it is already newest version
apt-get install tk8.5 tcl8.5
apt-get install expect
apt-get install byacc
apt-get install qemu
apt-get install genisoimage
sudo apt-get install expect
sudo apt-get install udisks

After untarring the genode toolchain /usr/local/genode-gcc directory, next is to untar the Genode OS download to “genode-14.11”.

With some assistance as documented here:

http://sourceforge.net/p/genode/mailman/message/33465225/

cd genode-14.11/
cd tool/

Listing all the hardware:

./create_builddir

‘linux_x86’
‘linux_arm’
‘fiasco_x86’
‘pistachio_x86’
‘okl4_x86’
‘nova_x86_32’
‘nova_x86_64’
‘codezero_vpb926’
‘hw_panda’
‘hw_vea9x4’
‘hw_vea9x4_tz’
‘hw_pbxa9’
‘hw_imx31’
‘hw_imx53’
‘hw_imx53_tz’
‘hw_arndale’
‘hw_odroid_xu’
‘hw_rpi’
‘foc_x86_32’
‘foc_x86_64’
‘foc_pbxa9’
‘foc_imx53’
‘foc_vea9x4’
‘foc_panda’
‘foc_arndale’
‘lx_hybrid_x86’

Now we set the hardware to be imx53:

./create_builddir hw_imx53_tz BUILD_DIR=build_imx53
cd build_imx53/

Setting up it for uboot as the bootloader:

echo "SPECS += trustzone" >> etc/specs.conf
echo "RUN_OPT = --target uboot" >> etc/build.conf
make run/tz_vmm

After this “uImage” is generated in the build_imx53/var/run.

Now, to download u-boot bootloader (and its ARM gcc compiler):

git clone https://github.com/m-stein/uboot uboot_stein

cd uboot_stein/

wget http://releases.linaro.org/14.09/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.9-2014.09_linux.tar.xz

Extract out the config file:

make ARCH=arm CROSS_COMPILE=/opt/gcc-linaro-arm-none-eabi-4.9-2014.09_linux/bin/arm-none-eabi- usbarmory_config

Now start the make process:

make ARCH=arm CROSS_COMPILE=/opt/gcc-linaro-arm-none-eabi-4.9-2014.09_linux/bin/arm-none-eabi- V=1

Notice a “u-boot.imx” is created. But first we need to format the sdcard.

(from hence onwards my sdcard is detected as /dev/sdg???):

Aim: make a sdcard from uImage, which will require uboot bootloader:

sudo parted /dev/sdg –script mklabel msdos

sudo parted /dev/sdg –script mkpart primary ext4 5M 100%

Upon completion, “dd” the u-boot.imx (which is meant for imx53 as the target) to the sdcard’s 3rd 512-block:

sudo dd if=./u-boot.imx of=/dev/sdg seek=2 bs=512 conv=fsync

Take a look at the partition:

sudo fdisk -l /dev/sdg

sudo mkfs.ext4 /dev/sdg1

Now /dev/sdg1 is ext4-formatted, mount it:

udisks –mount /dev/sdg1

Copy the uImage there to the rootfs:

cp uImage /media/371a8dd7-58c1-4beb-aed3-cb18fb40f7eb/

And umount it:

sudo udisks –umount /dev/sdg1

Now insert the sdcard into i.MX53QSB and connect via serial port, bootup message as follows:

U-Boot 2014.07-g0ca0b0f (Feb 20 2015 – 09:14:08)

Board: USB armory
I2C: ready
DRAM: 256 MiB
MMC: FSL_SDHC: 0, FSL_SDHC: 1
*** Warning – bad CRC, using default environment

In: serial
Out: serial
Err: serial
Net: CPU Net Initialization Failed
No ethernet found.
Hit any key to stop autoboot: 0

=> ext2ls
ext2ls – list files in a directory (default /)

Usage:
ext2ls <interface> <dev[:part]> [directory]
– list files from ‘dev’ on ‘interface’ in a ‘directory’

=> ext2ls mmc 0:1
<DIR> 4096 .
<DIR> 4096 ..
<DIR> 16384 lost+found
7860111 uImage

=> ext2load mmc 0:1 0x70200000 uImage
7860111 bytes read in 583 ms (12.9 MiB/s)

=> bootm 0x70200000
## Booting kernel from Legacy Image at 70200000 …
Image Name:
Image Type: ARM Linux Kernel Image (gzip compressed)
Data Size: 7860047 Bytes = 7.5 MiB
Load Address: 70010000
Entry Point: 70010000
Verifying Checksum … OK
Uncompressing Kernel Image … OK

Starting kernel …

kernel initialized
Genode 14.11
int main(): — create local services —
int main(): — start init —
int main(): transferred 246 MB to init
int main(): — init created, waiting for exit condition —
[init] Could not open file “ld.lib.so
[init] parent provides
[init] service “ROM”
[init] service “RAM”
[init] service “IRQ”
[init] service “IO_MEM”
[init] service “CAP”
[init] service “PD”
[init] service “RM”
[init] service “CPU”
[init] service “LOG”
[init] service “SIGNAL”
[init] service “VM”
[init] child “tz_vmm”
[init] RAM quota: 3932160
[init] ELF binary: tz_vmm
[init] priority: 0
[init -> tz_vmm] Start virtual machine …
undefined instruction

More debugging needed……

Advertisements

8 responses to this post.

  1. additional requirements (libncurses5-dev):

    https://github.com/genodelabs/genode/issues/62

    Reply

  2. If just TrustZone with QEMU is needed, then just follow the entire steps here:

    https://github.com/ckuethe/usbarmory/wiki/QEMU-Virtual-Armory

    vexpress_defconfig will setup the environment that is compatible with QEMU.

    Reply

  3. Posted by skalk on March 12, 2015 at 8:33 pm

    Please do not use the u-boot for USB Armory when actually using the i.MX53 Quickstart Board. Other people already start to wrongly copy this method. Use another u-boot image, e.g.: follow this instructions for building u-boot for i.MX53 QSB: https://www.eewiki.net/display/linuxonarm/i.MX53+Quick+Start#i.MX53QuickStart-Bootloader:U-Boot

    Reply

  4. Hi, I have followed the above steps for iMX6 Sabre SDBoard. But the board is not booting.
    It is saying:
    Booting kernel from Legacy Image at 10800000 …

    Image Name:

    Image Type: ARM Linux Kernel Image (gzip compressed)

    Data Size: 7858662 Bytes = 7.5 MB

    Load Address: 10001000

    Entry Point: 10001000

    Verifying Checksum … Bad Data CRC

    ERROR: can’t get kernel image!

    What might be wrong?

    Reply

  5. I have given the following commands:

    sudo dd if=uBoot of=/dev/sdc bs=512 seek=2 conv=fsync
    sudo dd if=uImage of=/dev/sdc bs=512 seek=2048 conv=fsync

    Reply

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: