mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] u-boot: Add wrapper blacklist
@ 2018-01-31 14:57 Alexander Dahl
  2018-01-31 15:09 ` Michael Olbrich
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Dahl @ 2018-01-31 14:57 UTC (permalink / raw)
  To: ptxdist

u-boot had the same problem as the other bootloaders (barebox,
at91bootstrap, …): much too big images were generated. Use the same
wrapper blacklist approach to prevent this like in barebox package.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
---
Out of curiosity: if I wanted to find out which of those options are
necessary to add, instead of just blindly copying them. How would I do
that?

Greets
Alex
---
 rules/u-boot.make | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/rules/u-boot.make b/rules/u-boot.make
index 6dd2e43a45..94aa774580 100644
--- a/rules/u-boot.make
+++ b/rules/u-boot.make
@@ -29,6 +29,13 @@ U_BOOT_DIR	:= $(BUILDDIR)/$(U_BOOT)
 # Prepare
 # ----------------------------------------------------------------------------
 
+U_BOOT_WRAPPER_BLACKLIST := \
+	TARGET_HARDEN_RELRO \
+	TARGET_HARDEN_BINDNOW \
+	TARGET_HARDEN_PIE \
+	TARGET_DEBUG \
+	TARGET_BUILD_ID
+
 U_BOOT_PATH	:= PATH=$(CROSS_PATH)
 U_BOOT_MAKE_OPT	:= CROSS_COMPILE=$(BOOTLOADER_CROSS_COMPILE) HOSTCC=$(HOSTCC)
 U_BOOT_MAKE_PAR	:= NO
-- 
2.11.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH] u-boot: Add wrapper blacklist
  2018-01-31 14:57 [ptxdist] [PATCH] u-boot: Add wrapper blacklist Alexander Dahl
@ 2018-01-31 15:09 ` Michael Olbrich
  2018-02-01  7:49   ` Alexander Dahl
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Olbrich @ 2018-01-31 15:09 UTC (permalink / raw)
  To: ptxdist

On Wed, Jan 31, 2018 at 03:57:30PM +0100, Alexander Dahl wrote:
> u-boot had the same problem as the other bootloaders (barebox,
> at91bootstrap, …): much too big images were generated. Use the same
> wrapper blacklist approach to prevent this like in barebox package.
> 
> Signed-off-by: Alexander Dahl <ada@thorsis.com>
> ---
> Out of curiosity: if I wanted to find out which of those options are
> necessary to add, instead of just blindly copying them. How would I do
> that?

Build/runtime failures or by knowing what the options mean :-).

TARGET_HARDEN_RELRO/TARGET_HARDEN_BINDNOW only makes sense for elf
binaries.
TARGET_HARDEN_PIE produces relocatable code. A bootloader may be
relocatable but that requires special handling, so it makes no sense to
force this from the outside.
TARGET_DEBUG matches any TARGET_DEBUG_* option. If debugging is enabled
then extra debug sections may be added to the binary. This can cause
problems depending on the bootloader build system and linker script. It's
not useful anyways, so blacklisting this is a good idea.
TARGET_BUILD_ID is just like TARGET_DEBUG. It adds a special elf section.
It makes no sense for a bootloader and can cause problems.

I'm not sure which one is responsible for your problem. Is
TARGET_DEBUG_ENABLE or TARGET_DEBUG_FULL enabled in your BSP?

Michael

> Greets
> Alex
> ---
>  rules/u-boot.make | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/rules/u-boot.make b/rules/u-boot.make
> index 6dd2e43a45..94aa774580 100644
> --- a/rules/u-boot.make
> +++ b/rules/u-boot.make
> @@ -29,6 +29,13 @@ U_BOOT_DIR	:= $(BUILDDIR)/$(U_BOOT)
>  # Prepare
>  # ----------------------------------------------------------------------------
>  
> +U_BOOT_WRAPPER_BLACKLIST := \
> +	TARGET_HARDEN_RELRO \
> +	TARGET_HARDEN_BINDNOW \
> +	TARGET_HARDEN_PIE \
> +	TARGET_DEBUG \
> +	TARGET_BUILD_ID
> +
>  U_BOOT_PATH	:= PATH=$(CROSS_PATH)
>  U_BOOT_MAKE_OPT	:= CROSS_COMPILE=$(BOOTLOADER_CROSS_COMPILE) HOSTCC=$(HOSTCC)
>  U_BOOT_MAKE_PAR	:= NO
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
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 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH] u-boot: Add wrapper blacklist
  2018-01-31 15:09 ` Michael Olbrich
@ 2018-02-01  7:49   ` Alexander Dahl
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Dahl @ 2018-02-01  7:49 UTC (permalink / raw)
  To: ptxdist

Hello Michael,

thanks for your explanations, I comment below.

Am Mittwoch, 31. Januar 2018, 16:09:40 CET schrieb Michael Olbrich:
> Build/runtime failures or by knowing what the options mean :-).
> 
> TARGET_HARDEN_RELRO/TARGET_HARDEN_BINDNOW only makes sense for elf
> binaries.
> TARGET_HARDEN_PIE produces relocatable code. A bootloader may be
> relocatable but that requires special handling, so it makes no sense to
> force this from the outside.

I read this as: it makes sense to blacklist those for a bootloader.

> TARGET_DEBUG matches any TARGET_DEBUG_* option. If debugging is enabled
> then extra debug sections may be added to the binary. This can cause
> problems depending on the bootloader build system and linker script. It's
> not useful anyways, so blacklisting this is a good idea.

TARGET_DEBUG_KEEP is set, but if it's a good idea to blacklist those, well 
then this can stay in.

> TARGET_BUILD_ID is just like TARGET_DEBUG. It adds a special elf section.
> It makes no sense for a bootloader and can cause problems.
> 
> I'm not sure which one is responsible for your problem. Is
> TARGET_DEBUG_ENABLE or TARGET_DEBUG_FULL enabled in your BSP?

TARGET_BUILD_ID is set, globally in /usr/local/lib/ptxdist-2017.09.0/
platforms/toolchain_options.in and there is no option to change that. ;-)

If I blacklist nothing, the u-boot.bin has a size of 543M. Just blacklisting 
TARGET_BUILD_ID leads to the normal size of 332K.

To sum it up: I see no need to send an updated v2 of the patch. I would be 
happy if you could merge it for those still using u-boot. :-)

Greets
Alex


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

end of thread, other threads:[~2018-02-01  7:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-31 14:57 [ptxdist] [PATCH] u-boot: Add wrapper blacklist Alexander Dahl
2018-01-31 15:09 ` Michael Olbrich
2018-02-01  7:49   ` Alexander Dahl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox