^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) # (C) COPYRIGHT 2010-2017 ARM Limited. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) # This program is free software and is provided to you under the terms of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) # GNU General Public License version 2 as published by the Free Software
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) # Foundation, and any use by you of this program is subject to the terms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) # of such GNU licence.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) # A copy of the licence is included with the program, and can also be obtained
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) # from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) # Boston, MA 02110-1301, USA.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) import sys
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) Import('env')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) SConscript( 'tests/sconscript' )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) mock_test = 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) # Fake platform is a transient solution for GPL drivers running in kernel that does not provide configuration via platform data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) # For such kernels fake_platform_device should be set to 1. For kernels providing platform data fake_platform_device should be set to 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) if env['platform_config']=='devicetree' or env['platform_config']=='juno_soc':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) fake_platform_device = 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) else:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) fake_platform_device = 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) # Source files required for kbase.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) kbase_src = [
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) Glob('*.c'),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) Glob('backend/*/*.c'),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) Glob('internal/*/*.c'),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) Glob('ipa/*.c')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) ]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) if env['platform_config']=='juno_soc':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) kbase_src += [Glob('platform/devicetree/*.c')]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) else:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) kbase_src += [Glob('platform/%s/*.c' % env['platform_config'])]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) if Glob('#kernel/drivers/gpu/arm/midgard/tests/internal/src/mock') and env['unit'] == '1':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) kbase_src += [Glob('#kernel/drivers/gpu/arm/midgard/tests/internal/src/mock/*.c')]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) mock_test = 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) # we need platform config for GPL version using fake platform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) if fake_platform_device==1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) # Check if we are compiling for PBX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) if env.KernelConfigEnabled("CONFIG_MACH_REALVIEW_PBX") and \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) env["platform_config"] in {"vexpress", "vexpress_6xvirtex7_10mhz"}:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) sys.stderr.write("WARNING: Building for a PBX kernel but with platform_config=vexpress*\n")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) # if the file platform config file is in the tpip directory then use that, otherwise use the default config directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) if Glob('#kernel/drivers/gpu/arm/midgard/config/tpip/*%s.c' % (env['platform_config'])):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) kbase_src += Glob('#kernel/drivers/gpu/arm/midgard/config/tpip/*%s.c' % (env['platform_config']))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) else:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) kbase_src += Glob('#kernel/drivers/gpu/arm/midgard/config/*%s.c' % (env['platform_config']))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) make_args = env.kernel_get_config_defines(ret_list = True,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) fake = fake_platform_device) + [
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 'PLATFORM=%s' % env['platform'],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 'MALI_ERROR_INJECT_ON=%s' % env['error_inject'],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 'MALI_KERNEL_TEST_API=%s' % env['debug'],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 'MALI_UNIT_TEST=%s' % env['unit'],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 'MALI_RELEASE_NAME=%s' % env['mali_release_name'],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 'MALI_MOCK_TEST=%s' % mock_test,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 'MALI_CUSTOMER_RELEASE=%s' % env['release'],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 'MALI_INSTRUMENTATION_LEVEL=%s' % env['instr'],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 'MALI_COVERAGE=%s' % env['coverage'],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 'MALI_BUS_LOG=%s' % env['buslog']
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) ]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) kbase = env.BuildKernelModule('$STATIC_LIB_PATH/mali_kbase.ko', kbase_src,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) make_args = make_args)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) # Add a dependency on kds.ko.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) # Only necessary when KDS is not built into the kernel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) if env['os'] != 'android':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) if not env.KernelConfigEnabled("CONFIG_KDS"):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) env.Depends(kbase, '$STATIC_LIB_PATH/kds.ko')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) # need Module.symvers from ump.ko build
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) if int(env['ump']) == 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) env.Depends(kbase, '$STATIC_LIB_PATH/ump.ko')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) if 'smc_protected_mode_switcher' in env:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) env.Depends('$STATIC_LIB_PATH/mali_kbase.ko', '$STATIC_LIB_PATH/smc_protected_mode_switcher.ko')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) env.KernelObjTarget('kbase', kbase)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) env.AppendUnique(BASE=['cutils_linked_list'])