From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 416E921A422 for ; Fri, 24 Jan 2025 12:31:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.60.130.6 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737721885; cv=none; b=fcU+mzXHBFPlcPj8R+cYeZMNAeqBUEWxrZ3Y1w+xGJnYqDjf8Z+3EQzcdbJ8BvvQd3Jryt/vF79hWz3pVrlNK4zs6oFfe9Z+Ke1GPlZaxOjttITl5QG62zvUdws7bKElMT2yTO2ELQfJkwixLDMRo4IGKp68F1pW9Q8O4R3t4Ic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737721885; c=relaxed/simple; bh=d2J2mgTdug9/IaMwKLaVOkYQC8NoZUy2lFGv40xR85s=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=PjfjgNgnxMtsXtVTN0H5xUE6dTQGq8G7pkR3xF7u9jqUIsCIWEWJvUXlOxFzzdYBPlGkvaLgTil8yndxkYI+h42UxU0L70ETVYzKoqLC6DNN1l23CcHEdLx7bjF8ruDM2MVxMeDY+WRtoPJywwlfTHaLgf4IgudW1Cerz/s9qNU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=WRWuyIUY; arc=none smtp.client-ip=178.60.130.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="WRWuyIUY" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=WkGqB7fI4lmFoWqeceHKQjA/okAY4wx0NKfY8kwc3aA=; b=WRWuyIUYHHUmshzjB/rD49U5IH GJoFJxokmHgbedAmjhvyvQa2BrRGiFZ2ib+Pn7VObGqgN1Ho4AvXWXgnKmt2yYvPlr+pS/uGx3q54 I6QrBoDqU2qxsu2Nmr1f+a1CghWW09FNG1V+rXAWFwa+moo4agbqydCKtjvKmNtSunCLLx2X9NYd8 m4gNP1s26Y4VCIiNh/5ps/4tKZn+9cLyozuaCeC+ALN+7GJw4KvU5eKxIEXxXtk2gG2/e1hmakhVs s2htnOOzw/FrQSmGpor9bvu4mcEKJK16Ff0J84zMH69mtHIVFLtuv48M3OLxV4958sxai7Y9GbamD 330C0g4g==; Received: from [189.110.51.10] (helo=[192.168.1.60]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1tbIqC-001kho-0Z; Fri, 24 Jan 2025 13:31:17 +0100 Message-ID: Date: Fri, 24 Jan 2025 09:31:07 -0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH] scripts: Add script to extract built-in firmware blobs To: Andrew Morton Cc: linux-kernel@vger.kernel.org, mcgrof@kernel.org, russ.weight@linux.dev, dakr@kernel.org, gregkh@linuxfoundation.org, rafael@kernel.org, masahiroy@kernel.org, nathan@kernel.org, nicolas@fjasle.eu, kernel-dev@igalia.com, kernel@gpiccoli.net, Thadeu Lima de Souza Cascardo References: <20250120190436.127578-1-gpiccoli@igalia.com> <20250123223816.c695a6b85f568a2eb8719508@linux-foundation.org> Content-Language: en-US From: "Guilherme G. Piccoli" In-Reply-To: <20250123223816.c695a6b85f568a2eb8719508@linux-foundation.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 24/01/2025 03:38, Andrew Morton wrote: > On Mon, 20 Jan 2025 16:04:26 -0300 "Guilherme G. Piccoli" wrote: > >> Through the options CONFIG_EXTRA_FIRMWARE{_DIR} one is able to build >> a kernel including firmware blobs in a built-in fashion. This is >> usually the case of built-in drivers that require some blobs in >> order to work properly, for example, like in non-initrd based systems. >> >> Add hereby a script to extract these blobs from a non-stripped vmlinux, >> similar to the idea of "extract-ikconfig". The firmware loader interface >> saves such built-in blobs as rodata entries, having a field for the FW >> name as "_fw___bin"; the tool extracts files >> named "_" for each rodata firmware entry >> detected. It makes use of awk, bash, dd and readelf, pretty standard >> tooling for Linux development. > > Please describe the use case(s) for this. ie, why are you suggesting > this be added to Linux? > Hi Andrew, there is currently no tool to extract a firmware blob that is built-in on vmlinux to the best of my knowledge. So if we have a kernel image containing the blobs, and we want to rebuild the kernel with some debug patches for example (and given that the image also has IKCONFIG=y), we currently can't do that for the same versions for all the firmware blobs, _unless_ we have exact commits of linux-firmware for the specific versions for each firmware included. With this tool, we can blindly extract the FWs and easily re-add them in the new debug kernel build, allowing a more deterministic testing without the burden of "hunting down" the proper version of each firmware binary. Makes sense to you? Cheers, Guilherme