All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] How to convert imximage.cfg so it can be used in mkimage?
@ 2019-11-17 23:22 Winston Gao
  2019-11-19 12:12 ` Alexander Dahl
  0 siblings, 1 reply; 3+ messages in thread
From: Winston Gao @ 2019-11-17 23:22 UTC (permalink / raw)
  To: u-boot

Hi all,



I am trying to create a bootstrap image for iMX6 and the command mkimage fails like below:



$ mkimage -n imximage.cfg -T imximage -e 0x17000000 -d overlay_img bootstrap_img.bin
Error: imximage.cfg[1] - Invalid command(/*)



Further investigation shows that the error is caused by that there is c-type comments (/*...*/) in imximage.cfg file. When I remove all the c-type comments in the file, it works fine.



u-boot document does say that imximage.cfg accept comment line starting with '#' in the file. However, that file, which is coming together with u-boot source has c-type comments. I am thinking the file is involved in some u-boot compiling. How to convert that file to remove all the c-type comments automatically so it can be used in mkimage command?



Thanks,

Yan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] How to convert imximage.cfg so it can be used in mkimage?
  2019-11-17 23:22 [U-Boot] How to convert imximage.cfg so it can be used in mkimage? Winston Gao
@ 2019-11-19 12:12 ` Alexander Dahl
  2019-11-19 12:30   ` Alexander Dahl
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Dahl @ 2019-11-19 12:12 UTC (permalink / raw)
  To: u-boot

Hei hei,

Am Sonntag, 17. November 2019, 23:22:30 CET schrieb Winston Gao:
> I am trying to create a bootstrap image for iMX6 and the command mkimage
> fails like below:

mkimage as you call it for a legacy image takes a binary file and puts a 
special 64 byte header in front of it. This way U-Boot can load it at runtime 
or you can load it from U-Boot commandline.

> $ mkimage -n imximage.cfg -T imximage -e 0x17000000 -d overlay_img
> bootstrap_img.bin Error: imximage.cfg[1] - Invalid command(/*)

What's the content of that 'overlay_img' file?

Besides: I would not name the resulting file .bin but .uimg to see it's a U-
Boot image "container" file.

> Further investigation shows that the error is caused by that there is c-type
> comments (/*...*/) in imximage.cfg file. When I remove all the c-type
> comments in the file, it works fine.

Well, -n sets a name in the image header. I guess you have those '/*...*/' in 
your file 'overlay_img'?

> u-boot document does say that imximage.cfg accept comment line starting with
> '#' in the file. However, that file, which is coming together with u-boot
> source has c-type comments. I am thinking the file is involved in some
> u-boot compiling. How to convert that file to remove all the c-type
> comments automatically so it can be used in mkimage command?

Recent U-Boot source tree has over 30 files named 'imximage.cfg', which one do 
you refer to?

Kind regards
Alex

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] How to convert imximage.cfg so it can be used in mkimage?
  2019-11-19 12:12 ` Alexander Dahl
@ 2019-11-19 12:30   ` Alexander Dahl
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Dahl @ 2019-11-19 12:30 UTC (permalink / raw)
  To: u-boot

Hello,

Am Dienstag, 19. November 2019, 13:12:20 CET schrieb Alexander Dahl:
> > Further investigation shows that the error is caused by that there is
> > c-type comments (/*...*/) in imximage.cfg file. When I remove all the
> > c-type comments in the file, it works fine.
> 
> Well, -n sets a name in the image header. I guess you have those '/*...*/'
> in your file 'overlay_img'?

At least I thought from the documentation, then I saw this when building 
'riotboard_defconfig' from U-Boot 2016.11:


  arm-v7a-linux-gnueabihf-gcc -E -Wp,-MD,board/boundary/
nitrogen6x/.nitrogen6s1g.cfg.cfgtmp.d  -nostdinc -isystem /opt/
OSELAS.Toolchain-2016.06.1/arm-v7a-linux-g
nueabihf/gcc-5.4.0-glibc-2.23-binutils-2.26-kernel-4.6-sanitized/lib/gcc/arm-
v7a-linux-gnueabihf/5.4.0/include -Iinclude  -I/home/adahl/Work/bsp/tt-
generic/platf
orm-v7a/build-target/u-boot-2016.11/include  -I/home/adahl/Work/bsp/tt-
generic/platform-v7a/build-target/u-boot-2016.11/arch/arm/include -include /
home/adahl/Wor
k/bsp/tt-generic/platform-v7a/build-target/u-boot-2016.11/include/linux/
kconfig.h -D__KERNEL__ -D__UBOOT__ -D__ARM__ -marm -mno-thumb-interwork -
mabi=aapcs-linux
 -mword-relocations -fno-pic -mno-unaligned-access -ffunction-sections -fdata-
sections -fno-common -ffixed-r9 -msoft-float -pipe -march=armv7-a -
D__LINUX_ARM_ARCH__=7 -x c -o board/boundary/nitrogen6x/
nitrogen6s1g.cfg.cfgtmp /home/adahl/Work/bsp/tt-generic/platform-v7a/build-
target/u-boot-2016.11/board/boundary/nitrogen6x/nitrogen6s1g.cfg
  ./tools/mkimage -n board/boundary/nitrogen6x/nitrogen6s1g.cfg.cfgtmp -T 
imximage -e 0x17800000 -d u-boot.bin u-boot.imx
Image Type:   Freescale IMX Boot Image
Image Ver:    2 (i.MX53/6/7 compatible)
Mode:         DCD
Data Size:    442368 Bytes = 432.00 kB = 0.42 MB
Load Address: 177ff420
Entry Point:  17800000


Looks like -n behaves differently when called with '-T imximage'? However it 
is quite clear from the first call how to get the appropriate file without C 
comments: use the C preprocessor on the input file, this not only removes 
those comments, but also resolves includes.

To just create that imximage though, you only have to configure U-Boot 
correctly and it will drop out of the usual call to make without calling 
mkimage manually.

A

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-19 12:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-17 23:22 [U-Boot] How to convert imximage.cfg so it can be used in mkimage? Winston Gao
2019-11-19 12:12 ` Alexander Dahl
2019-11-19 12:30   ` Alexander Dahl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.