diff mbox

powerpc: 32BIT vs. 64BIT (PPC32 vs. PPC64)

Message ID 20180707221316.5b75e075@roar.ozlabs.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Nicholas Piggin July 7, 2018, 12:13 p.m. UTC
On Fri, 6 Jul 2018 21:58:29 -0700
Randy Dunlap <rdunlap@infradead.org> wrote:

> On 07/06/2018 06:45 PM, Benjamin Herrenschmidt wrote:
> > On Thu, 2018-07-05 at 14:30 -0700, Randy Dunlap wrote:  
> >> Hi,
> >>
> >> Is there a good way (or a shortcut) to do something like:
> >>
> >> $ make ARCH=powerpc O=PPC32 [other_options] allmodconfig
> >>   to get a PPC32/32BIT allmodconfig
> >>
> >> and also be able to do:
> >>
> >> $make ARCH=powerpc O=PPC64 [other_options] allmodconfig
> >>   to get a PPC64/64BIT allmodconfig?  
> > 
> > Hrm... O= is for the separate build dir, so there much be something
> > else.
> > 
> > You mean having ARCH= aliases like ppc/ppc32 and ppc64 ?  
> 
> Yes.
> 
> > That would be a matter of overriding some .config defaults I suppose, I
> > don't know how this is done on other archs.
> > 
> > I see the aliasing trick in the Makefile but that's about it.
> >   
> >> Note that arch/x86, arch/sh, and arch/sparc have ways to do
> >> some flavor(s) of this (from Documentation/kbuild/kbuild.txt;
> >> sh and sparc based on a recent "fix" patch from me):  
> > 
> > I fail to see what you are actually talking about here ... sorry. Do
> > you have concrete examples on x86 or sparc ? From what I can tell the
> > "i386" or "sparc32/sparc64" aliases just change SRCARCH in Makefile and
> > 32 vs 64-bit is just a Kconfig option...  
> 
> Yes, your summary is mostly correct.
> 
> I'm just looking for a way to do cross-compile builds that are close to
> ppc32 allmodconfig and ppc64 allmodconfig.

Would there a problem with adding ARCH=ppc32 / ppc64 matching? This
seems to work...

Thanks,
Nick

---
 Makefile                               | 8 ++++++++
 arch/powerpc/Kconfig                   | 9 +++++++++
 arch/powerpc/platforms/Kconfig.cputype | 8 --------
 3 files changed, 17 insertions(+), 8 deletions(-)

Comments

Randy Dunlap July 7, 2018, 2:59 p.m. UTC | #1
On 07/07/2018 05:13 AM, Nicholas Piggin wrote:
> On Fri, 6 Jul 2018 21:58:29 -0700
> Randy Dunlap <rdunlap@infradead.org> wrote:
> 
>> On 07/06/2018 06:45 PM, Benjamin Herrenschmidt wrote:
>>> On Thu, 2018-07-05 at 14:30 -0700, Randy Dunlap wrote:  
>>>> Hi,
>>>>
>>>> Is there a good way (or a shortcut) to do something like:
>>>>
>>>> $ make ARCH=powerpc O=PPC32 [other_options] allmodconfig
>>>>   to get a PPC32/32BIT allmodconfig
>>>>
>>>> and also be able to do:
>>>>
>>>> $make ARCH=powerpc O=PPC64 [other_options] allmodconfig
>>>>   to get a PPC64/64BIT allmodconfig?  
>>>
>>> Hrm... O= is for the separate build dir, so there much be something
>>> else.
>>>
>>> You mean having ARCH= aliases like ppc/ppc32 and ppc64 ?  
>>
>> Yes.
>>
>>> That would be a matter of overriding some .config defaults I suppose, I
>>> don't know how this is done on other archs.
>>>
>>> I see the aliasing trick in the Makefile but that's about it.
>>>   
>>>> Note that arch/x86, arch/sh, and arch/sparc have ways to do
>>>> some flavor(s) of this (from Documentation/kbuild/kbuild.txt;
>>>> sh and sparc based on a recent "fix" patch from me):  
>>>
>>> I fail to see what you are actually talking about here ... sorry. Do
>>> you have concrete examples on x86 or sparc ? From what I can tell the
>>> "i386" or "sparc32/sparc64" aliases just change SRCARCH in Makefile and
>>> 32 vs 64-bit is just a Kconfig option...  
>>
>> Yes, your summary is mostly correct.
>>
>> I'm just looking for a way to do cross-compile builds that are close to
>> ppc32 allmodconfig and ppc64 allmodconfig.
> 
> Would there a problem with adding ARCH=ppc32 / ppc64 matching? This
> seems to work...
> 
> Thanks,
> Nick

Yes, this mostly works and is similar to a patch (my patch) on my test machine.
And they both work for allmodconfig, which is my primary build target.

And they both have one little quirk that is confusing when the build target
is defconfig:

When ARCH=ppc32, the terminal output (stdout) is: (using O=PPC32)

make[1]: Entering directory '/home/rdunlap/lnx/lnx-418-rc3/PPC32'
  GEN     ./Makefile
*** Default configuration is based on 'ppc64_defconfig'   <<<<< NOTE <<<<<
#
# configuration written to .config
#
make[1]: Leaving directory '/home/rdunlap/lnx/lnx-418-rc3/PPC32'


I expect that can be fixed also.  :)

And the written .config file is indeed for 32BIT, not 64BIT.

Thanks, Nick.

> ---
>  Makefile                               | 8 ++++++++
>  arch/powerpc/Kconfig                   | 9 +++++++++
>  arch/powerpc/platforms/Kconfig.cputype | 8 --------
>  3 files changed, 17 insertions(+), 8 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index c5ce55cbc543..f97204aed17a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -345,6 +345,14 @@ ifeq ($(ARCH),sh64)
>         SRCARCH := sh
>  endif
>  
> +# Additional ARCH settings for powerpc
> +ifeq ($(ARCH),ppc32)
> +       SRCARCH := powerpc
> +endif
> +ifeq ($(ARCH),ppc64)
> +       SRCARCH := powerpc
> +endif
> +
>  KCONFIG_CONFIG	?= .config
>  export KCONFIG_CONFIG
>  
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 9f2b75fe2c2d..3405b1b122be 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -1,4 +1,13 @@
>  # SPDX-License-Identifier: GPL-2.0
> +
> +config PPC64
> +	bool "64-bit kernel" if "$(ARCH)" = "powerpc"
> +	default "$(ARCH)" != "ppc32"
> +	select ZLIB_DEFLATE
> +	help
> +	  This option selects whether a 32-bit or a 64-bit kernel
> +	  will be built.
> +
>  source "arch/powerpc/platforms/Kconfig.cputype"
>  
>  config PPC32
> diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
> index e6a1de521319..f6e5d6ef9782 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -1,12 +1,4 @@
>  # SPDX-License-Identifier: GPL-2.0
> -config PPC64
> -	bool "64-bit kernel"
> -	default n
> -	select ZLIB_DEFLATE
> -	help
> -	  This option selects whether a 32-bit or a 64-bit kernel
> -	  will be built.
> -
>  menu "Processor support"
>  choice
>  	prompt "Processor Type"
>
Nicholas Piggin July 8, 2018, 3:44 p.m. UTC | #2
On Sat, 7 Jul 2018 07:59:49 -0700
Randy Dunlap <rdunlap@infradead.org> wrote:

> On 07/07/2018 05:13 AM, Nicholas Piggin wrote:
> > On Fri, 6 Jul 2018 21:58:29 -0700
> > Randy Dunlap <rdunlap@infradead.org> wrote:
> >   
> >> On 07/06/2018 06:45 PM, Benjamin Herrenschmidt wrote:  
> >>> On Thu, 2018-07-05 at 14:30 -0700, Randy Dunlap wrote:    
> >>>> Hi,
> >>>>
> >>>> Is there a good way (or a shortcut) to do something like:
> >>>>
> >>>> $ make ARCH=powerpc O=PPC32 [other_options] allmodconfig
> >>>>   to get a PPC32/32BIT allmodconfig
> >>>>
> >>>> and also be able to do:
> >>>>
> >>>> $make ARCH=powerpc O=PPC64 [other_options] allmodconfig
> >>>>   to get a PPC64/64BIT allmodconfig?    
> >>>
> >>> Hrm... O= is for the separate build dir, so there much be something
> >>> else.
> >>>
> >>> You mean having ARCH= aliases like ppc/ppc32 and ppc64 ?    
> >>
> >> Yes.
> >>  
> >>> That would be a matter of overriding some .config defaults I suppose, I
> >>> don't know how this is done on other archs.
> >>>
> >>> I see the aliasing trick in the Makefile but that's about it.
> >>>     
> >>>> Note that arch/x86, arch/sh, and arch/sparc have ways to do
> >>>> some flavor(s) of this (from Documentation/kbuild/kbuild.txt;
> >>>> sh and sparc based on a recent "fix" patch from me):    
> >>>
> >>> I fail to see what you are actually talking about here ... sorry. Do
> >>> you have concrete examples on x86 or sparc ? From what I can tell the
> >>> "i386" or "sparc32/sparc64" aliases just change SRCARCH in Makefile and
> >>> 32 vs 64-bit is just a Kconfig option...    
> >>
> >> Yes, your summary is mostly correct.
> >>
> >> I'm just looking for a way to do cross-compile builds that are close to
> >> ppc32 allmodconfig and ppc64 allmodconfig.  
> > 
> > Would there a problem with adding ARCH=ppc32 / ppc64 matching? This
> > seems to work...
> > 
> > Thanks,
> > Nick  
> 
> Yes, this mostly works and is similar to a patch (my patch) on my test machine.
> And they both work for allmodconfig, which is my primary build target.
> 
> And they both have one little quirk that is confusing when the build target
> is defconfig:
> 
> When ARCH=ppc32, the terminal output (stdout) is: (using O=PPC32)
> 
> make[1]: Entering directory '/home/rdunlap/lnx/lnx-418-rc3/PPC32'
>   GEN     ./Makefile
> *** Default configuration is based on 'ppc64_defconfig'   <<<<< NOTE <<<<<
> #
> # configuration written to .config
> #
> make[1]: Leaving directory '/home/rdunlap/lnx/lnx-418-rc3/PPC32'
> 
> 
> I expect that can be fixed also.  :)

It can, we'd just have to choose one of the many 32-bit configs to be
the default config in that case. I don't know much about 32 bit ppc,
so I don't know what would be the most useful for allmodconfig type of
build tests.

Even 64 bit have a bunch of major variants that are exclusive at build
time (Server vs embedded, endian, etc). So maybe the simple ppc64/ppc32
is not enough. Not sure.

Thanks,
Nick
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Masahiro Yamada July 30, 2018, 8:42 a.m. UTC | #3
2018-07-07 23:59 GMT+09:00 Randy Dunlap <rdunlap@infradead.org>:
> On 07/07/2018 05:13 AM, Nicholas Piggin wrote:
>> On Fri, 6 Jul 2018 21:58:29 -0700
>> Randy Dunlap <rdunlap@infradead.org> wrote:
>>
>>> On 07/06/2018 06:45 PM, Benjamin Herrenschmidt wrote:
>>>> On Thu, 2018-07-05 at 14:30 -0700, Randy Dunlap wrote:
>>>>> Hi,
>>>>>
>>>>> Is there a good way (or a shortcut) to do something like:
>>>>>
>>>>> $ make ARCH=powerpc O=PPC32 [other_options] allmodconfig
>>>>>   to get a PPC32/32BIT allmodconfig
>>>>>
>>>>> and also be able to do:
>>>>>
>>>>> $make ARCH=powerpc O=PPC64 [other_options] allmodconfig
>>>>>   to get a PPC64/64BIT allmodconfig?
>>>>
>>>> Hrm... O= is for the separate build dir, so there much be something
>>>> else.
>>>>
>>>> You mean having ARCH= aliases like ppc/ppc32 and ppc64 ?
>>>
>>> Yes.
>>>
>>>> That would be a matter of overriding some .config defaults I suppose, I
>>>> don't know how this is done on other archs.
>>>>
>>>> I see the aliasing trick in the Makefile but that's about it.
>>>>
>>>>> Note that arch/x86, arch/sh, and arch/sparc have ways to do
>>>>> some flavor(s) of this (from Documentation/kbuild/kbuild.txt;
>>>>> sh and sparc based on a recent "fix" patch from me):
>>>>
>>>> I fail to see what you are actually talking about here ... sorry. Do
>>>> you have concrete examples on x86 or sparc ? From what I can tell the
>>>> "i386" or "sparc32/sparc64" aliases just change SRCARCH in Makefile and
>>>> 32 vs 64-bit is just a Kconfig option...
>>>
>>> Yes, your summary is mostly correct.
>>>
>>> I'm just looking for a way to do cross-compile builds that are close to
>>> ppc32 allmodconfig and ppc64 allmodconfig.
>>
>> Would there a problem with adding ARCH=ppc32 / ppc64 matching? This
>> seems to work...
>>
>> Thanks,
>> Nick
>
> Yes, this mostly works and is similar to a patch (my patch) on my test machine.
> And they both work for allmodconfig, which is my primary build target.
>
> And they both have one little quirk that is confusing when the build target
> is defconfig:
>
> When ARCH=ppc32, the terminal output (stdout) is: (using O=PPC32)
>
> make[1]: Entering directory '/home/rdunlap/lnx/lnx-418-rc3/PPC32'
>   GEN     ./Makefile
> *** Default configuration is based on 'ppc64_defconfig'   <<<<< NOTE <<<<<
> #
> # configuration written to .config
> #
> make[1]: Leaving directory '/home/rdunlap/lnx/lnx-418-rc3/PPC32'
>


Maybe, we can set one of ppc32 defconfigs to KBUILD_DEFCONFIG
if ARCH is ppc32 ?


ifeq ($(ARCH),ppc32)
   KBUILD_DEFCONFIG := (some reasonable 32bit machine _defconfig)
else
   KBUILD_DEFCONFIG := ppc64_defconfig
endif

ifeq ($(CROSS_COMPILE),)
    KBUILD_DEFCONFIG := $(shell uname -m)_defconfig
endif


> I expect that can be fixed also.  :)
>
> And the written .config file is indeed for 32BIT, not 64BIT.
>
> Thanks, Nick.
>
>> ---
>>  Makefile                               | 8 ++++++++
>>  arch/powerpc/Kconfig                   | 9 +++++++++
>>  arch/powerpc/platforms/Kconfig.cputype | 8 --------
>>  3 files changed, 17 insertions(+), 8 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index c5ce55cbc543..f97204aed17a 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -345,6 +345,14 @@ ifeq ($(ARCH),sh64)
>>         SRCARCH := sh
>>  endif
>>
>> +# Additional ARCH settings for powerpc
>> +ifeq ($(ARCH),ppc32)
>> +       SRCARCH := powerpc
>> +endif
>> +ifeq ($(ARCH),ppc64)
>> +       SRCARCH := powerpc
>> +endif
>> +
>>  KCONFIG_CONFIG       ?= .config
>>  export KCONFIG_CONFIG
>>
>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>> index 9f2b75fe2c2d..3405b1b122be 100644
>> --- a/arch/powerpc/Kconfig
>> +++ b/arch/powerpc/Kconfig
>> @@ -1,4 +1,13 @@
>>  # SPDX-License-Identifier: GPL-2.0
>> +
>> +config PPC64
>> +     bool "64-bit kernel" if "$(ARCH)" = "powerpc"
>> +     default "$(ARCH)" != "ppc32"
>> +     select ZLIB_DEFLATE
>> +     help
>> +       This option selects whether a 32-bit or a 64-bit kernel
>> +       will be built.
>> +
>>  source "arch/powerpc/platforms/Kconfig.cputype"
>>
>>  config PPC32
>> diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
>> index e6a1de521319..f6e5d6ef9782 100644
>> --- a/arch/powerpc/platforms/Kconfig.cputype
>> +++ b/arch/powerpc/platforms/Kconfig.cputype
>> @@ -1,12 +1,4 @@
>>  # SPDX-License-Identifier: GPL-2.0
>> -config PPC64
>> -     bool "64-bit kernel"
>> -     default n
>> -     select ZLIB_DEFLATE
>> -     help
>> -       This option selects whether a 32-bit or a 64-bit kernel
>> -       will be built.
>> -
>>  menu "Processor support"
>>  choice
>>       prompt "Processor Type"
>>
>
>
> --
> ~Randy
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Ellerman July 31, 2018, 9:57 a.m. UTC | #4
Masahiro Yamada <yamada.masahiro@socionext.com> writes:
> 2018-07-07 23:59 GMT+09:00 Randy Dunlap <rdunlap@infradead.org>:
>> On 07/07/2018 05:13 AM, Nicholas Piggin wrote:
>>> On Fri, 6 Jul 2018 21:58:29 -0700
>>> Randy Dunlap <rdunlap@infradead.org> wrote:
>>>
>>>> On 07/06/2018 06:45 PM, Benjamin Herrenschmidt wrote:
>>>>> On Thu, 2018-07-05 at 14:30 -0700, Randy Dunlap wrote:
>>>>>> Hi,
>>>>>>
>>>>>> Is there a good way (or a shortcut) to do something like:
>>>>>>
>>>>>> $ make ARCH=powerpc O=PPC32 [other_options] allmodconfig
>>>>>>   to get a PPC32/32BIT allmodconfig
>>>>>>
>>>>>> and also be able to do:
>>>>>>
>>>>>> $make ARCH=powerpc O=PPC64 [other_options] allmodconfig
>>>>>>   to get a PPC64/64BIT allmodconfig?
>>>>>
>>>>> Hrm... O= is for the separate build dir, so there much be something
>>>>> else.
>>>>>
>>>>> You mean having ARCH= aliases like ppc/ppc32 and ppc64 ?
>>>>
>>>> Yes.
>>>>
>>>>> That would be a matter of overriding some .config defaults I suppose, I
>>>>> don't know how this is done on other archs.
>>>>>
>>>>> I see the aliasing trick in the Makefile but that's about it.
>>>>>
>>>>>> Note that arch/x86, arch/sh, and arch/sparc have ways to do
>>>>>> some flavor(s) of this (from Documentation/kbuild/kbuild.txt;
>>>>>> sh and sparc based on a recent "fix" patch from me):
>>>>>
>>>>> I fail to see what you are actually talking about here ... sorry. Do
>>>>> you have concrete examples on x86 or sparc ? From what I can tell the
>>>>> "i386" or "sparc32/sparc64" aliases just change SRCARCH in Makefile and
>>>>> 32 vs 64-bit is just a Kconfig option...
>>>>
>>>> Yes, your summary is mostly correct.
>>>>
>>>> I'm just looking for a way to do cross-compile builds that are close to
>>>> ppc32 allmodconfig and ppc64 allmodconfig.
>>>
>>> Would there a problem with adding ARCH=ppc32 / ppc64 matching? This
>>> seems to work...
>>
>> Yes, this mostly works and is similar to a patch (my patch) on my test machine.
>> And they both work for allmodconfig, which is my primary build target.
>>
>> And they both have one little quirk that is confusing when the build target
>> is defconfig:
>>
>> When ARCH=ppc32, the terminal output (stdout) is: (using O=PPC32)
>>
>> make[1]: Entering directory '/home/rdunlap/lnx/lnx-418-rc3/PPC32'
>>   GEN     ./Makefile
>> *** Default configuration is based on 'ppc64_defconfig'   <<<<< NOTE <<<<<
>> #
>> # configuration written to .config
>> #
>> make[1]: Leaving directory '/home/rdunlap/lnx/lnx-418-rc3/PPC32'
>>
>
>
> Maybe, we can set one of ppc32 defconfigs to KBUILD_DEFCONFIG
> if ARCH is ppc32 ?

We could, but as I said in another reply I'd rather we didn't play
tricks with ARCH.

I've merged a patch to add three new allmodconfig targets for ppc32,
ppc64le and ppc64_book3e:

  https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=54457&state=*


cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Makefile b/Makefile
index c5ce55cbc543..f97204aed17a 100644
--- a/Makefile
+++ b/Makefile
@@ -345,6 +345,14 @@  ifeq ($(ARCH),sh64)
        SRCARCH := sh
 endif
 
+# Additional ARCH settings for powerpc
+ifeq ($(ARCH),ppc32)
+       SRCARCH := powerpc
+endif
+ifeq ($(ARCH),ppc64)
+       SRCARCH := powerpc
+endif
+
 KCONFIG_CONFIG	?= .config
 export KCONFIG_CONFIG
 
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 9f2b75fe2c2d..3405b1b122be 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -1,4 +1,13 @@ 
 # SPDX-License-Identifier: GPL-2.0
+
+config PPC64
+	bool "64-bit kernel" if "$(ARCH)" = "powerpc"
+	default "$(ARCH)" != "ppc32"
+	select ZLIB_DEFLATE
+	help
+	  This option selects whether a 32-bit or a 64-bit kernel
+	  will be built.
+
 source "arch/powerpc/platforms/Kconfig.cputype"
 
 config PPC32
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index e6a1de521319..f6e5d6ef9782 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -1,12 +1,4 @@ 
 # SPDX-License-Identifier: GPL-2.0
-config PPC64
-	bool "64-bit kernel"
-	default n
-	select ZLIB_DEFLATE
-	help
-	  This option selects whether a 32-bit or a 64-bit kernel
-	  will be built.
-
 menu "Processor support"
 choice
 	prompt "Processor Type"