Commit 6654f33c9b520bd4073c7f82a13044e79bc14898

Authored by Marek Vasut
Committed by Stefano Babic
1 parent 762a88ccf8

ARM: mxs: tools: Use mkimage for BootStream generation

Now that mkimage can generate an BootStream for i.MX23 and i.MX28,
use the mkimage as a default tool to generate the BootStreams instead
of the elftosb tool. This cuts out another obscure dependency.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Stefano Babic <sbabic@denx.de>

Showing 4 changed files with 41 additions and 17 deletions Side-by-side Diff

arch/arm/cpu/arm926ejs/mxs/Makefile
... ... @@ -25,14 +25,15 @@
25 25 $(call cmd_link_o_target, $(OBJS))
26 26  
27 27 # Specify the target for use in elftosb call
28   -ELFTOSB_TARGET-$(CONFIG_MX23) = imx23
29   -ELFTOSB_TARGET-$(CONFIG_MX28) = imx28
  28 +MKIMAGE_TARGET-$(CONFIG_MX23) = mx23
  29 +MKIMAGE_TARGET-$(CONFIG_MX28) = mx28
30 30  
31   -$(OBJTREE)/u-boot.bd: $(SRCTREE)/$(CPUDIR)/$(SOC)/u-boot-$(ELFTOSB_TARGET-y).bd
  31 +$(OBJTREE)/mxsimage.cfg: $(SRCTREE)/$(CPUDIR)/$(SOC)/mxsimage.$(MKIMAGE_TARGET-y).cfg
32 32 sed "s@OBJTREE@$(OBJTREE)@g" $^ > $@
33 33  
34   -$(OBJTREE)/u-boot.sb: $(OBJTREE)/u-boot.bin $(OBJTREE)/spl/u-boot-spl.bin $(OBJTREE)/u-boot.bd
35   - elftosb -zf $(ELFTOSB_TARGET-y) -c $(OBJTREE)/u-boot.bd -o $(OBJTREE)/u-boot.sb
  34 +$(OBJTREE)/u-boot.sb: $(OBJTREE)/u-boot.bin $(OBJTREE)/spl/u-boot-spl.bin $(OBJTREE)/mxsimage.cfg
  35 + $(OBJTREE)/tools/mkimage -n $(OBJTREE)/mxsimage.cfg -T mxsimage $@
  36 +
36 37  
37 38 #########################################################################
38 39  
arch/arm/cpu/arm926ejs/mxs/mxsimage.mx23.cfg
1 1 SECTION 0x0 BOOTABLE
2 2 TAG LAST
3   - LOAD 0x0 spl/u-boot-spl.bin
  3 + LOAD 0x0 OBJTREE/spl/u-boot-spl.bin
4 4 CALL 0x14 0x0
5   - LOAD 0x40000100 u-boot.bin
  5 + LOAD 0x40000100 OBJTREE/u-boot.bin
6 6 CALL 0x40000100 0x0
arch/arm/cpu/arm926ejs/mxs/mxsimage.mx28.cfg
1 1 SECTION 0x0 BOOTABLE
2 2 TAG LAST
3   - LOAD 0x0 spl/u-boot-spl.bin
  3 + LOAD 0x0 OBJTREE/spl/u-boot-spl.bin
4 4 LOAD IVT 0x8000 0x14
5 5 CALL HAB 0x8000 0x0
6   - LOAD 0x40000100 u-boot.bin
  6 + LOAD 0x40000100 OBJTREE/u-boot.bin
7 7 LOAD IVT 0x8000 0x40000100
8 8 CALL HAB 0x8000 0x0
... ... @@ -27,10 +27,26 @@
27 27 1) Prerequisites
28 28 ----------------
29 29  
30   -To make a MXS based board bootable, some tools are necessary. The first one is
31   -the "elftosb" tool distributed by Freescale Semiconductor. The other one is the
32   -"mxsboot" tool found in U-Boot source tree.
  30 +To make a MXS based board bootable, some tools are necessary. The only
  31 +mandatory tool is the "mxsboot" tool found in U-Boot source tree. The
  32 +tool is built automatically when compiling U-Boot for i.MX23 or i.MX28.
33 33  
  34 +The production of BootStream image is handled via "mkimage", which is
  35 +also part of the U-Boot source tree. The "mkimage" requires OpenSSL
  36 +development libraries to be installed. In case of Debian and derivates,
  37 +this is installed by running:
  38 +
  39 + $ sudo apt-get install libssl-dev
  40 +
  41 +NOTE: The "elftosb" tool distributed by Freescale Semiconductor is no
  42 + longer necessary for general use of U-Boot on i.MX23 and i.MX28.
  43 + The mkimage supports generation of BootStream images encrypted
  44 + with a zero key, which is the vast majority of use-cases. In
  45 + case you do need to produce image encrypted with non-zero key
  46 + or other special features, please use the "elftosb" tool,
  47 + otherwise continue to section 2). The installation procedure of
  48 + the "elftosb" is outlined below:
  49 +
34 50 Firstly, obtain the elftosb archive from the following location:
35 51  
36 52 ftp://ftp.denx.de/pub/tools/elftosb-10.12.01.tar.gz
... ... @@ -63,11 +79,6 @@
63 79 Make sure the "elftosb" binary can be found in your $PATH, in this case this
64 80 means "/usr/local/bin/" has to be in your $PATH.
65 81  
66   -Install the 'libssl-dev' package as well. On a Debian-based distribution, this
67   -package can be installed as follows:
68   -
69   - $ sudo apt-get install libssl-dev
70   -
71 82 2) Compiling U-Boot for a MXS based board
72 83 -------------------------------------------
73 84  
... ... @@ -111,6 +122,18 @@
111 122 The code produces "u-boot.sb" file. This file needs to be augmented with a
112 123 proper header to allow successful boot from SD or NAND. Adding the header is
113 124 discussed in the following chapters.
  125 +
  126 +NOTE: The process that produces u-boot.sb uses the mkimage to generate the
  127 + BootStream. The BootStream is encrypted with zero key. In case you need
  128 + some special features of the BootStream and plan on using the "elftosb"
  129 + tool instead, the invocation to produce a compatible BootStream with the
  130 + one produced by mkimage is outlined below. For further details, refer to
  131 + the documentation bundled with the "elftosb" package.
  132 +
  133 + $ elftosb -zf imx23 -c arch/arm/cpu/arm926ejs/mxs/u-boot-imx23.bd \
  134 + -o u-boot.sb
  135 + $ elftosb -zf imx28 -c arch/arm/cpu/arm926ejs/mxs/u-boot-imx28.bd \
  136 + -o u-boot.sb
114 137  
115 138 3) Installation of U-Boot for a MXS based board to SD card
116 139 ----------------------------------------------------------