From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1076115-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id D2051138334
	for <garchives@archives.gentoo.org>; Fri,  8 Mar 2019 17:08:44 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id D37A7E08C2;
	Fri,  8 Mar 2019 17:08:43 +0000 (UTC)
Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id A84F8E08C2
	for <gentoo-commits@lists.gentoo.org>; Fri,  8 Mar 2019 17:08:43 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 16CA7335C51
	for <gentoo-commits@lists.gentoo.org>; Fri,  8 Mar 2019 17:08:41 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 7C7AE326
	for <gentoo-commits@lists.gentoo.org>; Fri,  8 Mar 2019 17:08:39 +0000 (UTC)
From: "Ben Kohler" <bkohler@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Ben Kohler" <bkohler@gentoo.org>
Message-ID: <1552064703.2effaa1441944936193d7ee40c386e33bd5d253d.bkohler@gentoo>
Subject: [gentoo-commits] proj/genkernel:master commit in: /
X-VCS-Repository: proj/genkernel
X-VCS-Files: gen_initramfs.sh
X-VCS-Directories: /
X-VCS-Committer: bkohler
X-VCS-Committer-Name: Ben Kohler
X-VCS-Revision: 2effaa1441944936193d7ee40c386e33bd5d253d
X-VCS-Branch: master
Date: Fri,  8 Mar 2019 17:08:39 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: be180710-abfd-40f7-b6dc-4f907606c847
X-Archives-Hash: 2cc66254e07cfe1778bff6a764b135e9

commit:     2effaa1441944936193d7ee40c386e33bd5d253d
Author:     José Pekkarinen <koalinux <AT> gmail <DOT> com>
AuthorDate: Sun Jun 24 05:29:56 2018 +0000
Commit:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
CommitDate: Fri Mar  8 17:05:03 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=2effaa14

Use firmware prefix and path in initramfs generation

Mimic kernel behaviour of a prefix where to lookup firmware and a file with its path from prefix to avoid confusion on how to use these parameters. This also prevents in folder firmware(ex. i915,amdgpu...) to be copied straight to /lib/firmware in the initramfs.

Signed-off-by: José Pekkarinen <koalinux <AT> gmail.com>
Fixes: https://github.com/gentoo/genkernel/pull/5
Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 gen_initramfs.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index a2c55c6..b4200c7 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -722,7 +722,7 @@ append_dropbear(){
 }
 
 append_firmware() {
-	if [ -z "${FIRMWARE_FILES}" -a ! -d "${FIRMWARE_DIR}" ]
+	if [ ! -d "${FIRMWARE_DIR}" ]
 	then
 		gen_die "specified firmware directory (${FIRMWARE_DIR}) does not exist"
 	fi
@@ -736,10 +736,12 @@ append_firmware() {
 	then
 		OLD_IFS=$IFS
 		IFS=","
+		pushd ${FIRMWARE_DIR} >/dev/null
 		for i in ${FIRMWARE_FILES}
 		do
-			cp -L "${i}" ${TEMP}/initramfs-firmware-temp/lib/firmware/
+			cp -L --parents "${i}" ${TEMP}/initramfs-firmware-temp/lib/firmware/
 		done
+		popd >/dev/null
 		IFS=$OLD_IFS
 	else
 		cp -a "${FIRMWARE_DIR}"/* ${TEMP}/initramfs-firmware-temp/lib/firmware/