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

Fix dts-check command and use Pip for some Python packages instead of APT #6799

Merged
merged 6 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions lib/functions/cli/commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function armbian_register_commands() {
["rewrite-kernel-config"]="artifact"

# Patch kernel and then check & validate the dtb file
["dts-check"]="artifact" # Not really an artifact, but cli output only. Builds nothing.
["dts-check"]="artifact" # Not really an artifact, but cli output only. Builds nothing.

["uboot"]="artifact"
["uboot-patch"]="artifact"
Expand Down Expand Up @@ -134,7 +134,7 @@ function armbian_register_commands() {
["rewrite-kernel-config"]="WHAT='kernel' KERNEL_CONFIGURE='yes' ARTIFACT_WILL_NOT_BUILD='yes' ARTIFACT_IGNORE_CACHE='yes' ${common_cli_artifact_vars}"
["kernel-patch"]="WHAT='kernel' CREATE_PATCHES='yes' ${common_cli_artifact_interactive_vars} ${common_cli_artifact_vars}"
["kernel-dtb"]="WHAT='kernel' KERNEL_DTB_ONLY='yes' ${common_cli_artifact_interactive_vars} ${common_cli_artifact_vars}"
["dts-check"]="WHAT='kernel' DTS_VALIDATE='yes' ARTIFACT_WILL_NOT_BUILD='yes'" # Not really an artifact, but cli output only. Builds nothing.
["dts-check"]="WHAT='kernel' DTS_VALIDATE='yes' ARTIFACT_WILL_NOT_BUILD='yes' ARTIFACT_IGNORE_CACHE='yes'" # Not really an artifact, but cli output only. Builds nothing.

["uboot"]="WHAT='uboot' ${common_cli_artifact_vars}"
["uboot-config"]="WHAT='uboot' UBOOT_CONFIGURE='yes' ${common_cli_artifact_interactive_vars} ${common_cli_artifact_vars}"
Expand Down
11 changes: 5 additions & 6 deletions lib/functions/compilation/kernel-dts-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/


# Validate the dts/dtb file against dt bindings found in "linux/Documentation/devicetree/bindings/"
# See slide 15 in https://elinux.org/images/1/17/How_to_Get_Your_DT_Schema_Bindings_Accepted_in_Less_than_10_Iterations_-_Krzysztof_Kozlowski%2C_Linaro_-_ELCE_2023.pdf
function validate_dts() {
[[ -z "${BOOT_FDT_FILE}" ]] && exit_with_error "BOOT_FDT_FILE not set! No dts file to validate."
display_alert "Validating dts/dtb file for selected board" "${BOOT_FDT_FILE} ; see output below" "info"
[[ -z "${BOOT_FDT_FILE}" ]] && exit_with_error "BOOT_FDT_FILE not set! No dts file to validate."
display_alert "Validating dts/dtb file for selected board" "${BOOT_FDT_FILE} ; see output below" "info"

# "make CHECK_DTBS=y" uses the pip modules "dtschema" and "yamllint"
prepare_python_and_pip
# "make CHECK_DTBS=y" uses the pip modules "dtschema" and "yamllint"
prepare_python_and_pip

# Run "make CHECK_DTBS=y" for the selected board's dtb file
# Run "make CHECK_DTBS=y" for the selected board's dtb file
run_kernel_make "CHECK_DTBS=y ${BOOT_FDT_FILE}"
}
14 changes: 7 additions & 7 deletions lib/functions/compilation/kernel-make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ function run_kernel_make_internal() {
prepare_distcc_compilation_config

common_make_envs=(
"CCACHE_BASEDIR=\"$(pwd)\"" # Base directory for ccache, for cache reuse # @TODO: experiment with this and the source path to maximize hit rate
"CCACHE_TEMPDIR=\"${CCACHE_TEMPDIR:?}\"" # Temporary directory for ccache, under WORKDIR
"PATH=\"${toolchain}:${PYTHON3_INFO[USERBASE]}/bin:${PATH}\"" # Insert the toolchain and the pip binaries into the PATH
"PYTHONPATH=\"${PYTHON3_INFO[MODULES_PATH]}:${PYTHONPATH}\"" # Insert the pip modules downloaded by Armbian into PYTHONPATH (needed for dtb checks)
"DPKG_COLORS=always" # Use colors for dpkg @TODO no dpkg is done anymore, remove?
"XZ_OPT='--threads=0'" # Use parallel XZ compression
"TERM='${TERM}'" # Pass the terminal type, so that 'make menuconfig' can work.
"CCACHE_BASEDIR=\"$(pwd)\"" # Base directory for ccache, for cache reuse # @TODO: experiment with this and the source path to maximize hit rate
"CCACHE_TEMPDIR=\"${CCACHE_TEMPDIR:?}\"" # Temporary directory for ccache, under WORKDIR
"PATH=\"${toolchain}:${PYTHON3_INFO[USERBASE]}/bin:${PATH}\"" # Insert the toolchain and the pip binaries into the PATH
"PYTHONPATH=\"${PYTHON3_INFO[MODULES_PATH]}:${PYTHONPATH}\"" # Insert the pip modules downloaded by Armbian into PYTHONPATH (needed for dtb checks)
"DPKG_COLORS=always" # Use colors for dpkg @TODO no dpkg is done anymore, remove?
"XZ_OPT='--threads=0'" # Use parallel XZ compression
"TERM='${TERM}'" # Pass the terminal type, so that 'make menuconfig' can work.
"COLUMNS='${COLUMNS:-160}'"
"COLORFGBG='${COLORFGBG}'"
)
Expand Down
1 change: 1 addition & 0 deletions lib/functions/general/python-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ function prepare_python_and_pip() {
"PYTHONUSERBASE=${PYTHON3_INFO[USERBASE]}"
"PYTHONUNBUFFERED=yes"
"PYTHONPYCACHEPREFIX=${PYTHON3_INFO[PYCACHEPREFIX]}"
"PATH=\"${toolchain}:${PYTHON3_INFO[USERBASE]}/bin:${PATH}\"" # add toolchain to PATH to make building wheels work
)

# If the hash file exists, we're done.
Expand Down
12 changes: 7 additions & 5 deletions lib/functions/host/prepare-host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ function adaptative_prepare_host_dependencies() {
host_deps_add_extra_python # See python-tools.sh::host_deps_add_extra_python()

### Python3 -- required for Armbian's Python tooling, and also for more recent u-boot builds. Needs 3.9+; ffi-dev is needed for some Python packages when the wheel is not prebuilt
host_dependencies+=("python3-dev" "python3-setuptools" "python3-pip" "python3-pyelftools" "libffi-dev")
### 'python3-setuptools' and 'python3-pyelftools' moved to requirements.txt to make sure build hosts use the same/latest versions of these tools.
host_dependencies+=("python3-dev" "python3-pip" "libffi-dev")

# Needed for some u-boot's, lest "tools/mkeficapsule.c:21:10: fatal error: gnutls/gnutls.h"
host_dependencies+=("libgnutls28-dev")
Expand All @@ -303,11 +304,12 @@ function adaptative_prepare_host_dependencies() {
fi

### Python2 -- required for some older u-boot builds
# Debian 'sid'/'bookworm' and Ubuntu 'lunar' does not carry python2 anymore; in this case some u-boot's might fail to build.
if [[ "sid bookworm trixie lunar mantic noble" == *"${host_release}"* ]]; then
display_alert "Python2 not available on host release '${host_release}'" "old(er) u-boot builds might/will fail" "wrn"
else
# Debian newer than 'bookworm' and Ubuntu newer than 'lunar'/'mantic' does not carry python2 anymore; in this case some u-boot's might fail to build.
# Last versions to support python2 were Debian 'bullseye' and Ubuntu 'jammy'
if [[ "bullseye jammy" == *"${host_release}"* ]]; then
host_dependencies+=("python2" "python2-dev")
else
display_alert "Python2 not available on host release '${host_release}'" "ancient u-boot versions might/will fail to build" "info"
fi

# Only install acng if asked to.
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# Always use a fixed version, this is important for correct hashing.
# Dependabot will keep these versions up to date.

setuptools == 70.1.1 # for building Python packages
pyelftools == 0.31 # for building U-Boot
unidiff == 0.7.5 # for parsing unified diff
GitPython == 3.1.43 # for manipulating git repos
unidecode == 1.3.8 # for converting strings to ascii
Expand All @@ -13,7 +15,5 @@ PyYAML == 6.0.1 # for parsing/writing YAML
oras == 0.1.30 # for OCI stuff in mapper-oci-update
Jinja2 == 3.1.4 # for templating
rich == 13.7.1 # for rich text formatting
#dtschema == 2024.5 # for checking dts files and dt bindings
#yamllint == 1.35.1 # for checking dts files and dt bindings

#### dts-schema and its functionality dts-check does not build
dtschema == 2024.5 # for checking dts files and dt bindings
yamllint == 1.35.1 # for checking dts files and dt bindings