Skip to contentSkip to conversation

package/Makefile.in: Fix dependency for selecting uclinux as TARGET_OS

PATCH Superseded Axel Lin 4 participants 11 messages Sep 4, 2013 – Sep 6, 2013

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 package/Makefile.in: Fix dependency for selecting uclinux as TARGET_OS

Current setting only allows blackfin to select uclinux as TARGET_OS. However, some noMMU ARM platforms that using FLAT binary format also need to select uclinux as TARGET_OS. Fix the dependency.

---
I need this change to allow testing build for ARM noMMU. Maybe worth to upstream.

Axel

 package/Makefile.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/Makefile.in +2 -2
index 91ae1b9..6aa6266 100644
@@ -23,8 +23,8 @@ MAKE:=$(HOSTMAKE) -j$(PARALLEL_JOBS)
 # Compute GNU_TARGET_NAME
 GNU_TARGET_NAME=$(ARCH)-buildroot-$(TARGET_OS)-$(LIBC)$(ABI)
 
-# Blackfin FLAT needs uclinux
-ifeq ($(BR2_bfin)$(BR2_BINFMT_FLAT),yy)
+# FLAT binary format needs uclinux
+ifeq ($(BR2_BINFMT_FLAT),y)
 TARGET_OS=uclinux
 else
 TARGET_OS=linux
Signature · 1 line
1.8.1.2
author
#1 lore raw

PATCH 2/2 arch/Config.in: Allow ARM to select BR2_BINFMT_FLAT

Some noMMU ARM platforms need to select BR2_BINFMT_FLAT. Most ARM platforms have MMU, thus set default to BR2_BINFMT_ELF for ARM.

---
 arch/Config.in | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
arch/Config.in +4 -3
index 14899ca..31c23ec 100644
@@ -223,8 +223,9 @@ config BR2_GCC_TARGET_MODE
 # Set up target binary format
 choice
 	prompt "Target Binary Format"
-	depends on BR2_bfin || BR2_m68k
-	default BR2_BINFMT_FDPIC
+	depends on BR2_arm || BR2_bfin || BR2_m68k
+	default BR2_BINFMT_ELF if BR2_arm
+	default BR2_BINFMT_FDPIC if (BR2_bfin || BR2_m68k)
 
 config BR2_BINFMT_ELF
 	bool "ELF"
@@ -245,7 +246,7 @@ config BR2_BINFMT_FDPIC
 
 config BR2_BINFMT_FLAT
 	bool "FLAT"
-	depends on BR2_bfin || BR2_m68k
+	depends on BR2_arm || BR2_bfin || BR2_m68k
 	select BR2_PREFER_STATIC_LIB
 	help
 	  FLAT binary is a relatively simple and lightweight executable format
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH 2/2 arch/Config.in: Allow ARM to select BR2_BINFMT_FLAT

Dear Axel Lin,

arch/Config.in config BR2_GCC_TARGET_MODE · line 228

Quoted 13 lines · Axel Lin
arch/Config.in +3 -2
index 14899ca..31c23ec 100644
@@ -223,8 +223,9 @@ config BR2_GCC_TARGET_MODE
 # Set up target binary format
 choice
 	prompt "Target Binary Format"
-	depends on BR2_bfin || BR2_m68k
-	default BR2_BINFMT_FDPIC
+	depends on BR2_arm || BR2_bfin || BR2_m68k
+	default BR2_BINFMT_ELF if BR2_arm
+	default BR2_BINFMT_FDPIC if (BR2_bfin || BR2_m68k)

I know it was broken before, but FDPIC isn't supported on BR2_m68k, so I guess we should have something like:

prompt "Target Binary Format" depends on BR2_arm || BR2_m68k || BR2_bfin default BR2_BINFMT_ELF if BR2_arm default BR2_BINFMT_FDPIC if BR2_bfin default BR2_BINFMT_FLAT if BR2_m68k

But I'm wondering if we shouldn't go further than that, and make BR2_BINFMT_FLAT available only for non-MMU ARMs. Something like:

	prompt "Target Binary Format"
	depends on BR2_arm7tmdi || BR2_arm_cortex_m3 ||	BR2_arm_cortex_m4 || BR2_m68k || BR2_bfin
	default BR2_BINFMT_FLAT if BR2_arm7tmdi || BR2_arm_cortex_m3 ||	BR2_arm_cortex_m4 || BR2_m68k
	default BR2_BINFMT_FDPIC if BR2_bfin

or something like this. This way, users of MMU-capable ARM variants wouldn't be confused by the availability of FLAT and ELF as binary formats. Of course, BR2_BINFMT_ELF should gain some !BR2_arm7tmdi && !BR2_arm_cortex_m3 && !BR2_arm_cortex_m4 dependencies, or maybe even a !BR2_USE_MMU dependency. I think there's quite some room for improvement around the definition of which CPU has an MMU or not, and which architectures support which binary formats.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#3 lore raw

PATCH 2/2 arch/Config.in: Allow ARM to select BR2_BINFMT_FLAT

Op 5-sep.-2013 23:48 schreef "Thomas Petazzoni" < [email protected]> het volgende:

Quoted 5 lines

But I'm wondering if we shouldn't go further than that, and make BR2_BINFMT_FLAT available only for non-MMU ARMs. Something like:

prompt "Target Binary Format"
depends on BR2_arm7tmdi || BR2_arm_cortex_m3 || BR2_arm_cortex_m4

|| BR2_m68k || BR2_bfin
>         default BR2_BINFMT_FLAT if BR2_arm7tmdi || BR2_arm_cortex_m3 ||
BR2_arm_cortex_m4 || BR2_m68k
>         default BR2_BINFMT_FDPIC if BR2_bfin
Quoted 8 lines

or something like this. This way, users of MMU-capable ARM variants wouldn't be confused by the availability of FLAT and ELF as binary formats. Of course, BR2_BINFMT_ELF should gain some !BR2_arm7tmdi && !BR2_arm_cortex_m3 && !BR2_arm_cortex_m4 dependencies, or maybe even a !BR2_USE_MMU dependency. I think there's quite some room for improvement around the definition of which CPU has an MMU or not, and which architectures support which binary formats.

Don't we/shouldn't we have something like ARCH_HAS_MMU and/or ARCH_SUPPORTS_FLAT_BINARY?

Best regards,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130906/22703a2b/attachment.html>

#4 lore raw

PATCH 2/2 arch/Config.in: Allow ARM to select BR2_BINFMT_FLAT

Dear Thomas De Schampheleire,

Quoted 10 lines · Thomas De Schampheleire
Quoted 7 lines

or something like this. This way, users of MMU-capable ARM variants wouldn't be confused by the availability of FLAT and ELF as binary formats. Of course, BR2_BINFMT_ELF should gain some !BR2_arm7tmdi && !BR2_arm_cortex_m3 && !BR2_arm_cortex_m4 dependencies, or maybe even a !BR2_USE_MMU dependency. I think there's quite some room for improvement around the definition of which CPU has an MMU or not, and which architectures support which binary formats.

Don't we/shouldn't we have something like ARCH_HAS_MMU and/or ARCH_SUPPORTS_FLAT_BINARY?

Yes, we should probably have something like this (and ditto for other binary formats: ELF, FDPIC and so on).

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#5 lore raw

PATCH 2/2 arch/Config.in: Allow ARM to select BR2_BINFMT_FLAT

Quoted 7 lines · Thomas Petazzoni
Quoted 2 lines · Thomas De Schampheleire

Don't we/shouldn't we have something like ARCH_HAS_MMU and/or ARCH_SUPPORTS_FLAT_BINARY?

Yes, we should probably have something like this (and ditto for other binary formats: ELF, FDPIC and so on).

On a side note, remember that HAS_MMU doesn't mean it's using it - from what i've read you can use MMU-bearing processors to test uclinux MMU-less scenarios (dunno if it can be done with every SOC out there, probably depends on the linux support for each one, at least a couple of Atmel ones were used this way for testing and/or masochism). Regards.

#6 lore raw

PATCH 2/2 arch/Config.in: Allow ARM to select BR2_BINFMT_FLAT

Dear Gustavo Zacarias,

Quoted 7 lines · Gustavo Zacarias
Quoted 5 lines · Thomas Petazzoni
Quoted 2 lines · Thomas De Schampheleire

Don't we/shouldn't we have something like ARCH_HAS_MMU and/or ARCH_SUPPORTS_FLAT_BINARY?

Quoted 8 lines
Quoted 2 lines

Yes, we should probably have something like this (and ditto for other binary formats: ELF, FDPIC and so on).

On a side note, remember that HAS_MMU doesn't mean it's using it - from what i've read you can use MMU-bearing processors to test uclinux MMU-less scenarios (dunno if it can be done with every SOC out there, probably depends on the linux support for each one, at least a couple of Atmel ones were used this way for testing and/or masochism).

Right. We could distinguish what the hardware is capable of (i.e BR2_HAS_MMU vs. !BR2_HAS_MMU) and what the user wants to do (BR2_USE_MMU vs. !BR2_USE_MMU). Of course, BR2_USE_MMU depends on BR2_HAS_MMU. That said, until now, we've been hiding BR2_USE_MMU on many architectures for which !MMU doesn't exist/isn't supported. On ARM, I believe it doesn't make much sense to expose !MMU for MMU-capable variants.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#7 lore raw

PATCH 1/2 package/Makefile.in: Fix dependency for selecting uclinux as TARGET_OS

In reply to Axel Lin

Dear Axel Lin,

Quoted 3 lines · Axel Lin

Current setting only allows blackfin to select uclinux as TARGET_OS. However, some noMMU ARM platforms that using FLAT binary format also need to select uclinux as TARGET_OS. Fix the dependency.

Are you sure uclinux as TARGET_OS is the right selection for ARM? The release notes of gcc 4.7, at http://gcc.gnu.org/gcc-4.7/changes.html,
indicate:

""
The obsolete ports with alternatives are:

    arm*-*-rtems (use arm*-*-rtemseabi)
    arm*-*-linux-gnu (use arm*-*-linux-gnueabi)
    arm*-*-elf (use arm*-*-eabi)
    arm*-*-uclinux* (use arm*-*-uclinux*eabi)

""

So it looks like the arm-<something>-uclinux* tuple should not be used, if I understand this correctly. Do you have more details about why arm-<something>-uclinux* should be used?

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
author
#8 lore raw

PATCH 1/2 package/Makefile.in: Fix dependency for selecting uclinux as TARGET_OS

2013/9/6 Thomas Petazzoni <[email protected]>:

Quoted 18 lines

Dear Axel Lin,

Quoted 3 lines · Axel Lin

Current setting only allows blackfin to select uclinux as TARGET_OS. However, some noMMU ARM platforms that using FLAT binary format also need to select uclinux as TARGET_OS. Fix the dependency.

Are you sure uclinux as TARGET_OS is the right selection for ARM? The release notes of gcc 4.7, at http://gcc.gnu.org/gcc-4.7/changes.html,
indicate:

""
The obsolete ports with alternatives are:

    arm*-*-rtems (use arm*-*-rtemseabi)
    arm*-*-linux-gnu (use arm*-*-linux-gnueabi)
    arm*-*-elf (use arm*-*-eabi)
    arm*-*-uclinux* (use arm*-*-uclinux*eabi)
Quoted 5 lines

""

So it looks like the arm-<something>-uclinux* tuple should not be used, if I understand this correctly. Do you have more details about why arm-<something>-uclinux* should be used?

Somehow, I thought noMMU ARM platforms that using FLAT binary format needs to select uclinux as TARGET_OS.
But since you mentioned the release notes of gcc 4.7, I'm not 100% sure.

I check my build, the result is I have arm-buildroot-uclinux-uclibcgnueabi-gcc. And the build log shows it checks target system type as:
checking target system type... arm-buildroot-uclinux-uclibcgnueabi

Does buildroot automatically convert arm*-*-uclinux* to arm*-*-uclinux*eabi?

I also check host-gcc-final-4.5.4/gcc/config.gcc and libgcc/config.host. Looks like it also expects arm*-*-uclinux* for ARM ucLinux and arm*-*-linux* for ARM GNU/Linux with ELF.

Thanks for the review,
Axel

#9 lore raw

PATCH 1/2 package/Makefile.in: Fix dependency for selecting uclinux as TARGET_OS

Dear Axel Lin,

Quoted 7 lines · Axel Lin
Quoted 3 lines

So it looks like the arm-<something>-uclinux* tuple should not be used, if I understand this correctly. Do you have more details about why arm-<something>-uclinux* should be used?

Somehow, I thought noMMU ARM platforms that using FLAT binary format needs to select uclinux as TARGET_OS.
But since you mentioned the release notes of gcc 4.7, I'm not 100% sure.

I am not sure either.

Quoted 9 lines

I check my build, the result is I have arm-buildroot-uclinux-uclibcgnueabi-gcc. And the build log shows it checks target system type as:
checking target system type... arm-buildroot-uclinux-uclibcgnueabi

Does buildroot automatically convert arm*-*-uclinux* to arm*-*-uclinux*eabi?

I also check host-gcc-final-4.5.4/gcc/config.gcc and libgcc/config.host. Looks like it also expects arm*-*-uclinux* for ARM ucLinux and arm*-*-linux* for ARM GNU/Linux with ELF.

Can you check in more recent gcc versions such as 4.7 or 4.8 ? Looking at the most recent versions is important to see what is the current tuple accepted for this situation.

Thanks,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
author
#10 lore raw

PATCH 1/2 package/Makefile.in: Fix dependency for selecting uclinux as TARGET_OS

2013/9/6 Thomas Petazzoni <[email protected]>:

Quoted 20 lines

Dear Axel Lin,

Quoted 7 lines · Axel Lin
Quoted 3 lines

So it looks like the arm-<something>-uclinux* tuple should not be used, if I understand this correctly. Do you have more details about why arm-<something>-uclinux* should be used?

Somehow, I thought noMMU ARM platforms that using FLAT binary format needs to select uclinux as TARGET_OS.
But since you mentioned the release notes of gcc 4.7, I'm not 100% sure.

I am not sure either.

Quoted 6 lines

I check my build, the result is I have arm-buildroot-uclinux-uclibcgnueabi-gcc. And the build log shows it checks target system type as:
checking target system type... arm-buildroot-uclinux-uclibcgnueabi

Does buildroot automatically convert arm*-*-uclinux* to arm*-*-uclinux*eabi?

Quoted 7 lines
Quoted 3 lines

I also check host-gcc-final-4.5.4/gcc/config.gcc and libgcc/config.host. Looks like it also expects arm*-*-uclinux* for ARM ucLinux and arm*-*-linux* for ARM GNU/Linux with ELF.

Can you check in more recent gcc versions such as 4.7 or 4.8 ? Looking at the most recent versions is important to see what is the current tuple accepted for this situation.

Hi Thomas,
In host-gcc-final-4.8.1/gcc/config.gcc:

# Unsupported targets list. Do not put an entry in this list unless

# it would otherwise be caught by a more permissive pattern.  The list
# should be in alphabetical order.
case ${target} in
 # Avoid special cases that are not obsolete
   arm*-*-*eabi*                        \
 )
        ;;
   arm*-wince-pe*                       \
 | arm*-*-ecos-elf                      \
 | arm*-*-elf                           \
 | arm*-*-freebsd*                      \
 | arm*-*-linux*                        \
 | arm*-*-uclinux*                      \
 | i[34567]86-go32-*                    \
 | i[34567]86-*-go32*                   \
 | m68k-*-uclinuxoldabi*                \
 | mips64orion*-*-rtems*                \
 | pdp11-*-bsd                          \
 | sparc-hal-solaris2*                  \
 | thumb-*-*                            \
 | *-*-freebsd[12] | *-*-freebsd[12].*  \
 | *-*-freebsd*aout*                    \
 | *-*-linux*aout*                      \
 | *-*-linux*coff*                      \
 | *-*-linux*libc1*                     \
 | *-*-linux*oldld*                     \
 | *-*-rtemsaout*                       \
 | *-*-rtemscoff*                       \
 | *-*-solaris2                         \
 | *-*-solaris2.[0-8]                   \
 | *-*-solaris2.[0-8].*                 \
 | *-*-sysv*                            \
 | vax-*-vms*                           \
 )
        echo "*** Configuration ${target} not supported" 1>&2
        exit 1
        ;;
esac

The first case shows
case ${target} in
# Avoid special cases that are not obsolete
arm*-*-*eabi* \
)

        ;;

Although I have no idea which part of buildroot system converts arm*-*-uclinux* to arm*-*-uclinux*eabi.
The build result shows arm-buildroot-uclinux-uclibcgnueabi which matches the first case.
So I think it's ok to set TARGET_OS=uclinux.

Regards,
Axel