On 1/31/21 1:36 PM, Philippe Mathieu-Daudé wrote:
> On 1/31/21 12:13 PM, Philippe Mathieu-Daudé wrote:
>> Add a target-specific Kconfig.
>>
>> Target foo now has CONFIG_FOO defined.
>>
>> Two architecture have a particularity, ARM and MIPS:
>> their 64-bit version include the 32-bit subset.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
>> ---
> ...
> 
>> diff --git a/meson.build b/meson.build
>> index f00b7754fd4..a2dda0ce95e 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -1322,7 +1322,8 @@
>>        command: [minikconf,
>>                  get_option('default_devices') ? '--defconfig' : 
>> '--allnoconfig',
>>                  config_devices_mak, '@DEPFILE@', '@INPUT@',
>> -                host_kconfig, accel_kconfig])
>> +                host_kconfig, accel_kconfig,
>> +                'CONFIG_' + config_target['TARGET_ARCH'].to_upper() + '=y'])
>>  
>>      config_devices_data = configuration_data()
>>      config_devices = keyval.load(config_devices_mak)
>> diff --git a/Kconfig b/Kconfig
>> index bf694c42afe..c01e261e4e9 100644
>> --- a/Kconfig
>> +++ b/Kconfig
>> @@ -1,4 +1,5 @@
>>  source Kconfig.host
>>  source backends/Kconfig
>>  source accel/Kconfig
>> +source target/Kconfig
>>  source hw/Kconfig
>> diff --git a/target/Kconfig b/target/Kconfig
>> new file mode 100644
>> index 00000000000..a6f719f223a
>> --- /dev/null
>> +++ b/target/Kconfig
>> @@ -0,0 +1,23 @@
>> +source alpha/Kconfig
>> +source arm/Kconfig
>> +source avr/Kconfig
>> +source cris/Kconfig
>> +source hppa/Kconfig
>> +source i386/Kconfig
>> +source lm32/Kconfig
>> +source m68k/Kconfig
>> +source microblaze/Kconfig
>> +source mips/Kconfig
>> +source moxie/Kconfig
>> +source nios2/Kconfig
>> +source openrisc/Kconfig
>> +source ppc/Kconfig
>> +source riscv/Kconfig
>> +source rx/Kconfig
>> +source s390x/Kconfig
>> +source sh4/Kconfig
>> +source sparc/Kconfig
>> +source tilegx/Kconfig
>> +source tricore/Kconfig
>> +source unicore32/Kconfig
>> +source xtensa/Kconfig
>> diff --git a/target/arm/Kconfig b/target/arm/Kconfig
>> new file mode 100644
>> index 00000000000..3f3394a22b2
>> --- /dev/null
>> +++ b/target/arm/Kconfig
>> @@ -0,0 +1,6 @@
>> +config ARM
>> +    bool
>> +
>> +config AARCH64
>> +    bool
>> +    select ARM
> 
> This isn't correct yet, as Kconfig is primarly designed for devices,
> and per docs/devel/kconfig.rst:
> 
>   "devices are usually ``default y`` if and only if they have at
>    least one ``depends on``;"
> 
> So having one machine "depends on AARCH64" selects AARCH64 on ARM :/
> I'll see if explicit each arch as 'default n' helps...

Taking this comment back, the approach works but is fragile, as
an incorrect dependency can select the wrong arch and it is hard
to detect.

Reply via email to