From patchwork Thu Apr 22 21:40:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Voss X-Patchwork-Id: 1469415 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=140.211.166.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=dASV7ke8; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.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 4FR9p01nDpz9sRK for ; Fri, 23 Apr 2021 07:40:38 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 2E2A5405B6; Thu, 22 Apr 2021 21:40:36 +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 T0_FrpIQJPYV; Thu, 22 Apr 2021 21:40:35 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 418E140607; Thu, 22 Apr 2021 21:40:34 +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 29B2F1BF2FE for ; Thu, 22 Apr 2021 21:40:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 2665883E1A for ; Thu, 22 Apr 2021 21:40:33 +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 PJFjQrK2dGPM for ; Thu, 22 Apr 2021 21:40:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from ch3vs04.rockwellcollins.com (ch3vs04.rockwellcollins.com [205.175.226.52]) by smtp1.osuosl.org (Postfix) with ESMTPS id 0E31A842F8 for ; Thu, 22 Apr 2021 21:40:31 +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=Ea7beoSJvawZXpcB1SRK+Jp8QKJdd5MHbIsrIIMYf60=; b=dASV7ke8rDXKYvJiOKk9zZohgK08oEXNUeLqnkCepR2zvLYmZgaYNitv Aki+6pj/FddkGBM4LpDKaNzxCZdP4Bg2MSjiycCEi7oVcdvwf6utpfSaw ubTTNLQ0tANI2bd88/vdcVdHmc2g5qhoKUbacvd6e/JyENq8CK7Y0Vc+O Re+RhLFI+TldLZwVYhsaLj3PTaC9dE9gXUIzlNm18iStgpyuyU/6w4gQX Cy4hVOKqYOZOa8xzkScWS86LtHv8H1N61ZL1oXagWCisLhtoxA5I38a3b dRsKXUJoyzJuyF7nGiloSKSj/mlz9PGnO4Bjm1ui4UvvS/0FdSNWpt9r+ A==; IronPort-SDR: mduB5IQwPjgw4WSMn472mdYtBrtW43fbZEHLpSAwc6dKBcu11iRWHYeyCD49exuOXVddAyrX4C SdaRleYAIL99mYfMt9ObTTxFzBjDAR8sKF8Ejo8BH+NlDOqRgs5uWDWSa0l3jhemjSQRchM99U BZjZj9KiHmmzel0m7rskvI6IWTcUrCfC/DYD+S+Bo7abzp8j6K6jo0t9JvycgVF0ks3denWaif lWCH4FEkv7FxVAgaikPlyyKNBxdAFGTULGm0Hhl70rir99rheAQN26tboiKlZ987rPCNB2TLPm mJA= Received: from ofwch3n02.rockwellcollins.com (HELO dtulimr02.rockwellcollins.com) ([205.175.226.14]) by ch3vs04.rockwellcollins.com with ESMTP; 22 Apr 2021 16:40:31 -0500 X-Received: from eggs.rockwellcollins.com (eggs.rockwellcollins.lab [10.148.117.42]) by dtulimr02.rockwellcollins.com (Postfix) with ESMTP id C008F2006C; Thu, 22 Apr 2021 16:40:30 -0500 (CDT) From: Sam Voss To: buildroot@buildroot.org Date: Thu, 22 Apr 2021 16:40:30 -0500 Message-Id: <20210422214030.70343-1-sam.voss@rockwellcollins.com> X-Mailer: git-send-email 2.17.1 Subject: [Buildroot] [PATCH v2] 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 | 20 ++++++++++++++++++++ linux/linux.mk | 7 ++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/linux/Config.in b/linux/Config.in index 2460c3f124..570f42e87d 100644 --- a/linux/Config.in +++ b/linux/Config.in @@ -479,6 +479,26 @@ 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. + + WARNING: If you include additional firmware files into your + binary kernel image that are not available under the terms + of the GPL, then it may be a violation of the GPL to + distribute the resulting image since it combines both GPL + and non-GPL work. You should consult a lawyer of your own + before distributing such an image. + +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)