Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled building apps for linux armhf with chef. #20674

Merged
merged 1 commit into from
Jul 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions examples/chef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def main(argv: Sequence[str]) -> None:
"", "--ipv6only", help="Compile build which only supports ipv6. Linux only.",
action="store_true")
parser.add_option(
"", "--cpu_type", help="CPU type to compile for. Linux only.", choices=["arm64", "x64"])
"", "--cpu_type", help="CPU type to compile for. Linux only.", choices=["arm64", "arm", "x64"])

options, _ = parser.parse_args(argv)

Expand Down Expand Up @@ -620,24 +620,36 @@ def main(argv: Sequence[str]) -> None:
'chip_config_network_layer_ble = false',
f'target_defines = ["CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID={options.vid}", "CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID={options.pid}", "CONFIG_ENABLE_PW_RPC={int(options.do_rpc)}"]',
])
if options.cpu_type == "arm64":
uname_resp = shell.run_cmd("uname -m", return_cmd_output=True)
if "aarch" not in uname_resp and "arm" not in uname_resp:
if (
"aarch" not in uname_resp and
"arm" not in uname_resp and
"SYSROOT_AARCH64" not in shell.env):

uname_resp = shell.run_cmd("uname -m", return_cmd_output=True)
if "aarch" not in uname_resp and "arm" not in uname_resp:
if options.cpu_type == "arm64":
if "SYSROOT_AARCH64" not in shell.env:
flush_print(
"SYSROOT_AARCH64 env variable not set. "
"AARCH64 toolchain needed for cross-compiling for arm64.")
exit(1)
shell.env["PKG_CONFIG_PATH"] = (
f'{shell.env["SYSROOT_AARCH64"]}/lib/aarch64-linux-gnu/pkgconfig')
linux_args.append('target_cpu="arm64"')
linux_args.append('is_clang=true')
linux_args.append('chip_crypto="mbedtls"')
linux_args.append(f'sysroot="{shell.env["SYSROOT_AARCH64"]}"')
elif options.cpu_type == "x64":
linux_args.append('target_cpu="arm64"')
linux_args.append('is_clang=true')
linux_args.append('chip_crypto="mbedtls"')
linux_args.append(f'sysroot="{shell.env["SYSROOT_AARCH64"]}"')

elif options.cpu_type == "arm":
if "SYSROOT_ARMHF" not in shell.env:
flush_print(
"SYSROOT_ARMHF env variable not set. "
"ARMHF toolchain needed for cross-compiling for arm.")
exit(1)
shell.env["PKG_CONFIG_PATH"] = (
f'{shell.env["SYSROOT_ARMHF"]}/lib/arm-linux-gnueabihf/pkgconfig')
linux_args.append('target_cpu="arm"')
linux_args.append('is_clang=true')
linux_args.append('chip_crypto="mbedtls"')
linux_args.append(f'sysroot="{shell.env["SYSROOT_ARMHF"]}"')

if options.cpu_type == "x64":
uname_resp = shell.run_cmd("uname -m", return_cmd_output=True)
if "x64" not in uname_resp and "x86_64" not in uname_resp:
flush_print(f"Unable to cross compile for x64 on {uname_resp}")
Expand Down