From patchwork Fri Jan 3 17:59:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317263 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 E114B138C for ; Fri, 3 Jan 2020 18:00:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C168E24649 for ; Fri, 3 Jan 2020 18:00:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578074407; bh=ozrucs3hXuheQjEorq11WIXtn1trwo+RaflQS7bqMmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sluSrssSiTfEDcZxWWG1jxqR3W6lrySWZt0tw9yqAhhV2q5XPA/qu+BT6NLIX5hG5 dxgkSPNSdemykoYniscYTmYP6bs8/CHRsMF3lTQpqsvjTzaL+HTBGynqu/m18MIwt7 eu9RNmjvOV+Al/L1ug7haRgOotnsm7SNOeajaVyM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728362AbgACR77 (ORCPT ); Fri, 3 Jan 2020 12:59:59 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:64711 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728110AbgACR7j (ORCPT ); Fri, 3 Jan 2020 12:59:39 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-07.nifty.com with ESMTP id 003HxSJ2022724; Sat, 4 Jan 2020 02:59:29 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 003HxSJ2022724 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578074369; bh=zoAmWBfqVWksao6CrQDMXgz0tVFyw9MhTptiTkdSm+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wcAhjkbI3zZJMz8+G6QH/1O3pTb1EfIxNiVR/4arYaJ4K6iKS1I6uymllQj2Dfh5w 9PahHjR6X4DFFMuep4BpFHvc/nLvUqS2yDYKLfGO/qQ9lhLyNQLcpl2Df24wPw+w1q BY92IjDSRHY4tdUnfWHvBL295m822KdBG9nsC+MXMoMJuuEcQDx+FPum+cPlNzv/Do VIdI6LEKaNDlKCaQzu3JcP8S5Ah1gnIXn/5h9OUjok6mRFctgPO/Qj2kuxgQVmdnJQ t9/ntZH1E03wVqrXeZeSRP46KcoYxyAVVR9bn7LWuNGWWsbJlkjlyBhixORJWSRk33 wvI//duEbgMOA== 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 01/12] gen_initramfs_list.sh: remove unused variable 'default_list' Date: Sat, 4 Jan 2020 02:59:04 +0900 Message-Id: <20200103175915.26663-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200103175915.26663-1-masahiroy@kernel.org> References: <20200103175915.26663-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 --- 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 Fri Jan 3 17:59:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317261 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 137EB138C for ; Fri, 3 Jan 2020 18:00:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E6BB724649 for ; Fri, 3 Jan 2020 18:00:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578074407; bh=Ym4Usi6TztsoaTLXjFOCvD6wElY8Ymhye9J13tAqGqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=bSgG1/SWYHjgr8y4Z8AiOnYqHVY9OEjC+wYj2EGN8D1ARor6E62ytn2RQdOCnul6g xmAwH8n3udJ6cbrSw1iDA5QaQq5csL/Po+79nyaBN3+O7+zaINnVFVTa5fWzlu33mr k1NPME30G9NgX5AhcgSLJi8qSaKwfAgxcUp5vhkc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728370AbgACSAA (ORCPT ); Fri, 3 Jan 2020 13:00:00 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:64708 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728218AbgACR7j (ORCPT ); Fri, 3 Jan 2020 12:59:39 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-07.nifty.com with ESMTP id 003HxSJ3022724; Sat, 4 Jan 2020 02:59:29 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 003HxSJ3022724 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578074370; bh=GRGGfCfoQ/0hyOTt3wty73oXtffQ+8+tIJPvI8S8JZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bcezmG3abfJr6Y/Wu2vaPSno2Wovm0MI5BKGf+iR8g4VTlkk6jsbO8wpcacrF99Q4 KtJOVRN7nJkV8l1VGfXN5UfRrMUOl7hY6mB7tuXX3YpDrakJoaLvwit/0Ych6HOx8L o1oMuw2iiWDq6BmQ3jkCf+Wf0Oo/7mplCbYlUxMKP+VLW8KRYfv7bRxCxrN+pXUT8N T7lB2Ju3Ccr8vJluVLAImg9g3m1Co6NJl+1g30+ltsZs+kFanAHjUp9IpIyxou8CXY Ei+3hbhPLUGXegCcfwSddUyAgTz/ndr9OjIMRrG5EDOmQNbt9Eh0XgRRwVGZ0wjLmr RpqGxxePtuh4A== 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 02/12] gen_initramfs_list.sh: fix the tool name in the comment Date: Sat, 4 Jan 2020 02:59:05 +0900 Message-Id: <20200103175915.26663-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200103175915.26663-1-masahiroy@kernel.org> References: <20200103175915.26663-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 --- 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 Fri Jan 3 17:59:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317277 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 6506B138C for ; Fri, 3 Jan 2020 18:00:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 450F522B48 for ; Fri, 3 Jan 2020 18:00:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578074458; bh=vRXpqGjbCzUYmYIDpduowAJZHbZP9laXLZYm9bHfsZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gf1drPl9x/COnpHapEHv5hh5vKxn2VZg81DouhpsDImIp56e9IlvXeu/n/1f5tLdA gOK0midI7tGqbYB0/bLdIn61u6S8joPjg1OpdEo1ID18pkfnk2GXptftZtoO0DsFEx 1vmebGRre2Zi+paOulXhov8NNCIJarQibr9S8h9s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728400AbgACSAh (ORCPT ); Fri, 3 Jan 2020 13:00:37 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:16472 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728204AbgACSAh (ORCPT ); Fri, 3 Jan 2020 13:00:37 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-07.nifty.com with ESMTP id 003HxSJ4022724; Sat, 4 Jan 2020 02:59:30 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 003HxSJ4022724 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578074370; bh=zbfOeyYJKpEXpX8cm6nJcngXr1YLvlt8Dm3gdwkJxjE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cyOIXMs5QY7UNGYM9+hl9EdBtQ2Mu2ctgb1TQjB1Qf5AA1oJVpn1n5p/q/bGnpjNb 2u49ODiQ1plKqizMEiQZCTCYkFbpF23wKGVHAgVcVxvAphgeTZzFIqi0VXW1La2EGM WUtwsgxOhLohbzxk7BGo5ZQT34SRwxRZEnC4YpDDioCdu+ksPE58Asdvw7qTBbpo/Q YQC2B2h3+Ql4pVcRiM/pjWLTOE7WwSsZUMaOt+ugYTDKFbbc2nVqcLkiuh3rQ47Glc OslUPsDVscyGKLuTTx2Z6LFHyj/Az0MUjL7tt8neM6yaK2s2yBTFxouO8a01LR4gqV nwNRbPIxxEQsw== 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 03/12] initramfs: rename gen_initramfs_list.sh to gen_initramfs.sh Date: Sat, 4 Jan 2020 02:59:06 +0900 Message-Id: <20200103175915.26663-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200103175915.26663-1-masahiroy@kernel.org> References: <20200103175915.26663-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 --- 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 Fri Jan 3 17:59:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317253 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 2F3261398 for ; Fri, 3 Jan 2020 17:59:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0EBC12253D for ; Fri, 3 Jan 2020 17:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578074391; bh=3O2oQvSBk+7BR0ZGuvlpb/SpotQyclTbejUPgtbX2xU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=q83CWZ/4fRRCZK6O8gvZchfMm/wAoYjceWsraRhdNaI4e+KfIMT2GAHBdmLVVOtYG q/ay7smk3+5GbOQF0CqbAeQQ6rPLHnrSOEyhWWJCZThDPCD+VYDNVozNBgann1OFM1 8MlVe0dn2GASdJtsh7dSLcrE5VstDmxwR0zRlMDw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728301AbgACR7o (ORCPT ); Fri, 3 Jan 2020 12:59:44 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:64714 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728183AbgACR7k (ORCPT ); Fri, 3 Jan 2020 12:59:40 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-07.nifty.com with ESMTP id 003HxSJ5022724; Sat, 4 Jan 2020 02:59:31 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 003HxSJ5022724 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578074371; bh=bHwr5zrMPtwj0Xjsz5tjllHBAG13FvggunbN5z1QbKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xd/MEXm8ioLojnsWB0ebtrQHArl9nr90m/Yi8CIVTgSI6GevZDIlVrzJ0YDnLFSXK vzQPuSJo/9vZkt+AAWIfRmGTcWlrZ3/aUd4Lh00uYJ897EdcWtAOlCT/UJqHipc5kE Cg1gxT5K+iQ1Hu3AFT6mCOPOJJ1IPl8p02wd4q48TL1ZfzDr/gbEz58nDBlO7i4m8b AeDeycIgEaQFrHxMZZbaFs/k2kfhtpJ4wSh4oTQDakeTLZaodxGW8X8H/+Jj//QRxj dvs4p6vRXeaF0b+M5TeT8O2ecxNcQ6Z6XzIjkM36QQL94nTi7F4J+4UdHXA5o50oum tXYgy5GwD0ddA== 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 04/12] initramfs: remove redundant dependency on BLK_DEV_INITRD Date: Sat, 4 Jan 2020 02:59:07 +0900 Message-Id: <20200103175915.26663-5-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200103175915.26663-1-masahiroy@kernel.org> References: <20200103175915.26663-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 --- 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 Fri Jan 3 17:59:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317251 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 26AC41398 for ; Fri, 3 Jan 2020 17:59:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 064B4215A4 for ; Fri, 3 Jan 2020 17:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578074384; bh=xn1Q54HWkOB4uBFT5MNOts3FC211CUhekLUk48JFLB0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=EtSSQzO/+wiBZb+7JY8gQS0xmGKhec9goZn/hg97tDwvPc7eXNcaUTOHLkbhqhAjg yIbZZAs9x2bGdnM2vlohl6528nPz4SSqCA+rg9cn93xs1ACMhZc1CGdZmEoxDKmdD7 51nB1ZMjGMwXujvmqWvei5qEPOBNJ3+0c8AdDMK0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728272AbgACR7k (ORCPT ); Fri, 3 Jan 2020 12:59:40 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:64713 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728220AbgACR7j (ORCPT ); Fri, 3 Jan 2020 12:59:39 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-07.nifty.com with ESMTP id 003HxSJ6022724; Sat, 4 Jan 2020 02:59:31 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 003HxSJ6022724 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578074371; bh=bJfY9P/JRKRZL7zus1oisBlsP9ihX0EmmC9HMpfIWSM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PTu8eM5NHXVqrx5W1k/BibTYQ0P4tMRWzZvHSbFNWXpZ6kxxVnWK1xBvz7QzgdNkj jDEC15QKl6bSHyX9S/qbDMKQ9ixMvaRO4yDrrLjWpATl2X3otG12gWzxnaVm13Lk5k 8wAb0w1g7417BhkzYSbCy5Asxp81gug3naTYzYd4ssC/fIDJVQArVqxGWOXdL9hqyW +AT3N66EgAhgBLOgA1Hh61TVWhaULFXPwYsLg5mmktpEhjCN8WlMOKNzv8+Pv2SE17 RHn5RY/50mGN38cVNVDeaL6gjyH4lYrrmlyhMhHgGdWYJrzIJ29mBY3GWdICteylKk sncjN4GY//lUw== 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 05/12] initramfs: make compression options not depend on INITRAMFS_SOURCE Date: Sat, 4 Jan 2020 02:59:08 +0900 Message-Id: <20200103175915.26663-6-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200103175915.26663-1-masahiroy@kernel.org> References: <20200103175915.26663-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 --- 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 Fri Jan 3 17:59:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317249 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 D1B0E109A for ; Fri, 3 Jan 2020 17:59:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B20E92253D for ; Fri, 3 Jan 2020 17:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578074379; bh=LcYp5NO69Jc/FcWqAZdjBFn7cck1DEbCrKPis24czsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hVP2JZaeLRhd+6DwhwqOuAVA3Kc3eNhrOdeOinhTGsaxHpw56cwr12787Adn2t2Zn Tu2/kh6oUvGNRwtR6D4th69N4DC7YxPL8pqJNVG/BCaFF6SBBs3avKdydcjsEBpgye /1j/tGhIniNi8QC/vQTRy3CKJ3foRWsuUd08YvF0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728225AbgACR7j (ORCPT ); Fri, 3 Jan 2020 12:59:39 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:64712 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728215AbgACR7j (ORCPT ); Fri, 3 Jan 2020 12:59:39 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-07.nifty.com with ESMTP id 003HxSJ7022724; Sat, 4 Jan 2020 02:59:32 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 003HxSJ7022724 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578074372; bh=lCI2C0HKijtxw/L++AnPUMRqL4ioNQYvaRVeKU0+Ujc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OKs8HuJLubLRXqwBVJ+RXENL44jC8tBQJKPXnBMbawLw5KCofF4mUkwDEX6BOFaYE Acy0/RygIoA8MKHLmuW/CVrLlmcpbEBFuz5t+wvwtiwQfRMe1kbN/0sgBwJWR0s7Ph F8wVoOd/s6SlZs/kSXV1PTK60u/AUtf028PX9gJH/g5SU3B3RRyJiz1XUFQ3zrnjwH t+WnN0mDnDInSEUwld+H8CUH0/i8UDNqlFsNzecP9djcJKS+MmAxnigNI+1kiSOWyB yI8GxfdAW+sQ2zHk/YBXZLGgNLjxOkdUF1nupAVHF+mcoqGIAs/v4rKmocBQmmcPFR jB1z16i6Jyv1Q== 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 06/12] initramfs: make initramfs compression choice non-optional Date: Sat, 4 Jan 2020 02:59:09 +0900 Message-Id: <20200103175915.26663-7-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200103175915.26663-1-masahiroy@kernel.org> References: <20200103175915.26663-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 --- 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 Fri Jan 3 17:59:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317265 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 35B611398 for ; Fri, 3 Jan 2020 18:00:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 15490215A4 for ; Fri, 3 Jan 2020 18:00:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578074438; bh=6wRmEExRarJkLmBrIOi8mE+v+7mDbntHaGXjK7T8WRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=JnT9/RUvLOX5Ut8POMSUwJYTQynS1EsmF1OG+ABQ6gttjnuFwKtO0l3gtRdz31iUf Tm6UOPx1d9H7FkEqORAb20nK5xTRBAf6VPVHQC0lbwh87+aUW6pfH4ifMPkbUlJJg1 pQRC7RycCGFAKR293EPbIRg4AK80kMhoKzq6iE8o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728344AbgACSAh (ORCPT ); Fri, 3 Jan 2020 13:00:37 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:16476 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728196AbgACSAh (ORCPT ); Fri, 3 Jan 2020 13:00:37 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-07.nifty.com with ESMTP id 003HxSJ8022724; Sat, 4 Jan 2020 02:59:32 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 003HxSJ8022724 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578074373; bh=aVtB2Rv+NyX9qUbly4Qthna7cERKkW7+WHgodTXdBR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uGR92y+s2WkTTOI5sPh83az0Pv8eNaKr3/FY3MzlnUHM3GyWhLGVymfumcmWHutEb DIIQmQ42KKDIChA0Q3BJU9W9BTBs4j+WQa0MpVbVSpjNGvv7zOEJzZzBWAy8guYuWa 12N3j0iEnj1EyVA67fxsdJaQtO/EfaBoAks3rRk/6c++E7Gko+3Bbht6rn2JZJlU5l arU/fslYNYGotbQdTKO4DPdSsfcz+w3tf/COA/uItVbA/GjaNOKEPPE6LiJr1YgJI6 +GBMf0V2bbd3BylEPA+BnBT+8OmYRKvupGHUD1hp9rz5rizcKdPy2NGRfUFBExyaEz MI5W0U4ZwjMmw== 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 07/12] initramfs: specify $(src)/gen_initramfs.sh as a prerequisite in Makefile Date: Sat, 4 Jan 2020 02:59:10 +0900 Message-Id: <20200103175915.26663-8-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200103175915.26663-1-masahiroy@kernel.org> References: <20200103175915.26663-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 --- 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 Fri Jan 3 17:59:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317269 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 E6A03138C for ; Fri, 3 Jan 2020 18:00:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD11D2253D for ; Fri, 3 Jan 2020 18:00:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578074446; bh=2HjaLUduFBSJ5hz1guV5z5SZi4zmbzwWOPaQqgvOS0w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uSX7oWJau7ZZU3xkfwoZeb9BgcCUmFqVmFIivlFP84cnPDSAmIIiJaRuO2smjwRG9 5n4CwtUa85r3LYsMl8CHM5TT4Q8shtL2e7vU3RZUSIspE3kUuXlRsLSeWejxsRXDCY l5c2r+YftToHBVS5fydh8wucY45Y3Z/LCIzvXtHE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728417AbgACSAi (ORCPT ); Fri, 3 Jan 2020 13:00:38 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:16475 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728218AbgACSAi (ORCPT ); Fri, 3 Jan 2020 13:00:38 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-07.nifty.com with ESMTP id 003HxSJ9022724; Sat, 4 Jan 2020 02:59:33 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 003HxSJ9022724 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578074373; bh=MBmHV2xb8S5ncyo4FHxT28EH/0BPBlVbQ3cUU9l9rsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PPpXtuA9FFiHxw8mGhI9/Z6mjyyatPIma8H2WPyfAd3BFQp+XR0M/t9jzLyHpGIZB 9eemzq3j28MWOUQWvyc1HVAU568Xs9BRWS++gQ6Ep5/jgv8bXu9cO27QWzQAcCcChm FfS6dMJxwWk6pK1XBaDg57ichgwTUYWT/2V7EwZCUPeW4PyoPQ9+zMe+U2MYYznWZt ACaKWG7cu9aJET8SMXamSVobLJJ7ekBDf3maYGLAkL3WrYQGW/VblEyUHIQK9r3Ejd Cnj5Hl3TRP5LxTiloV7Bag/y/lT/uI7VJAoTiNjuf8gQ3TPRay4Bw94ZvzefuqEqvb vGomppjyhEsOg== 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 08/12] initramfs: generate dependency list and cpio at the same time Date: Sat, 4 Jan 2020 02:59:11 +0900 Message-Id: <20200103175915.26663-9-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200103175915.26663-1-masahiroy@kernel.org> References: <20200103175915.26663-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 --- 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 Fri Jan 3 17:59:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317275 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 7637614B4 for ; Fri, 3 Jan 2020 18:00:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5672E2253D for ; Fri, 3 Jan 2020 18:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578074452; bh=i8WArktP0tpXooYzxRJlDmVKKgB23oje8R2LPTwin5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QI3fTHlcyxbCWi/D9zyRAfyOpTvA7y5XJqpNBL7LmfFuO6J3UYmMfsilrAtaOQEWo BJ5DElCCarBnUw3oCXspcDqZOS+6JXtY6A2rHgDiJQSu+FPySN2lSaFEbM/NIY+RDW /warFsShAx8wV4etyMU3b41HdSpcienijxKUTJjI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728291AbgACSAv (ORCPT ); Fri, 3 Jan 2020 13:00:51 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:16481 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728268AbgACSAi (ORCPT ); Fri, 3 Jan 2020 13:00:38 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-07.nifty.com with ESMTP id 003HxSJA022724; Sat, 4 Jan 2020 02:59:34 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 003HxSJA022724 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578074374; bh=flhc+DXSbGVbPkljWVMNT8R6yI5s96NQRo/2c6fDjQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nCJ1ZnVklvR8HI7xSyBYN2JrInwTEMaZbdLUEIELQatENREBUm/PHgNtRHuTbTbUa fW7jdb3T+kUganCSAbaV7cQsYxaz114BF6v5LRabpeQgq+FHa+N+2TQZU4+D8HNMrL /WOXkKfBiBILEVSS4hkUim9bMVxjKQ8y1j4Gv1D1HDP2MwSI3jqgzU2waGu4wa79vP 4WZ+rrJmWc/pBBymDe4e28ElKJEGuCJlcYuJJJ/9Klix/xsO9KkezlMYSKsMdmcQ1n w0DaBSdGolww/2MKWv3yy8InaB740hko2WxwKq1RTnIamR1Iet+pFqc36ZZa+aV8RE 35zBYJaTHvUAg== 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 09/12] initramfs: add default_cpio_list, and delete -d option support Date: Sat, 4 Jan 2020 02:59:12 +0900 Message-Id: <20200103175915.26663-10-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200103175915.26663-1-masahiroy@kernel.org> References: <20200103175915.26663-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 simplify the default behavior; remove the -d option, and add the default cpio list. Signed-off-by: Masahiro Yamada --- 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 Fri Jan 3 17:59:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317255 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 9E56D109A for ; Fri, 3 Jan 2020 17:59:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E78922522 for ; Fri, 3 Jan 2020 17:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578074391; bh=9kwzpWOP+dbx21kVOlNozlOPHBOk6wAtzDv+U09dF7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vrZ9BbMMI177NQEhstbI5Dia2QdWzDDqDCGKRoAmF8Ja35+zpWQorddqNWojo6Ux6 96UwijW0h/90eLvQuCm8Cw5FugHf3aCObuuF+Tk3HrdWjCN5scAlWtVciDP0+oEv3k ux8Ly2HHa1uj0SjzIW4tapquU0p9yyELuK4Khbac= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728299AbgACR7n (ORCPT ); Fri, 3 Jan 2020 12:59:43 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:64707 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728223AbgACR7k (ORCPT ); Fri, 3 Jan 2020 12:59:40 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-07.nifty.com with ESMTP id 003HxSJB022724; Sat, 4 Jan 2020 02:59:34 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 003HxSJB022724 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578074374; bh=IixOZfomVhBc53dTdWlB8Lij+8LbaLBdC9mPIGrpvkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0gVEWqJ5DZXHLuErJd43XABaQ/TvJCjwjAmVRPl1WWoWODwGI/aZKM1hY7gQ/cNHv NF+UGMjSn8IJRQFHpZp+PnRYC0wUvKOOGTmVlbubFZPs7RYqi0wzwgqmEXo8klzz1o a3YO5J1cul0dONVb3IZEnjm7bLVI0YSYru0HBzTQWHNBfnvxUO22XtubxwWVLAiDKd o76OnNQrfBTsQ199SJsrPBvT8h/kTxIgGe7sVqR95n3PO4pjVLQhRvf6X5jwcfn5ja 5G21J5gIDk/i8Kd0N4QiX5CVfGMfbVvx/DEi2ioXMGXNdC+QiCO6ZfQ71G4tOx5nPp zwn/YhrTlNqFg== 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 10/12] gen_initramfs.sh: always output cpio even without -o option Date: Sat, 4 Jan 2020 02:59:13 +0900 Message-Id: <20200103175915.26663-11-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200103175915.26663-1-masahiroy@kernel.org> References: <20200103175915.26663-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 --- 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 Fri Jan 3 17:59:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317271 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 263D314B4 for ; Fri, 3 Jan 2020 18:00:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F15052253D for ; Fri, 3 Jan 2020 18:00:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578074447; bh=Q+vip1d4MH9n8Mpor8/c92UsRgJk5SIQJq4WnrUkjfk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Xwf+Yml4ywlsp+eo/m2o8fUKGl8+oHlPUTGeW/DWOJ6tpUAa+bJ4/RRrxTMcVj4Sl vK05bY8cD2VBOvo5xUFbFdrYdj6gw307HcfMZl0HAUCIAX7AbPoe46p+tA39ld01N7 A9FvFP+Jtp0ubsLb/C/1u4G0aV40zw7EtzNQjIi8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728446AbgACSAq (ORCPT ); Fri, 3 Jan 2020 13:00:46 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:16587 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728291AbgACSAp (ORCPT ); Fri, 3 Jan 2020 13:00:45 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-07.nifty.com with ESMTP id 003HxSJC022724; Sat, 4 Jan 2020 02:59:35 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 003HxSJC022724 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578074375; bh=PA1hh0oVkb5HTcxrPiCLvIrt+m0pb6t29hc66/OGTJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1tbMTCIFZYalxjRrxnssVvO72bKqmXpu+6P1iwJb4YVy+g3D+7XVImew+51Gm6ED3 IIobTIDFW3KL1gxXl3jDwQEhzOlv0qUw4tXpVR5yVFOLF5HcGGONEPBuX25U86NxO1 uwsAWJmLrRCKBgxwckpZc8Y85eq5y34+x+n9NDg3+JSL6/ERt4VJg+6UVrIOsO21eP FBag7Lk813MD/6hfg5Xjc7iFu+5CVKAK0GksxuUTxFmcpFndn7rsya7ma4Bud94bcG RjPx457XREKp0WtnPbKaRzpuyOoQ8yd4w3GNLsQyfyVtnbi5GVT9406HRD6JUIT93R b75eS3U7ghZpQ== 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 11/12] initramfs: refactor the initramfs build rules Date: Sat, 4 Jan 2020 02:59:14 +0900 Message-Id: <20200103175915.26663-12-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200103175915.26663-1-masahiroy@kernel.org> References: <20200103175915.26663-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 --- usr/.gitignore | 8 +--- usr/Kconfig | 10 ----- usr/Makefile | 88 +++++++++++++++++++++++++++++--------------- usr/gen_initramfs.sh | 77 ++++++++------------------------------ usr/initramfs_data.S | 5 +-- 5 files changed, 77 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..579ffb915b8e 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -3,55 +3,85 @@ # 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 := $(shell echo $(CONFIG_INITRAMFS_SOURCE)) +cpio-data := + +ifeq ($(words $(ramfs-input)),0) + +# If CONFIG_INITRAMFS_SOURCE is empty, generate a small initramfs with the +# default contents. +ramfs-input := $(srctree)/$(src)/default_cpio_list + +else ifeq ($(words $(ramfs-input)),1) +# If CONFIG_INITRAMFS_SOURCE specifies a single file, and it is suffixed with +# .cpio or .cpio.*, use it directly as an initramfs. +ifneq ($(filter %.cpio,$(ramfs-input)),) +cpio-data := $(ramfs-input) +endif + +ifeq ($(words $(subst .cpio.,$(space),$(ramfs-input))),2) +cpio-data := $(ramfs-input) +# If the specified archive is suffixed with .cpio.* (i.e. already compressed), +# we do not double-compress it. +compress-y := shipped +endif + +endif + +ifeq ($(cpio-data),) +# For other cases, generate the initramfs cpio archive based on the contents +# specified by CONFIG_INITRAMFS_SOURCE. + +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 Fri Jan 3 17:59:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11317257 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 8E085109A for ; Fri, 3 Jan 2020 17:59:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C9A222522 for ; Fri, 3 Jan 2020 17:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578074398; bh=dMqASpC659LENtHa95N1QTvsssdbeiVwXeWGI7uR54o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=GGE99qWu49V9xksNXChNahQQx7gO7ybn8E2GH4ok9kY4AEnfWJ6mCDmaQhJ1TtCZt gX/KO0DAJPhoM5rGB6+6wWNNRs2dmjQ/DHGeGPhxUeWBMx9rRNzyl+UTpuib237QXo BpJHmTPG/SXuiX+U0XXvI6Ra5D8ZXqbXTrCJI8PA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728346AbgACR7y (ORCPT ); Fri, 3 Jan 2020 12:59:54 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:64930 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728344AbgACR7y (ORCPT ); Fri, 3 Jan 2020 12:59:54 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-07.nifty.com with ESMTP id 003HxSJD022724; Sat, 4 Jan 2020 02:59:35 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 003HxSJD022724 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1578074376; bh=/afvTso/ONcbcPbguDu7doM3beXBGjZKCYuIlhp0xDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Br4rfbRu5i0gbvU0nzBOzM4der3Qvjcbms4s5AqAy0sws3+s5DJYzqQN4ga7SUmBh W4oBcIiUZi1szC+IrjLCglukha9lum7QeLjDHrZhKngvJKVi7fAIyWcCMYDwneWwMH VGjxzAv7lgQ3osY8CHPpxollowRMWpACJjwap19wA639Nfs2rPJ0aOF8agtLla5aOZ W5rkf8MpvpJw7f4LaSWwl8j76rxRHuzlLamxLvMNWdpkvuaRRMLBZbBvnDDkdiJwgt eSUc04v4HQ0mw7tMg6y//l8JYnkk2PYS5lve2V9Y3hxiutclNGixOTCxxQxqWTbl8o qozQrpG1E9Nag== 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 12/12] gen_initramfs.sh: remove intermediate cpio_list on errors Date: Sat, 4 Jan 2020 02:59:15 +0900 Message-Id: <20200103175915.26663-13-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200103175915.26663-1-masahiroy@kernel.org> References: <20200103175915.26663-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 --- 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