Merge tag 'v2022.04-rc5' into next
[platform/kernel/u-boot.git] / Makefile
index 58a0c34..6a0234a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0+
 
 VERSION = 2022
-PATCHLEVEL = 01
+PATCHLEVEL = 04
 SUBLEVEL =
-EXTRAVERSION =
+EXTRAVERSION = -rc5
 NAME =
 
 # *DOCUMENTATION*
@@ -521,7 +521,8 @@ 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 \
+                        pylint_err
 
 config-targets := 0
 mixed-targets  := 0
@@ -682,10 +683,16 @@ endif
 
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 KBUILD_CFLAGS  += -Os
-else
+endif
+
+ifdef CONFIG_CC_OPTIMIZE_FOR_SPEED
 KBUILD_CFLAGS  += -O2
 endif
 
+ifdef CONFIG_CC_OPTIMIZE_FOR_DEBUG
+KBUILD_CFLAGS  += -Og
+endif
+
 LTO_CFLAGS :=
 LTO_FINAL_LDFLAGS :=
 export LTO_CFLAGS LTO_FINAL_LDFLAGS
@@ -1080,7 +1087,7 @@ define deprecated
                echo >&2 "for $(2)). Please update the board to use"; \
                echo >&2 "$(firstword $(1)) before the $(3) release. Failure to"; \
                echo >&2 "update by the deadline may result in board removal."; \
-               echo >&2 "See doc/driver-model/migration.rst for more info."; \
+               echo >&2 "See doc/develop/driver-model/migration.rst for more info."; \
                echo >&2 "===================================================="; \
        fi; fi
 
@@ -1121,7 +1128,7 @@ ifneq ($(CONFIG_DM),y)
        @echo >&2 "This board does not use CONFIG_DM. CONFIG_DM will be"
        @echo >&2 "compulsory starting with the v2020.01 release."
        @echo >&2 "Failure to update may result in board removal."
-       @echo >&2 "See doc/driver-model/migration.rst for more info."
+       @echo >&2 "See doc/develop/driver-model/migration.rst for more info."
        @echo >&2 "===================================================="
 endif
        $(call deprecated,CONFIG_WDT,DM watchdog,v2019.10,\
@@ -1129,6 +1136,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.
@@ -1316,10 +1329,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) \
@@ -1327,7 +1342,6 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
                -a tpl-bss-pad=$(if $(CONFIG_TPL_SEPARATE_BSS),,1) \
                -a spl-dtb=$(CONFIG_SPL_OF_REAL) \
                -a tpl-dtb=$(CONFIG_TPL_OF_REAL) \
-               $(if $(BINMAN_FAKE_EXT_BLOBS),--fake-ext-blobs) \
                $(BINMAN_$(@F))
 
 OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex
@@ -1404,7 +1418,7 @@ MKIMAGEFLAGS_u-boot-spl.kwb = -n $(KWD_CONFIG_FILE) \
        $(if $(KEYDIR),-k $(KEYDIR))
 
 MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
-               -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
+               -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -A $(ARCH) -T pblimage
 
 ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy)
 UBOOT_BIN := u-boot-with-dtb.bin
@@ -1530,7 +1544,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 $@
@@ -1777,9 +1790,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
@@ -1838,7 +1851,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)
@@ -1855,7 +1868,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
@@ -2180,7 +2193,8 @@ CLEAN_DIRS  += $(MODVERDIR) \
               $(foreach d, spl tpl, $(patsubst %,$d/%, \
                        $(filter-out include, $(shell ls -1 $d 2>/dev/null))))
 
-CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h tools/version.h \
+CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h \
+              drivers/video/u_boot_logo.S 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* \
@@ -2221,7 +2235,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
 
@@ -2253,6 +2268,54 @@ distclean: mrproper
                -type f -print | xargs rm -f
        @rm -f boards.cfg CHANGELOG
 
+# See doc/develop/python_cq.rst
+PHONY += pylint pylint_err
+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
+
+# Check for errors only
+pylint_err:
+       $(Q)pylint -E  -j 0 --ignore-imports=yes \
+               $(shell find tools test -name "*.py")
+
 backup:
        F=`basename $(srctree)` ; cd .. ; \
        gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
@@ -2271,6 +2334,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'