cli: Add command "dts-check"

Validates the dts/dtb file for the selected board and outputs the validation logs to the user.
This can be used when adding a new board, developing or improving a dts file. Should lead to higher quality device trees and patches overall, if used.
Will show warnings/errors if patches patch in some functionalities to a devicetree file without patching in the dt-bindings .yaml at the same time.
This commit is contained in:
ColorfulRhino
2024-06-14 00:09:48 +02:00
committed by Igor
parent 663530dcf6
commit de81f10b0d
6 changed files with 71 additions and 13 deletions

View File

@@ -53,7 +53,7 @@ function compile_kernel() {
declare hash pre_patch_version
kernel_main_patching # has it's own logging sections inside
# Stop after patching;
# Stop after patching.
if [[ "${PATCH_ONLY}" == yes ]]; then
display_alert "PATCH_ONLY is set, stopping." "PATCH_ONLY=yes and patching success" "cachehit"
return 0
@@ -72,7 +72,6 @@ function compile_kernel() {
# re-read kernel version after patching
declare version
version=$(grab_version "$kernel_work_dir")
display_alert "Compiling $BRANCH kernel" "$version" "info"
# determine the toolchain
declare toolchain
@@ -80,6 +79,14 @@ function compile_kernel() {
kernel_config # has it's own logging sections inside
# Validate dts file if flag is set and stop after validation.
# Has to happen after kernel .config file was created
if [[ "${DTS_VALIDATE}" == yes ]]; then
LOG_SECTION="validate_dts" do_with_logging validate_dts
display_alert "DTS_VALIDATE is set, stopping." "DTS_VALIDATE=yes and dts sucessfully checked. See output above to fix your board's dts file." "cachehit"
return 0
fi
# Stop after configuring kernel, but only if using a specific CLI command ("kernel-config").
# Normal "KERNEL_CONFIGURE=yes" (during image build) is still allowed.
if [[ "${KERNEL_CONFIGURE}" == yes && "${ARMBIAN_COMMAND}" == *kernel-config ]]; then
@@ -87,6 +94,8 @@ function compile_kernel() {
return 0
fi
display_alert "Compiling $BRANCH kernel" "$version" "info"
# build via make and package .debs; they're separate sub-steps
kernel_prepare_build_and_package # has it's own logging sections inside