Skip to contentSkip to conversation

imd: model and compatible missing in metadata

PATCH Applied Thorsten K. Scherer 5 participants 9 messages Dec 13, 2018 – Jan 23, 2019 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 imd: model and compatible missing in metadata

fixes 97e81f2

---
 include/asm-generic/barebox.lds.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-generic/barebox.lds.h +1 -1
index 74d3ca4a9..decaab79a 100644
@@ -66,7 +66,7 @@
 #define BAREBOX_IMD				\
 	KEEP(*(.barebox_imd_start))		\
 	KEEP(*(.barebox_imd_1*))		\
-	*(.barebox_imd_0*)			\
+	KEEP(*(.barebox_imd_0*))		\
 	KEEP(*(.barebox_imd_end))
 
 #if defined(CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE) && \
Signature · 16 lines
2.19.1


-- 
Eckelmann AG
Vorstand: Dipl.-Ing. Peter Frankenbach (Sprecher) Dipl.-Wi.-Ing. Philipp Eckelmann
Dr.-Ing. Marco Münchhof Dr.-Ing. Frank Uhlemann
Vorsitzender des Aufsichtsrats: Hubertus G. Krossa
Stv. Vorsitzender des Aufsichtsrats: Dr.-Ing. Gerd Eckelmann
Sitz der Gesellschaft: Berliner Str. 161, 65205 Wiesbaden, Amtsgericht Wiesbaden HRB 12636
http://www.eckelmann.de

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#1 lore raw
Quoted 12 lines · Thorsten K. Scherer

fixes 97e81f2

---
 include/asm-generic/barebox.lds.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-generic/barebox.lds.h +0 -0
index 74d3ca4a9..decaab79a 100644

include/asm-generic/barebox.lds.h line 69

Quoted 5 lines
include/asm-generic/barebox.lds.h +1 -1
@@ -66,7 +66,7 @@
 #define BAREBOX_IMD				\
 	KEEP(*(.barebox_imd_start))		\
 	KEEP(*(.barebox_imd_1*))		\
-	*(.barebox_imd_0*)			\
+	KEEP(*(.barebox_imd_0*))		\

Applied, thanks. I wonder why I didn't add that in the first place, given that all other lines have the KEEP().

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw
In reply to Thorsten K. Scherer

On Thu, 13 Dec 2018 07:33:56 +0100
"Thorsten K. Scherer" <[email protected]> wrote:

Hi!

Quoted 22 lines

fixes 97e81f2

---
 include/asm-generic/barebox.lds.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-generic/barebox.lds.h +1 -1
index 74d3ca4a9..decaab79a 100644
@@ -66,7 +66,7 @@
 #define BAREBOX_IMD				\
 	KEEP(*(.barebox_imd_start))		\
 	KEEP(*(.barebox_imd_1*))		\
-	*(.barebox_imd_0*)			\
+	KEEP(*(.barebox_imd_0*))		\
 	KEEP(*(.barebox_imd_end))
 
 #if defined(CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE) && \
Signature · 1 line
2.19.1

It looks like this patch has unobvious drawback.
The bareboximd utility sees too many 'model' and 'compatible' strings in a single image, e.g.:

  $ git clone -b next git://git.pengutronix.de/git/barebox.git
  $ cd barebox
  barebox$ git log -1 --oneline
  5407887ff (HEAD -> next, origin/next) Merge branch 'for-next/mtd' into next
  barebox$ export ARCH=arm
  barebox$ export CROSS_COMPILE=arm-linux-gnueabi-
  barebox$ make tegra_v7_defconfig
  barebox$ echo "CONFIG_IMD=y" >> .config
  barebox$ echo "CONFIG_IMD_TARGET=y" >> .config
  barebox$ make oldconfig
  barebox$ make
  barebox$ ./scripts/bareboximd images/barebox-tegra20-toshiba-ac100-usbloader.img
  build: #1 Mon Dec 17 13:59:41 MSK 2018
  release: 2018.12.0-00273-g5407887ff
  of_compatible: nvidia,jetson-tk1 nvidia,tegra124
  model: NVIDIA Tegra124 Jetson TK1
  of_compatible: toradex,iris toradex,colibri_t20 nvidia,tegra20
  model: Toradex Colibri T20 on Iris
  of_compatible: compal,paz00 nvidia,tegra20
  model: Toshiba AC100 / Dynabook AZ
  of_compatible: nvidia,beaver nvidia,tegra30
  model: NVIDIA Tegra30 Beaver evaluation board
Signature · 7 lines
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw
Quoted 25 lines · Antony Pavlov

On Thu, 13 Dec 2018 07:33:56 +0100
"Thorsten K. Scherer" <[email protected]> wrote:

Hi!

Quoted 19 lines

fixes 97e81f2

---
 include/asm-generic/barebox.lds.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-generic/barebox.lds.h +1 -1
index 74d3ca4a9..decaab79a 100644
@@ -66,7 +66,7 @@
 #define BAREBOX_IMD				\
 	KEEP(*(.barebox_imd_start))		\
 	KEEP(*(.barebox_imd_1*))		\
-	*(.barebox_imd_0*)			\
+	KEEP(*(.barebox_imd_0*))		\
 	KEEP(*(.barebox_imd_end))
 
Quoted 6 lines
Quoted 3 lines
include/asm-generic/barebox.lds.h +0 -0
 #if defined(CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE) && \
Signature · 1 line
2.19.1

It looks like this patch has unobvious drawback.
The bareboximd utility sees too many 'model' and 'compatible' strings in a single image, e.g.:

Now I remember what the intention was that this line looks so apparently different from the other ones ;)

To get the compatible strings into the binary I have created imd_used(). This should be called with the symbol that should be kept in the resulting image.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

Hallo Sascha,

Quoted 39 lines · Sascha Hauer
Quoted 26 lines · Antony Pavlov

On Thu, 13 Dec 2018 07:33:56 +0100
"Thorsten K. Scherer" <[email protected]> wrote:

Hi!

Quoted 20 lines

fixes 97e81f2

---
 include/asm-generic/barebox.lds.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm- renamed from include/asm-generic/barebox.lds.h +0 -0

generic/barebox.lds.h
index 74d3ca4a9..decaab79a 100644

include/asm-generic/barebox.lds.h +1 -1
@@ -66,7 +66,7 @@
 #define BAREBOX_IMD				\
 	KEEP(*(.barebox_imd_start))		\
 	KEEP(*(.barebox_imd_1*))		\
-	*(.barebox_imd_0*)			\
+	KEEP(*(.barebox_imd_0*))		\
 	KEEP(*(.barebox_imd_end))
 
Quoted 7 lines
Quoted 3 lines
include/asm-generic/barebox.lds.h +0 -0
 #if defined(CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE) && \
Signature · 1 line
2.19.1

It looks like this patch has unobvious drawback. The bareboximd utility sees too many 'model' and 'compatible' strings in a single image, e.g.:

Now I remember what the intention was that this line looks so apparently
different from the other ones ;)

Quoted 7 lines

To get the compatible strings into the binary I have created imd_used().
This should be called with the symbol that should be kept in the resulting image.

Sascha

sorry for introducing confusion. I misread the documenation on IMD as
"of_compatible and model will be figured out and put into the proper location by barebox". What's your opinion on adding some documentation for "imd_used" in (user/imd.rst)? So I may try to produce a meaningful a patch for that.

Or is this out of scope (at least in this context)?

Best regards,
Thorsten
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#5 lore raw
Quoted 47 lines · Thorsten

Hallo Sascha,

Quoted 44 lines · Sascha Hauer
Quoted 26 lines · Antony Pavlov

On Thu, 13 Dec 2018 07:33:56 +0100
"Thorsten K. Scherer" <[email protected]> wrote:

Hi!

Quoted 20 lines

fixes 97e81f2

---
 include/asm-generic/barebox.lds.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm- renamed from include/asm-generic/barebox.lds.h +0 -0

generic/barebox.lds.h
index 74d3ca4a9..decaab79a 100644

include/asm-generic/barebox.lds.h +1 -1
@@ -66,7 +66,7 @@
 #define BAREBOX_IMD				\
 	KEEP(*(.barebox_imd_start))		\
 	KEEP(*(.barebox_imd_1*))		\
-	*(.barebox_imd_0*)			\
+	KEEP(*(.barebox_imd_0*))		\
 	KEEP(*(.barebox_imd_end))
 
Quoted 7 lines
Quoted 3 lines
include/asm-generic/barebox.lds.h +0 -0
 #if defined(CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE) && \
Signature · 1 line
2.19.1

It looks like this patch has unobvious drawback. The bareboximd utility sees too many 'model' and 'compatible' strings in a single image, e.g.:

Now I remember what the intention was that this line looks so apparently
different from the other ones ;)

To get the compatible strings into the binary I have created imd_used().
This should be called with the symbol that should be kept in the resulting image.

Quoted 8 lines
Quoted 2 lines

Sascha

sorry for introducing confusion. I misread the documenation on IMD as
"of_compatible and model will be figured out and put into the proper location by barebox". What's your opinion on adding some documentation for "imd_used" in (user/imd.rst)? So I may try to produce a meaningful a patch for that.

Sure, that would be appreciated.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw
In reply to Sascha Hauer

Hello,

i spent some time trying to understand the usage of imd_used etc.

In another reply I stated:

'I misread the documenation on IMD as "of_compatible and model will be figured out and put into the proper location by barebox".'

I am not so sure, if that is really the case.

As far as i understand things:

1. of_compatible and model are (should be) automagically added to imd from the
entries in the dts.

git show 97e81f2d7 | grep -A 1 'For.*model.*of_compatible' cat scripts/gen-dtb-s | grep -A 23 -B 3 'barebox_imd_0'

2. the IMD_USED macro puts arbitrary tags in the metadata. Which may
also be a tag named model.

Now I wonder, if the lack of the patch just covers up an issue at another place or if there is something (in the context of multi image support?) which I do not understand. Maybe there is something messed up with the entries in the device tree?

https://www.spinics.net/lists/arm-kernel/msg699453.html

Maybe someone can point me in the right direction?

Best regards,
Thorsten

Quoted 47 lines · Sascha Hauer
Quoted 25 lines · Antony Pavlov

On Thu, 13 Dec 2018 07:33:56 +0100
"Thorsten K. Scherer" <[email protected]> wrote:

Hi!

Quoted 19 lines

fixes 97e81f2

---
 include/asm-generic/barebox.lds.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-generic/barebox.lds.h +1 -1
index 74d3ca4a9..decaab79a 100644
@@ -66,7 +66,7 @@
 #define BAREBOX_IMD				\
 	KEEP(*(.barebox_imd_start))		\
 	KEEP(*(.barebox_imd_1*))		\
-	*(.barebox_imd_0*)			\
+	KEEP(*(.barebox_imd_0*))		\
 	KEEP(*(.barebox_imd_end))
 
Quoted 6 lines
Quoted 3 lines
include/asm-generic/barebox.lds.h +0 -0
 #if defined(CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE) && \
Signature · 1 line
2.19.1

It looks like this patch has unobvious drawback.
The bareboximd utility sees too many 'model' and 'compatible' strings in a single image, e.g.:

Now I remember what the intention was that this line looks so apparently different from the other ones ;)

To get the compatible strings into the binary I have created imd_used(). This should be called with the symbol that should be kept in the resulting image.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Signature · 20 lines
Mit freundlichen Grüßen
Thorsten K. Scherer
Diplom-Ingenieur (FH)
Kälte- und Gebäudeleittechnik
Datentechnik


Eckelmann AG
Berliner Str. 161, 65205 Wiesbaden
Telefon +49 611 7103-329     
Fax +49 611 7103-133
[email protected]
https://www.eckelmann.de

Eckelmann Group - Source of inspiration

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

Hello,

Quoted 6 lines · Thorsten

i spent some time trying to understand the usage of imd_used etc.

In another reply I stated:

'I misread the documenation on IMD as "of_compatible and model will be figured out and put into the proper location by barebox".'

That is wrong. The current code doesn't ensure that and I don't see a way how this could be done comfortably without per-board changes.

Quoted 9 lines

I am not so sure, if that is really the case.

As far as i understand things:

1. of_compatible and model are (should be) automagically added to imd from the
entries in the dts.

git show 97e81f2d7 | grep -A 1 'For.*model.*of_compatible' cat scripts/gen-dtb-s | grep -A 23 -B 3 'barebox_imd_0'

The imd tags for compatible and model are generated, but not automatically included with this change. This is AFAICT the current state.

The problem is that the needed information is included in the "barebox" image (i.e. the file with the name "barebox" that is build in the top build dir) but then there is an additional step that extracts "all needed" parts from that image to create a binary that then is able to be started on your target. So if "barebox" has three entry points for different machines, there are three images generated and each only has a single entry point. Unused functions and data structures are stripped. The linker detects that the imd section that contains the compatible and model is not used and so this goes away in all three generated binaries.

Quoted 2 lines

2. the IMD_USED macro puts arbitrary tags in the metadata. Which may
also be a tag named model.

The IMD_USED claims a certain data structure is used such that the linker doesn't throw it away.

Quoted 3 lines

Now I wonder, if the lack of the patch just covers up an issue at another place or if there is something (in the context of multi image support?) which I do not understand.

Did you look at the patch I sent you?

Quoted 4 lines

Maybe there is something messed up with the entries in the device tree?

https://www.spinics.net/lists/arm-kernel/msg699453.html

This is unrelated, this is a patch for Linux to add a device tree.

Best regards
Uwe

Signature · 7 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw

Hello,

Quoted 27 lines · Uwe Kleine-König

Hello,

Quoted 6 lines · Thorsten

i spent some time trying to understand the usage of imd_used etc.

In another reply I stated:

'I misread the documenation on IMD as "of_compatible and model will be figured out and put into the proper location by barebox".'

That is wrong. The current code doesn't ensure that and I don't see a way how this could be done comfortably without per-board changes.

Quoted 9 lines

I am not so sure, if that is really the case.

As far as i understand things:

1. of_compatible and model are (should be) automagically added to imd from the
entries in the dts.

git show 97e81f2d7 | grep -A 1 'For.*model.*of_compatible' cat scripts/gen-dtb-s | grep -A 23 -B 3 'barebox_imd_0'

The imd tags for compatible and model are generated, but not automatically included with this change. This is AFAICT the current state.

Quoted 10 lines

The problem is that the needed information is included in the "barebox" image (i.e. the file with the name "barebox" that is build in the top build dir) but then there is an additional step that extracts "all needed" parts from that image to create a binary that then is able to be started on your target. So if "barebox" has three entry points for different machines, there are three images generated and each only has a single entry point. Unused functions and data structures are stripped. The linker detects that the imd section that contains the compatible and model is not used and so this goes away in all three generated binaries.

Thank you for the explanation. Now things start to clear up a bit.

Quoted 6 lines
Quoted 2 lines

2. the IMD_USED macro puts arbitrary tags in the metadata. Which may
also be a tag named model.

The IMD_USED claims a certain data structure is used such that the linker doesn't throw it away.

Ok.

Quoted 6 lines
Quoted 3 lines

Now I wonder, if the lack of the patch just covers up an issue at another place or if there is something (in the context of multi image support?) which I do not understand.

Did you look at the patch I sent you?

I did. But not closely enough. On the invokation of imd, model and of_compatible were not displayed. Somehow I did not get, that your patch was made to apply for the imx25 boards and not for the imx6 board (the one which I was checking). After adjusting the lowlevel.c file of the imx6 board, everything went fine.

Quoted 6 lines
Quoted 4 lines

Maybe there is something messed up with the entries in the device tree?

https://www.spinics.net/lists/arm-kernel/msg699453.html

This is unrelated, this is a patch for Linux to add a device tree.

Right. It didn't make sense to add this.

Quoted 4 lines

Best regards
Uwe

Again, thank you for feedback.

Best regards
Thorsten

Quoted 3 lines
Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Signature · 20 lines
Mit freundlichen Grüßen
Thorsten K. Scherer
Diplom-Ingenieur (FH)
Kälte- und Gebäudeleittechnik
Datentechnik


Eckelmann AG
Berliner Str. 161, 65205 Wiesbaden
Telefon +49 611 7103-329     
Fax +49 611 7103-133
[email protected]
https://www.eckelmann.de

Eckelmann Group - Source of inspiration

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox