Re: [U-Boot] FIT Image Crashing

2016-12-20 Thread Jagan Teki
On Mon, Dec 19, 2016 at 10:23 PM, Kipper, Matthew
 wrote:
> Hi all,
>
> I'm working on a Zynq-7000 system that currently performs a "legacy" boot - 
> the kernel, device tree and initramfs are loaded independently into RAM, and 
> then they're all loaded by passing their addresses into 'bootm'. I'd like to 
> update this to a "moderm" boot, where the system loads a single FIT image 
> instead. This is my first exposure to FIT images - I thought I figured out 
> how to do this, but my system is crashing so I'm beginning to doubt myself ;)
>
> This is the "legacy" load sequence (output omitted):
>
> setenv bootargs "console=ttyPS0,115200 root=/dev/ram rw 
> ramdisk_size=0x160 earlyprintk init=/sbin/init"
> tftpboot 0x200 devicetree.dtb
> tftpboot 0x208 uImage
> tftpboot 0x400 initramfs.img
>
> Here's the output when I actually boot:

Questions apart, I've tried latest u-boot and linux-next on Microzed
board and able to boot if you need please see below.

its:

/dts-v1/;

/ {
description = "Verified RSA image with single Linux kernel and FDT blob";
#address-cells = <1>;

images {
kernel@1 {
description = "Zynq Linux kernel";
data = /incbin/("./vmlinux.bin.gz");
type = "kernel";
arch = "arm";
os = "linux";
compression = "gzip";
load = <0x8000>;
entry = <0x8000>;
hash@1 {
algo = "md5";
};
hash@2 {
algo = "sha1";
};
signature@1 {
algo = "sha1,rsa2048";
key-name-hint = "eng";
};
};
fdt@1 {
description = "Microzed Devicetree blob";
data = /incbin/("./zynq-microzed.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
hash@1 {
algo = "md5";
};
hash@2 {
algo = "sha1";
};
signature@1 {
algo = "sha1,rsa2048";
key-name-hint = "eng";
};
};
ramdisk@1 {
description = "Ramdisk Image";
data = /incbin/("./arm_ramdisk.image.gz");
type = "ramdisk";
arch = "arm";
os = "linux";
compression = "gzip";
hash@1 {
algo = "md5";
};
hash@2 {
algo = "sha1";
};
signature@1 {
algo = "sha1,rsa2048";
key-name-hint = "eng";
};
};

};

configurations {
default = "conf@1";
conf@1 {
description = "Boot Linux kernel with FDT blob and ramdisk";
kernel = "kernel@1";
fdt = "fdt@1";
ramdisk = "ramdisk@1";
};
};
};

Steps:
http://www.openedev.com/wiki/Microzed_Board#FIT

thanks!
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] FIT Image Crashing

2016-12-19 Thread Kipper, Matthew
Hi all,

I'm working on a Zynq-7000 system that currently performs a "legacy" boot - the 
kernel, device tree and initramfs are loaded independently into RAM, and then 
they're all loaded by passing their addresses into 'bootm'. I'd like to update 
this to a "moderm" boot, where the system loads a single FIT image instead. 
This is my first exposure to FIT images - I thought I figured out how to do 
this, but my system is crashing so I'm beginning to doubt myself ;)

This is the "legacy" load sequence (output omitted):

setenv bootargs "console=ttyPS0,115200 root=/dev/ram rw ramdisk_size=0x160 
earlyprintk init=/sbin/init"
tftpboot 0x200 devicetree.dtb
tftpboot 0x208 uImage
tftpboot 0x400 initramfs.img

Here's the output when I actually boot:

Zynq> bootm 0x208 0x400 0x200
## Booting kernel from Legacy Image at 0208 ...
   Image Name:   Linux-4.0.0-00011-gcfd1f62
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:3297728 Bytes = 3.1 MiB
   Load Address: 8000
   Entry Point:  8000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 0400 ...
   Image Name:   Ramdisk Image
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:22569621 Bytes = 21.5 MiB
   Load Address: 
   Entry Point:  
   Verifying Checksum ... OK
## Flattened Device Tree blob at 0200
   Booting using the fdt blob at 0x200
   Loading Kernel Image ... OK
   Loading Ramdisk to 1ea79000, end 1295 ... OK
   Loading Device Tree to 1ea73000, end 1ea78ba1 ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
[Omitted]

The kernel boots. All is well.

To replace this with a FIT image, I created a '.its' file and compiled it with 
'mkimage'. If it matters...


* I'm using the 'mkimage' binary in my u-boot/tools directory

* 'which dtc' points to the 'scripts/dtc' directory in the kernel tree 
that I'm using for my build

I won't post the entire '.its' file, but here is the output from 'mkimage':

FIT description: Test FIT Image
Created: Mon Dec 19 14:09:14 2016
Image 0 (kernel@1)
  Description:  Linux Kernel
  Created:  Mon Dec 19 14:09:14 2016
  Type: Kernel Image
  Compression:  uncompressed
  Data Size:3297792 Bytes = 3220.50 kB = 3.15 MB
  Architecture: ARM
  OS:   Linux
  Load Address: 0x8000
  Entry Point:  0x8000
Image 1 (fdt@1)
  Description:  Device Tree Blob
  Created:  Mon Dec 19 14:09:14 2016
  Type: Flat Device Tree
  Compression:  uncompressed
  Data Size:11170 Bytes = 10.91 kB = 0.01 MB
  Architecture: ARM
Image 2 (ramdisk@1)
  Description:  initramfs
  Created:  Mon Dec 19 14:09:14 2016
  Type: RAMDisk Image
  Compression:  gzip compressed
  Data Size:22569685 Bytes = 22040.71 kB = 21.52 MB
  Architecture: ARM
  OS:   Linux
  Load Address: 0x
  Entry Point:  0x
Default Configuration: 'conf@1'
Configuration 0 (conf@1)
  Description:  Boot Linux kernel with FDT blob
  Kernel:   kernel@1
  Init Ramdisk: ramdisk@1
  FDT:  fdt@1

To me, it looks like the FIT image was built correctly. The load addresses and 
entry points line up with what U-Boot reports during a "legacy" boot. But this 
is my first time using FIT images, so I'm not 100% sure that this is correct.

To load this image, I changed the command sequence to the following (output 
omitted):

setenv bootargs "console=ttyPS0,115200 root=/dev/ram rw ramdisk_size=0x160 
earlyprintk init=/sbin/init"
tftpboot 0x200 image.itb

All my bootargs are the same as before, but now I'm only loading a single FIT 
image into RAM rather than three separate images.

Here's what happens when I try to boot:

Zynq> bootm 0x200
## Loading kernel from FIT Image at 0200 ...
   Using 'conf@1' configuration
   Verifying Hash Integrity ... OK
   Trying 'kernel@1' kernel subimage
 Description:  Linux Kernel
 Type: Kernel Image
 Compression:  uncompressed
 Data Start:   0x02c4
 Data Size:3297792 Bytes = 3.1 MiB
 Architecture: ARM
 OS:   Linux
 Load Address: 0x8000
 Entry Point:  0x8000
   Verifying Hash Integrity ... OK
## Loading ramdisk from FIT Image at 0200 ...
   Using 'conf@1' configuration
   Trying 'ramdisk@1' ramdisk subimage
 Description:  initramfs
 Type: RAMDisk Image
 Compression:  gzip compressed
 Data Start:   0x02327f88
 Data Size:22569685 Bytes = 21.5 MiB
 Architecture: ARM
 OS:   Linux
 Load Address: 0x
 Entry Point:  0x
   Verifying Hash Integrity ... OK
## Loading fdt from FIT Image at 0200 ...
   Using 'conf@1' configuration
   Trying 'fdt@1' fdt subimage
 Description:  Device Tree Blob
 Type: Flat Device Tree
 Compression:  uncompressed
 Data Start:   0x02325370
 Data Size:11170