patman: Correct pylint errors
[platform/kernel/u-boot.git] / Makefile
index a4f267c..e6fc80a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0+
 
 VERSION = 2022
-PATCHLEVEL = 01
+PATCHLEVEL = 04
 SUBLEVEL =
-EXTRAVERSION = -rc4
+EXTRAVERSION = -rc3
 NAME =
 
 # *DOCUMENTATION*
@@ -521,7 +521,7 @@ env_h := include/generated/environment.h
 
 no-dot-config-targets := clean clobber mrproper distclean \
                         help %docs check% coccicheck \
-                        ubootversion backup tests check qcheck tcheck
+                        ubootversion backup tests check qcheck tcheck pylint
 
 config-targets := 0
 mixed-targets  := 0
@@ -944,7 +944,9 @@ INPUTS-$(CONFIG_SPL_FRAMEWORK) += u-boot.img
 endif
 endif
 INPUTS-$(CONFIG_TPL) += tpl/u-boot-tpl.bin
-INPUTS-$(CONFIG_OF_SEPARATE) += u-boot.dtb
+
+# Allow omitting the .dtb output if it is not normally used
+INPUTS-$(CONFIG_OF_SEPARATE) += $(if $(CONFIG_OF_OMIT_DTB),dts/dt.dtb,u-boot.dtb)
 ifeq ($(CONFIG_SPL_FRAMEWORK),y)
 INPUTS-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img
 endif
@@ -1127,6 +1129,12 @@ endif
        $(call deprecated,CONFIG_DM_ETH,Ethernet drivers,v2020.07,$(CONFIG_NET))
        $(call deprecated,CONFIG_DM_I2C,I2C drivers,v2022.04,$(CONFIG_SYS_I2C_LEGACY))
        $(call deprecated,CONFIG_DM_KEYBOARD,Keyboard drivers,v2022.10,$(CONFIG_KEYBOARD))
+       @# CONFIG_SYS_TIMER_RATE has brackets in it for some boards which
+       @# confuses this rule. Use if() to send just a single character which
+       @# is enable to tell 'deprecated' that one of these symbols exists
+       $(call deprecated,CONFIG_TIMER,Timer drivers,v2023.01,$(if $(strip $(CONFIG_SYS_TIMER_RATE)$(CONFIG_SYS_TIMER_COUNTER)),x))
+       $(call deprecated,CONFIG_DM_SERIAL,Serial drivers,v2023.04,$(CONFIG_SERIAL))
+       $(call deprecated,CONFIG_DM_SCSI,SCSI drivers,v2023.04,$(CONFIG_SCSI))
        @# Check that this build does not use CONFIG options that we do not
        @# know about unless they are in Kconfig. All the existing CONFIG
        @# options are whitelisted, so new ones should not be added.
@@ -1187,7 +1195,7 @@ u-boot.bin: u-boot-fit-dtb.bin FORCE
 u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE
        $(call if_changed,cat)
 
-else ifeq ($(CONFIG_OF_SEPARATE),y)
+else ifeq ($(CONFIG_OF_SEPARATE).$(CONFIG_OF_OMIT_DTB),y.)
 u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE
        $(call if_changed,cat)
 
@@ -1314,10 +1322,12 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
                 --toolpath $(objtree)/tools \
                $(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \
                build -u -d u-boot.dtb -O . -m --allow-missing \
+               --fake-ext-blobs \
                -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
                -I arch/$(ARCH)/dts -a of-list=$(CONFIG_OF_LIST) \
                $(foreach f,$(BINMAN_INDIRS),-I $(f)) \
                -a atf-bl31-path=${BL31} \
+               -a tee-os-path=${TEE} \
                -a opensbi-path=${OPENSBI} \
                -a default-dt=$(default_dt) \
                -a scp-path=$(SCP) \
@@ -1527,7 +1537,6 @@ else
 ifeq ($(CONFIG_BINMAN),y)
 flash.bin: spl/u-boot-spl.bin $(INPUTS-y) FORCE
        $(call if_changed,binman)
-       $(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
 else
 flash.bin: spl/u-boot-spl.bin u-boot.itb FORCE
        $(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
@@ -1774,9 +1783,9 @@ else
 quiet_cmd_u-boot__ ?= LD      $@
       cmd_u-boot__ ?= $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_u-boot) -o $@          \
                -T u-boot.lds $(u-boot-init)                                    \
-               $(if $(CONFIG_EFI_APP_64BIT),,--whole-archive)                  \
+               --whole-archive                                                 \
                        $(u-boot-main)                                          \
-               $(if $(CONFIG_EFI_APP_64BIT),,--no-whole-archive)               \
+               --no-whole-archive                                              \
                $(PLATFORM_LIBS) -Map u-boot.map;                               \
                $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
 endif
@@ -1835,7 +1844,7 @@ quiet_cmd_gen_envp = ENVP    $@
                        -I$(srctree)/arch/$(ARCH)/include \
                        $< -o $@; \
        else \
-               echo -n >$@ ; \
+               touch $@ ; \
        fi
 include/generated/env.in: include/generated/env.txt FORCE
        $(call cmd,gen_envp)
@@ -1852,7 +1861,7 @@ quiet_cmd_envc = ENVC    $@
        elif [ -n "$(ENV_SOURCE_FILE)" ]; then \
                echo "Missing file $(ENV_FILE_CFG)"; \
        else \
-               echo -n >$@ ; \
+               touch $@ ; \
        fi
 
 include/generated/env.txt: $(wildcard $(ENV_FILE)) FORCE
@@ -2181,7 +2190,9 @@ CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h tools/version.h \
               u-boot* MLO* SPL System.map fit-dtb.blob* \
               u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log \
               lpc32xx-* bl31.c bl31.elf bl31_*.bin image.map tispl.bin* \
-              idbloader.img flash.bin flash.log defconfig keep-syms-lto.c
+              idbloader.img flash.bin flash.log defconfig keep-syms-lto.c \
+              mkimage-out.spl.mkimage mkimage.spl.mkimage imx-boot.map \
+              itb.fit.fit itb.fit.itb itb.map spl.map
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include/generated spl tpl \
@@ -2216,7 +2227,8 @@ clean: $(clean-dirs)
                -o -name '*.asn1.[ch]' \
                -o -name '*.symtypes' -o -name 'modules.order' \
                -o -name modules.builtin -o -name '.tmp_*.o.*' \
-               -o -name 'dsdt.aml' -o -name 'dsdt.asl.tmp' -o -name 'dsdt.c' \
+               -o -name 'dsdt_generated.aml' -o -name 'dsdt_generated.asl.tmp' \
+               -o -name 'dsdt_generated.c' \
                -o -name '*.efi' -o -name '*.gcno' -o -name '*.so' \) \
                -type f -print | xargs rm -f
 
@@ -2248,6 +2260,49 @@ distclean: mrproper
                -type f -print | xargs rm -f
        @rm -f boards.cfg CHANGELOG
 
+# See doc/develop/python_cq.rst
+PHONY += pylint
+PYLINT_BASE := scripts/pylint.base
+PYLINT_CUR := pylint.cur
+PYLINT_DIFF := pylint.diff
+pylint:
+       $(Q)echo "Running pylint on all files (summary in $(PYLINT_CUR); output in pylint.out/)"
+       $(Q)mkdir -p pylint.out
+       $(Q)rm -f pylint.out/out*
+       $(Q)find tools test -name "*.py" \
+               | xargs -n1 -P$(shell nproc 2>/dev/null || echo 1) \
+                       sh -c 'pylint --reports=y --exit-zero -f parseable --ignore-imports=yes $$@ > pylint.out/$$(echo $$@ | tr / _ | sed s/.py//)' _
+       $(Q)rm -f $(PYLINT_CUR)
+       $(Q)( cd pylint.out; for f in *; do \
+               sed -ne "s/Your code has been rated at \([-0-9.]*\).*/$$f \1/p" $$f; \
+       done ) | sort > $(PYLINT_CUR)
+       $(Q)base=$$(mktemp) cur=$$(mktemp); cut -d' ' -f1 $(PYLINT_BASE) >$$base; \
+               cut -d' ' -f1 $(PYLINT_CUR) >$$cur; \
+               comm -3 $$base $$cur > $(PYLINT_DIFF); \
+               if [ -s $(PYLINT_DIFF) ]; then \
+                       echo "Files have been added/removed. Try:\n\tcp $(PYLINT_CUR) $(PYLINT_BASE)"; \
+                       echo; \
+                       echo "Added files:"; \
+                       comm -13 $$base $$cur; \
+                       echo; \
+                       echo "Removed files:"; \
+                       comm -23 $$base $$cur; \
+                       false; \
+               else \
+                       rm $$base $$cur $(PYLINT_DIFF); \
+               fi
+       $(Q)bad=false; while read base_file base_val <&3 && read cur_file cur_val <&4; do \
+               if awk "BEGIN {exit !($$cur_val < $$base_val)}"; then \
+                       echo "$$base_file: Score was $$base_val, now $$cur_val"; \
+                       bad=true; fi; \
+               done 3<$(PYLINT_BASE) 4<$(PYLINT_CUR); \
+               if $$bad; then \
+                       echo "Some files have regressed, please fix"; \
+                       false; \
+               else \
+                       echo "No pylint regressions"; \
+               fi
+
 backup:
        F=`basename $(srctree)` ; cd .. ; \
        gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
@@ -2266,6 +2321,7 @@ help:
        @echo  '  check           - Run all automated tests that use sandbox'
        @echo  '  qcheck          - Run quick automated tests that use sandbox'
        @echo  '  tcheck          - Run quick automated tests on tools'
+       @echo  '  pylint          - Run pylint on all Python files'
        @echo  ''
        @echo  'Other generic targets:'
        @echo  '  all             - Build all necessary images depending on configuration'