diff mbox series

[pseudo,3/3] configure: Add support for LoongArch

Message ID 20250309060039.454124-4-wuxiaotian@loongson.cn
State New
Headers show
Series Porting pseudo to LoongArch | expand

Commit Message

Xiaotian Wu March 9, 2025, 6 a.m. UTC
Set the default architecture based on the current machine

Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn>
---
 configure | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Richard Purdie March 13, 2025, 3:48 p.m. UTC | #1
On Sun, 2025-03-09 at 14:00 +0800, Xiaotian Wu via lists.yoctoproject.org wrote:
> Set the default architecture based on the current machine
> 
> Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn>
> ---
>  configure | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 39b5fbe..9fbba9a 100755
> --- a/configure
> +++ b/configure
> @@ -22,8 +22,17 @@ opt_xattrdb=false
>  opt_profile=false
>  opt_passwd_fallback='""'
>  
> +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=x86
> +case $UNAME_MACHINE in
> +  i*86|x86_64) opt_arch=x86 ;;
> +  arm|arm64) opt_arch=arm ;;
> +  loongarch32|loongarch64) opt_arch=loongarch ;;
> +esac
> +

Using uname like this is not cross compile compatible and will break
pseudo from building in OpenEmbedded. We can't do this...

Cheers,

Richard
Xiaotian Wu March 14, 2025, 1:17 a.m. UTC | #2
在 2025/3/13 23:48, Richard Purdie 写道:
> On Sun, 2025-03-09 at 14:00 +0800, Xiaotian Wu via lists.yoctoproject.org wrote:
>> Set the default architecture based on the current machine
>>
>> Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn>
>> ---
>>   configure | 11 ++++++++++-
>>   1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index 39b5fbe..9fbba9a 100755
>> --- a/configure
>> +++ b/configure
>> @@ -22,8 +22,17 @@ opt_xattrdb=false
>>   opt_profile=false
>>   opt_passwd_fallback='""'
>>   
>> +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=x86
>> +case $UNAME_MACHINE in
>> +  i*86|x86_64) opt_arch=x86 ;;
>> +  arm|arm64) opt_arch=arm ;;
>> +  loongarch32|loongarch64) opt_arch=loongarch ;;
>> +esac
>> +
> Using uname like this is not cross compile compatible and will break
> pseudo from building in OpenEmbedded. We can't do this...
Here the default arch parameter is just set based on uname, just like 
opt_arch=x86 before, and there is still support for rewriting the actual 
opt_arch with the --arch option, so the functionality hasn't actually 
changed, and the expectation is that it will still work as before.
>
> Cheers,
>
> Richard
Xiaotian Wu March 14, 2025, 3:21 a.m. UTC | #3
After re-testing in OpenEmbeded, it looks like we only need the "[PATCH 
1/3] pseudo_wrappers.c: Add support for LoongArch64" patch to work and 
not the other 2.

在 2025/3/14 09:17, Xiaotian Wu 写道:
>
> 在 2025/3/13 23:48, Richard Purdie 写道:
>> On Sun, 2025-03-09 at 14:00 +0800, Xiaotian Wu via 
>> lists.yoctoproject.org wrote:
>>> Set the default architecture based on the current machine
>>>
>>> Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn>
>>> ---
>>>   configure | 11 ++++++++++-
>>>   1 file changed, 10 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/configure b/configure
>>> index 39b5fbe..9fbba9a 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -22,8 +22,17 @@ opt_xattrdb=false
>>>   opt_profile=false
>>>   opt_passwd_fallback='""'
>>>   +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=x86
>>> +case $UNAME_MACHINE in
>>> +  i*86|x86_64) opt_arch=x86 ;;
>>> +  arm|arm64) opt_arch=arm ;;
>>> +  loongarch32|loongarch64) opt_arch=loongarch ;;
>>> +esac
>>> +
>> Using uname like this is not cross compile compatible and will break
>> pseudo from building in OpenEmbedded. We can't do this...
> Here the default arch parameter is just set based on uname, just like 
> opt_arch=x86 before, and there is still support for rewriting the 
> actual opt_arch with the --arch option, so the functionality hasn't 
> actually changed, and the expectation is that it will still work as 
> before.
>>
>> Cheers,
>>
>> Richard
>
diff mbox series

Patch

diff --git a/configure b/configure
index 39b5fbe..9fbba9a 100755
--- a/configure
+++ b/configure
@@ -22,8 +22,17 @@  opt_xattrdb=false
 opt_profile=false
 opt_passwd_fallback='""'
 
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=x86
+case $UNAME_MACHINE in
+  i*86|x86_64) opt_arch=x86 ;;
+  arm|arm64) opt_arch=arm ;;
+  loongarch32|loongarch64) opt_arch=loongarch ;;
+esac
+
 compile_x86_32=-m32
 compile_x86_64=-m64
+compile_loongarch_32=
+compile_loongarch_64=
 
 usage()
 {
@@ -170,7 +179,7 @@  do
 done
 
 case $opt_arch in
-'' | x86 | arm )
+'' | x86 | arm | loongarch)
     ;;
 *)    echo >&2 "Untested arch $opt_arch."
     ;;