From patchwork Thu Apr 22 20:24:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Voss X-Patchwork-Id: 1469399 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=rockwellcollins.com header.i=@rockwellcollins.com header.a=rsa-sha256 header.s=hrcrc2020 header.b=gtMlZWF8; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FR86n1vMZz9sV5 for ; Fri, 23 Apr 2021 06:25:03 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 28089404A5; Thu, 22 Apr 2021 20:25:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i5-W1Gm4gJQF; Thu, 22 Apr 2021 20:24:57 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 89AD2404A6; Thu, 22 Apr 2021 20:24:56 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 008CD1BF376 for ; Thu, 22 Apr 2021 20:24:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id E407E84303 for ; Thu, 22 Apr 2021 20:24:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=rockwellcollins.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BN-MHC2vE5DD for ; Thu, 22 Apr 2021 20:24:54 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from ch3vs02.rockwellcollins.com (ch3vs02.rockwellcollins.com [205.175.226.29]) by smtp1.osuosl.org (Postfix) with ESMTPS id 05F94842F8 for ; Thu, 22 Apr 2021 20:24:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rockwellcollins.com; s=hrcrc2020; h=from:to:cc:subject:date:message-id; bh=Gkb8OPm854X/4pJzGx1OL6VkrjAUH6T7aXlaFjymXS0=; b=gtMlZWF8p9aZmIrlq3e9vhXYhLMUAyG207Z0XMbHMonJRTn86J9UFvAf oYAWG4iFE14t5LMHYqFq4yy23Ay+S459LWc20rXw+JALUhc4SG83mgg/o Bxs1ajCPbZOI2Ax8Z3GnxbHB/UBIQ5kfWTni2JKEm6xWmBzc56gew4p58 7lTR678QamIxm4Ny9GecV5faVhltqjtJweS2ZeKTVaicj7YnrqqJ6pAHR jw0nSzjjcCkMy37QbeBa5j3EcQ9NQI11ugN/8h8iuSnDtxdOvzTRFPfNS uLwLcczN0Y1dun7+ZTrU+2TQQuocFrVezC3TQodkgF8YXI+KnEeL8NyIy A==; IronPort-SDR: xp7cA3OiauNa9x82zrDgqpEU+C0Qnwsrt3vBy66Nj6sl2gk2PVbt11w8Xz7puyHE3pZEtSYgKz PCyoIuepFxo8+slcrl/6S17LdJegRK5uqDUj6TEQbBrtSBVgiTDu3Jj0J+LznZ3pvlqiWZjXTf MEOr1mJYFJfh9RTvChtpxXDnG3C1I5NgVtZZuUTr5CGpiXXe2uWxB87rle7Pre1Xt1SsJoitR9 wxdVTqaQM1e4dA6O26e7LozM92CyXaMUbZlB51VF/6PcY5JUZnVOPAocvpbOvwkiSZD5ZcpRRR ugU= Received: from ofwch3n02.rockwellcollins.com (HELO ciulimr01.rockwellcollins.com) ([205.175.226.14]) by ch3vs02.rockwellcollins.com with ESMTP; 22 Apr 2021 15:24:53 -0500 X-Received: from eggs.rockwellcollins.com (eggs.rockwellcollins.lab [10.148.117.42]) by ciulimr01.rockwellcollins.com (Postfix) with ESMTP id E78CE603DF; Thu, 22 Apr 2021 15:24:52 -0500 (CDT) From: Sam Voss To: buildroot@buildroot.org Date: Thu, 22 Apr 2021 15:24:52 -0500 Message-Id: <20210422202452.41704-1-sam.voss@rockwellcollins.com> X-Mailer: git-send-email 2.17.1 Subject: [Buildroot] [PATCH] linux: allow firmware to be included in kernel X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sam Voss MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Add functionality to use the kernel's built-in options to allow binary blobs to be included with the kernel. This is equivalent to the blobs existing in /lib/firmware, however are available earlier in the boot process. This may be useful in situations where a device probes before the rootfs is fully available (such as a squashfs not being loaded before a usb device probing). Signed-off-by: Sam Voss --- linux/Config.in | 13 +++++++++++++ linux/linux.mk | 7 ++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/linux/Config.in b/linux/Config.in index 2460c3f124..ef0d9f79ea 100644 --- a/linux/Config.in +++ b/linux/Config.in @@ -479,6 +479,19 @@ config BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel". +config BR2_LINUX_KERNEL_EXTRA_FIRMWARE + bool "Build firmware binaries into the kernel" + help + Include the firmware from linux-firmware into the kernel + using the CONFIG_EXTRA_FIRMWARE option. + +config BR2_LINUX_KERNEL_EXTRA_FIRMWARE_BINARIES + string "External firmware blobs to build into the kernel binary" + depends on BR2_LINUX_KERNEL_EXTRA_FIRMWARE + help + Space delimited list of firmware to be built into the kernel. + These files must exist in the target's /lib/firmware. + # Linux extensions source "linux/Config.ext.in" diff --git a/linux/linux.mk b/linux/linux.mk index b67f739ca0..d581dd7f5d 100644 --- a/linux/linux.mk +++ b/linux/linux.mk @@ -78,7 +78,8 @@ LINUX_MAKE_ENV = \ LINUX_INSTALL_IMAGES = YES LINUX_DEPENDENCIES += host-kmod \ - $(if $(BR2_PACKAGE_INTEL_MICROCODE),intel-microcode) + $(if $(BR2_PACKAGE_INTEL_MICROCODE),intel-microcode) \ + $(if $(BR2_LINUX_KERNEL_EXTRA_FIRMWARE),linux-firmware) # Starting with 4.16, the generated kconfig paser code is no longer # shipped with the kernel sources, so we need flex and bison, but @@ -384,6 +385,10 @@ define LINUX_KCONFIG_FIXUP_CMDS $(call KCONFIG_ENABLE_OPT,CONFIG_FB) $(call KCONFIG_ENABLE_OPT,CONFIG_LOGO) $(call KCONFIG_ENABLE_OPT,CONFIG_LOGO_LINUX_CLUT224)) + $(if $(BR2_LINUX_KERNEL_EXTRA_FIRMWARE), + $(call KCONFIG_ENABLE_OPT,CONFIG_FIRMWARE_IN_KERNEL) + $(call KCONFIG_SET_OPT,CONFIG_EXTRA_FIRMWARE,$(BR2_LINUX_KERNEL_EXTRA_FIRMWARE_BINARIES)) + $(call KCONFIG_SET_OPT,CONFIG_EXTRA_FIRMWARE_DIR,"$(TARGET_DIR)/lib/firmware")) $(call KCONFIG_DISABLE_OPT,CONFIG_GCC_PLUGINS) $(PACKAGES_LINUX_CONFIG_FIXUPS)