[U-Boot] [PATCH 2/7] ls102xa: pblimage: Add pblimage tool support for LS102xA

Huan Wang
2014-09-22T06:22:44Z

Hi, Albert,

> On Thu, 18 Sep 2014 13:47:14 +0800, Alison Wang <b18965@freescale.com>
> wrote:
>
> > @@ -111,6 +115,14 @@ static void pbl_parser(char *name)
> > size_t len = 0;
> >
> > fname = name;
> > +
> > + if (strstr(fname, "ls102xa")) {
> > + next_pbl_cmd = 0x8101a000;
> > + pbl_cmd_initaddr = 0x8101a000;
> > + pbi_crc_cmd1 = 0x61;
> > + pbi_crc_cmd2 = 0;
> > + }
>
> Basing the tool's behaviour on the file name is not a good approach IMO.
> Can't we add some command line option to the tool to select the right
> set of values?

[Alison Wang] Yes, it is really not a good approach. How about this command line approach?

diff --git a/Makefile b/Makefile
index d4a3899..db38112 100644
--- a/Makefile
+++ b/Makefile
@@ -976,8 +976,14 @@ endif
#Add a target to create boot binary having SPL binary in PBI format
#concatenated with u-boot binary. It is need by PowerPC SoC having
#internal SRAM <= 512KB.
+ifdef CONFIG_SPL_PBL_PAD
+MKIMAGEFLAGS_u-boot-spl.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
+ -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage \
+ -A $(ARCH) -a $(CONFIG_SPL_PBL_CMD_ADDR)
+else
MKIMAGEFLAGS_u-boot-spl.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
-R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
+endif

diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h
index 191caef..4fd25ab 100644
--- a/include/configs/ls1021atwr.h
+++ b/include/configs/ls1021atwr.h
@@ -60,6 +60,7 @@
#define CONFIG_SPL_STACK 0x1001d000
#define CONFIG_SPL_PAD_TO 0x1c000
#define CONFIG_SYS_TEXT_BASE 0x82000000
+#define CONFIG_SPL_PBL_CMD_ADDR 0x8101a000

diff --git a/tools/pblimage.c b/tools/pblimage.c
index 152678b..9eae0e4 100644
--- a/tools/pblimage.c
+++ b/tools/pblimage.c+int pblimage_check_params(struct image_tool_params *params)
+{
+ if (!params)
+ return EXIT_FAILURE;
+
+ if (params->arch == IH_ARCH_ARM) {
+ pbi_crc_cmd1 = 0x61;
+ pbi_crc_cmd2 = 0;
+ pbl_cmd_initaddr = params->addr;
+ next_pbl_cmd = pbl_cmd_initaddr;
+ }
+
+ return 0;
+};
+
/* pblimage parameters */
static struct image_type_params pblimage_params = {
.name = "Freescale PBL Boot Image support",
.header_size = sizeof(struct pbl_header),
.hdr = (void *)&pblimage_header,
.check_image_type = pblimage_check_image_types,
+ .check_params = pblimage_check_params,
.verify_header = pblimage_verify_header,

Best Regards,
Alison Wang