From patchwork Fri Dec 21 03:12:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10739833 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE45F746 for ; Fri, 21 Dec 2018 03:13:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F68A287C6 for ; Fri, 21 Dec 2018 03:13:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 936ED287CF; Fri, 21 Dec 2018 03:13:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D236287C6 for ; Fri, 21 Dec 2018 03:13:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389033AbeLUDM6 (ORCPT ); Thu, 20 Dec 2018 22:12:58 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:53264 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388689AbeLUDM6 (ORCPT ); Thu, 20 Dec 2018 22:12:58 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id wBL3Ci1o003819; Fri, 21 Dec 2018 12:12:44 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com wBL3Ci1o003819 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1545361964; bh=uwc4h7OaYnqTtMRVaURUeVDBjbGaCXyizVdHE15ae9w=; h=From:To:Cc:Subject:Date:From; b=CsBEesqdpFekSo+Xj8X1sNVps9vZvdQXIjGppBx/mJ58EWAa3UWQpWvIKEqi/KOp4 6jCqTtOyWgbVivuW/df/R0+hU/hvYGEKOPSSpPdj7ryGaNXpfroA/nYnsEbQ7IunVe 9NdgmsPbQKYBOMmRimkSicmlranskbalqTfiMzkMdkmaRYH8GK911uOXSIyl0ie9mG nrpWtUcej4qwd+ydx+8jfoLoMnLxIIQoGCNeGteKUb7COhgbIvN2MrIxgh8eN662W+ yQoCxHEkE/22HVEuujax2guA1/FhMAxNJgDvvufXRkne02AVkIjHVbYkB5Abx0jNOI tAIdcL4MC2LzA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] scripts: remove unnecessary ihex2fw and check-lc_ctypes from .gitignore Date: Fri, 21 Dec 2018 12:12:39 +0900 Message-Id: <1545361961-31990-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit c512d2544c68 ("gitignore: ignore scripts/ihex2fw") was unneeded because ihex2fw was generated in firmware/ instead of scripts/ at that time. I guess it was accidentally added because ihex2fw.c was pushed back and forth between those two directories according to 8b249b6856f1 ("fix modules_install via NFS") and 556b0f58bbcd (Revert "fix modules_install via NFS"). Of course, you may cross file-moves during git-bisect, but we do not generally add removed binaries to the .gitignore file. check-lc_ctype was removed by commit cb43fb5775df ("docs: remove DocBook from the building system"). Signed-off-by: Masahiro Yamada --- scripts/.gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/.gitignore b/scripts/.gitignore index 12d302d..17f8cef 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -6,9 +6,7 @@ conmakehash kallsyms pnmtologo unifdef -ihex2fw recordmcount -check-lc_ctype sortextable asn1_compiler extract-cert From patchwork Fri Dec 21 03:12:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10739835 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 86CEF13AD for ; Fri, 21 Dec 2018 03:13:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77E07287C6 for ; Fri, 21 Dec 2018 03:13:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C119287CF; Fri, 21 Dec 2018 03:13:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25EB1287C6 for ; Fri, 21 Dec 2018 03:13:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388746AbeLUDM6 (ORCPT ); Thu, 20 Dec 2018 22:12:58 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:53265 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731785AbeLUDM6 (ORCPT ); Thu, 20 Dec 2018 22:12:58 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id wBL3Ci1p003819; Fri, 21 Dec 2018 12:12:45 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com wBL3Ci1p003819 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1545361965; bh=sPoUWgm9HoTObFyYcNyHA9wD9gNx+jYnO+blEKMDeJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D1+COK9RzxFZQJvuqL19LNaQDQdet8mQnLEhTxsnijMbqjWv14oiJB+swLCchj5ek 8y0wHpPWfdyHs540RyRIBdBlN0tHhwmM7W2Rq+4Lg95o/TYbu51bT4+nh9kFNnlGZn ZuR24M39PzexLa7Qba9+dqF3LKTWhVsYgpS78+O/QzGVfa7orS9m/GTPMWjjRObbg5 1Orz8QSuiwsEIIhz0qKiw2hywauQUIk2J7PpM3obJ1QZNy2Mkmg0sjpvombKvqqe/0 XcdTBc8SPJk6ZjGtPguSIIsUeO3FITl7vRipy38FuoUctC9YrKJZZUTLatNz542NFl yMEh0w6AWEY2Q== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 2/3] firmware: remove unnecessary patterns in .gitignore Date: Fri, 21 Dec 2018 12:12:40 +0900 Message-Id: <1545361961-31990-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545361961-31990-1-git-send-email-yamada.masahiro@socionext.com> References: <1545361961-31990-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit df85b2d767aa ("firmware: Restore support for built-in firmware") should not have restored this .gitignore blindly. What git should ignore is merely *.gen.S now. Signed-off-by: Masahiro Yamada --- firmware/.gitignore | 5 ----- 1 file changed, 5 deletions(-) diff --git a/firmware/.gitignore b/firmware/.gitignore index d9c6901..9c8bdb9 100644 --- a/firmware/.gitignore +++ b/firmware/.gitignore @@ -1,6 +1 @@ *.gen.S -*.fw -*.bin -*.csp -*.dsp -ihex2fw From patchwork Fri Dec 21 03:12:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10739831 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D806D746 for ; Fri, 21 Dec 2018 03:13:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C41E1287C6 for ; Fri, 21 Dec 2018 03:13:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B28DA287CF; Fri, 21 Dec 2018 03:13:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1252C287C6 for ; Fri, 21 Dec 2018 03:13:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390808AbeLUDNC (ORCPT ); Thu, 20 Dec 2018 22:13:02 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:53266 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731899AbeLUDM7 (ORCPT ); Thu, 20 Dec 2018 22:12:59 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id wBL3Ci1q003819; Fri, 21 Dec 2018 12:12:45 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com wBL3Ci1q003819 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1545361965; bh=7BUcAm2kzh0Oah2K4UpaMEeLxvXGjrdT7tbi0/n1Edg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gnVyb9KH6yRmJOX41ZPUv0rd2BP3fB2xGmD5eq2LQDmAcuLqczoe2QoICGZwUJKiV OUw16z3JdKl3BSKtfxvlxWkZgHRckpyHENNOQuJZ6qowoGRAXA2hrXyfQQlMCHRjwh 6TaYsoBtn/VEGEPwaFzM2zLNz90bJb2T4U60S4Ue0VUnpE+UCrmcAPxfinAg2aB/VV olZkbE/HrPNF4Jna61XSI2JK3RwE3IyvPTUhK6XRSXjp5+mO0gmOFDl6tacHgI+6XD ctgB9eTFzWaytP8eHHi7kU3T/LKv0K/oaDpVAOjPrfMnQLVOniBC7ZniraYD8FUgIg CX5qgEySgNvmQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] firmware: rewrite Makefile Date: Fri, 21 Dec 2018 12:12:41 +0900 Message-Id: <1545361961-31990-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545361961-31990-1-git-send-email-yamada.masahiro@socionext.com> References: <1545361961-31990-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Clean up the Makefile. Equivalent *.gen.S files are produced. - Use filechk to remove ugly wordsize_deps - Get FWNAME, FWSTR, ASM_WORD, ASM_ALIGN, and PROGBITS out of the recipe for readability - Move mkdir into the recipe - Clean up generated directories by 'make clean' Signed-off-by: Masahiro Yamada --- For this patch to work correctly, the following prerequisite is necessary: https://patchwork.kernel.org/patch/10707461/ So, I will queue this series to kbuild tree. BTW, my next plan is to move firmware/ to more relevant place, for example, drivers/base/firmware_loader/builtin. firmware/Makefile | 89 ++++++++++++++++++++++--------------------------------- 1 file changed, 35 insertions(+), 54 deletions(-) diff --git a/firmware/Makefile b/firmware/Makefile index 2964138..18d1c84 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -1,61 +1,42 @@ # SPDX-License-Identifier: GPL-2.0 -# -# kbuild file for firmware/ -# -# Create $(fwabs) from $(CONFIG_EXTRA_FIRMWARE_DIR) -- if it doesn't have a +# Create $(fwdir) from $(CONFIG_EXTRA_FIRMWARE_DIR) -- if it doesn't have a # leading /, it's relative to $(srctree). fwdir := $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE_DIR)) -fwabs := $(addprefix $(srctree)/,$(filter-out /%,$(fwdir)))$(filter /%,$(fwdir)) - -fw-external-y := $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE)) - -quiet_cmd_fwbin = MK_FW $@ - cmd_fwbin = FWNAME="$(patsubst firmware/%.gen.S,%,$@)"; \ - FWSTR="$(subst /,_,$(subst .,_,$(subst -,_,$(patsubst \ - firmware/%.gen.S,%,$@))))"; \ - ASM_WORD=$(if $(CONFIG_64BIT),.quad,.long); \ - ASM_ALIGN=$(if $(CONFIG_64BIT),3,2); \ - PROGBITS=$(if $(CONFIG_ARM),%,@)progbits; \ - echo "/* Generated by firmware/Makefile */" > $@;\ - echo " .section .rodata" >>$@;\ - echo " .p2align $${ASM_ALIGN}" >>$@;\ - echo "_fw_$${FWSTR}_bin:" >>$@;\ - echo " .incbin \"$(2)\"" >>$@;\ - echo "_fw_end:" >>$@;\ - echo " .section .rodata.str,\"aMS\",$${PROGBITS},1" >>$@;\ - echo " .p2align $${ASM_ALIGN}" >>$@;\ - echo "_fw_$${FWSTR}_name:" >>$@;\ - echo " .string \"$$FWNAME\"" >>$@;\ - echo " .section .builtin_fw,\"a\",$${PROGBITS}" >>$@;\ - echo " .p2align $${ASM_ALIGN}" >>$@;\ - echo " $${ASM_WORD} _fw_$${FWSTR}_name" >>$@;\ - echo " $${ASM_WORD} _fw_$${FWSTR}_bin" >>$@;\ - echo " $${ASM_WORD} _fw_end - _fw_$${FWSTR}_bin" >>$@; - -# One of these files will change, or come into existence, whenever -# the configuration changes between 32-bit and 64-bit. The .S files -# need to change when that happens. -wordsize_deps := $(wildcard include/config/64bit.h include/config/32bit.h \ - include/config/ppc32.h include/config/ppc64.h \ - include/config/superh32.h include/config/superh64.h \ - include/config/x86_32.h include/config/x86_64.h \ - firmware/Makefile) - -$(patsubst %,$(obj)/%.gen.S, $(fw-external-y)): %: $(wordsize_deps) \ - include/config/extra/firmware/dir.h - $(call cmd,fwbin,$(fwabs)/$(patsubst $(obj)/%.gen.S,%,$@)) +fwdir := $(addprefix $(srctree)/,$(filter-out /%,$(fwdir)))$(filter /%,$(fwdir)) + +obj-y := $(addsuffix .gen.o, $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE))) + +FWNAME = $(patsubst $(obj)/%.gen.S,%,$@) +FWSTR = $(subst /,_,$(subst .,_,$(subst -,_,$(FWNAME)))) +ASM_WORD = $(if $(CONFIG_64BIT),.quad,.long) +ASM_ALIGN = $(if $(CONFIG_64BIT),3,2) +PROGBITS = $(if $(CONFIG_ARM),%,@)progbits + +filechk_fwbin = { \ + echo "/* Generated by $(src)/Makefile */" ;\ + echo " .section .rodata" ;\ + echo " .p2align $(ASM_ALIGN)" ;\ + echo "_fw_$(FWSTR)_bin:" ;\ + echo " .incbin \"$(fwdir)/$(FWNAME)\"" ;\ + echo "_fw_end:" ;\ + echo " .section .rodata.str,\"aMS\",$(PROGBITS),1" ;\ + echo " .p2align $(ASM_ALIGN)" ;\ + echo "_fw_$(FWSTR)_name:" ;\ + echo " .string \"$(FWNAME)\"" ;\ + echo " .section .builtin_fw,\"a\",$(PROGBITS)" ;\ + echo " .p2align $(ASM_ALIGN)" ;\ + echo " $(ASM_WORD) _fw_$(FWSTR)_name" ;\ + echo " $(ASM_WORD) _fw_$(FWSTR)_bin" ;\ + echo " $(ASM_WORD) _fw_end - _fw_$(FWSTR)_bin" ;\ +} + +$(obj)/%.gen.S: FORCE + @mkdir -p $(dir $@) + $(call filechk,fwbin) # The .o files depend on the binaries directly; the .S files don't. -$(patsubst %,$(obj)/%.gen.o, $(fw-external-y)): $(obj)/%.gen.o: $(fwdir)/% - -obj-y += $(patsubst %,%.gen.o, $(fw-external-y)) - -ifeq ($(KBUILD_SRC),) -# Makefile.build only creates subdirectories for O= builds, but external -# firmware might live outside the kernel source tree -_dummy := $(foreach d,$(addprefix $(obj)/,$(dir $(fw-external-y))), $(shell [ -d $(d) ] || mkdir -p $(d))) -endif +$(addprefix $(obj)/, $(obj-y)): $(obj)/%.gen.o: $(fwdir)/% -targets := $(patsubst $(obj)/%,%, \ - $(shell find $(obj) -name \*.gen.S 2>/dev/null)) +targets := $(shell cd $(obj) && find * -name '*.gen.S') +clean-dirs := $(shell cd $(obj) && find * -maxdepth 0 -type d)