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

Makefile: Export PLATFORM as docker build argument #4489

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

rene
Copy link
Contributor

@rene rene commented Dec 16, 2024

This commit introduces a new build configuration file (autogenerated) that allows to export build parameters to docker files of packages under pkg/. So far only the PLATFORM is exported as a build argument, which will allow packages to take different actions according to the PLATFORM provided during the build.

Note: This PR is needed for upcoming changes for NVIDIA Platform.

This commit introduces a new build configuration file (autogenerated) that
allows to export build parameters to docker files of packages under pkg/.
So far only the PLATFORM is exported as a build argument, which will allow
packages to take different actions according to the PLATFORM provided
during the build.

Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
@rene rene requested a review from deitch December 16, 2024 11:54
@rene rene requested a review from eriknordmark as a code owner December 16, 2024 11:54
@deitch
Copy link
Contributor

deitch commented Dec 16, 2024

Other than more complexity (and it isn't bad), I see no issues with it. What are you planning on doing with it down the line? Obviously something for the builds, but how will PLATFORM be used in the builds?

@rene
Copy link
Contributor Author

rene commented Dec 16, 2024

Other than more complexity (and it isn't bad), I see no issues with it. What are you planning on doing with it down the line? Obviously something for the builds, but how will PLATFORM be used in the builds?

@deitch , the nvidia platform will need to be split into two variants: nvidia-jp5 and nvidia-jp6 to support both Jetpack 5 and 6, respectively. Unfortunately this is necessary because of the lack of support for Xavier devices on Jetpack 6. With the changes of this PR, the plan is to use something like the following when processing different files for JP5 and JP6, for instance:

ARG PLATFORM=generic

...

# Nvidia Firmwares for Jetpack 5.1.3 and Jetpack 6.0
ENV JETPACK5_DEB=nvidia-l4t-firmware_35.5.0-20240219203809_arm64.deb
ENV JETPACK5_URL=https://repo.download.nvidia.com/jetson/t194/pool/main/n/nvidia-l4t-firmware/${JETPACK5_DEB}
ENV JETPACK6_DEB=nvidia-l4t-firmware_36.3.0-20240506102626_arm64.deb
ENV JETPACK6_URL=https://repo.download.nvidia.com/jetson/t234/pool/main/n/nvidia-l4t-firmware/${JETPACK6_DEB}

FROM build-base AS generic
ENV NVIDIA_FW_TEGRA=${JETPACK5_DEB}
ENV NVIDIA_FW_URL=${JETPACK5_URL}

FROM build-base AS nvidia-jp5
ENV NVIDIA_FW_TEGRA=${JETPACK5_DEB}
ENV NVIDIA_FW_URL=${JETPACK5_URL}

FROM build-base AS nvidia-jp6
ENV NVIDIA_FW_TEGRA=${JETPACK6_DEB}
ENV NVIDIA_FW_URL=${JETPACK6_URL}

FROM ${PLATFORM} AS build

ADD ${NVIDIA_FW_URL} /${NVIDIA_FW_TEGRA}

So in a nutshell, make ZARCH=arm64 PLATFORM=nvidia-jp5 ... will choose the firmware files for JP5 while make ZARCH=arm64 PLATFORM=nvidia-jp5 ... (or generic) will take the firmware files for JP5.... and the idea is to follow the same approach for other packages, specially pkg/nvidia...

@deitch
Copy link
Contributor

deitch commented Dec 16, 2024

Got it. Thanks for explaining.

@deitch
Copy link
Contributor

deitch commented Dec 16, 2024

Are build args meant to be universal, or per pkg/*? Any concerns about conflicts? Are we building a framework for build-args?

@rene
Copy link
Contributor Author

rene commented Dec 17, 2024

Are build args meant to be universal, or per pkg/*? Any concerns about conflicts? Are we building a framework for build-args?

The idea is to export only those variables that are meant to be global across packages, so no custom variables per package at the moment.

@deitch
Copy link
Contributor

deitch commented Dec 17, 2024

Makes sense.

@eriknordmark eriknordmark merged commit bcee4dd into lf-edge:master Dec 17, 2024
39 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants