转自:https://tthtlc.wordpress.com/2015/02/21/getting-genode-with-trustzone-on-the-i-mx53-quick-start-board/
Posted February 21, 2015 by Peter Teoh in genode, i.MX53SQB. 5 Comments
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.confecho "RUN_OPT = --target uboot" >> etc/build.confmake 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 environmentIn: 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 … OKStarting 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……