Skip to contentSkip to conversation

powerpc/CoreNet: add tool to support pbl image build.

PATCH Superseded Shaohui Xie 3 participants 5 messages Jun 6, 2012 – Jun 7, 2012 1 message not in the archive Kbuild

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc/CoreNet: add tool to support pbl image build.

Provides a tool to build boot Image for PBL(Pre boot loader) which is used on Freescale CoreNet SoCs, PBL can be used to load some instructions and/or data for pre-initialization. The default output image is u-boot.pbl, for more details please refer to doc/README.pblimage.

---
 Makefile                                |    5 +
 board/freescale/corenet_ds/config.mk    |   26 +++
 board/freescale/corenet_ds/pblimage.cfg |   60 ++++++
 common/image.c                          |    1 +
 doc/README.pblimage                     |  138 +++++++++++++
 include/image.h                         |    1 +
 tools/Makefile                          |    2 +
 tools/mkimage.c                         |    5 +
 tools/mkimage.h                         |    2 +
 tools/pblimage.c                        |  325 +++++++++++++++++++++++++++++++
 tools/pblimage.h                        |   36 ++++
 11 files changed, 601 insertions(+), 0 deletions(-)
 create mode 100644 board/freescale/corenet_ds/config.mk
 create mode 100644 board/freescale/corenet_ds/pblimage.cfg
 create mode 100644 doc/README.pblimage
 create mode 100644 tools/pblimage.c
 create mode 100644 tools/pblimage.h
Makefile +5 -0
index 57ad45b..06f079f 100644
@@ -416,6 +416,10 @@ $(obj)u-boot.kwb:       $(obj)u-boot.bin
 		$(obj)tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \
 		-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $< $@
 
+$(obj)u-boot.pbl:	$(obj)u-boot.bin
+		$(obj)tools/mkimage -n $(CONFIG_PBL_CONFIG) -T pblimage \
+		-d $< $@
+
 $(obj)u-boot.sha1:	$(obj)u-boot.bin
 		$(obj)tools/ubsha1 $(obj)u-boot.bin
 
@@ -773,6 +777,7 @@ clobber:	tidy
 		$(obj)cscope.* $(obj)*.*~
 	@rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL-y)
 	@rm -f $(obj)u-boot.kwb
+	@rm -f $(obj)u-boot.pbl
 	@rm -f $(obj)u-boot.imx
 	@rm -f $(obj)u-boot.ubl
 	@rm -f $(obj)u-boot.ais
board/freescale/corenet_ds/config.mk new file +26 -0
new file mode 100644
index 0000000..2a0ab9d
@@ -0,0 +1,26 @@
+#
+# Copyright 2012 Freescale Semiconductor, Inc.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+ifeq ($(CONFIG_RAMBOOT_PBL), y)
+CONFIG_PBL_CONFIG = $(SRCTREE)/$(CONFIG_BOARDDIR)/pblimage.cfg
+ALL-y += $(obj)u-boot.pbl
+endif
board/freescale/corenet_ds/pblimage.cfg new file +60 -0

60 lines not on this page · raw message

common/image.c +1 -0
index 202c8a1..afc7155 100644
@@ -147,6 +147,7 @@ static const table_entry_t uimage_type[] = {
 	{	IH_TYPE_SCRIPT,     "script",	  "Script",		},
 	{	IH_TYPE_STANDALONE, "standalone", "Standalone Program", },
 	{	IH_TYPE_UBLIMAGE,   "ublimage",   "Davinci UBL image",},
+	{	IH_TYPE_PBLIMAGE,   "pblimage",   "Freescale PBL Boot Image",},
 	{	-1,		    "",		  "",			},
 };
 
doc/README.pblimage new file +138 -0

138 lines not on this page · raw message

include/image.h +1 -0
index bbf80f0..0913e35 100644
@@ -164,6 +164,7 @@
 #define IH_TYPE_OMAPIMAGE	12	/* TI OMAP Config Header Image	*/
 #define IH_TYPE_AISIMAGE	13	/* TI Davinci AIS Image		*/
 #define IH_TYPE_KERNEL_NOLOAD	14	/* OS Kernel Image, can run from any load address */
+#define IH_TYPE_PBLIMAGE	15	/* Freescale PBL Boot Image	*/
 
 /*
  * Compression Types
tools/Makefile +2 -0
index 64bcc4d..26f4927 100644
@@ -90,6 +90,7 @@ OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
 OBJ_FILES-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes.o
 NOPED_OBJ_FILES-y += aisimage.o
 NOPED_OBJ_FILES-y += kwbimage.o
+NOPED_OBJ_FILES-y += pblimage.o
 NOPED_OBJ_FILES-y += imximage.o
 NOPED_OBJ_FILES-y += omapimage.o
 NOPED_OBJ_FILES-y += mkenvimage.o
@@ -203,6 +204,7 @@ $(obj)mkimage$(SFX):	$(obj)aisimage.o \
 			$(obj)image.o \
 			$(obj)imximage.o \
 			$(obj)kwbimage.o \
+			$(obj)pblimage.o \
 			$(obj)md5.o \
 			$(obj)mkimage.o \
 			$(obj)os_support.o \
tools/mkimage.c +5 -0
index eeb1b10..ef76d94 100644
@@ -150,6 +150,8 @@ main (int argc, char **argv)
 	int retval = 0;
 	struct image_type_params *tparams = NULL;
 
+	/* Init Freescale PBL Boot image generation/list support */
+	init_pbl_image_type();
 	/* Init Kirkwood Boot image generation/list support */
 	init_kwb_image_type ();
 	/* Init Freescale imx Boot image generation/list support */
@@ -440,6 +442,9 @@ NXTARG:		;
 					break;
 				}
 			}
+		} else if (params.type == IH_TYPE_PBLIMAGE) {
+			/* PBL has special Image format, implements its' own */
+			pbl_load_uboot(ifd, &params);
 		} else {
 			copy_file (ifd, params.datafile, 0);
 		}
tools/mkimage.h +2 -0
index 5fe1a48..8465541 100644
@@ -147,6 +147,8 @@ void mkimage_register (struct image_type_params *tparams);
  *
  * Supported image types init functions
  */
+void pbl_load_uboot(int fd, struct mkimage_params *mparams);
+void init_pbl_image_type(void);
 void init_ais_image_type(void);
 void init_kwb_image_type (void);
 void init_imx_image_type (void);
tools/pblimage.c new file +325 -0

325 lines not on this page · raw message

tools/pblimage.h new file +36 -0
new file mode 100644
index 0000000..514a477
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2012 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef PBLIMAGE_H
+#define PBLIMAGE_H
+
+#define RCW_BYTES	64
+#define RCW_PREAMBLE	0xaa55aa55
+#define RCW_HEADER	0x010e0100
+
+struct pbl_header {
+	uint32_t preamble;
+	uint32_t rcwheader;
+	uint8_t rcw_data[RCW_BYTES];
+};
+
+#endif /* PBLIMAGE_H */
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v2 1/1 powerpc/CoreNet: add tool to support pbl image build.

Dear Shaohui Xie,

Quoted 4 lines · In message <[email protected]> you…

Provides a tool to build boot Image for PBL(Pre boot loader) which is used on Freescale CoreNet SoCs, PBL can be used to load some instructions and/or data for pre-initialization. The default output image is u-boot.pbl, for more details please refer to doc/README.pblimage.

...

Quoted 3 lines
board/freescale/corenet_ds/config.mk new file +0 -0
@@ -0,0 +1,26 @@

...

board/freescale/corenet_ds/config.mk line 26

Quoted 4 lines
board/freescale/corenet_ds/config.mk new file +4 -0
+ifeq ($(CONFIG_RAMBOOT_PBL), y)
+CONFIG_PBL_CONFIG = $(SRCTREE)/$(CONFIG_BOARDDIR)/pblimage.cfg
+ALL-y += $(obj)u-boot.pbl
+endif

I want to get rid if config.mk files to the extend possible - and here I see no need for a new one.

Please dump this.

Quoted 6 lines
board/freescale/corenet_ds/pblimage.cfg new file +0 -0
new file mode 100644
index 0000000..01003ce
@@ -0,0 +1,60 @@

...

board/freescale/corenet_ds/pblimage.cfg line 34

Quoted 6 lines
board/freescale/corenet_ds/pblimage.cfg new file +6 -0
+#64 bytes RCW data for P4080, replace it when building image
+#for P3041DS or P5020DS.
+4c580000 00000000 18185218 0000cccc
+40464000 3c3c2000 58000000 61000000
+00000000 00000000 00000000 008b6000
+00000000 00000000 00000000 00000000

You don;t expect us to edit this fiule just when building for another target? Please find a solution that works without editing source files.

common/image.c static const table_entry_t uimage_type[] = { · line 150

Quoted 9 lines
common/image.c +1 -0
index 202c8a1..afc7155 100644
@@ -147,6 +147,7 @@ static const table_entry_t uimage_type[] = {
 	{	IH_TYPE_SCRIPT,     "script",	  "Script",		},
 	{	IH_TYPE_STANDALONE, "standalone", "Standalone Program", },
 	{	IH_TYPE_UBLIMAGE,   "ublimage",   "Davinci UBL image",},
+	{	IH_TYPE_PBLIMAGE,   "pblimage",   "Freescale PBL Boot Image",},

Please keep/make list sorted.

doc/README.pblimage line 6

Quoted 9 lines
doc/README.pblimage new file +6 -0
@@ -0,0 +1,138 @@
+------------------------------------------------------------------
+Freescale PBL(pre-boot loader) Boot Image generation using mkimage
+------------------------------------------------------------------
+
+This document describes the U-Boot feature as it
+is implemented for the Freescale CoreNet SoC.

Is it also implemented for other SoCs, differently? If not, then this is redundant and should be removed.

doc/README.pblimage line 10

Quoted 3 lines
doc/README.pblimage new file +3 -0
+The CoreNet SoC's can boot directly from eSPI FLASH, SD/MMC and
+NAND, etc. For more details refer section 5 Pre-boot loader
+specifications.

section 5 of which document? Provide title and URL.

doc/README.pblimage line 28

Quoted 9 lines
doc/README.pblimage new file +9 -0
+   For eSPI boot:
+	To build the eSPI boot image for P4080DS:
+	make P4080DS_SPIFLASH
+
+	To build the eSPI boot image for P3041DS:
+	make P3041DS_SPIFLASH
+
+	To build the eSPI boot image for P5020DS:
+	make P5020DS_SPIFLASH

Come on, this doesn't scale. Why not simply:

make <name>_SPIFLASH

?

doc/README.pblimage line 50

Quoted 3 lines
doc/README.pblimage new file +3 -0
+2. Command below provided a way to re-build the PBL boot image if the
+configuration file needes to be modified while the u-boot.bin does not
+need to be re-built.

Fix spelling and grammar.

Also, such a command should never be necessary - the "make" system should catch any such situations automatically. If it doesn't, then please fix this.

doc/README.pblimage line 96

Quoted 4 lines
doc/README.pblimage new file +4 -0
+Board specific configuration file specifications:
+------------------------------------------------
+1. This file must present in the $(BOARDDIR) and the name should be
+	pblimage.cfg (since this is used in Makefile)

WHo knows what $(BOARDDIR) might be? s/should/must/

Quoted 13 lines
tools/Makefile +1 -0
index 64bcc4d..26f4927 100644
@@ -90,6 +90,7 @@ OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
 OBJ_FILES-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes.o
 NOPED_OBJ_FILES-y += aisimage.o
 NOPED_OBJ_FILES-y += kwbimage.o
+NOPED_OBJ_FILES-y += pblimage.o
 NOPED_OBJ_FILES-y += imximage.o
 NOPED_OBJ_FILES-y += omapimage.o
 NOPED_OBJ_FILES-y += mkenvimage.o

tools/Makefile $(obj)mkimage$(SFX): $(obj)aisimage.o \ · line 210

Quoted 7 lines
tools/Makefile +1 -0
@@ -203,6 +204,7 @@ $(obj)mkimage$(SFX):	$(obj)aisimage.o \
 			$(obj)image.o \
 			$(obj)imximage.o \
 			$(obj)kwbimage.o \
+			$(obj)pblimage.o \
 			$(obj)md5.o \
 			$(obj)mkimage.o \
 			$(obj)os_support.o \

Should we make this code conditional? Most users will never need it.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
When a woman marries again it is because she detested her first  hus-
band.  When  a  man  marries again, it is because he adored his first
wife.                                                  -- Oscar Wilde
#2 lore raw

PATCH v2 1/1 powerpc/CoreNet: add tool to support pbl image build.

Quoted 15 lines · Wolfgang Denk

Dear Shaohui Xie,

doc/README.pblimage line 28

Quoted 9 lines · In message <[email protected]> you…
doc/README.pblimage new file +9 -0
+   For eSPI boot:
+	To build the eSPI boot image for P4080DS:
+	make P4080DS_SPIFLASH
+
+	To build the eSPI boot image for P3041DS:
+	make P3041DS_SPIFLASH
+
+	To build the eSPI boot image for P5020DS:
+	make P5020DS_SPIFLASH

Come on, this doesn't scale. Why not simply:

Quoted 3 lines

make <name>_SPIFLASH

?

Listing all boards here isn't the right answer, but some targets might have other orthogonal options to be specified, so the pattern wouldn't necessarily hold.

-Scott

A message that is not in the archive (sent off-list or not yet received): ED492CCEAF882048BC2237DE806547C907968C56@039-SN2MPN1-012.039d.mgd.msft.net

#4 lore raw

PATCH v2 1/1 powerpc/CoreNet: add tool to support pbl image build.

Dear Xie Shaohui-B21989,

Quoted 4 lines · In message <ED492CCEAF882048BC2237DE806547C907968C56@039-SN2MPN1-012.039d.mgd.m…
Quoted 3 lines

I want to get rid if config.mk files to the extend possible - and here I see no need for a new one.

[Xie Shaohui] Actually, I was hesitate to use the config.mk file, I found other person define the "CONFIG_XXX_CONFIG" in header files, but when I tried the same way, the checkpatch.pl complained that $(SRCTREE)/$(CONFIG_BOARDDIR)/pblimage.cfg should be wrapped by Parentheses, but the Parentheses will make the cfg file cannot be found because the Parentheses was included in path of the cfg file. Should I ignore the complain of the checkpatch.pl?

Yes.

And please - restrict your line length so some 70 characters or so. Thanks.

Quoted 4 lines
Quoted 2 lines

You don;t expect us to edit this fiule just when building for another target? Please find a solution that works without editing source files.

[Xie Shaohui] Maybe I should have another file for RCW...
Just building does not need to edit this file; this is only needed for real board.

This is what I mean - it is mandatory that you can build U-Boot for any real board without modifying any source files, and with only including files that are checked in into the git repository.

Quoted 4 lines
Quoted 3 lines

Also, such a command should never be necessary - the "make" system should catch any such situations automatically. If it doesn't, then please fix this.

[Xie Shaohui] It *is* not necessary, for ex I've built a boot Image, but I want to try another configuration file, I only need to run this command with new configuration file, I do not need to rebuild everything.

Yes, but this should be covered by the Makefile - the user should never need to know any such internal details.

Quoted 1 line

[Xie Shaohui] I just followed what people done. A bad day for me...

Not really. Don't be frustrated. These were actually very few remarks on pretty long and complex code.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In my experience the best way to get something done  is to give it to
someone who is busy.               - Terry Pratchett, _Going_Postal_
#5 lore raw

PATCH v2 1/1 powerpc/CoreNet: add tool to support pbl image build.

In reply to Shaohui Xie

Dear Shaohui Xie,

Quoted 10 lines · In message <[email protected]> you…

Provides a tool to build boot Image for PBL(Pre boot loader) which is used on Freescale CoreNet SoCs, PBL can be used to load some instructions and/or data for pre-initialization. The default output image is u-boot.pbl, for more details please refer to doc/README.pblimage.

---
 Makefile                                |    5 +
 board/freescale/corenet_ds/config.mk    |   26 +++
 board/freescale/corenet_ds/pblimage.cfg |   60 ++++++

...

BTW: The subject says V2, but there is no change log. This is mandatory!!

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Our way is peace.
	-- Septimus, the Son Worshiper, "Bread and Circuses",
	   stardate 4040.7.