powerpc/CoreNet: add tool to support pbl image build.
PATCH 1/1 powerpc/CoreNet: add tool to support pbl image build.
From: Shaohui Xie <[email protected]>
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.
---
rebased to lasted tree.
Makefile | 5 + board/freescale/corenet_ds/config.mk | 26 +++ board/freescale/corenet_ds/pblimage.cfg | 60 ++++++ common/image.c | 1 + doc/README.pblimage | 140 +++++++++++++ include/image.h | 1 + tools/Makefile | 2 + tools/mkimage.c | 5 + tools/mkimage.h | 2 + tools/pblimage.c | 329 +++++++++++++++++++++++++++++++ tools/pblimage.h | 36 ++++ 11 files changed, 607 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
@@ -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
@@ -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
@@ -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 +140 -0
140 lines not on this page · raw message
include/image.h +1 -0
@@ -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
@@ -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
@@ -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, ¶ms); }else {copy_file (ifd, params.datafile,0 ); }
tools/mkimage.h +2 -0
@@ -147,6 +147,8 @@ void mkimage_register (struct image_type_params *tparams);* * Supported image types init functions */ +void pbl_load_uboot (int ,struct mkimage_params *); +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 +329 -0
329 lines not on this page · raw message
tools/pblimage.h new file +36 -0
@@ -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.6.4
PATCH 1/1 powerpc/CoreNet: add tool to support pbl image build.
Quoted 34 lines · Shaohui Xie
From: Shaohui Xie <[email protected]>
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.
Signed-off-by Shaohui Xie <[email protected]>---
rebased to lasted tree.Makefile | 5 + board/freescale/corenet_ds/config.mk | 26 +++ board/freescale/corenet_ds/pblimage.cfg | 60 ++++++ common/image.c | 1 + doc/README.pblimage | 140 +++++++++++++ include/image.h | 1 + tools/Makefile | 2 + tools/mkimage.c | 5 + tools/mkimage.h | 2 + tools/pblimage.c | 329 +++++++++++++++++++++++++++++++ tools/pblimage.h | 36 ++++ 11 files changed, 607 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.hMakefile +0
-0
Makefile $(obj)u-boot.kwb: $(obj)u-boot.bin · line 417
Quoted 2 lines
Makefile +0
-0@@ -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 $< $@
*>
Quoted 37 lines
Makefile +5
-0+$(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.aisboard/freescale/corenet_ds/config.mk new file +16
-0@@ -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. +#
board/freescale/corenet_ds/config.mk line 26
Quoted 10 lines
board/freescale/corenet_ds/config.mk new file +10
-0+# 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
Why is this specific to corenet_ds?
Quoted 30 lines
board/freescale/corenet_ds/pblimage.cfg new file +24
-0@@ -0,0 +1,60 @@ +# +# Copyright 2012 Freescale Semiconductor, Inc. +# Written-by: Shaohui Xie<[email protected]> +# +# 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., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +# Refer docs/README.pblimage for more details about how-to configure +# and create PBL boot image
board/freescale/corenet_ds/pblimage.cfg line 34
Quoted 10 lines
board/freescale/corenet_ds/pblimage.cfg new file +10
-0+# + +#PBL preamble and RCW header +aa55aa55 010e0100 +#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
Could you have the tool source this from a separate file, rather than require the user to replace it manually?
Talk to Timur (when he gets back from vacation in a couple weeks) about his RCW tool and how best to accept the output it produces.
Quoted 15 lines
board/freescale/corenet_ds/pblimage.cfg new file +15
-0+#PBI commands +#Initialize CPC1 +09010000 00200400 +09138000 00000000 +091380c0 00000100 +09010100 00000000 +09010104 fff0000b +09010f00 08000000 +09010000 80000000 +#Configure LAW for CPC1 +09000d00 00000000 +09000d04 fff00000 +09000d08 81000013 +09000010 00000000 +09000014 ff000000
board/freescale/corenet_ds/pblimage.cfg line 60
Quoted 10 lines
board/freescale/corenet_ds/pblimage.cfg new file +10
-0+09000018 81000000 +#Initialize eSPI controller +09110000 80000403 +09110020 2d170008 +09110024 00100008 +09110028 00100008 +0911002c 00100008 +#Flush PBL data +09138000 00000000 +091380c0 00000000
Why is eSPI in here? Isn't this supposed to just generically write an image into CPC SRAM?
Quoted 90 lines
doc/README.pblimage new file +82
-0@@ -0,0 +1,140 @@ +------------------------------------------------------------------ +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. + +The CoreNet SoC's can boot directly from eSPI FLASH, SD/MMC. + +for more details refer section 5 Pre-boot loader specifications. + +Building PBL Boot Image and boot steps +-------------------------------------- + +1. Building PBL Boot Image. + The default Image is u-boot.pbl. Before build the iamge, make sure + rcw data in pblimage.cfg is suitable for the platform, if not, this + need to be fixed in step 2. + + 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 + + For SD boot: + To build the SD boot image for P4080DS: + make P4080DS_SDCARD + + To build the SD boot image for P3041DS: + make P3041DS_SDCARD + + To build the SD boot image for P5020DS: + make P5020DS_SDCARD + + For Nand boot(P4080DS does not have Nand chip): + To build the PBL boot image for P3041DS: + make P3041DS_NAND + + To build the PBL boot image for P5020DS: + make P5020DS_NAND + + +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-build. + +Command syntax: +-------------- +./tools/mkimage -n <board specific configuration file> \ + -T pblimage -d <input_raw_binary> <output_pblboot_file> + +for ex. +./tools/mkimage -n ./board/freescale/corenet_ds/pblimage.cfg \ + -T pblimage -d u-boot.bin u-boot.pbl + + +3. pblimage support available with mkimage utility will generate Freescale PBL +boot image that can be flashed on the board eSPI flash, SD/MMC. Following steps +described how to boot from eSPI flash, SD/MMC. + + 1). Boot from eSPI flash + Write u-boot.pbl to eSPI flash from offset 0x0. + for ex in u-boot: + =>tftp 100000 u-boot.pbl + =>sf probe 0 + =>sf erase 0 100000 + =>sf write 100000 0 $filesize + Change SW1[1:5] = off off on off on. + + 2). Boot from SD/MMC + Write u-boot.pbl to SD/MMC from offset 0x1000. + for ex in u-boot: + =>tftp 100000 u-boot.pbl + =>mmcinfo + =>mmc write 100000 8 441 + Change SW1[1:5] = off off on on off. +
doc/README.pblimage line 92
Quoted 10 lines
doc/README.pblimage new file +10
-0+ 3). Boot from Nand + Write u-boot.pbl to Nand from offset 0x0, Note that in case of eLBC NAND + flash, the address starts from the first good block. + for ex in u-boot: + =>tftp 100000 u-boot.pbl + =>nand info + =>nand erase 0 100000 + =>nand write 100000 0 $filesize + Change SW1[1:5] = off on off off on + Change SW7[1:4] = on off off on
How do you load the environment? We should find a way, possibly using SPL, to have the environment ready early. We do not want to wait post relocation for the full NAND/SD/SPI driver to load the environment.
tools/mkimage.h void mkimage_register (struct image_type_params *tparams); · line 150
Quoted 9 lines
tools/mkimage.h +1
-0@@ -147,6 +147,8 @@ void mkimage_register (struct image_type_params *tparams);* * Supported image types init functions */ +void pbl_load_uboot (int ,struct mkimage_params *);
Please provide names for parameters.
tools/mkimage.h void mkimage_register (struct image_type_params *tparams);
Quoted 5 lines
tools/mkimage.h +5
-0+/* +* PBL can load 64 bytes each time in MAX, so the u-boot need to be splited into +* pieces of 64 bytes, PBL needs a command for each piece, the command looks +* like 81xxxxxx, the "xxxxxx" is offset, it starts from F80000 in our case. +*/
Better wording:
The PBL can load up to 64 bytes at a time, so we split the U-Boot image into 64 byte chunks. PBL needs a command for each piece, of the form "81xxxxxx", where "xxxxxx" is the offset.
Why are we hardcoding 0xf80000? Where does it come from?
Quoted 1 line
+static unsigned int
uboot_label=0x81F80000;
I'm not sure that label is the right word here. Maybe "next_pbl_cmd"?
tools/mkimage.h
Quoted 5 lines
tools/mkimage.h +5
-0+/* +* need to store all bytes in memory for calculating crc32, then write the +* bytes to image file for PBL boot. +*/ +static unsigned char mem_buf[600000 ];
600000 is arbitrary. Do you have any checking if the image size exceeds this? Can you dynamically allocate the buffer instead?
tools/mkimage.h
Quoted 2 lines
tools/mkimage.h +2
-0+static unsigned char *pmem_buf = mem_buf; +static int mem_byte_cnt;
s/mem_byte_cnt/pbl_size/
tools/mkimage.h
Quoted 9 lines
tools/mkimage.h +9
-0+static char *fname ="Unknown" ; +static int lineno =-1 ; +static struct pbl_header pblimage_header; + +static union +{ +char c[4 ]; +unsigned char l; +} endian_test = { {'l' ,'?' ,'?' ,'b' } };
Please fix whitespace.
tools/mkimage.h
Quoted 5 lines
tools/mkimage.h +5
-0+#define ENDIANNESS ((char)endian_test.l) + +static void generate_pbl_cmd (void ) +{ +unsigned int val = uboot_label;
s/unsigned int/uint32_t/
Quoted 4 lines
tools/mkimage.h +4
-0+ uboot_label +=0x40 ; +int i; + +for (i =3 ; i >=0 ; i--) {
tools/mkimage.h
Quoted 10 lines
tools/mkimage.h +10
-0+ *pmem_buf++ = (val >> (i *8 )) &0xff ; + mem_byte_cnt++; + } +} + +static void pbl_fget (size_t size,FILE *stream) +{ +unsigned char c; +while (size) { + c = (unsigned char )fgetc (stream);
Check for fgetc() returning EOF before converting to unsigned char.
Quoted 1 line
+/* load splited u-boot with PBI command 81xxxxxx. */
s/splited/split/
Quoted 7 lines
tools/mkimage.h +7
-0+static void pbl_parser (char *name) +{ +FILE *fd =NULL ; +char *line =NULL ; +char *token, *saveptr1, *saveptr2; +size_t len =0 ; +
tools/mkimage.h
Quoted 10 lines
tools/mkimage.h +10
-0+ fname = name; + fd =fopen (name,"r" ); +if (fd ==NULL ) { +printf ("Error:%s - Can't open\n" , fname); +exit (EXIT_FAILURE ); + } + +while ((getline (&line, &len, fd)) >0 ) { + lineno++; + token =strtok_r (line,"\r\n" , &saveptr1);
Why do you need to tokenize if you're using getline()?
Quoted 35 lines
tools/mkimage.h +35
-0+static uint32_t crc_table[256 ]; + +static void make_crc_table (void ) +{ +uint32_t mask; +int i, j; +uint32_t poly;/* polynomial exclusive-or pattern */ + +/* +* the polynomial used by PBL is 1 + x1 + x2 + x4 + x5 + x7 + x8 + x10 +* + x11 + x12 + x16 + x22 + x23 + x26 + x32. +*/ + poly =0x04c11db7 ; + +for (i =0 ; i <256 ; i++) { + mask = i <<24 ; +for (j =0 ; j <8 ; j++) { +if (mask &0x80000000 ) + mask = (mask <<1 ) ^ poly; +else + mask <<=1 ; + } + crc_table[i] = mask; + } +} + +unsigned long pbl_crc32 (unsigned long crc,const char *buf,unsigned int len) +{ +unsigned int crc32_val =0xffffffff ; +unsigned int xor =0x0 ; +int i; + +make_crc_table (); + +for (i =0 ; i < len; i++)
tools/mkimage.h
Quoted 10 lines
tools/mkimage.h +10
-0+ crc32_val = (crc32_val <<8 ) ^ + crc_table[(crc32_val >>24 ) ^ (*buf++ &0xff )]; + + crc32_val = crc32_val ^ xor; +if (crc32_val <0 ) { + crc32_val +=0xffffffff ; + crc32_val +=1 ; + } +return crc32_val; +}
Is this the standard CRC32 function (which we should be able to pull in from elsewhere instead of reimplementing here) or is it something different (which deserves a comment)?
Quoted 8 lines
tools/mkimage.h +8
-0+static unsigned int reverse_byte (unsigned int val) +{ +unsigned int temp; +unsigned char *p1; +int j; + + temp = val; + p1 = (unsigned char *)&temp;
tools/mkimage.h
Quoted 10 lines
tools/mkimage.h +10
-0+for (j =3 ; j >=0 ; j--) + *p1++ = (val >> (j *8 )) &0xff ; +return temp; +} + +/* write end command and crc command to memory. */ +static void add_end_cmd (void ) +{ +unsigned int pbl_end_cmd[4 ] = {0x09138000 ,0x00000000 , +0x091380c0 ,0x00000000 };
s/unsigned int/uint32_t/
tools/mkimage.h
Quoted 8 lines
tools/mkimage.h +8
-0+unsigned int crc32_pbl; +int i; +unsigned char *p = (unsigned char *)&pbl_end_cmd; + +if (ENDIANNESS =='l' ) { +for (i =0 ; i <4 ; i++) + pbl_end_cmd[i] =reverse_byte (pbl_end_cmd[i]); + }
Can you use htonl() or similar, to avoid the endian test? Or have a function to write out a 32-bit word by bytes, similar to what you open-code in generate_pbl_cmd().
tools/mkimage.h
Quoted 4 lines
tools/mkimage.h +4
-0+for (i =0 ; i <16 ; i++) { + *pmem_buf++ = *p++; + mem_byte_cnt++; + }
memcpy()?
tools/mkimage.h
Quoted 1 line
tools/mkimage.h +1
-0+if (((mem_byte_cnt) %16 ) !=0 ) {
Unnecessary parentheses.
tools/mkimage.h
Quoted 11 lines
tools/mkimage.h +11
-0+for (i =0 ; i <8 ; i++) { + *pmem_buf++ =0x0 ; + mem_byte_cnt++; + } + } +if ((mem_byte_cnt %16 !=0 )) { +printf ("Error: Bad size of image file\n" ); +exit (EXIT_FAILURE ); + } + +}
No blank line at end of block.
Quoted 20 lines
tools/pblimage.h new file +14
-0@@ -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
tools/pblimage.h line 24
Quoted 10 lines
tools/pblimage.h new file +10
-0+* 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_
s/_PBLIMAGE_H_/PBLIMAGE_H/
Leading underscores are reserved to the C implementation when followed by an uppercase letter or another underscore, or when in file scope.
I know most of the other tools/ headers do this, but it's wrong.
-Scott
PATCH 1/1 powerpc/CoreNet: add tool to support pbl image build.
Quoted 74 lines
-----Original Message-----
From: Wood Scott-B07421
Sent: Tuesday, June 05, 2012 8:33 AM
To: Xie Shaohui-B21989
Cc: u-boot at lists.denx.de; Tabi Timur-B04825
Subject: Re: [U-Boot] [PATCH] powerpc/CoreNet: add tool to support pbl image build.Quoted 6 lines · Shaohui Xie
From: Shaohui Xie <[email protected]>
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 5 lines
Signed-off-by Shaohui Xie <[email protected]>---
rebased to lasted tree.Quoted 10 lines
Makefile | 5 + board/freescale/corenet_ds/config.mk | 26 +++ board/freescale/corenet_ds/pblimage.cfg | 60 ++++++ common/image.c | 1 + doc/README.pblimage | 140 +++++++++++++ include/image.h | 1 + tools/Makefile | 2 + tools/mkimage.c | 5 + tools/mkimage.h | 2 + tools/pblimage.c | 329+++++++++++++++++++++++++++++++
Quoted 12 lines
tools/pblimage.h | 36 ++++ 11 files changed, 607 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.ccreate mode 100644tools/pblimage.hMakefile +0
-0Makefile $(obj)u-boot.kwb: $(obj)u-boot.bin · line 417
Quoted 2 lines
Makefile +0
-0@@ -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 $< $@*>
Quoted 27 lines
Makefile +5
-0+$(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.aisboard/freescale/corenet_ds/config.mk new file +5
-0@@ -0,0 +1,26 @@ +# + +#PBL preamble and RCW header +aa55aa55 010e0100 +#64 bytes RCW data for P4080, replace it when building image #for
Quoted 8 lines
board/freescale/corenet_ds/config.mk line 10
Quoted 5 lines
board/freescale/corenet_ds/config.mk new file +5
-0+P3041DS or P5020DS. +4c580000 00000000 18185218 0000cccc +40464000 3c3c2000 58000000 61000000 +00000000 00000000 00000000 008b6000 +00000000 00000000 00000000 00000000Could you have the tool source this from a separate file, rather than require the user to replace it manually?
[Xie Shaohui] Then I have to prepare a separate file and a tool... It is quite simple to replace, just copy and paste, and users may need to modify the RCW when the default one does not fit their use case, they will always have to do it manually. It's simple to do it here.
Quoted 6 lines
Talk to Timur (when he gets back from vacation in a couple weeks) about his RCW tool and how best to accept the output it produces.
Why is eSPI in here? Isn't this supposed to just generically write an image into CPC SRAM?
[Xie Shaohui] No. some interfaces need to be pre-initialized before PBL start to load stuff from it, and default configurations for SPI is suitable, this tool provides a more compatible configurations.
Quoted 9 lines
doc/README.pblimage line 2
Quoted 8 lines
doc/README.pblimage new file mode renamed from doc/README.pblimage +0
-0100644 index 0000000..73d90f1
doc/README.pblimage new file +2
-0@@ -0,0 +1,140 @@ + 3). Boot from Nand + Write u-boot.pbl to Nand from offset 0x0, Note that in case of eLBCNAND
Quoted 12 lines
doc/README.pblimage line 92
Quoted 8 lines
doc/README.pblimage new file +8
-0+ flash, the address starts from the first good block. + for ex in u-boot: + =>tftp 100000 u-boot.pbl + =>nand info + =>nand erase 0 100000 + =>nand write 100000 0 $filesize + Change SW1[1:5] = off on off off on + Change SW7[1:4] = on off off onHow do you load the environment? We should find a way, possibly using SPL, to have the environment ready early. We do not want to wait post relocation for the full NAND/SD/SPI driver to load the environment.
[Xie Shaohui] This tool did not intend to provide a way to load the environment. The ENV thing should belong to the boot Image, this tool is a wrapper.
Quoted 7 lines
tools/mkimage.h void mkimage_register (struct image_type_params
Quoted 6 lines
tools/mkimage.h index 5fe1a48..a886305 renamed from tools/mkimage.h +0
-0100644
tools/mkimage.h +0
-0@@ -147,6 +147,8 @@ void mkimage_register (struct image_type_params*tparams);
Quoted 6 lines
tools/mkimage.h void mkimage_register (struct image_type_params *tparams); · line 150
Quoted 4 lines
tools/mkimage.h +1
-0* * Supported image types init functions */ +void pbl_load_uboot (int ,struct mkimage_params *);Please provide names for parameters.
[Xie Shaohui] OK.
Quoted 8 lines
tools/mkimage.h void mkimage_register (struct image_type_params
Quoted 7 lines
tools/mkimage.h +6
-0+/* +* PBL can load 64 bytes each time in MAX, so the u-boot need to be +splited into +* pieces of 64 bytes, PBL needs a command for each piece, the +command looks +* like 81xxxxxx, the "xxxxxx" is offset, it starts from F80000 in our case.
Quoted 7 lines
Quoted 1 line
+ */
Better wording:
The PBL can load up to 64 bytes at a time, so we split the U-Boot image into 64 byte chunks. PBL needs a command for each piece, of the form "81xxxxxx", where "xxxxxx" is the offset.
[Xie Shaohui] OK. Thanks.
Quoted 2 lines
Why are we hardcoding
0xf80000? Where does it come from?
[Xie Shaohui] it's from CONFIG_SYS_TEXT_BASE. I hardcoded it for simple coding.
Quoted 4 lines
Quoted 2 lines
+static unsigned int
uboot_label=0x81F80000;I'm not sure that label is the right word here. Maybe "
next_pbl_cmd"?
[Xie Shaohui] Right. "next_pbl_cmd" is better.
Quoted 10 lines
tools/mkimage.h
Quoted 7 lines
tools/mkimage.h +6
-0+/* +* need to store all bytes in memory for calculating crc32, then +write the +* bytes to image file for PBL boot. +*/ +static unsigned char mem_buf[600000 ];600000 is arbitrary. Do you have any checking if the image size exceeds this? Can you dynamically allocate the buffer instead?
[Xie Shaohui] Actually, I thought of dynamically allocate the buffer at beginning, but I found at least I need to allocate a buffer to store the parsed result of the configure file, but we won't know the size until we parsed the file, so I decided to use an arbitrary size, I thought 600k is big enough.
Quoted 4 lines
Quoted 2 lines
+static unsigned char
*pmem_buf=mem_buf; static intmem_byte_cnt;s/mem_byte_cnt/pbl_size/
[Xie Shaohui] OK.
Quoted 12 lines
tools/mkimage.h
Quoted 10 lines
tools/mkimage.h +9
-0+static char *fname ="Unknown" ; +static int lineno =-1 ; +static struct pbl_header pblimage_header; + +static union +{ +char c[4 ]; +unsigned char l; +} endian_test = { {'l' ,'?' ,'?' ,'b' } };Please fix whitespace.
[Xie Shaohui] OK. Thanks. I did not find it when using checkpatch.pl
Quoted 8 lines
tools/mkimage.h
Quoted 6 lines
tools/mkimage.h +5
-0+#define ENDIANNESS ((char)endian_test.l) + +static void generate_pbl_cmd (void ) +{ +unsigned int val = uboot_label;s/unsigned int/uint32_t/
[Xie Shaohui] OK.
Quoted 16 lines
Quoted 4 lines
tools/mkimage.h +3
-0+ uboot_label +=0x40 ; +int i; +tools/mkimage.h
Quoted 10 lines
tools/mkimage.h +10
-0+for (i =3 ; i >=0 ; i--) { + *pmem_buf++ = (val >> (i *8 )) &0xff ; + mem_byte_cnt++; + } +} + +static void pbl_fget (size_t size,FILE *stream) { +unsigned char c; +while (size) { + c = (unsigned char )fgetc (stream);Check for
fgetc()returning EOF before converting to unsigned char.
[Xie Shaohui] OK.
Quoted 4 lines
Quoted 2 lines
+/* load splited u-boot with PBI command 81xxxxxx. */
s/splited/split/
[Xie Shaohui] OK.
Quoted 12 lines
Quoted 12 lines
tools/mkimage.h +11
-0+static void pbl_parser (char *name) +{ +FILE *fd =NULL ; +char *line =NULL ; +char *token, *saveptr1, *saveptr2; +size_t len =0 ; + + fname = name; + fd =fopen (name,"r" ); +if (fd ==NULL ) { +printf ("Error:%s - Can't open\n" , fname);
Quoted 8 lines
tools/mkimage.h
Quoted 6 lines
tools/mkimage.h +6
-0+exit (EXIT_FAILURE ); + } + +while ((getline (&line, &len, fd)) >0 ) { + lineno++; + token =strtok_r (line,"\r\n" , &saveptr1);Why do you need to tokenize if you're using
getline()?
[Xie Shaohui] I need to drop empty lines.
Quoted 43 lines
tools/mkimage.h
Quoted 11 lines
tools/mkimage.h +10
-0+static uint32_t crc_table[256 ]; + +static void make_crc_table (void ) +{ +uint32_t mask; +int i, j; +uint32_t poly;/* polynomial exclusive-or pattern */ + +/* +* the polynomial used by PBL is 1 + x1 + x2 + x4 + x5 + x7 + x8 + x10
Quoted 31 lines
tools/mkimage.h +31
-0+* + x11 + x12 + x16 + x22 + x23 + x26 + x32. +*/ + poly =0x04c11db7 ; + +for (i =0 ; i <256 ; i++) { + mask = i <<24 ; +for (j =0 ; j <8 ; j++) { +if (mask &0x80000000 ) + mask = (mask <<1 ) ^ poly; +else + mask <<=1 ; + } + crc_table[i] = mask; + } +} + +unsigned long pbl_crc32 (unsigned long crc,const char *buf,unsigned +int len) { +unsigned int crc32_val =0xffffffff ; +unsigned int xor =0x0 ; +int i; + +make_crc_table (); + +for (i =0 ; i < len; i++) + crc32_val = (crc32_val <<8 ) ^ + crc_table[(crc32_val >>24 ) ^ (*buf++ &0xff )]; + + crc32_val = crc32_val ^ xor; +if (crc32_val <0 ) { + crc32_val +=0xffffffff ;
Quoted 8 lines
tools/mkimage.h
Quoted 4 lines
tools/mkimage.h +4
-0+ crc32_val +=1 ; + } +return crc32_val; +}Is this the standard CRC32 function (which we should be able to pull in from elsewhere instead of reimplementing here) or is it something different (which deserves a comment)?
[Xie Shaohui] This not standard CRC32 function, I tried use the one which u-boot provides, but it did not work with PBL, PBL uses a different algorithm. I've indicated it in make_crc_table() above.
Quoted 11 lines
Quoted 11 lines
tools/mkimage.h +10
-0+static unsigned int reverse_byte (unsigned int val) { +unsigned int temp; +unsigned char *p1; +int j; + + temp = val; + p1 = (unsigned char *)&temp; +for (j =3 ; j >=0 ; j--) + *p1++ = (val >> (j *8 )) &0xff ; +return temp;
Quoted 8 lines
tools/mkimage.h
Quoted 6 lines
tools/mkimage.h +6
-0+} + +/* write end command and crc command to memory. */ static void +add_end_cmd (void ) { +unsigned int pbl_end_cmd[4 ] = {0x09138000 ,0x00000000 , +0x091380c0 ,0x00000000 };s/unsigned int/uint32_t/
[Xie Shaohui] OK.
Quoted 13 lines
tools/mkimage.h
Quoted 9 lines
tools/mkimage.h +8
-0+unsigned int crc32_pbl; +int i; +unsigned char *p = (unsigned char *)&pbl_end_cmd; + +if (ENDIANNESS =='l' ) { +for (i =0 ; i <4 ; i++) + pbl_end_cmd[i] =reverse_byte (pbl_end_cmd[i]); + }Can you use
htonl()or similar, to avoid the endian test? Or have a function to write out a 32-bit word by bytes, similar to what you open- code ingenerate_pbl_cmd().
[Xie Shaohui] OK. I'll have a try.
Quoted 8 lines
tools/mkimage.h
Quoted 6 lines
tools/mkimage.h +4
-0+for (i =0 ; i <16 ; i++) { + *pmem_buf++ = *p++; + mem_byte_cnt++; + }
memcpy()?
[Xie Shaohui] memcpy() works here, but also need to move pointer of *pmem_buf and calculate the mem_byte_cnt. So I used this one straight.
Quoted 4 lines
tools/mkimage.h
Quoted 2 lines
tools/mkimage.h +1
-0+if (((mem_byte_cnt) %16 ) !=0 ) {Unnecessary parentheses.
[Xie Shaohui] OK.
Quoted 14 lines
tools/mkimage.h
Quoted 12 lines
tools/mkimage.h +11
-0+for (i =0 ; i <8 ; i++) { + *pmem_buf++ =0x0 ; + mem_byte_cnt++; + } + } +if ((mem_byte_cnt %16 !=0 )) { +printf ("Error: Bad size of image file\n" ); +exit (EXIT_FAILURE ); + } + +}No blank line at end of block.
[Xie Shaohui] OK.
Quoted 33 lines
Quoted 20 lines
tools/pblimage.h new file +14
-0@@ -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 tools/pblimage.h line 24
Quoted 10 lines
tools/pblimage.h new file +10
-0+* 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_s/_PBLIMAGE_H_/PBLIMAGE_H/
Quoted 4 lines
Leading underscores are reserved to the C implementation when followed by an uppercase letter or another underscore, or when in file scope.
I know most of the other
tools/headers do this, but it's wrong.
[Xie Shaohui] OK. Thanks for reviewing this patch.
Best Regards,
Shaohui Xie
PATCH 1/1 powerpc/CoreNet: add tool to support pbl image build.
Quoted 16 lines · On 06/05/2012 12:35 AM, Xie Shaohui-B21989 wrote:
Quoted 7 lines
Quoted 7 lines
+++
b/board/freescale/corenet_ds/config.mkboard/freescale/corenet_ds/pblimage.cfg new file +5
-0@@ -0,0 +1,26 @@ +# + +#PBL preamble and RCW header +aa55aa55 010e0100 +#64 bytes RCW data for P4080, replace it when building image #forQuoted 8 lines
board/freescale/corenet_ds/pblimage.cfg line 34
Quoted 5 lines
board/freescale/corenet_ds/pblimage.cfg new file +5
-0+P3041DS or P5020DS. +4c580000 00000000 18185218 0000cccc +40464000 3c3c2000 58000000 61000000 +00000000 00000000 00000000 008b6000 +00000000 00000000 00000000 00000000Could you have the tool source this from a separate file, rather than require the user to replace it manually?
Quoted 5 lines
[Xie Shaohui] Then I have to prepare a separate file and a tool... It is quite simple to replace, just copy and paste, and users may need to modify the RCW when the default one does not fit their use case, they will always have to do it manually. It's simple to do it here.
I disagree that copy and paste is good enough, though taking an external RCW source (such as output from Timur's tool) could be a future enhancement.
Quoted 9 lines
Quoted 5 lines
Talk to Timur (when he gets back from vacation in a couple weeks) about his RCW tool and how best to accept the output it produces.
Why is eSPI in here? Isn't this supposed to just generically write an image into CPC SRAM?
[Xie Shaohui] No. some interfaces need to be pre-initialized before PBL start to load stuff from it, and default configurations for SPI is suitable, this tool provides a more compatible configurations.
What do you mean by a more compatible configuration? If the default is good enough to load the first few PBL commands, why is it not goot enough to load the rest?
Quoted 21 lines
Quoted 8 lines
doc/README.pblimage line 2
Quoted 7 lines
doc/README.pblimage new file mode renamed from doc/README.pblimage +0
-0100644 index 0000000..73d90f1
doc/README.pblimage new file +2
-0@@ -0,0 +1,140 @@ + 3). Boot from Nand + Write u-boot.pbl to Nand from offset 0x0, Note that in case of eLBCNAND
Quoted 12 lines
doc/README.pblimage line 92
Quoted 8 lines
doc/README.pblimage new file +8
-0+ flash, the address starts from the first good block. + for ex in u-boot: + =>tftp 100000 u-boot.pbl + =>nand info + =>nand erase 0 100000 + =>nand write 100000 0 $filesize + Change SW1[1:5] = off on off off on + Change SW7[1:4] = on off off onHow do you load the environment? We should find a way, possibly using SPL, to have the environment ready early. We do not want to wait post relocation for the full NAND/SD/SPI driver to load the environment.
Quoted 3 lines
[Xie Shaohui] This tool did not intend to provide a way to load the environment. The ENV thing should belong to the boot Image, this tool is a wrapper.
This isn't a comment on this tool specifically, but rather on this method of booting. This is a problem that needs to be solved.
Quoted 2 lines
Quoted 1 line
Please fix whitespace.
[Xie Shaohui] OK. Thanks. I did not find it when using checkpatch.pl
No tool can find every possible error.
Quoted 6 lines
Quoted 5 lines
doc/README.pblimage line 13
Quoted 3 lines
doc/README.pblimage new file +3
-0+ while ((getline(&line, &len, fd)) > 0) { + lineno++; + token = strtok_r(line, "\r\n", &saveptr1);Why do you need to tokenize if you're using
getline()?[Xie Shaohui] I need to drop empty lines.
strtok is a bit heavy handed for that, but whatever...
-Scott
PATCH 1/1 powerpc/CoreNet: add tool to support pbl image build.
Quoted 24 lines
-----Original Message-----
From: Wood Scott-B07421
Sent: Wednesday, June 06, 2012 2:14 AM
To: Xie Shaohui-B21989
Cc: Wood Scott-B07421; u-boot at lists.denx.de; Tabi Timur-B04825
Subject: Re: [U-Boot] [PATCH] powerpc/CoreNet: add tool to support pbl image build.Quoted 15 lines · On 06/05/2012 12:35 AM, Xie Shaohui-B21989 wrote:
Quoted 14 lines
Review line 9
Quoted 11 lines
+++
b/board/freescale/corenet_ds/config.mk(quoted diff) +9
-0@@ -0,0 +1,26 @@ +# + +#PBL preamble and RCW header +aa55aa55 010e0100 +#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 00000000Could you have the tool source this from a separate file, rather than require the user to replace it manually?
Quoted 8 lines
Quoted 4 lines
[Xie Shaohui] Then I have to prepare a separate file and a tool... It is quite simple to replace, just copy and paste, and users may need to modify the RCW when the default one does not fit their use case, they will always have to do it manually. It's simple to do it here.
I disagree that copy and paste is good enough, though taking an external RCW source (such as output from Timur's tool) could be a future enhancement.
[Xie Shaohui] OK. Suppose we got the output from Timur's tool, what should we do for the input if we need to change the RCW? Can Timur's tool do it automatically, or by some arguments provided? And even though, there will be two files for configuration, one is RCW output from Timur's tool, and another is PBI commands. This is too much for the tool; it has only one entry for configuration file.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Talk to Timur (when he gets back from vacation in a couple weeks) about his RCW tool and how best to accept the output it produces.
Why is eSPI in here? Isn't this supposed to just generically write an image into CPC SRAM?
Quoted 7 lines
Quoted 3 lines
[Xie Shaohui] No. some interfaces need to be pre-initialized before PBL start to load stuff from it, and default configurations for SPI is suitable, this tool provides a more compatible configurations.
What do you mean by a more compatible configuration? If the default is good enough to load the first few PBL commands, why is it not goot enough to load the rest?
[Xie Shaohui] the default configurations for SPI is too slow, it will take more than half minutes to finish the loading.
Quoted 22 lines
Quoted 10 lines
Quoted 10 lines
doc/README.pblimage line 3
Quoted 9 lines
doc/README.pblimage new file mode renamed from doc/README.pblimage +0
-0100644 index 0000000..73d90f1
doc/README.pblimage new file +3
-0@@ -0,0 +1,140 @@ + 3). Boot from Nand + Write u-boot.pbl to Nand from offset 0x0, Note that in case of +eLBCNAND
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
doc/README.pblimage new file +4
-0+ flash, the address starts from the first good block. + for ex in u-boot: + =>tftp 100000 u-boot.pbl + =>nand infoQuoted 8 lines
doc/README.pblimage line 92
Quoted 4 lines
doc/README.pblimage new file +4
-0+ =>nand erase 0 100000 + =>nand write 100000 0 $filesize + Change SW1[1:5] = off on off off on + Change SW7[1:4] = on off off onHow do you load the environment? We should find a way, possibly using SPL, to have the environment ready early. We do not want to wait post relocation for the full NAND/SD/SPI driver to load the
Quoted 8 lines
environment.
Quoted 4 lines
[Xie Shaohui] This tool did not intend to provide a way to load the environment. The ENV thing should belong to the boot Image, this tool is a wrapper.
This isn't a comment on this tool specifically, but rather on this method of booting. This is a problem that needs to be solved.
[Xie Shaohui] OK. This is will be a new work.
Best Regards,
Shaohui Xie
PATCH 1/1 powerpc/CoreNet: add tool to support pbl image build.
Quoted 29 lines · On 06/05/2012 09:45 PM, Xie Shaohui-B21989 wrote:
Quoted 29 lines
-----Original Message-----
From: Wood Scott-B07421
Sent: Wednesday, June 06, 2012 2:14 AM
To: Xie Shaohui-B21989
Cc: Wood Scott-B07421; u-boot at lists.denx.de; Tabi Timur-B04825
Subject: Re: [U-Boot] [PATCH] powerpc/CoreNet: add tool to support pbl image build.Quoted 19 lines · On 06/05/2012 12:35 AM, Xie Shaohui-B21989 wrote:
Quoted 6 lines
Quoted 6 lines
+++
b/board/freescale/corenet_ds/config.mkboard/freescale/corenet_ds/pblimage.cfg new file +4
-0@@ -0,0 +1,26 @@ +# + +#PBL preamble and RCW header +aa55aa55 010e0100Quoted 8 lines
Review line 9
Quoted 5 lines
(quoted diff) +5
-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 00000000Could you have the tool source this from a separate file, rather than require the user to replace it manually?
[Xie Shaohui] Then I have to prepare a separate file and a tool... It is quite simple to replace, just copy and paste, and users may need to modify the RCW when the default one does not fit their use case, they will always have to do it manually. It's simple to do it here.
Quoted 6 lines
Quoted 3 lines
I disagree that copy and paste is good enough, though taking an external RCW source (such as output from Timur's tool) could be a future enhancement.
[Xie Shaohui] OK. Suppose we got the output from Timur's tool, what should we do for the input if we need to change the RCW?
You change the input to Timur's tool -- that's what it's for. It compiles a textual description of the RCW settings into a PBL image.
Quoted 5 lines
Can Timur's
tool do it automatically, or by some arguments provided? And even though, there will be two files for configuration, one is RCW output from Timur's tool, and another is PBI commands. This is too much for the tool; it has only one entry for configuration file.
Too much for which tool, and why can't that be changed?
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Talk to Timur (when he gets back from vacation in a couple weeks) about his RCW tool and how best to accept the output it produces.
Why is eSPI in here? Isn't this supposed to just generically write an image into CPC SRAM?
[Xie Shaohui] No. some interfaces need to be pre-initialized before PBL start to load stuff from it, and default configurations for SPI is suitable, this tool provides a more compatible configurations.
Quoted 6 lines
Quoted 3 lines
What do you mean by a more compatible configuration? If the default is good enough to load the first few PBL commands, why is it not goot enough to load the rest?
[Xie Shaohui] the default configurations for SPI is too slow, it will take more than half minutes to finish the loading.
Please add a comment describing what you're doing to the SPI controller and why. Are there any situations where the faster speed you're programming won't work?
-Scott
PATCH 1/1 powerpc/CoreNet: add tool to support pbl image build.
Quoted 49 lines
-----Original Message-----
From: Wood Scott-B07421
Sent: Thursday, June 07, 2012 2:19 AM
To: Xie Shaohui-B21989
Cc: Wood Scott-B07421; u-boot at lists.denx.de; Tabi Timur-B04825
Subject: Re: [U-Boot] [PATCH] powerpc/CoreNet: add tool to support pbl image build.Quoted 24 lines · On 06/05/2012 09:45 PM, Xie Shaohui-B21989 wrote:
Quoted 24 lines
-----Original Message-----
From: Wood Scott-B07421
Sent: Wednesday, June 06, 2012 2:14 AM
To: Xie Shaohui-B21989
Cc: Wood Scott-B07421; u-boot at lists.denx.de; Tabi Timur-B04825
Subject: Re: [U-Boot] [PATCH] powerpc/CoreNet: add tool to support pbl image build.Quoted 15 lines · On 06/05/2012 12:35 AM, Xie Shaohui-B21989 wrote:
Quoted 14 lines
Review line 9
Quoted 11 lines
+++
b/board/freescale/corenet_ds/config.mk(quoted diff) +9
-0@@ -0,0 +1,26 @@ +# + +#PBL preamble and RCW header +aa55aa55 010e0100 +#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 00000000Could you have the tool source this from a separate file, rather than require the user to replace it manually?
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
[Xie Shaohui] Then I have to prepare a separate file and a tool... It is quite simple to replace, just copy and paste, and users may need to modify the RCW when the default one does not fit their use case, they will always have to do it manually. It's simple to do it
here.
Quoted 7 lines
Quoted 4 lines
I disagree that copy and paste is good enough, though taking an external RCW source (such as output from Timur's tool) could be a future enhancement.
[Xie Shaohui] OK. Suppose we got the output from Timur's tool, what should we do for the input if we need to change the RCW?
You change the input to Timur's tool -- that's what it's for. It compiles a textual description of the RCW settings into a PBL image.
Quoted 7 lines
Quoted 5 lines
Can Timur's
tool do it automatically, or by some arguments provided? And even though, there will be two files for configuration, one is RCW output from Timur's tool, and another is PBI commands. This is too much for the tool; it has only one entry for configuration file.Too much for which tool, and why can't that be changed?
[Xie Shaohui] The mkimage structure provides one entry to indicate the configuration file, is it OK to add a more entry just for PBL?
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 10 lines
Quoted 6 lines
Talk to Timur (when he gets back from vacation in a couple weeks) about his RCW tool and how best to accept the output it produces.
Why is eSPI in here? Isn't this supposed to just generically write an image into CPC SRAM?
[Xie Shaohui] No. some interfaces need to be pre-initialized before PBL start to load stuff from it, and default configurations for SPI is suitable, this tool provides a more compatible configurations.
What do you mean by a more compatible configuration? If the default is good enough to load the first few PBL commands, why is it not goot enough to load the rest?
Quoted 6 lines
Quoted 2 lines
[Xie Shaohui] the default configurations for SPI is too slow, it will take more than half minutes to finish the loading.
Please add a comment describing what you're doing to the SPI controller and why. Are there any situations where the faster speed you're programming won't work?
[Xie Shaohui] OK. Will add a comment in new version. The configuration for SPI is same as the one used in u-boot, so I think it's OK for PBL.
Best Regards,
Shaohui Xie
PATCH 1/1 powerpc/CoreNet: add tool to support pbl image build.
Quoted 15 lines · On 06/06/2012 10:16 PM, Xie Shaohui-B21989 wrote:
Quoted 15 lines
-----Original Message-----
From: Wood Scott-B07421
Sent: Thursday, June 07, 2012 2:19 AM
To: Xie Shaohui-B21989
Cc: Wood Scott-B07421; u-boot at lists.denx.de; Tabi Timur-B04825
Subject: Re: [U-Boot] [PATCH] powerpc/CoreNet: add tool to support pbl image build.Quoted 5 lines · On 06/05/2012 09:45 PM, Xie Shaohui-B21989 wrote:
Can Timur's
tool do it automatically, or by some arguments provided? And even though, there will be two files for configuration, one is RCW output from Timur's tool, and another is PBI commands. This is too much for the tool; it has only one entry for configuration file.
Quoted 4 lines
Quoted 1 line
Too much for which tool, and why can't that be changed?
[Xie Shaohui] The mkimage structure provides one entry to indicate the configuration file, is it OK to add a more entry just for PBL?
I don't see why not.
-Scott
PATCH 1/1 powerpc/CoreNet: add tool to support pbl image build.
Quoted 16 lines · On 06/06/2012 10:16 PM, Xie Shaohui-B21989 wrote:
Quoted 15 lines
Quoted 15 lines
-----Original Message-----
From: Wood Scott-B07421
Sent: Thursday, June 07, 2012 2:19 AM
To: Xie Shaohui-B21989
Cc: Wood Scott-B07421; u-boot at lists.denx.de; Tabi Timur-B04825
Subject: Re: [U-Boot] [PATCH] powerpc/CoreNet: add tool to support pbl image build.Quoted 5 lines · On 06/05/2012 09:45 PM, Xie Shaohui-B21989 wrote:
Can Timur's
tool do it automatically, or by some arguments provided? And even though, there will be two files for configuration, one is RCW output from Timur's tool, and another is PBI commands. This is too much for the tool; it has only one entry for configuration file.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Too much for which tool, and why can't that be changed?
[Xie Shaohui] The mkimage structure provides one entry to indicate the configuration file, is it OK to add a more entry just for PBL?
I don't see why not.
[Xie Shaohui] OK. Then I'll split the current configuration file in two, one is for RCW, another is for PBI commands. Also, add one more entry for the second configuration file. But as you know, Timur's tool is not in open source now, I can only use a default RCW file for now.
I have two questions:
1. Is there a plan that we submit Timur' tool to open source?
2. If yes, should I combine Timur's tool with my tool or I just tell user They should use Timur's tool to produce the RCW and then use it in my tool?
Best Regards,
Shaohui Xie
PATCH 1/1 powerpc/CoreNet: add tool to support pbl image build.
Quoted 23 lines · On 06/07/2012 09:55 PM, Xie Shaohui-B21989 wrote:
Quoted 16 lines · On 06/06/2012 10:16 PM, Xie Shaohui-B21989 wrote:
Quoted 15 lines
Quoted 15 lines
-----Original Message-----
From: Wood Scott-B07421
Sent: Thursday, June 07, 2012 2:19 AM
To: Xie Shaohui-B21989
Cc: Wood Scott-B07421; u-boot at lists.denx.de; Tabi Timur-B04825
Subject: Re: [U-Boot] [PATCH] powerpc/CoreNet: add tool to support pbl image build.Quoted 5 lines · On 06/05/2012 09:45 PM, Xie Shaohui-B21989 wrote:
Can Timur's
tool do it automatically, or by some arguments provided? And even though, there will be two files for configuration, one is RCW output from Timur's tool, and another is PBI commands. This is too much for the tool; it has only one entry for configuration file.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Too much for which tool, and why can't that be changed?
[Xie Shaohui] The mkimage structure provides one entry to indicate the configuration file, is it OK to add a more entry just for PBL?
I don't see why not.
Quoted 7 lines
[Xie Shaohui] OK. Then I'll split the current configuration file in two, one is for RCW, another is for PBI commands. Also, add one more entry for the second configuration file. But as you know, Timur's tool is not in open source now, I can only use a default RCW file for now.
I have two questions:
1. Is there a plan that we submit Timur' tool to open source?
I hope so. If not, the RCW will have to be provided directly as a hexdump/binary/etc.
Quoted 2 lines
2. If yes, should I combine Timur's tool with my tool or I just tell user They should use Timur's tool to produce the RCW and then use it in my tool?
They should be separate, since there are situations where you just want the RCW and not the PBL image loading -- but it should all be an automatic part of the U-Boot bulid process for targets that require it.
-Scott
PATCH 1/1 powerpc/CoreNet: add tool to support pbl image build.
Quoted 6 lines · On Jun 8, 2012, at 6:09 PM, "Wood Scott-B07421" <[email protected]> wrote:
Quoted 3 lines
I have two questions:
1. Is there a plan that we submit Timur' tool to open source?I hope so. If not, the RCW will have to be provided directly as a hexdump/binary/etc.
Where do you think my compiler should go?
Quoted 7 lines
Quoted 3 lines
2. If yes, should I combine Timur's tool with my tool or I just tell user They should use Timur's tool to produce the RCW and then use it in my tool?
They should be separate, since there are situations where you just want the RCW and not the PBL image loading -- but it should all be an automatic part of the U-Boot bulid process for targets that require it.
I can add a parameter or command to embed a pbl image into an rcw binary during the compilation.
Quoted 2 lines
-Scott
PATCH 1/1 powerpc/CoreNet: add tool to support pbl image build.
Quoted 11 lines · On 06/12/2012 12:42 PM, Tabi Timur-B04825 wrote:
Quoted 6 lines · On Jun 8, 2012, at 6:09 PM, "Wood Scott-B07421" <[email protected]> wrote:
Quoted 3 lines
I have two questions:
1. Is there a plan that we submit Timur' tool to open source?I hope so. If not, the RCW will have to be provided directly as a hexdump/binary/etc.
Where do you think my compiler should go?
tools/
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
2. If yes, should I combine Timur's tool with my tool or I just tell user They should use Timur's tool to produce the RCW and then use it in my tool?
They should be separate, since there are situations where you just want the RCW and not the PBL image loading -- but it should all be an automatic part of the U-Boot bulid process for targets that require it.
I can add a parameter or command to embed a pbl image into an rcw binary during the compilation.
You mean to replace this tool? There are other PBL things that may need to be done, such as reconfiguring the SPI speed so it doesn't take forever to read out the rest of the PBL image.
-Scott
PATCH 1/1 powerpc/CoreNet: add tool to support pbl image build.
Quoted 4 lines · On Jun 12, 2012, at 7:54 PM, "Wood Scott-B07421" <[email protected]> wrote:
You mean to replace this tool? There are other PBL things that may need to be done, such as reconfiguring the SPI speed so it doesn't take forever to read out the rest of the PBL image.
My tool builds and RCW image. I could change it so that it also understands the PBL language, but that's not trivial. For now, it would be easy to add a feature to only embed the PBL binary into the RCW binary.
Quoted 2 lines
-Scott