Received: by 10.223.176.46 with SMTP id f43csp1569008wra; Wed, 24 Jan 2018 19:38:26 -0800 (PST) X-Google-Smtp-Source: AH8x225I8iRDCSFHOvt0c6mHouXl+VvGd4aPc1omcMeTHwccwuck0naRB1HR3Bu2QUtavDWej/LN X-Received: by 10.101.66.131 with SMTP id j3mr11916111pgp.56.1516851506439; Wed, 24 Jan 2018 19:38:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516851506; cv=none; d=google.com; s=arc-20160816; b=Gi/MhR3+lyWKqpuZBkMJlstqrr5NTteOTvKQrFsxxgLiaDAUJL4ymcMBK0eJPZGj6w mAJQqgk8Dv4KgSZlW5DlvGNi1LqCpUJONjF4F+cYMXUOLxPnajFfAWyCLOV6v1hhzmUQ LjCxn7C5fA1JEFSCAXza3tAtzHgjySSEOh86ea+C75CZ0mhVoEWrJrgwHbIea8faG7J8 NR4Xi0FIkkPc18FdM/Tz0bZUuIFWCnQfddFVsFO02c6766hoegYe3W8+49wd3bDmLm+b gKtVU+Fi+nXe8njxB8vkbNb8rDOaSeVE4i4/6tDdmK0M/OcgOJdu/rfjiUF3f4BC9rfb Yw/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=uU9CDPzfkHv4kIhlS+FXByyEE7jbCMb3ynoHiiDpXq4=; b=Nq7oc/F8HV9IHut3OLrQi3oaKHoByrUhnLr42aY48g7iPxep/m5C7hzzMW5/a5zeQb EOLOyJN/nT4ws8pFL3I8Dos5Pm4p2tFAxdetvAwTif/5LQnBwvGBiof4lQV98rum5tNo pGNlRFeJzn1mWtTvVgn6Ek9b5BCiMsZuDTeKK9E2umgpGbyc6bhFE1ZxysKgQapzx1N7 RPUiffGa3r6e0hRDRL962E8WgmRDYMUMAe7EvaCdQ0nOmkAVveedcTQC3M5lbVevl+fs UQl7nArEiVSyBEKHxroAOcpICKudhxMnX+R05MYpYd/yO/WA0GGglIzpr/ORH2pNO8e0 zDFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=UfO6U7kI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cisco.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3si971456pgr.521.2018.01.24.19.38.12; Wed, 24 Jan 2018 19:38:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=UfO6U7kI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cisco.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933574AbeAYDhk (ORCPT + 99 others); Wed, 24 Jan 2018 22:37:40 -0500 Received: from alln-iport-6.cisco.com ([173.37.142.93]:21061 "EHLO alln-iport-6.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933519AbeAYDhg (ORCPT ); Wed, 24 Jan 2018 22:37:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3480; q=dns/txt; s=iport; t=1516851455; x=1518061055; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=dQ7LLTRmN2q9Pmp/35oM3M+RAoO+z7MJHtmUq8U+j4Y=; b=UfO6U7kI857Ync87UPID1n492RLG9agJFU4IY2dd727gaPvpMIZGJ7yU iJEqb1PDmKKAN0BKs4r5PqqpflX2NFVFUOZ+4uaoyfgdiL6aZ4l/S1O74 0709XZnuYBqMBYQ6yv4D/GVElKJSurei1lCOX1RGpbVZLLJgHBvhnfzgZ c=; X-IronPort-AV: E=Sophos;i="5.46,409,1511827200"; d="scan'208";a="60774011" Received: from rcdn-core-6.cisco.com ([173.37.93.157]) by alln-iport-6.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jan 2018 03:28:08 +0000 Received: from sjc-ads-7132.cisco.com (sjc-ads-7132.cisco.com [10.30.217.207]) (authenticated bits=0) by rcdn-core-6.cisco.com (8.14.5/8.14.5) with ESMTP id w0P3Ruj4007601 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NO); Thu, 25 Jan 2018 03:28:08 GMT From: Taras Kondratiuk To: "H. Peter Anvin" , Al Viro , Arnd Bergmann , Rob Landley , Mimi Zohar , Jonathan Corbet , James McMechan Cc: initramfs@vger.kernel.org, Victor Kamensky , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, xe-linux-external@cisco.com Subject: [PATCH v2 13/15] gen_initramfs_list.sh: add -x option to enable newcx format Date: Thu, 25 Jan 2018 03:27:53 +0000 Message-Id: <1516850875-25066-14-git-send-email-takondra@cisco.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516850875-25066-1-git-send-email-takondra@cisco.com> References: <1516850875-25066-1-git-send-email-takondra@cisco.com> X-Auto-Response-Suppress: DR, OOF, AutoReply X-Authenticated-User: takondra@cisco.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mimi Zohar -x option populates extended attributes in cpio_list file passed to get_init_cpio and selects newcx CPIO format. Signed-off-by: Mimi Zohar Signed-off-by: Taras Kondratiuk --- scripts/gen_initramfs_list.sh | 13 ++++++++++++- usr/Kconfig | 11 +++++++++++ usr/Makefile | 3 ++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index 86a3c0e5cfbc..cddb82f093d9 100755 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh @@ -24,6 +24,7 @@ $0 [-o ] [-u ] [-g ] {-d | } ... -g Group ID to map to group ID 0 (root). is only meaningful if is a directory. "squash" forces all files to gid 0. + -x include file extended attributes in cpio archive. File list or directory for cpio archive. If is a .cpio file it will be used as direct input to initramfs. @@ -146,6 +147,9 @@ parse() { ;; esac + $include_xattrs && \ + getfattr -h -d -m - -e hex --absolute-names ${location} | \ + sed -e '/^#/d' -e '/^$/d' -e 's/^/xattr /' >> ${output} echo "${str}" >> ${output} return 0 @@ -226,6 +230,8 @@ root_gid=0 dep_list= cpio_file= cpio_list= +cpio_opts= +include_xattrs=false output="/dev/stdout" output_file="" is_cpio_compressed= @@ -283,6 +289,10 @@ while [ $# -gt 0 ]; do default_list="$arg" ${dep_list}default_initramfs ;; + "-x") # include extended attributers + cpio_opts="-x" + include_xattrs=true + ;; "-h") usage exit 0 @@ -312,7 +322,8 @@ if [ ! -z ${output_file} ]; then fi fi cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)" - usr/gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile} + usr/gen_init_cpio $timestamp ${cpio_opts} ${cpio_list} \ + > ${cpio_tfile} else cpio_tfile=${cpio_file} fi diff --git a/usr/Kconfig b/usr/Kconfig index 43658b8a975e..0cc03bc4614c 100644 --- a/usr/Kconfig +++ b/usr/Kconfig @@ -52,6 +52,17 @@ config INITRAMFS_ROOT_GID If you are not sure, leave it set to "0". +config INITRAMFS_NEWCX + bool "Use newcx CPIO format for initramfs" + depends on INITRAMFS_SOURCE!="" + default n + help + If selected "usr/gen_init_cpio" will generate newcx CPIO archive + format that supports extended attributes. + + See for + more details. + config RD_GZIP bool "Support initial ramdisk/ramfs compressed using gzip" depends on BLK_DEV_INITRD diff --git a/usr/Makefile b/usr/Makefile index 237a028693ce..1106bfd61475 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -29,7 +29,8 @@ ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \ $(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d) ramfs-args := \ $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ - $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) + $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) \ + $(if $(CONFIG_INITRAMFS_NEWCX), -x) # $(datafile_d_y) is used to identify all files included # in initramfs and to detect if any files are added/removed. -- 2.10.3.dirty