From patchwork Sat Jan 4 15:02:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317741 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B903B138C for ; Sat, 4 Jan 2020 15:03:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9808A24650 for ; Sat, 4 Jan 2020 15:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578150235; bh=eyXmBLypHW5TpeigWouarWEU3eDNS+OoIA395TkiLmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fndZ/nMxTOU6Ab7NNCn9p/GHrgl5hAQ/LWBUVS9W1DjX/Z2kqvh0OgrQXEzyq2CGk T4tsQm7TlXODfqH4F1s7Pi3dVDkge7kqEdG7ylfTALwNDf+5XX8MWGx1mIQ0asf50t jggYjxioOnUdu5BiATOkqKA8YEMlYoTJy6uRQ7fc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725924AbgADPDy (ORCPT ); Sat, 4 Jan 2020 10:03:54 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:54706 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726101AbgADPDy (ORCPT ); Sat, 4 Jan 2020 10:03:54 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-10.nifty.com with ESMTP id 004F2gcR018492; Sun, 5 Jan 2020 00:02:43 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 004F2gcR018492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578150164; bh=qWFTJfXrTovHSQ1K+HfIhyPmZ7ecH7FTNzu3/ME2O30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHT3UFLvU99bgjiIN4P4TEQC0/qhTcOOXcIiMpG5Iiy8U5MuS63ZyRMzSMb6iPpPB vSMgnm6xUhDhFHUKHNCm31EbDnHboNBiCwl0bjNB3ZEx0Af1XJ7J41zUEGxMCMSNSM urw9LjpCO1WfvgfgAHv9L5b89wBpAI8Q3sR3FlJquf5+Te7nn/6p6TGA7Y8mIl4sRE 1Av0I3aegowEzoHOb7TvFGqw/Nz93xvPzfGD/FoT6+b9adZuqwCEIWW++xDzsnaT3M xZl0JTxINqGjvusWU9WhozTHxELO7mwz+Yf8Rn3/4k/7CB6z10k8t8AnIytwXvldFH MMgilXnT6DJXA== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Andrew Morton , Greg Thelen , Sam Ravnborg , linux-kernel@vger.kernel.org Subject: [PATCH v2 01/13] initramfs: replace klibcdirs in Makefile with FORCE Date: Sun, 5 Jan 2020 00:02:26 +0900 Message-Id: <20200104150238.19834-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200104150238.19834-1-masahiroy@kernel.org> References: <20200104150238.19834-1-masahiroy@kernel.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 'klibcdirs' was added by commit d39a206bc35d ("kbuild: rebuild initramfs if content of initramfs changes"). If this is just a matter of forcing execution of the recipe line, we can replace it with FORCE. I do not understand the purpose of $(deps_initramfs): klibcdirs Remove it. Signed-off-by: Masahiro Yamada Reviewed-by: Greg Thelen --- Changes in v2: - New patch (I forgot to submit this in v1 series) usr/Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/usr/Makefile b/usr/Makefile index e6f7cb2f81db..55c942da01cd 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -3,9 +3,6 @@ # kbuild file for usr/ - including initramfs image # -klibcdirs:; -PHONY += klibcdirs - suffix_y = $(subst $\",,$(CONFIG_INITRAMFS_COMPRESSION)) datafile_y = initramfs_data.cpio$(suffix_y) datafile_d_y = .$(datafile_y).d @@ -50,13 +47,12 @@ targets := $(datafile_y) # do not try to update files included in initramfs $(deps_initramfs): ; -$(deps_initramfs): klibcdirs # We rebuild initramfs_data.cpio if: # 1) Any included file is newer than initramfs_data.cpio # 2) There are changes in which files are included (added or deleted) # 3) If gen_init_cpio are newer than initramfs_data.cpio # 4) Arguments to gen_initramfs.sh changes -$(obj)/$(datafile_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs +$(obj)/$(datafile_y): $(obj)/gen_init_cpio $(deps_initramfs) FORCE $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/$(datafile_d_y) $(call if_changed,initfs) From patchwork Sat Jan 4 15:02:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317733 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3AF1314E3 for ; Sat, 4 Jan 2020 15:03:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A1DB24653 for ; Sat, 4 Jan 2020 15:03:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578150197; bh=OImT5951usVoEzBTTXk40cdtKNYhMGaPcyc+mblWNvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zFVLb4DJ1TCA3wzJYQ0JG1SXHdehNmKjMDMxGrwbf4px5Lq8PuuF0oi9/6exy9u/4 fWkEmGTMCxCDOozdz1VKEdOYXElK4LzKyRTt0j/M8cblU/54ZF97LzL2pM3ZEltWsZ XCr27huRBT+KBc+hll2tyThdPYuGD2CxRcveVldg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726080AbgADPDI (ORCPT ); Sat, 4 Jan 2020 10:03:08 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:53557 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726099AbgADPDB (ORCPT ); Sat, 4 Jan 2020 10:03:01 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-10.nifty.com with ESMTP id 004F2gcS018492; Sun, 5 Jan 2020 00:02:44 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 004F2gcS018492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578150164; bh=SKiPM0FBFgdXfstujev5RqYQ1TcIrVxmqymcoyNEglI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t/YeNqRwEpLsxuSW+1yl8DiFvcgQkDWkeOi9OhPlHBinKjerZnRrY3dk9S629dwyZ sgSRPYhG/51Ij2BHa7Zgl9JWi96c5L+/B15z4P9W5j2czJCQNBvtTnyVCFkBPDMjOh OnEaR3XOd49j7rkP103PrKPyA41XyJZRrXgk6/DHqL2rdqGvdhpr3mh4LTVkH6jAf/ tLdwM3Gv6FZlivlJQZoR0Oyrki/e3LWt5P1p4/B1XUAcwPZtesiH1UzVfrdu/l2FtL C7xa/TRX2/StXg1d3yg0Yx+OzzsVGsKTHMrDSwd/ipT13n/MARhhWRltPwFSiRe3nA 3uj40gll2iudg== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 02/13] gen_initramfs_list.sh: remove unused variable 'default_list' Date: Sun, 5 Jan 2020 00:02:27 +0900 Message-Id: <20200104150238.19834-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200104150238.19834-1-masahiroy@kernel.org> References: <20200104150238.19834-1-masahiroy@kernel.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org This is assigned, but not referenced. Signed-off-by: Masahiro Yamada Reviewed-by: Greg Thelen --- Changes in v2: None usr/gen_initramfs_list.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/usr/gen_initramfs_list.sh b/usr/gen_initramfs_list.sh index 2bbac73e6477..909a7b865aa7 100755 --- a/usr/gen_initramfs_list.sh +++ b/usr/gen_initramfs_list.sh @@ -280,7 +280,6 @@ while [ $# -gt 0 ]; do shift ;; "-d") # display default initramfs list - default_list="$arg" ${dep_list}default_initramfs ;; "-h") From patchwork Sat Jan 4 15:02:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317737 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6FDFE6C1 for ; Sat, 4 Jan 2020 15:03:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F6BD24653 for ; Sat, 4 Jan 2020 15:03:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578150205; bh=fUsYRRJnL+vBR/iTDS5tGHHgO5+pC1xmHCTBxBe+1b8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=GiCsGkb8F276hVqK/4Vm3VwQcWgxr7vXfpfZrcT+fL5LlECVqtCyIPqWsU7a/1RJ2 AtWRXq8/UFmLjayw9oGcWewKCZJOkSEDBZTelZUPgufKonMTRVTZHqLj7ymbvG6NOC QXctYTNK9XAXDZxLwPMrWD18pKGWUwt0tcbJDDRg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726608AbgADPDV (ORCPT ); Sat, 4 Jan 2020 10:03:21 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:53555 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725924AbgADPDB (ORCPT ); Sat, 4 Jan 2020 10:03:01 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-10.nifty.com with ESMTP id 004F2gcT018492; Sun, 5 Jan 2020 00:02:44 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 004F2gcT018492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578150165; bh=zUVXeIJTFh9cAI4ZnqdgT2rf+tWF/1NubRKRJEqQ8Kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rAyxLQ4/E572t2vCiQaRi2R2U2etpr+ZmpTWNAjOFGt2MBPHtOxYvL0HyWveKyqqI BlLc/KPzbaeOihMRogi4t/fTJg6tv+PBUylrDGJtVSFSM+khAarrENp7etVvIXsVNP 8CtGKwwiTN5m/mUUl2KxWaY8/froJmdSSiZo98QdKInhCOVhHF62pPGQdQhFNXiRF/ CxCaTEo8DCDvLa+3DXYezg0NhSfgwJIZVU+Wvdk2oqJ6nesx15EkzdoZfLWmyrEvKQ NW9xNYERMA/HKt+LVu8UM2jTLGVJA4uNIkW6y7JifD6Ydvf/x1CCOe9GuwkG5CKdVe rtmgzaqjqyhEA== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 03/13] gen_initramfs_list.sh: fix the tool name in the comment Date: Sun, 5 Jan 2020 00:02:28 +0900 Message-Id: <20200104150238.19834-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200104150238.19834-1-masahiroy@kernel.org> References: <20200104150238.19834-1-masahiroy@kernel.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org There is no tool named "gen_initramfs". The correct name is "gen_init_cpio". Signed-off-by: Masahiro Yamada Reviewed-by: Greg Thelen --- Changes in v2: None usr/gen_initramfs_list.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/gen_initramfs_list.sh b/usr/gen_initramfs_list.sh index 909a7b865aa7..1fd93414fb37 100755 --- a/usr/gen_initramfs_list.sh +++ b/usr/gen_initramfs_list.sh @@ -189,7 +189,7 @@ dir_filelist() { # if only one file is specified and it is .cpio file then use it direct as fs # if a directory is specified then add all files in given direcotry to fs -# if a regular file is specified assume it is in gen_initramfs format +# if a regular file is specified assume it is in gen_init_cpio format input_file() { source="$1" if [ -f "$1" ]; then From patchwork Sat Jan 4 15:02:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317751 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AD71E6C1 for ; Sat, 4 Jan 2020 15:04:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8BD8524653 for ; Sat, 4 Jan 2020 15:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578150258; bh=ofvL6+NKRIHoxGD4O6WsEGd7L3xRLx2b33fpLfXq2q0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WpM/Oarndil3BifvI6pgFVAJu4upY9Z82ymsFwFYphr6kojH40c2e+KCBpEKNnlrg w8YU7s4RC4fdyoteffqmGSizArP5QgS/NhLNyQk8fq1tTnPhbenJO0bFM0YW/AjHqq T2HK52f3SpN8CX4nK8g1aedRbjYZexLwvsTHoL2A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726608AbgADPEP (ORCPT ); Sat, 4 Jan 2020 10:04:15 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:54709 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726231AbgADPDx (ORCPT ); Sat, 4 Jan 2020 10:03:53 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-10.nifty.com with ESMTP id 004F2gcU018492; Sun, 5 Jan 2020 00:02:45 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 004F2gcU018492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578150165; bh=27Oq2PPg5dWtrSRAhiLEszC3H3oMsZeBE21RU3EfIJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hTotURN8Is++lA4h8hVX5P1CazlmH5sUJqqdXFuNk1nWsiwYLUohGDsgu1ggH5EjR /FcKYhHiF7ktvCHHA6zT9koSFJfz3kfpBKeSReri912JpihQS6W0rnR7X3kJxCJ+zT lxE5Ym4eyd0IJ0AcVOkwdkvO+2qirRO1u5SQd8xYpwuLr7w3mDsNhsmg376gam4Am8 nZaZcLLcMTVP1+w538ELMjCLZNDf/CuzM/SadKvNMw1Y/LioUEhdTdVp9MhbBfIbGZ tOgw9G3Mb8bZk0lkjXTTfVQ7yTfvNnqrd92N6UvwePh7VT0adsmz+hexGUAQLXUjj6 wo7I5VsIOJuHA== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Andrew Morton , Greg Thelen , Sam Ravnborg , linux-kernel@vger.kernel.org Subject: [PATCH v2 04/13] initramfs: rename gen_initramfs_list.sh to gen_initramfs.sh Date: Sun, 5 Jan 2020 00:02:29 +0900 Message-Id: <20200104150238.19834-5-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200104150238.19834-1-masahiroy@kernel.org> References: <20200104150238.19834-1-masahiroy@kernel.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org The comments in usr/Makefile wrongly refer to the script name (twice). Line 37: # The dependency list is generated by gen_initramfs.sh -l Line 54: # 4) Arguments to gen_initramfs.sh changes There does not exist such a script. I was going to fix the comments, but after some consideration, I thought "gen_initramfs.sh" would be more suitable than "gen_initramfs_list.sh" because it generates an initramfs image in the common usage. The script generates a list that can be fed to gen_init_cpio only when it is directly run without -o or -l option. Signed-off-by: Masahiro Yamada --- Changes in v2: None usr/Makefile | 2 +- usr/{gen_initramfs_list.sh => gen_initramfs.sh} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename usr/{gen_initramfs_list.sh => gen_initramfs.sh} (100%) diff --git a/usr/Makefile b/usr/Makefile index 55c942da01cd..e44a66b8c051 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -24,7 +24,7 @@ $(obj)/initramfs_data.o: $(obj)/$(datafile_y) FORCE # Generate the initramfs cpio archive hostprogs-y := gen_init_cpio -initramfs := $(CONFIG_SHELL) $(srctree)/$(src)/gen_initramfs_list.sh +initramfs := $(CONFIG_SHELL) $(srctree)/$(src)/gen_initramfs.sh ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \ $(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d) ramfs-args := \ diff --git a/usr/gen_initramfs_list.sh b/usr/gen_initramfs.sh similarity index 100% rename from usr/gen_initramfs_list.sh rename to usr/gen_initramfs.sh From patchwork Sat Jan 4 15:02:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317727 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A22CB138C for ; Sat, 4 Jan 2020 15:03:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 81F9B24653 for ; Sat, 4 Jan 2020 15:03:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578150196; bh=KZJqwEO8rCD1fdiW81fU+BstE78ZFW5FzzBCm48r5Dk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=TxXd1ku01h7D+fbZNkX0MeTnVemf0G9aPY961Gbf0pSrtpuT7KBfbDTnmWtcW0Gir Kd0kvRmjO2etdB19ARgArk6HuF1dE2A6jP8LIzon+xIZhlFjldTNpbu+0J3iivRi0/ 3NYKKLuKSYKg6NwnlFYGylYYoEoTDSZX3l8uHnbg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726135AbgADPDC (ORCPT ); Sat, 4 Jan 2020 10:03:02 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:53558 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726118AbgADPDB (ORCPT ); Sat, 4 Jan 2020 10:03:01 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-10.nifty.com with ESMTP id 004F2gcV018492; Sun, 5 Jan 2020 00:02:46 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 004F2gcV018492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578150166; bh=m+QNw9lJ1lLT2KZMs68ll6UoAC70qCeAUczCTb6/mWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DGH3kX4WJdQwfpbNa4BApSJsWxpSuB/GaVrQ0YrCsnW6BDjoH8vbbySP1ctZf3hmV xAuSU6YrwMjH/fxhRl8F+AJLs4uPr1zH29ofqi6/Im9LXG2bhBSHNREGssSH+feuZV DlPabRXo3OSX1yof1Zj0kQZiuJsX5W/ZHlAi3WJJ9bo7bzc+tgY656dRwxv1CAtejt +s6jDpaQ0Edsm1Luq+xvXR4fXRZsgigfs9JWMXRlVuKtIdnyi+lj42EWbsGhAyu/a6 K2rtm7yY2qKhi+KO0HGieTUUNkBG8HU5/ZgS5IzSpzlKzgafvvDGrYdAkEKOQaqUsm 9foIxN/3AZbSQ== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Subject: [PATCH v2 05/13] initramfs: remove redundant dependency on BLK_DEV_INITRD Date: Sun, 5 Jan 2020 00:02:30 +0900 Message-Id: <20200104150238.19834-6-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200104150238.19834-1-masahiroy@kernel.org> References: <20200104150238.19834-1-masahiroy@kernel.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org init/Kconfig includes usr/Kconfig inside the "if BLK_DEV_INITRD" ... "endif" block: if BLK_DEV_INITRD source "usr/Kconfig" endif Hence, all the defines in usr/Kconfig depend on BLK_DEV_INITRD. Remove the redundant "depends on BLK_DEV_INITRD". Signed-off-by: Masahiro Yamada Reviewed-by: Greg Thelen --- Changes in v2: None usr/Kconfig | 6 ------ 1 file changed, 6 deletions(-) diff --git a/usr/Kconfig b/usr/Kconfig index a6b68503d177..72f50a21c051 100644 --- a/usr/Kconfig +++ b/usr/Kconfig @@ -54,7 +54,6 @@ config INITRAMFS_ROOT_GID config RD_GZIP bool "Support initial ramdisk/ramfs compressed using gzip" - depends on BLK_DEV_INITRD default y select DECOMPRESS_GZIP help @@ -64,7 +63,6 @@ config RD_GZIP config RD_BZIP2 bool "Support initial ramdisk/ramfs compressed using bzip2" default y - depends on BLK_DEV_INITRD select DECOMPRESS_BZIP2 help Support loading of a bzip2 encoded initial ramdisk or cpio buffer @@ -73,7 +71,6 @@ config RD_BZIP2 config RD_LZMA bool "Support initial ramdisk/ramfs compressed using LZMA" default y - depends on BLK_DEV_INITRD select DECOMPRESS_LZMA help Support loading of a LZMA encoded initial ramdisk or cpio buffer @@ -81,7 +78,6 @@ config RD_LZMA config RD_XZ bool "Support initial ramdisk/ramfs compressed using XZ" - depends on BLK_DEV_INITRD default y select DECOMPRESS_XZ help @@ -91,7 +87,6 @@ config RD_XZ config RD_LZO bool "Support initial ramdisk/ramfs compressed using LZO" default y - depends on BLK_DEV_INITRD select DECOMPRESS_LZO help Support loading of a LZO encoded initial ramdisk or cpio buffer @@ -100,7 +95,6 @@ config RD_LZO config RD_LZ4 bool "Support initial ramdisk/ramfs compressed using LZ4" default y - depends on BLK_DEV_INITRD select DECOMPRESS_LZ4 help Support loading of a LZ4 encoded initial ramdisk or cpio buffer From patchwork Sat Jan 4 15:02:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317725 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B012A138C for ; Sat, 4 Jan 2020 15:03:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8929E22B48 for ; Sat, 4 Jan 2020 15:03:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578150181; bh=rWfLsX7FvE6XFx5/wr1y7YTz71JBQxR4Rw7itajfC2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=InjIQakj5K4h9YJtrFONIqmjGK1N2KXrQUaoVmLwKSQQdig9mzSJPBqMVlHa5Iy+A xYEly3orHnluxh6byf9qf31qW58YQJ0r+ZAo50y652lt8XRSlwnNgqYmi/ihlOsEqK +q3Vvc+sPzrNwYJMGs2Ujcg1owS8hXrC5j7ZvGHk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726143AbgADPDB (ORCPT ); Sat, 4 Jan 2020 10:03:01 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:53563 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726135AbgADPDA (ORCPT ); Sat, 4 Jan 2020 10:03:00 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-10.nifty.com with ESMTP id 004F2gcW018492; Sun, 5 Jan 2020 00:02:46 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 004F2gcW018492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578150166; bh=BflCds3eDfZKKkb79ngQRy2WmRBR4w8cbD1yLoBTetY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u0W+BeWxwmpgJoaJCKv644PAmFlZKKPxRKKj5DtfjAAH6ozoptNbKkh7SjP8Iki3G EGpwga3ewU6nG+c04MU5dClubeoxgU1eJydXnbtfyStbJrhYo7A4iKwN3TU7bAWKQe 3D54nbHKIDMxsg7DEe8EVfhNj8vQ7E2zpLSU5lJ+04aJC4MbLwr5GAIdIkHglQnDf6 jdI3OI5eduAOJC1NpYD0p1WGDJt3xnIIDEDofKQ7Yp7XGbtOi5L+0P5z0ipup++qv4 sNosRY3bLjkJogUuWqDpvyrs8nsPRYKHKCku6VBm5oa9eeETua/PLOSIV2rCGUAzSn DK017OKWvJ+9w== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Subject: [PATCH v2 06/13] initramfs: make compression options not depend on INITRAMFS_SOURCE Date: Sun, 5 Jan 2020 00:02:31 +0900 Message-Id: <20200104150238.19834-7-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200104150238.19834-1-masahiroy@kernel.org> References: <20200104150238.19834-1-masahiroy@kernel.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Even if INITRAMFS_SOURCE is empty, usr/gen_initramfs.sh generates a tiny default initramfs, which is embedded in vmlinux. So, defining INITRAMFS_COMPRESSION* options should be valid irrespective of INITRAMFS_SOURCE. Signed-off-by: Masahiro Yamada --- Changes in v2: None usr/Kconfig | 2 -- 1 file changed, 2 deletions(-) diff --git a/usr/Kconfig b/usr/Kconfig index 72f50a21c051..43934c128010 100644 --- a/usr/Kconfig +++ b/usr/Kconfig @@ -102,7 +102,6 @@ config RD_LZ4 choice prompt "Built-in initramfs compression mode" - depends on INITRAMFS_SOURCE!="" optional help This option allows you to decide by which algorithm the builtin @@ -211,7 +210,6 @@ config INITRAMFS_COMPRESSION_LZ4 endchoice config INITRAMFS_COMPRESSION - depends on INITRAMFS_SOURCE!="" string default "" if INITRAMFS_COMPRESSION_NONE default ".gz" if INITRAMFS_COMPRESSION_GZIP From patchwork Sat Jan 4 15:02:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317735 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 932F16C1 for ; Sat, 4 Jan 2020 15:03:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 72FC024650 for ; Sat, 4 Jan 2020 15:03:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578150198; bh=MMABjUVZWxnTwWVITjGAwYQRcAIUgmynU62s4UjP0cc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dKlQrN/SIqjs0yT7ZRCLYo+ZRVI5mPggGzSM42PJz5eA5XbqOqKAmIwNpFiqd99S1 bUkVrVtU50qJJeG/KI+w3cl2Z/Y52X4yhAxYo/NSawJgh9n7Xj9abmZ2FLNGhZ1euU pO5oXbMYj3I6entMHieZVJaPlVXCp3F3bzIeqy5s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726101AbgADPDR (ORCPT ); Sat, 4 Jan 2020 10:03:17 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:53560 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726083AbgADPDB (ORCPT ); Sat, 4 Jan 2020 10:03:01 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-10.nifty.com with ESMTP id 004F2gcX018492; Sun, 5 Jan 2020 00:02:47 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 004F2gcX018492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578150167; bh=Ds0+VtuhBD3d3jLcnJM/gKsN6b9rI46kgvvBCTFzsDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xey2FSI/Ddi4dSKw72YJoJjpFHdKZvBdE76fBZSDwy9Q6YbaAMSqM3NlL9w+LZsAP kYwsbYSBX7FxJeh2PkAN0LEm1li63XVTaNWeFuVwzimF/tDOski6/b3o08xQgvN5Ne YzY54Z9e63cd55eVNO1Gc0p4vz4N8dYlGeY/er63bzJnTqUwKouZU2Y/kAP3d/DIO3 40RPTCP+Ov3mPZl3NxQsfljkCjTFqtxQywcifwRHU+EtCm2/cSyn+NY3dDbWE08sSR qVb4sTm/g9pd0nRSEHgDrXLmkCAK4fuytBpPxAlv/2LPfTbtvAhvehZ0C8HgSErMY4 Grgbh4u6CJjLQ== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Subject: [PATCH v2 07/13] initramfs: make initramfs compression choice non-optional Date: Sun, 5 Jan 2020 00:02:32 +0900 Message-Id: <20200104150238.19834-8-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200104150238.19834-1-masahiroy@kernel.org> References: <20200104150238.19834-1-masahiroy@kernel.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Currently, the choice of the initramfs compression mode is too complex because users are allowed to not specify the compression mode at all. I think it makes more sense to require users to choose the compression explicitly, and delete the fallback defaults of INITRAMFS_COMPRESSION. Signed-off-by: Masahiro Yamada --- Changes in v2: None usr/Kconfig | 8 -------- 1 file changed, 8 deletions(-) diff --git a/usr/Kconfig b/usr/Kconfig index 43934c128010..ab61e81165e0 100644 --- a/usr/Kconfig +++ b/usr/Kconfig @@ -102,7 +102,6 @@ config RD_LZ4 choice prompt "Built-in initramfs compression mode" - optional help This option allows you to decide by which algorithm the builtin initramfs will be compressed. Several compression algorithms are @@ -218,10 +217,3 @@ config INITRAMFS_COMPRESSION default ".xz" if INITRAMFS_COMPRESSION_XZ default ".lzo" if INITRAMFS_COMPRESSION_LZO default ".lz4" if INITRAMFS_COMPRESSION_LZ4 - default ".gz" if RD_GZIP - default ".lz4" if RD_LZ4 - default ".lzo" if RD_LZO - default ".xz" if RD_XZ - default ".lzma" if RD_LZMA - default ".bz2" if RD_BZIP2 - default "" From patchwork Sat Jan 4 15:02:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317739 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 16494138C for ; Sat, 4 Jan 2020 15:03:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E8C8822B48 for ; Sat, 4 Jan 2020 15:03:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578150234; bh=vq1F45TZIDTVqRtBdZowWxaDOnhIsY0/udUSRb+mbiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=p+QwgafplDZqIVnLlDGNI6lBj3WjvKC2UHETKcsKBCse6edkhs7sSDpnww/gRmYhd 06Nt5c6U49OIVMlrVuUiRObreFYI5xPQtb224Fn8JpKp2UdkBEKOY2NFZDT6ui7TVJ 9/fnkAN8udfx12rii679hTJF2hHmyDIrKSlXnNO8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726697AbgADPDx (ORCPT ); Sat, 4 Jan 2020 10:03:53 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:54704 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725924AbgADPDx (ORCPT ); Sat, 4 Jan 2020 10:03:53 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-10.nifty.com with ESMTP id 004F2gcY018492; Sun, 5 Jan 2020 00:02:47 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 004F2gcY018492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578150168; bh=WZOgRtqxF0Kb4x0Cb5gHlA6M0SDhuMJyyQqpxtV4EQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wev/N8AAp5/DD4da/QsUTYbx8iXUNMjbJkMfmgPPBQZZlwqeGuepRFZFW4VtMD382 shjSHWL3l0fAzWs8aQxVCGyDwLU6jSA2H78QVyovy4NDHq+50OG1uCoz4yXd+LCTHJ rFfRD91rahAw0I54+4NR7m9GhWgVQIXpRHKQoAbtZcaqlS0rJz7cz5I+beTQodz8gz voM3hq2yITOpzQYa0YlwHbqoBcwFpSYu3bx1XUmaBvPbW7+qyaqD5sBZfIB+vcrnsz HXoDFMmQ1MhsoRj8thmxlCiWgHkZu1zoEYIRN2YJgdRhk2sIZFoApmJ+TJWCBzE4X8 OcEThb3g0c6EA== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Andrew Morton , Greg Thelen , Sam Ravnborg , linux-kernel@vger.kernel.org Subject: [PATCH v2 08/13] initramfs: specify $(src)/gen_initramfs.sh as a prerequisite in Makefile Date: Sun, 5 Jan 2020 00:02:33 +0900 Message-Id: <20200104150238.19834-9-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200104150238.19834-1-masahiroy@kernel.org> References: <20200104150238.19834-1-masahiroy@kernel.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Specify the dependency directly in the Makefile. Signed-off-by: Masahiro Yamada Reviewed-by: Greg Thelen --- Changes in v2: None usr/Makefile | 7 +++---- usr/gen_initramfs.sh | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/usr/Makefile b/usr/Makefile index e44a66b8c051..7df6559f0f30 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -24,7 +24,6 @@ $(obj)/initramfs_data.o: $(obj)/$(datafile_y) FORCE # Generate the initramfs cpio archive hostprogs-y := gen_init_cpio -initramfs := $(CONFIG_SHELL) $(srctree)/$(src)/gen_initramfs.sh ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \ $(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d) ramfs-args := \ @@ -40,7 +39,7 @@ ifneq ($(wildcard $(obj)/$(datafile_d_y)),) endif quiet_cmd_initfs = GEN $@ - cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) + cmd_initfs = $< -o $@ $(ramfs-args) $(ramfs-input) targets := $(datafile_y) @@ -52,8 +51,8 @@ $(deps_initramfs): ; # 2) There are changes in which files are included (added or deleted) # 3) If gen_init_cpio are newer than initramfs_data.cpio # 4) Arguments to gen_initramfs.sh changes -$(obj)/$(datafile_y): $(obj)/gen_init_cpio $(deps_initramfs) FORCE - $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/$(datafile_d_y) +$(obj)/$(datafile_y): $(src)/gen_initramfs.sh $(obj)/gen_init_cpio $(deps_initramfs) FORCE + $(Q)$< -l $(ramfs-input) > $(obj)/$(datafile_d_y) $(call if_changed,initfs) subdir-$(CONFIG_UAPI_HEADER_TEST) += include diff --git a/usr/gen_initramfs.sh b/usr/gen_initramfs.sh index 1fd93414fb37..68b6ddfd5f96 100755 --- a/usr/gen_initramfs.sh +++ b/usr/gen_initramfs.sh @@ -235,7 +235,7 @@ arg="$1" case "$arg" in "-l") # files included in initramfs - used by kbuild dep_list="list_" - echo "deps_initramfs := $0 \\" + echo "deps_initramfs := \\" shift ;; "-o") # generate compressed cpio image named $1 From patchwork Sat Jan 4 15:02:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317749 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1414D138C for ; Sat, 4 Jan 2020 15:04:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DDC202465A for ; Sat, 4 Jan 2020 15:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578150254; bh=4zfKRNXnfEPVA6H1LMW4jI3w6iJ8UU2hMV5fAt122CE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gyJp0lPh0fv75u1tC3jgC2nLK+y5ekPyGavGVxQovsl4dq7yk5z/Fdl3KPevRboaQ I4ejqCvCgiNzhc4MNiYnGQgvCpe9411v+qqo5qItUOv36BQpJZjg3PHo4TF0b0y/TS +uCZygpzwXjYUfwvOF87gmoAmJxrED1Ha42AcyQQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726481AbgADPEF (ORCPT ); Sat, 4 Jan 2020 10:04:05 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:54708 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726080AbgADPDy (ORCPT ); Sat, 4 Jan 2020 10:03:54 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-10.nifty.com with ESMTP id 004F2gcZ018492; Sun, 5 Jan 2020 00:02:48 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 004F2gcZ018492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578150169; bh=bOa47bohg8Nz4cicoYQfhtwIwjqDpidX8PJY4kAWYPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xMjTKv/byEln4A1QGC5lVuO7z7BVe1w+KDergkVSs035zPXJklcwyaIfnUX8j49/f 0NijIUsimZo3+32kZ2VjtictFXZUZdLZQ4xU/CCYxJU9zVdStqNhohsniKuHijehdy Ruqqwe2PO3rSGEl0xMd/oSw+eHxNejn+jElJhhJyJeMYvAyeHL4MiHPcuTBzG5qXq2 nDThHdOzrqOVxMBopmAmbWPk6+msHvXgvjaVvSaFehCDtuPae+MkbTed4bM//jm2f8 F88GzPxdTT0A8iSMToEbTSHS5sUalqBnBzebPBbvG3QPINXeDca5CfjgNerAwAKwoC Md2V8fQdzRXAQ== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Andrew Morton , Greg Thelen , Sam Ravnborg , linux-kernel@vger.kernel.org Subject: [PATCH v2 09/13] initramfs: generate dependency list and cpio at the same time Date: Sun, 5 Jan 2020 00:02:34 +0900 Message-Id: <20200104150238.19834-10-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200104150238.19834-1-masahiroy@kernel.org> References: <20200104150238.19834-1-masahiroy@kernel.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Currently, this script is run twice, for the dependency list, and then for the cpio archive. The first one is re-run every time although its build log is suppressed so nobody notices it. Make it work more efficiently by generating the cpio and the dependency list at the same time. Signed-off-by: Masahiro Yamada --- Changes in v2: None usr/Makefile | 3 +- usr/gen_initramfs.sh | 108 ++++++++++++++++++------------------------- 2 files changed, 47 insertions(+), 64 deletions(-) diff --git a/usr/Makefile b/usr/Makefile index 7df6559f0f30..3ae8b45bfc61 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -39,7 +39,7 @@ ifneq ($(wildcard $(obj)/$(datafile_d_y)),) endif quiet_cmd_initfs = GEN $@ - cmd_initfs = $< -o $@ $(ramfs-args) $(ramfs-input) + cmd_initfs = $< -o $@ -l $(obj)/$(datafile_d_y) $(ramfs-args) $(ramfs-input) targets := $(datafile_y) @@ -52,7 +52,6 @@ $(deps_initramfs): ; # 3) If gen_init_cpio are newer than initramfs_data.cpio # 4) Arguments to gen_initramfs.sh changes $(obj)/$(datafile_y): $(src)/gen_initramfs.sh $(obj)/gen_init_cpio $(deps_initramfs) FORCE - $(Q)$< -l $(ramfs-input) > $(obj)/$(datafile_d_y) $(call if_changed,initfs) subdir-$(CONFIG_UAPI_HEADER_TEST) += include diff --git a/usr/gen_initramfs.sh b/usr/gen_initramfs.sh index 68b6ddfd5f96..49a4e22147b5 100755 --- a/usr/gen_initramfs.sh +++ b/usr/gen_initramfs.sh @@ -15,9 +15,10 @@ set -e usage() { cat << EOF Usage: -$0 [-o ] [-u ] [-g ] {-d | } ... +$0 [-o ] [-l ] [-u ] [-g ] {-d | } ... -o Create compressed initramfs file named using gen_init_cpio and compressor depending on the extension + -l Create dependency list named -u User ID to map to user ID 0 (root). is only meaningful if is a directory. "squash" forces all files to uid 0. @@ -42,11 +43,6 @@ field() { shift $1 ; echo $1 } -list_default_initramfs() { - # echo usr/kinit/kinit - : -} - default_initramfs() { cat <<-EOF >> ${output} # This is a very simple, default initramfs @@ -81,10 +77,6 @@ filetype() { return 0 } -list_print_mtime() { - : -} - print_mtime() { local my_mtime="0" @@ -97,10 +89,10 @@ print_mtime() { } list_parse() { - if [ -L "$1" ]; then + if [ -z "$dep_list" -o -L "$1" ]; then return fi - echo "$1" | sed 's/:/\\:/g; s/$/ \\/' + echo "$1" | sed 's/:/\\:/g; s/$/ \\/' >> $dep_list } # for each file print a line in following format @@ -161,28 +153,25 @@ unknown_option() { exit 1 } -list_header() { - : -} - header() { printf "\n#####################\n# $1\n" >> ${output} } # process one directory (incl sub-directories) dir_filelist() { - ${dep_list}header "$1" + header "$1" srcdir=$(echo "$1" | sed -e 's://*:/:g') dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | LANG=C sort) # If $dirlist is only one line, then the directory is empty if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then - ${dep_list}print_mtime "$1" + print_mtime "$1" echo "${dirlist}" | \ while read x; do - ${dep_list}parse ${x} + list_parse $x + parse $x done fi } @@ -193,22 +182,21 @@ dir_filelist() { input_file() { source="$1" if [ -f "$1" ]; then - ${dep_list}header "$1" + header "$1" is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\{0,1\}/cpio/')" if [ $2 -eq 0 -a ${is_cpio} = "cpio" ]; then cpio_file=$1 echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed" - [ ! -z ${dep_list} ] && echo "$1" + [ -n "$dep_list" ] && echo "$1" >> $dep_list return 0 fi - if [ -z ${dep_list} ]; then - print_mtime "$1" >> ${output} - cat "$1" >> ${output} - else - echo "$1 \\" + print_mtime "$1" >> ${output} + cat "$1" >> ${output} + if [ -n "$dep_list" ]; then + echo "$1 \\" >> $dep_list cat "$1" | while read type dir file perm ; do if [ "$type" = "file" ]; then - echo "$file \\"; + echo "$file \\" >> $dep_list fi done fi @@ -231,44 +219,40 @@ output_file="" is_cpio_compressed= compr="gzip -n -9 -f" -arg="$1" -case "$arg" in - "-l") # files included in initramfs - used by kbuild - dep_list="list_" - echo "deps_initramfs := \\" - shift - ;; - "-o") # generate compressed cpio image named $1 - shift - output_file="$1" - cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)" - output=${cpio_list} - echo "$output_file" | grep -q "\.gz$" \ - && [ -x "`which gzip 2> /dev/null`" ] \ - && compr="gzip -n -9 -f" - echo "$output_file" | grep -q "\.bz2$" \ - && [ -x "`which bzip2 2> /dev/null`" ] \ - && compr="bzip2 -9 -f" - echo "$output_file" | grep -q "\.lzma$" \ - && [ -x "`which lzma 2> /dev/null`" ] \ - && compr="lzma -9 -f" - echo "$output_file" | grep -q "\.xz$" \ - && [ -x "`which xz 2> /dev/null`" ] \ - && compr="xz --check=crc32 --lzma2=dict=1MiB" - echo "$output_file" | grep -q "\.lzo$" \ - && [ -x "`which lzop 2> /dev/null`" ] \ - && compr="lzop -9 -f" - echo "$output_file" | grep -q "\.lz4$" \ - && [ -x "`which lz4 2> /dev/null`" ] \ - && compr="lz4 -l -9 -f" - echo "$output_file" | grep -q "\.cpio$" && compr="cat" - shift - ;; -esac while [ $# -gt 0 ]; do arg="$1" shift case "$arg" in + "-l") # files included in initramfs - used by kbuild + dep_list="$1" + echo "deps_initramfs := \\" > $dep_list + shift + ;; + "-o") # generate compressed cpio image named $1 + output_file="$1" + cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)" + output=${cpio_list} + echo "$output_file" | grep -q "\.gz$" \ + && [ -x "`which gzip 2> /dev/null`" ] \ + && compr="gzip -n -9 -f" + echo "$output_file" | grep -q "\.bz2$" \ + && [ -x "`which bzip2 2> /dev/null`" ] \ + && compr="bzip2 -9 -f" + echo "$output_file" | grep -q "\.lzma$" \ + && [ -x "`which lzma 2> /dev/null`" ] \ + && compr="lzma -9 -f" + echo "$output_file" | grep -q "\.xz$" \ + && [ -x "`which xz 2> /dev/null`" ] \ + && compr="xz --check=crc32 --lzma2=dict=1MiB" + echo "$output_file" | grep -q "\.lzo$" \ + && [ -x "`which lzop 2> /dev/null`" ] \ + && compr="lzop -9 -f" + echo "$output_file" | grep -q "\.lz4$" \ + && [ -x "`which lz4 2> /dev/null`" ] \ + && compr="lz4 -l -9 -f" + echo "$output_file" | grep -q "\.cpio$" && compr="cat" + shift + ;; "-u") # map $1 to uid=0 (root) root_uid="$1" [ "$root_uid" = "-1" ] && root_uid=$(id -u || echo 0) @@ -280,7 +264,7 @@ while [ $# -gt 0 ]; do shift ;; "-d") # display default initramfs list - ${dep_list}default_initramfs + default_initramfs ;; "-h") usage From patchwork Sat Jan 4 15:02:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317745 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B2746C1 for ; Sat, 4 Jan 2020 15:04:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0AA7C24653 for ; Sat, 4 Jan 2020 15:04:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578150245; bh=SbRQ7kz7dE+QDtdPnCVbfXmAGXo+/HxZv3FQVwI9CGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=w2CVBNB+2CRhzapCAh2w/r5Vpk+tzpKHDSakPbbrjfd5qSK/51XWw4wNkPYb2j4CP eVbKQ6N4f1SCyFLFKUc5TjiU4lIoQwQJzCTGY8NlyClrcA+N7ZNp4HK+Y2FlUv2PVs ohbc9ZX3NFAUwwwb+AUKG0jpeOG864aRRZDAJoLY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726893AbgADPDy (ORCPT ); Sat, 4 Jan 2020 10:03:54 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:54705 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726118AbgADPDy (ORCPT ); Sat, 4 Jan 2020 10:03:54 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-10.nifty.com with ESMTP id 004F2gca018492; Sun, 5 Jan 2020 00:02:49 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 004F2gca018492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578150169; bh=FbaClWwqiWtKYH2Zb4LtEPVGB1SiRsdW/Otx4py+kiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sW1J5iwCvdypLA15s2Otlmhu6Fc/yORhyvi9YOAfndsaS3n39PoJKChZ9yZQ5XU+Y f/qvUwF+yz6xlg5tfB4XP7F2ZBK5L8zjgLLs9icqXX3Vq+QSJxEL7fWrkW9MPlHYsx Y0RHUGNR4Xb/H7F+3AivP2zJ/ZYF5gtxeXyxJZSpfOTWAcOVamBfwTJ5eYD1k7mJD/ QB7bimGgHbjJFNVRI5Qw4Ygo6Q7ICV/MjfKuX/oC0E6IJ5G6jcMG1Af8hbK8yMfnwi K3vt7eDh4JQyGbzuMj54RmV43xK8JfBLjyHMKgkwBu4Ip9nfc3gIfjvTYzmuwWEGWQ BeeZC1As4pI5A== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Andrew Morton , Greg Thelen , Sam Ravnborg , linux-kernel@vger.kernel.org Subject: [PATCH v2 10/13] initramfs: add default_cpio_list, and delete -d option support Date: Sun, 5 Jan 2020 00:02:35 +0900 Message-Id: <20200104150238.19834-11-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200104150238.19834-1-masahiroy@kernel.org> References: <20200104150238.19834-1-masahiroy@kernel.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org When CONFIG_INITRAMFS_SOURCE is empty, the Makefile passes the -d option to gen_initramfs.sh to create the default initramfs, which contains /dev, /dev/console, and /root. This commit simplifies the default behavior; remove the -d option, and add the default cpio list. Signed-off-by: Masahiro Yamada --- Changes in v2: None usr/Makefile | 2 +- usr/default_cpio_list | 6 ++++++ usr/gen_initramfs.sh | 16 ---------------- 3 files changed, 7 insertions(+), 17 deletions(-) create mode 100644 usr/default_cpio_list diff --git a/usr/Makefile b/usr/Makefile index 3ae8b45bfc61..9256a5b189ee 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -25,7 +25,7 @@ $(obj)/initramfs_data.o: $(obj)/$(datafile_y) FORCE hostprogs-y := gen_init_cpio ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \ - $(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d) + $(shell echo $(CONFIG_INITRAMFS_SOURCE)),$(srctree)/$(src)/default_cpio_list) ramfs-args := \ $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) diff --git a/usr/default_cpio_list b/usr/default_cpio_list new file mode 100644 index 000000000000..37b3864066e8 --- /dev/null +++ b/usr/default_cpio_list @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# This is a very simple, default initramfs + +dir /dev 0755 0 0 +nod /dev/console 0600 0 0 c 5 1 +dir /root 0700 0 0 diff --git a/usr/gen_initramfs.sh b/usr/gen_initramfs.sh index 49a4e22147b5..e6808a8c3b2b 100755 --- a/usr/gen_initramfs.sh +++ b/usr/gen_initramfs.sh @@ -28,7 +28,6 @@ $0 [-o ] [-l ] [-u ] [-g ] {-d | } ... File list or directory for cpio archive. If is a .cpio file it will be used as direct input to initramfs. - -d Output the default cpio list. All options except -o and -l may be repeated and are interpreted sequentially and immediately. -u and -g states are preserved across @@ -43,18 +42,6 @@ field() { shift $1 ; echo $1 } -default_initramfs() { - cat <<-EOF >> ${output} - # This is a very simple, default initramfs - - dir /dev 0755 0 0 - nod /dev/console 0600 0 0 c 5 1 - dir /root 0700 0 0 - # file /kinit usr/kinit/kinit 0755 0 0 - # slink /init kinit 0755 0 0 - EOF -} - filetype() { local argv1="$1" @@ -263,9 +250,6 @@ while [ $# -gt 0 ]; do [ "$root_gid" = "-1" ] && root_gid=$(id -g || echo 0) shift ;; - "-d") # display default initramfs list - default_initramfs - ;; "-h") usage exit 0 From patchwork Sat Jan 4 15:02:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317729 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0D0D6C1 for ; Sat, 4 Jan 2020 15:03:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ADB1C24653 for ; Sat, 4 Jan 2020 15:03:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578150196; bh=mBFYVnjd1D5DIZDUWHEfs3vrZZcZORNntegRlGLRIbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VPtTlmKHrHnFkTmKqhmFXkACK4Gvypv/4VkylgSzuuw8Iv3Ogy20Mt0P9erdW8nys XHH62TNdAkgAJXueKDNxxu4W4rT+OpPM8ny6NoGj8r/TFzRwaAd5245a0uEYwHEk8c FFyvnn+qQLwTofW3WX2frId9Em68+P/zG4VmKdBQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726118AbgADPDE (ORCPT ); Sat, 4 Jan 2020 10:03:04 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:53556 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726080AbgADPDC (ORCPT ); Sat, 4 Jan 2020 10:03:02 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-10.nifty.com with ESMTP id 004F2gcb018492; Sun, 5 Jan 2020 00:02:50 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 004F2gcb018492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578150170; bh=Vd/6UVoZeGWFet0wYyglEhVVlg+WMUtxzEuX+5frdFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sd0MkfPCPviYRg406S2hLQQSN6lW0MrE4rGR88MoyLxdoxpqWKHbtwXpn9O+zdrn7 Zcn+C9l99TpuGtLUPMWDVpwNFXgQYPFfpyllNxX0BAZDOKsxK8eBi8bIosXbpb1akM +ikNX3irEWdW//3aqyerxdJctrf9Hv/OvFDuugQE+TRjjNC/mJUZC3l2UHZ8mhMPOS MuIiOI+SOmsYBdn+vx5xQq3krXSD4cAYyVhPzk3hpARDytiWxXC1an3gwQ84UTN8ag NIi6NggkJLewDxHEeIc62vFdPVA/0IOKnNgyzgAfK6XirPVM60MjWFWNFUeTQjXVkA ioTZB7yiUnVcA== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 11/13] gen_initramfs.sh: always output cpio even without -o option Date: Sun, 5 Jan 2020 00:02:36 +0900 Message-Id: <20200104150238.19834-12-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200104150238.19834-1-masahiroy@kernel.org> References: <20200104150238.19834-1-masahiroy@kernel.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Currently, this script outputs a cpio file when -o option is given, but otherwise a text file in the format recognized by gen_init_cpio. This behavior is unclear. Make it always output a cpio file. Signed-off-by: Masahiro Yamada --- Changes in v2: None usr/gen_initramfs.sh | 58 +++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/usr/gen_initramfs.sh b/usr/gen_initramfs.sh index e6808a8c3b2b..1efb87bda545 100755 --- a/usr/gen_initramfs.sh +++ b/usr/gen_initramfs.sh @@ -6,7 +6,6 @@ # # Generate a cpio packed initramfs. It uses gen_init_cpio to generate # the cpio archive, and then compresses it. -# The script may also be used to generate the inputfile used for gen_init_cpio # This script assumes that gen_init_cpio is located in usr/ directory # error out on errors @@ -71,8 +70,8 @@ print_mtime() { my_mtime=$(find "$1" -printf "%T@\n" | sort -r | head -n 1) fi - echo "# Last modified: ${my_mtime}" >> ${output} - echo "" >> ${output} + echo "# Last modified: ${my_mtime}" >> $cpio_list + echo "" >> $cpio_list } list_parse() { @@ -125,7 +124,7 @@ parse() { ;; esac - echo "${str}" >> ${output} + echo "${str}" >> $cpio_list return 0 } @@ -141,7 +140,7 @@ unknown_option() { } header() { - printf "\n#####################\n# $1\n" >> ${output} + printf "\n#####################\n# $1\n" >> $cpio_list } # process one directory (incl sub-directories) @@ -177,8 +176,8 @@ input_file() { [ -n "$dep_list" ] && echo "$1" >> $dep_list return 0 fi - print_mtime "$1" >> ${output} - cat "$1" >> ${output} + print_mtime "$1" >> $cpio_list + cat "$1" >> $cpio_list if [ -n "$dep_list" ]; then echo "$1 \\" >> $dep_list cat "$1" | while read type dir file perm ; do @@ -200,9 +199,9 @@ root_uid=0 root_gid=0 dep_list= cpio_file= -cpio_list= +cpio_list=$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX) output="/dev/stdout" -output_file="" +output_file="/dev/stdout" is_cpio_compressed= compr="gzip -n -9 -f" @@ -217,8 +216,7 @@ while [ $# -gt 0 ]; do ;; "-o") # generate compressed cpio image named $1 output_file="$1" - cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)" - output=${cpio_list} + output=$cpio_list echo "$output_file" | grep -q "\.gz$" \ && [ -x "`which gzip 2> /dev/null`" ] \ && compr="gzip -n -9 -f" @@ -269,27 +267,25 @@ done # If output_file is set we will generate cpio archive and compress it # we are careful to delete tmp files -if [ ! -z ${output_file} ]; then - if [ -z ${cpio_file} ]; then - timestamp= - if test -n "$KBUILD_BUILD_TIMESTAMP"; then - timestamp="$(date -d"$KBUILD_BUILD_TIMESTAMP" +%s || :)" - if test -n "$timestamp"; then - timestamp="-t $timestamp" - fi +if [ -z ${cpio_file} ]; then + timestamp= + if test -n "$KBUILD_BUILD_TIMESTAMP"; then + timestamp="$(date -d"$KBUILD_BUILD_TIMESTAMP" +%s || :)" + if test -n "$timestamp"; then + timestamp="-t $timestamp" fi - cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)" - usr/gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile} - else - cpio_tfile=${cpio_file} - fi - rm ${cpio_list} - if [ "${is_cpio_compressed}" = "compressed" ]; then - cat ${cpio_tfile} > ${output_file} - else - (cat ${cpio_tfile} | ${compr} - > ${output_file}) \ - || (rm -f ${output_file} ; false) fi - [ -z ${cpio_file} ] && rm ${cpio_tfile} + cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)" + usr/gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile} +else + cpio_tfile=${cpio_file} +fi +rm ${cpio_list} +if [ "${is_cpio_compressed}" = "compressed" ]; then + cat ${cpio_tfile} > ${output_file} +else + (cat ${cpio_tfile} | ${compr} - > ${output_file}) \ + || (rm -f ${output_file} ; false) fi +[ -z ${cpio_file} ] && rm ${cpio_tfile} exit 0 From patchwork Sat Jan 4 15:02:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317743 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0363A6C1 for ; Sat, 4 Jan 2020 15:03:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C2F9A24650 for ; Sat, 4 Jan 2020 15:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578150235; bh=2Y3WljZ9rnypWFhiLFwN7R++E5WRJ7GLBDqk7ME5+KM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fy7AFUPB8pchScZ7fYoRlx6WAsfL2CZzcVUPlpEF+sRc/3Dsj01HhejzbQ4LxLums iA3O2eB5S0TXpH0thQC5Ad90wgwOs+l8OjcLN4yZyVmo44QYrr3WlKmZJn/d3o/8L5 G9OXmrUIyajZfIxUDQFS5ldT+NxF5VXgcRKePZSI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727036AbgADPDz (ORCPT ); Sat, 4 Jan 2020 10:03:55 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:54707 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726164AbgADPDy (ORCPT ); Sat, 4 Jan 2020 10:03:54 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-10.nifty.com with ESMTP id 004F2gcc018492; Sun, 5 Jan 2020 00:02:50 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 004F2gcc018492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578150171; bh=uOb/kJmsNjx5J7aD9SoFAKQAr0MTxGej4A365YtD1Uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x5HJJhlR+20cJHrysyYcsww5jJL+9hYCfZECsDAsSgxqlJbGfx/UiiTGFNDhAxVBF wjFqFJaKV4+NAtQi6mN5h/sKA8+67gAGl6LpP2ZHN5WAotzsztafbXN8ImstJ6ZtMg F2CK0LfsfvDUF9AIuj20jq8HrkAn0f7x1LLmoe94XPcjtxTg41cyi3pQpUus9BUli3 kn1hEtS/i2eCA297St26aAZwlXCcVTXsvncyfs5ZY2oZwZZZYoJqWhjeX2US1Qp0/5 bwyn827AYi6lRyHm/gpouz4iq+xdh+tcMr5TvI/bMcvu75Rhso4c5btwlfcrN+y5b4 aXtQorxl8vm/A== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Andrew Morton , Greg Thelen , Mauro Carvalho Chehab , Sam Ravnborg , linux-kernel@vger.kernel.org Subject: [PATCH v2 12/13] initramfs: refactor the initramfs build rules Date: Sun, 5 Jan 2020 00:02:37 +0900 Message-Id: <20200104150238.19834-13-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200104150238.19834-1-masahiroy@kernel.org> References: <20200104150238.19834-1-masahiroy@kernel.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Currently, usr/gen_initramfs.sh takes care of all the use-cases: [1] generates a cpio file unless CONFIG_INITRAMFS_SOURCE points to a single cpio archive [2] If CONFIG_INITRAMFS_SOURCE is the path to a cpio archive, use it as-is. [3] Compress the cpio file according to CONFIG_INITRAMFS_COMPRESSION_* unless it is passed a compressed archive. To simplify the script, move [2] and [3] to usr/Makefile. If CONFIG_INITRAMFS_SOURCE is the path to a cpio archive, there is no need to run this shell script. For the cpio archive compression, you can re-use the rules from scripts/Makefile.lib . Signed-off-by: Masahiro Yamada --- Changes in v2: - improve the comments so that they match to the code - use $(strip ...) instead of $(words ...) for the case CONFIG_INITRAMFS_SOURCE is empty usr/.gitignore | 8 +--- usr/Kconfig | 10 ----- usr/Makefile | 89 +++++++++++++++++++++++++++++--------------- usr/gen_initramfs.sh | 77 ++++++++------------------------------ usr/initramfs_data.S | 5 +-- 5 files changed, 78 insertions(+), 111 deletions(-) diff --git a/usr/.gitignore b/usr/.gitignore index be5eae1df7eb..610de736b75e 100644 --- a/usr/.gitignore +++ b/usr/.gitignore @@ -1,9 +1,3 @@ -# -# Generated files -# gen_init_cpio initramfs_data.cpio -initramfs_data.cpio.gz -initramfs_data.cpio.bz2 -initramfs_data.cpio.lzma -initramfs_list +/initramfs_inc_data diff --git a/usr/Kconfig b/usr/Kconfig index ab61e81165e0..529caab1a328 100644 --- a/usr/Kconfig +++ b/usr/Kconfig @@ -207,13 +207,3 @@ config INITRAMFS_COMPRESSION_LZ4 by default which could cause a build failure. endchoice - -config INITRAMFS_COMPRESSION - string - default "" if INITRAMFS_COMPRESSION_NONE - default ".gz" if INITRAMFS_COMPRESSION_GZIP - default ".bz2" if INITRAMFS_COMPRESSION_BZIP2 - default ".lzma" if INITRAMFS_COMPRESSION_LZMA - default ".xz" if INITRAMFS_COMPRESSION_XZ - default ".lzo" if INITRAMFS_COMPRESSION_LZO - default ".lz4" if INITRAMFS_COMPRESSION_LZ4 diff --git a/usr/Makefile b/usr/Makefile index 9256a5b189ee..e03753888ad4 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -3,55 +3,86 @@ # kbuild file for usr/ - including initramfs image # -suffix_y = $(subst $\",,$(CONFIG_INITRAMFS_COMPRESSION)) -datafile_y = initramfs_data.cpio$(suffix_y) -datafile_d_y = .$(datafile_y).d -AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/$(datafile_y)" +# cmd_bzip2, cmd_lzma, cmd_lzo, cmd_lz4 from scripts/Makefile.lib appends the +# size at the end of the compressed file, which unfortunately does not work +# with unpack_to_rootfs(). Make size_append no-op. +override size_append := : -# clean rules do not have CONFIG_INITRAMFS_COMPRESSION. So clean up after all -# possible compression formats. -clean-files += initramfs_data.cpio* +compress-$(CONFIG_INITRAMFS_COMPRESSION_NONE) := shipped +compress-$(CONFIG_INITRAMFS_COMPRESSION_GZIP) := gzip +compress-$(CONFIG_INITRAMFS_COMPRESSION_BZIP2) := bzip2 +compress-$(CONFIG_INITRAMFS_COMPRESSION_LZMA) := lzma +compress-$(CONFIG_INITRAMFS_COMPRESSION_XZ) := xzmisc +compress-$(CONFIG_INITRAMFS_COMPRESSION_LZO) := lzo +compress-$(CONFIG_INITRAMFS_COMPRESSION_LZ4) := lz4 -# Generate builtin.o based on initramfs_data.o obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o -# initramfs_data.o contains the compressed initramfs_data.cpio image. -# The image is included using .incbin, a dependency which is not -# tracked automatically. -$(obj)/initramfs_data.o: $(obj)/$(datafile_y) FORCE +$(obj)/initramfs_data.o: $(obj)/initramfs_inc_data -##### -# Generate the initramfs cpio archive +ramfs-input := $(strip $(shell echo $(CONFIG_INITRAMFS_SOURCE))) +cpio-data := + +# If CONFIG_INITRAMFS_SOURCE is empty, generate a small initramfs with the +# default contents. +ifeq ($(ramfs-input),) +ramfs-input := $(srctree)/$(src)/default_cpio_list +endif + +ifeq ($(words $(ramfs-input)),1) + +# If CONFIG_INITRAMFS_SOURCE specifies a single file, and it is suffixed with +# .cpio, use it directly as an initramfs. +ifneq ($(filter %.cpio,$(ramfs-input)),) +cpio-data := $(ramfs-input) +endif + +# If CONFIG_INITRAMFS_SOURCE specifies a single file, and it is suffixed with +# .cpio.*, use it directly as an initramfs, and avoid double compression. +ifeq ($(words $(subst .cpio.,$(space),$(ramfs-input))),2) +cpio-data := $(ramfs-input) +compress-y := shipped +endif + +endif + +# For other cases, generate the initramfs cpio archive based on the contents +# specified by CONFIG_INITRAMFS_SOURCE. +ifeq ($(cpio-data),) + +cpio-data := $(obj)/initramfs_data.cpio hostprogs-y := gen_init_cpio -ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \ - $(shell echo $(CONFIG_INITRAMFS_SOURCE)),$(srctree)/$(src)/default_cpio_list) -ramfs-args := \ - $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ - $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) -# $(datafile_d_y) is used to identify all files included +# .initramfs_data.cpio.d is used to identify all files included # in initramfs and to detect if any files are added/removed. # Removed files are identified by directory timestamp being updated # The dependency list is generated by gen_initramfs.sh -l -ifneq ($(wildcard $(obj)/$(datafile_d_y)),) - include $(obj)/$(datafile_d_y) -endif - -quiet_cmd_initfs = GEN $@ - cmd_initfs = $< -o $@ -l $(obj)/$(datafile_d_y) $(ramfs-args) $(ramfs-input) - -targets := $(datafile_y) +-include $(obj)/.initramfs_data.cpio.d # do not try to update files included in initramfs $(deps_initramfs): ; +quiet_cmd_initfs = GEN $@ + cmd_initfs = \ + $< -o $@ -l $(obj)/.initramfs_data.cpio.d \ + $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ + $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) \ + $(ramfs-input) + # We rebuild initramfs_data.cpio if: # 1) Any included file is newer than initramfs_data.cpio # 2) There are changes in which files are included (added or deleted) # 3) If gen_init_cpio are newer than initramfs_data.cpio # 4) Arguments to gen_initramfs.sh changes -$(obj)/$(datafile_y): $(src)/gen_initramfs.sh $(obj)/gen_init_cpio $(deps_initramfs) FORCE +$(obj)/initramfs_data.cpio: $(src)/gen_initramfs.sh $(obj)/gen_init_cpio $(deps_initramfs) FORCE $(call if_changed,initfs) +endif + +$(obj)/initramfs_inc_data: $(cpio-data) FORCE + $(call if_changed,$(compress-y)) + +targets += initramfs_data.cpio initramfs_inc_data + subdir-$(CONFIG_UAPI_HEADER_TEST) += include diff --git a/usr/gen_initramfs.sh b/usr/gen_initramfs.sh index 1efb87bda545..4e6715f8ff7f 100755 --- a/usr/gen_initramfs.sh +++ b/usr/gen_initramfs.sh @@ -5,7 +5,7 @@ # Released under the terms of the GNU GPL # # Generate a cpio packed initramfs. It uses gen_init_cpio to generate -# the cpio archive, and then compresses it. +# the cpio archive. # This script assumes that gen_init_cpio is located in usr/ directory # error out on errors @@ -15,8 +15,7 @@ usage() { cat << EOF Usage: $0 [-o ] [-l ] [-u ] [-g ] {-d | } ... - -o Create compressed initramfs file named using - gen_init_cpio and compressor depending on the extension + -o Create initramfs file named by using gen_init_cpio -l Create dependency list named -u User ID to map to user ID 0 (root). is only meaningful if is a @@ -162,20 +161,12 @@ dir_filelist() { fi } -# if only one file is specified and it is .cpio file then use it direct as fs -# if a directory is specified then add all files in given direcotry to fs -# if a regular file is specified assume it is in gen_init_cpio format input_file() { source="$1" if [ -f "$1" ]; then + # If a regular file is specified, assume it is in + # gen_init_cpio format header "$1" - is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\{0,1\}/cpio/')" - if [ $2 -eq 0 -a ${is_cpio} = "cpio" ]; then - cpio_file=$1 - echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed" - [ -n "$dep_list" ] && echo "$1" >> $dep_list - return 0 - fi print_mtime "$1" >> $cpio_list cat "$1" >> $cpio_list if [ -n "$dep_list" ]; then @@ -187,6 +178,7 @@ input_file() { done fi elif [ -d "$1" ]; then + # If a directory is specified then add all files in it to fs dir_filelist "$1" else echo " ${prog}: Cannot open '$1'" >&2 @@ -198,12 +190,8 @@ prog=$0 root_uid=0 root_gid=0 dep_list= -cpio_file= cpio_list=$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX) output="/dev/stdout" -output_file="/dev/stdout" -is_cpio_compressed= -compr="gzip -n -9 -f" while [ $# -gt 0 ]; do arg="$1" @@ -214,28 +202,8 @@ while [ $# -gt 0 ]; do echo "deps_initramfs := \\" > $dep_list shift ;; - "-o") # generate compressed cpio image named $1 - output_file="$1" - output=$cpio_list - echo "$output_file" | grep -q "\.gz$" \ - && [ -x "`which gzip 2> /dev/null`" ] \ - && compr="gzip -n -9 -f" - echo "$output_file" | grep -q "\.bz2$" \ - && [ -x "`which bzip2 2> /dev/null`" ] \ - && compr="bzip2 -9 -f" - echo "$output_file" | grep -q "\.lzma$" \ - && [ -x "`which lzma 2> /dev/null`" ] \ - && compr="lzma -9 -f" - echo "$output_file" | grep -q "\.xz$" \ - && [ -x "`which xz 2> /dev/null`" ] \ - && compr="xz --check=crc32 --lzma2=dict=1MiB" - echo "$output_file" | grep -q "\.lzo$" \ - && [ -x "`which lzop 2> /dev/null`" ] \ - && compr="lzop -9 -f" - echo "$output_file" | grep -q "\.lz4$" \ - && [ -x "`which lz4 2> /dev/null`" ] \ - && compr="lz4 -l -9 -f" - echo "$output_file" | grep -q "\.cpio$" && compr="cat" + "-o") # generate cpio image named $1 + output="$1" shift ;; "-u") # map $1 to uid=0 (root) @@ -258,34 +226,21 @@ while [ $# -gt 0 ]; do unknown_option ;; *) # input file/dir - process it - input_file "$arg" "$#" + input_file "$arg" ;; esac ;; esac done -# If output_file is set we will generate cpio archive and compress it +# If output_file is set we will generate cpio archive # we are careful to delete tmp files -if [ -z ${cpio_file} ]; then - timestamp= - if test -n "$KBUILD_BUILD_TIMESTAMP"; then - timestamp="$(date -d"$KBUILD_BUILD_TIMESTAMP" +%s || :)" - if test -n "$timestamp"; then - timestamp="-t $timestamp" - fi +timestamp= +if test -n "$KBUILD_BUILD_TIMESTAMP"; then + timestamp="$(date -d"$KBUILD_BUILD_TIMESTAMP" +%s || :)" + if test -n "$timestamp"; then + timestamp="-t $timestamp" fi - cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)" - usr/gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile} -else - cpio_tfile=${cpio_file} -fi -rm ${cpio_list} -if [ "${is_cpio_compressed}" = "compressed" ]; then - cat ${cpio_tfile} > ${output_file} -else - (cat ${cpio_tfile} | ${compr} - > ${output_file}) \ - || (rm -f ${output_file} ; false) fi -[ -z ${cpio_file} ] && rm ${cpio_tfile} -exit 0 +usr/gen_init_cpio $timestamp $cpio_list > $output +rm $cpio_list diff --git a/usr/initramfs_data.S b/usr/initramfs_data.S index d07648f05bbf..cd67edc38797 100644 --- a/usr/initramfs_data.S +++ b/usr/initramfs_data.S @@ -22,12 +22,9 @@ in the ELF header, as required by certain architectures. */ -#include -#include - .section .init.ramfs,"a" __irf_start: -.incbin __stringify(INITRAMFS_IMAGE) +.incbin "usr/initramfs_inc_data" __irf_end: .section .init.ramfs.info,"a" .globl __initramfs_size From patchwork Sat Jan 4 15:02:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317731 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0F57717F0 for ; Sat, 4 Jan 2020 15:03:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D996E24653 for ; Sat, 4 Jan 2020 15:03:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578150197; bh=fbgrMFaMcbpL+i9255Fsshaarkuf/yVk7nGhjDYyY7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CriI9wNMKBtVdCorxMBR/D3z+r+zXB6mVqxJkAlGgHKxoeOzNnhp+m23aG9JKnGpP jkhIw8aoJ/GPj5LjBe7fCehW+5H7PFOBfwZaAOY3/2LSfKsRG4F03llo/pCBzpT8Qf vxkTNQwsMsGTu1GTJhGKq5zuo57wWulE4hGcfPHc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726383AbgADPDI (ORCPT ); Sat, 4 Jan 2020 10:03:08 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:53554 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726101AbgADPDB (ORCPT ); Sat, 4 Jan 2020 10:03:01 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-10.nifty.com with ESMTP id 004F2gcd018492; Sun, 5 Jan 2020 00:02:51 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 004F2gcd018492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578150171; bh=JfnzzywVLoWBKXE/hU2AKnpwcjYAKABwHzUqlzgAHZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C3hOgILUe9n97Iu8UcWF4jCwx4G434D3SRgnKCrSZP3SyEXOMRYsBQBiYsW9JU/Qf 6Y6w45AmJpOFnPuXgN8lbKfd6HVDqQ2XFY5VBOAVRKJDH3kqsVc2xMYHc4r5N0qu8/ EEmKsASetC/NnEAPdMNmpnlDN71Bjc/H3LI3/Et/4SqCnoEq1Tr3JldVPKupFWbozX S19Le3fHgX1jQ/LYAsdVfUhF18ETD+L8a1zpKu5eDE2o3Dy+9Po5oa3+i7eSsH/k6A UWurkxacpFw1zGZ/v34FAjp+haBtvAfkgsx4wn/fKXYOt4JFEpTn6llKaOf8sM61Ol vZkK43n0UgNSQ== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 13/13] gen_initramfs.sh: remove intermediate cpio_list on errors Date: Sun, 5 Jan 2020 00:02:38 +0900 Message-Id: <20200104150238.19834-14-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200104150238.19834-1-masahiroy@kernel.org> References: <20200104150238.19834-1-masahiroy@kernel.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org This script sets the -e option, so it exits on any error, in which case it exits without cleaning up the intermediate cpio_list. Make sure to delete it on exit. Signed-off-by: Masahiro Yamada --- Changes in v2: None usr/gen_initramfs.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr/gen_initramfs.sh b/usr/gen_initramfs.sh index 4e6715f8ff7f..8ae831657e5d 100755 --- a/usr/gen_initramfs.sh +++ b/usr/gen_initramfs.sh @@ -193,6 +193,8 @@ dep_list= cpio_list=$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX) output="/dev/stdout" +trap "rm -f $cpio_list" EXIT + while [ $# -gt 0 ]; do arg="$1" shift @@ -243,4 +245,3 @@ if test -n "$KBUILD_BUILD_TIMESTAMP"; then fi fi usr/gen_init_cpio $timestamp $cpio_list > $output -rm $cpio_list