diff --git a/BUILD.gn b/BUILD.gn old mode 100755 new mode 100644 index a4a53a35adb8224569f7661fd56a3c4c8d7c3d72..3eda0e96bad6932aff8fd7df443088d23d73b5b4 --- a/BUILD.gn +++ b/BUILD.gn @@ -94,7 +94,10 @@ group("ohos") { # Skip device target for userspace only scenario. if (!ohos_build_userspace_only) { # Step 7: Add device and product target by default. - deps += [ "${device_path}/../" ] + # liteos_m kernel organise device build targets, but not by default. + if (product_cfg.kernel_type != "liteos_m") { + deps += [ "${device_path}/../" ] + } } } else { deps += string_split(ohos_build_target, "&&") diff --git a/hb/__init__.py b/hb/__init__.py old mode 100755 new mode 100644 index c5764c9c6d80a1059bb3650c661592532ee6a465..82821764834ca69a48d5f2b6d2d7f34bb943a454 --- a/hb/__init__.py +++ b/hb/__init__.py @@ -40,6 +40,7 @@ CONFIG_STRUCT = { "product": None, "product_path": None, "device_path": None, + "device_company": None, "patch_cache": None } diff --git a/hb/build/build_process.py b/hb/build/build_process.py old mode 100755 new mode 100644 index dc6e4241ac8d3f8edf6702e70eb00996d1eb8b4b..7082819804ce77374b3e8a44fff25fc16eea6929 --- a/hb/build/build_process.py +++ b/hb/build/build_process.py @@ -248,6 +248,7 @@ class Build(): gn_kernel_path = device_path self.register_args('ohos_build_target', [gn_device_path]) self.register_args('device_path', gn_kernel_path) + self.register_args('device_company', self.config.device_company) self.register_args('ohos_kernel_type', kernel) else: # Compile product in "hb set" @@ -256,6 +257,7 @@ class Build(): if self._compact_mode: self.register_args('product_name', self.config.product) self.register_args('device_path', self.config.device_path) + self.register_args('device_company', self.config.device_company) self.register_args('ohos_kernel_type', self.config.kernel) product_json = os.path.join(self.config.product_path, diff --git a/hb/common/config.py b/hb/common/config.py old mode 100755 new mode 100644 index 6987f78425dfdf72bb25c1b1000215cdd362ee82..2b7edc812170ff86888335fb0da1ed0b665d4216 --- a/hb/common/config.py +++ b/hb/common/config.py @@ -41,6 +41,7 @@ class Config(metaclass=Singleton): self._product = config_content.get('product', None) self._product_path = config_content.get('product_path', None) self._device_path = config_content.get('device_path', None) + self._device_company = config_content.get('device_company', None) self._patch_cache = config_content.get('patch_cache', None) self._out_path = None self.fs_attr = set() @@ -77,6 +78,18 @@ class Config(metaclass=Singleton): self._board = value self.config_update('board', self._board) + @property + def device_company(self): + if self._device_company is None: + raise OHOSException('Please run command "hb set" to ' + 'init OHOS development environment') + return self._device_company + + @device_company.setter + def device_company(self, value): + self._device_company = value + self.config_update('device_company', self._device_company) + @property def kernel(self): if self._kernel is None: diff --git a/hb/env/env.py b/hb/env/env.py old mode 100755 new mode 100644 index bbb0d0681f9028099df9849eea6970cc3e39cb0c..c323ae142a6f7ce31d4d44c5e595a475ba953847 --- a/hb/env/env.py +++ b/hb/env/env.py @@ -33,6 +33,7 @@ def exec_command(args): product = json_data.get('product', 'not set') product_path = json_data.get('product_path', 'not set') device_path = json_data.get('device_path', 'not set') + device_company = json_data.get('device_company', 'not set') hb_info('root path: {}'.format(root_path)) hb_info('board: {}'.format(board)) @@ -40,3 +41,4 @@ def exec_command(args): hb_info('product: {}'.format(product)) hb_info('product path: {}'.format(product_path)) hb_info('device path: {}'.format(device_path)) + hb_info('device company: {}'.format(device_company)) diff --git a/hb/set/set.py b/hb/set/set.py old mode 100755 new mode 100644 index 5e1d31d68ba0f1a53af9f68681f23402d9d7a868..f4a93854e3e1c55b70f04e8dd4113f5ea6c462df --- a/hb/set/set.py +++ b/hb/set/set.py @@ -69,11 +69,16 @@ def set_product(product_name=None, company=None): config.product_path = product_path product_json = os.path.join(config.product_path, 'config.json') - config.board, config.kernel, kernel_version, dev_company =\ + config.board, config.kernel, kernel_version, device_company =\ Product.get_device_info(product_json) + config.device_company = device_company board_path = os.path.join(config.root_path, 'device', - dev_company, config.board) + device_company, config.board) + # board and soc decoupling feature will add boards directory path here. + if not os.path.exists(board_path): + board_path = os.path.join(config.root_path, 'device', 'board', + device_company, config.board) config.device_path = Device.get_device_path(board_path, config.kernel, kernel_version)