Skip to content

Commit

Permalink
Revert "fix: set target platform of Pi 4 images to linux/arm64/v8 (#…
Browse files Browse the repository at this point in the history
…2197)"

This reverts commit 6a00589.
  • Loading branch information
nicomiguelino authored Jan 8, 2025
1 parent 6a00589 commit 01e0dab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 25 deletions.
8 changes: 4 additions & 4 deletions tools/image_builder/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
def build_image(
service: str,
board: str,
target_platform: list[str],
target_platform: str,
disable_cache_mounts: bool,
git_hash: str,
git_short_hash: str,
Expand Down Expand Up @@ -73,7 +73,7 @@ def build_image(
elif service == 'test':
context.update(get_test_context())
elif service == 'wifi-connect':
context.update(get_wifi_connect_context(board, target_platform))
context.update(get_wifi_connect_context(target_platform))
elif service == 'server':
if environment == 'development':
base_apt_dependencies.extend(['nodejs', 'npm'])
Expand Down Expand Up @@ -111,8 +111,8 @@ def build_image(
'dest': '/tmp/.buildx-cache',
},
file=f'docker/Dockerfile.{service}',
load=(not push and len(target_platform) == 1),
platforms=target_platform,
load=True,
platforms=[target_platform],
tags=docker_tags,
push=push,
)
Expand Down
33 changes: 12 additions & 21 deletions tools/image_builder/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,38 @@ def get_build_parameters(build_target: str) -> dict:
default_build_parameters = {
'board': 'x86',
'base_image': 'debian',
'target_platform': ['linux/amd64'],
'target_platform': 'linux/amd64',
}

if build_target == 'pi5':
return {
'board': 'pi5',
'base_image': 'balenalib/raspberrypi5-debian',
'target_platform': ['linux/arm64/v8'],
'target_platform': 'linux/arm64/v8',
}
if build_target == 'pi4':
return {
'board': 'pi4',
'base_image': 'balenalib/raspberrypi3-debian',
'target_platform': [
'linux/arm/v8',
'linux/arm64/v8',
],
'target_platform': 'linux/arm/v8',
}
elif build_target == 'pi3':
return {
'board': 'pi3',
'base_image': 'balenalib/raspberrypi3-debian',
'target_platform': ['linux/arm/v7'],
'target_platform': 'linux/arm/v7',
}
elif build_target == 'pi2':
return {
'board': 'pi2',
'base_image': 'balenalib/raspberry-pi2',
'target_platform': ['linux/arm/v6'],
'target_platform': 'linux/arm/v6',
}
elif build_target == 'pi1':
return {
'board': 'pi1',
'base_image': 'balenalib/raspberry-pi',
'target_platform': ['linux/arm/v6'],
'target_platform': 'linux/arm/v6',
}

return default_build_parameters
Expand Down Expand Up @@ -253,24 +250,18 @@ def get_viewer_context(board: str) -> dict:
}


def get_wifi_connect_context(board: str, target_platform: list[str]) -> dict:
# Use the first platform for determining architecture
platform = target_platform[0]

if platform == 'linux/arm/v6':
def get_wifi_connect_context(target_platform: str) -> dict:
if target_platform == 'linux/arm/v6':
architecture = 'rpi'
elif (
platform in ['linux/arm/v7', 'linux/arm/v8', 'linux/arm64/v8'] and
board != 'pi5'
):
elif target_platform in ['linux/arm/v7', 'linux/arm/v8']:
architecture = 'armv7hf'
elif platform == 'linux/arm64/v8' and board == 'pi5':
elif target_platform == 'linux/arm64/v8':
architecture = 'aarch64'
elif platform == 'linux/amd64':
elif target_platform == 'linux/amd64':
architecture = 'amd64'
else:
click.secho(
f'Unsupported target platform: {platform}',
f'Unsupported target platform: {target_platform}',
fg='red',
)
return {}
Expand Down

0 comments on commit 01e0dab

Please sign in to comment.