From nobody Sun Feb 8 16:35:51 2026 Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCF8325F96D for ; Tue, 6 Jan 2026 16:28:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767716884; cv=none; b=YOhEz3ce0cQ3ue9McETGdM9T0/aIE4c1J3uFCWix5lSBz3+V3iQVtjaS7tqIsH0WOuxLWrCiLU4A1v6iqzyZ+06Ge3P0B0bYL4oz2E7wWpI04Hs1YMjop26m4KmWlurUm1q2Pw9gSuU32EHOYhMOlIjvTtc37QXq78UExxy8US4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767716884; c=relaxed/simple; bh=dANt1IxVBpejBPX1GyE+hxJwTnKsLrEyXQVIM/d+pnQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZXM+a5y0x3aNAKk3QjXuO2Y4p7tpMLmS3ZQrLG8AH6+Ne2QoyYzse3cjt7EiZ99aaYbOussl9feBUUt39J/tpZc2wtbrukrHmjQOuDm8q2rjWGudIaHVeeMHqGgyD5rjLcWNjB7myp1mQChmDa8eFndJTdYG9LlpNTRaBf7gAX0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=SAdAdfF8; arc=none smtp.client-ip=209.85.210.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="SAdAdfF8" Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-7c7aee74dceso491883a34.2 for ; Tue, 06 Jan 2026 08:28:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1767716882; x=1768321682; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CLsfEOgWDExJ3WhLf4sg7dIsOWS7vuQUYkgDX6My13A=; b=SAdAdfF82ItFP53vpze7FRhd9MZ1xGXSS+yFQcCxGOXjJaA8duXWAO93tOL2v/uvGk FIX7UARZggLFHolKC5OuYsIFl75cVz4FCzswaHKgXTDkduLJj7zIY+tJIajXrQn0Uzrw YG3kw8OxyqBTgLA7+biddZdMHPphAG1zY7D5s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767716882; x=1768321682; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=CLsfEOgWDExJ3WhLf4sg7dIsOWS7vuQUYkgDX6My13A=; b=SXzJIduqGnrRx8WamYD877CDhO8NX6YN91R1tXR0wxBjOWgTqaPKeTv09t6ftCD/AD ZKjs7GnH/F2oeLg7v6OWYH/M5gyBctBeyPStYBZ5mxJdHO1HokhieWI0+Ici69m7GnIG x34QK/hN/wrK3s7qGrwumuACVNOPxmX0PIybe9Sf40OuZyTMCUqwVVJytak3No4FPWMa YRCTxp4qqCFV+AU1pVvZGenGJ+sXpIhilSP8hBijev48q7nir/RvjFUd4/usmGCxUHch 0G+4iH0yinsI6UUn+Om3QKvaKMEc+U1gHn2IPYGEhLkptuKN8sF0pRXBIf8Vu0vtsRZm H3BQ== X-Forwarded-Encrypted: i=1; AJvYcCX3WnagB8U7FfywV9cm2ilGa+oy/kX56xSvhgneR/aqWP4+ZZwFjs7UjRGs87y1hK6HdH/oSrOdUnd8Z24=@vger.kernel.org X-Gm-Message-State: AOJu0YyP8oASZZTCEUo8a05a93D2B3Ftf5WsP6o4BHHlbJ6zGcg87ig8 22M7k7UvE5t+Mz/TEfz0oV00sHVRA8jPie8pSK+yWXZFJCLFuoRToYLoALi4dq6OxA== X-Gm-Gg: AY/fxX6myhxAk5dWdQL/7LsK09JdI94aQnh/yDf9jjgcIIhyhLKjpBY2KaHDu0Z5olm 5yAlu2Qtkr2CZGf7AYbGb0fOlSMusAiwiPVbEtjGKVvpfCkGtn3zUnLZOj5W04KbNFg8s2AvGll WOv9czITlNZhZP1kI/MmzlNKjqwSAuzcS8QPVRC/ILUWpwbPaE46pHr1tD30UFuBwOOUEnTcAKF 9Jhy6CPllpVFLwN9gzgHDkxDgDec9PxnWY0ZwXsJUx5kDLX+3w3+KM42wnCZHaF+podNhG/k6jZ IBNvNibLRD6CMqBZqVCt6RvZeJmWRrD7U4VcDLGOIGB2V0HaZI9QVpo6BwfqGp+nkONQknrFmC8 qNH3yQd8PAX2qox6TcBBKXpScHCJ5JkyBIhscWD68s8ZWoTvFqQfmr6y3HIZkKtwShLf3tt0AF4 LxHoj+ X-Google-Smtp-Source: AGHT+IHGVWR+o96TRxTuXQ/F0UqzqBMP6VrRhont/V7m3XjqYj+I6OqdMsB67tcwk8vgU3JBwJdygQ== X-Received: by 2002:a05:6830:2647:b0:78a:5183:8f6a with SMTP id 46e09a7af769-7ce46710f3cmr1799055a34.28.1767716881755; Tue, 06 Jan 2026 08:28:01 -0800 (PST) Received: from chromium.org ([73.34.74.121]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7ce478af8b2sm1630951a34.15.2026.01.06.08.27.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 08:28:00 -0800 (PST) From: Simon Glass To: linux-arm-kernel@lists.infradead.org Cc: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , =?UTF-8?q?J=20=2E=20Neusch=C3=A4fer?= , Masahiro Yamada , Ahmad Fatoum , Nicolas Schier , Tom Rini , Chen-Yu Tsai , Simon Glass , Nicolas Schier , linux-kernel@vger.kernel.org Subject: [PATCH v9 1/6] scripts/make_fit: Speed up operation Date: Tue, 6 Jan 2026 09:27:31 -0700 Message-ID: <20260106162738.2605574-2-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260106162738.2605574-1-sjg@chromium.org> References: <20260106162738.2605574-1-sjg@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The kernel is likely at least 16MB so we may as well use that as a step size when reallocating space for the FIT in memory. Pack the FIT at the end, so there is no wasted space. This reduces the time to pack by an order of magnitude, or so. Signed-off-by: Simon Glass Reviewed-by: Nicolas Schier Reviewed-by: Ahmad Fatoum Tested-by: Chen-Yu Tsai --- (no changes since v3) Changes in v3: - Move the ramdisk chunk into the correct patch scripts/make_fit.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/make_fit.py b/scripts/make_fit.py index 1683e5ec6e67..0f5e7c4b8aed 100755 --- a/scripts/make_fit.py +++ b/scripts/make_fit.py @@ -98,7 +98,7 @@ def setup_fit(fsw, name): fsw (libfdt.FdtSw): Object to use for writing name (str): Name of kernel image """ - fsw.INC_SIZE =3D 65536 + fsw.INC_SIZE =3D 16 << 20 fsw.finish_reservemap() fsw.begin_node('') fsw.property_string('description', f'{name} with devicetree set') @@ -299,7 +299,9 @@ def build_fit(args): finish_fit(fsw, entries) =20 # Include the kernel itself in the returned file count - return fsw.as_fdt().as_bytearray(), seq + 1, size + fdt =3D fsw.as_fdt() + fdt.pack() + return fdt.as_bytearray(), seq + 1, size =20 =20 def run_make_fit(): --=20 2.43.0 From nobody Sun Feb 8 16:35:51 2026 Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A70FE25F96D for ; Tue, 6 Jan 2026 16:28:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767716891; cv=none; b=OudOSAPKTgLb4wpgjVyg47HTJceiFtt9uOv7jLvrx3zNL1UzWaBLMLVVFV5NjppUFSsJtXe+NRDffYtzP0rXU3cTNzw3087k4gxhQSjTkZl53Tdjq3A4oHtL8XIFywggEN/v8WwbDma93guDgXJvoHOt5Uq7h1qDmQsk+kt/2KM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767716891; c=relaxed/simple; bh=JDHwg4UH314RvplNCRL91Oy7GIV8cCK8/8DcmuuMJd8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hYdvO2DPLMfGhf3lPL2NODESJDvnKwDwZeL+qQRoh/KSurD6dtZywewf6nk7QNdAoKa+HkfpI3OznCipVwUUz3KRnqSUuha2OTgNpz3DcXVYzksUB1uruLCYhBFobcoMbBi01OQfsyVprFDaqtpF5Or5Xwewkcj8zq93el8dvXY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=c+X4V6Xz; arc=none smtp.client-ip=209.85.210.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="c+X4V6Xz" Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-7c6cc44ff62so901911a34.3 for ; Tue, 06 Jan 2026 08:28:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1767716888; x=1768321688; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uf5OzsvzLJF7JMEHMJOMsmKpYuDb1ZnOHsvKTOsoYw0=; b=c+X4V6Xz2PkadvEJx4RrelIDwO68UYc03/SA4OgDuexrtkVmxA0icwAvOl5J1Xi3MA XRW3UI9tM3ve6wuOCZ6UrUeLIrLWLlxF5vMEofFcuQSWqZlzMVE9kRJNlBt4r63kDCO5 tCct3ccuvcUbYUifdR/ej6m5I7pQ6mjBOyv48= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767716888; x=1768321688; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=uf5OzsvzLJF7JMEHMJOMsmKpYuDb1ZnOHsvKTOsoYw0=; b=SL9k0u9kCoYgeO002vGQDbCssh++V/P+PJFjIlqSBhJ+jjbMfbdHc9MwkOL210Fxjy N3RGjffJ/wJJdRFzJigHCtdn2cTZMtGD1tHfQ+aZwIUN3ZHRV3WVFRvoyUYe2wDTNpdr Y4uYSV5dcWsb+EaySmXZKwwEhmCwP/RIspjaNAzA935ASQCYcKGV2oXUNeb3G6cIlCmM eqQ238fTxHRBbC7oeqns2R3jrQ3JPkhqKNxc/jPnuPlkIfvRC2l4kdrfGkJ4KV8O9U+n ctOl+CeTCM9p3Ju+5gJlcW1K/RbWR0G5z/cSrBp+vtdxvLWOlJj/WfTaFOSKwrKZZ6bV CkSQ== X-Forwarded-Encrypted: i=1; AJvYcCWzj2Koq+3gUI9I73eUSwCIlDrSuFU/e6emWi98wgLXeQEzcuCjmcQWjtW3Vb68o58YcjtVjsvZiolugxk=@vger.kernel.org X-Gm-Message-State: AOJu0YxVGbGws/3Xd0AlMmo/8CxRh1vg6aHAveMTqUcF03nJf9yDmc2Y Nlz6AJeTCNEFQNZocJiK/lirf+1KIWDZHfdSxShMKmk+JNnzfQLcb/E/ZnaGcyPBqQ== X-Gm-Gg: AY/fxX6/5/E0q03OrSH1ULLkaZQvQjWGiIdS2sL1REF+q3+8HDl8IAUcjuvf7boO0Pz A6BG81f5Nr04CH7bowzZvLzP2BPqH7s2GnH9ZK23RpojM9k7aGEyNC6yBekWvkW8gpXMnEwaKo2 QpDo0/cdhyzjCXCPofdQ6MPu3Jo5KbQP4O0B9mUNj9863XlQ9oM2MzhksMolGsnnnqWxFbVGlD0 8b06T7GqSHDZpu/Tt8kLm40KYrw/yNW5ETQMRltP4yrjQsncnbd/NnXNZFwgttTYXqkW+kr1vos snTiTX0Gpm2VnBE8EqSnDw7FxJkW2dvjC1Pygteec0ihDniuKhWRCDDNd3tlIRJe628NhoXOjse 59rkxDbpFvV8kkwPhrRFYohcE3g3fulO4C7/dSaFk8A1xkgxnxtpG5xbBIdKmuuvwJYyDLmUFqv DEgiI0SZ85w5A3cZw= X-Google-Smtp-Source: AGHT+IH/uW+Dz4DHkg+DggfheF7JxW/x4X1apiIF05eXk1K0Su+uOEmzpRUhIyE4LvK1n4GcV+KuyA== X-Received: by 2002:a05:6830:2b26:b0:7c7:59ce:d195 with SMTP id 46e09a7af769-7ce4669d7f8mr2356558a34.6.1767716888521; Tue, 06 Jan 2026 08:28:08 -0800 (PST) Received: from chromium.org ([73.34.74.121]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7ce478af8b2sm1630951a34.15.2026.01.06.08.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 08:28:02 -0800 (PST) From: Simon Glass To: linux-arm-kernel@lists.infradead.org Cc: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , =?UTF-8?q?J=20=2E=20Neusch=C3=A4fer?= , Masahiro Yamada , Ahmad Fatoum , Nicolas Schier , Tom Rini , Chen-Yu Tsai , Simon Glass , Nicolas Schier , linux-kernel@vger.kernel.org Subject: [PATCH v9 2/6] scripts/make_fit: Support an initial ramdisk Date: Tue, 6 Jan 2026 09:27:32 -0700 Message-ID: <20260106162738.2605574-3-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260106162738.2605574-1-sjg@chromium.org> References: <20260106162738.2605574-1-sjg@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" FIT (Flat Image Tree) allows a ramdisk to be included in each configuration. Add support for this to the script. This feature is not available via 'make image.fit' since the ramdisk likely needs to be built separately anyway, e.g. using modules from the kernel build. Future work may provide support for doing that. Note that the uncompressed size is not correct when a ramdisk is used, since it is too expensive to decompress the ramdisk. Signed-off-by: Simon Glass Reviewed-by: Nicolas Schier Reviewed-by: Ahmad Fatoum --- (no changes since v6) Changes in v6: - Drop the load address for ramdisk, as it is not needed - Bring back the ramdisk 'compression' property, set to 'none' Changes in v5: - Fix 'use' typo Changes in v4: - Update the commit message Changes in v3: - Add a comment at the top of the file about the -r option - Count the ramdisk in the total files - Update the commit message Changes in v2: - Don't compress the ramdisk as it is already compressed scripts/make_fit.py | 52 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/scripts/make_fit.py b/scripts/make_fit.py index 0f5e7c4b8aed..66cd73711506 100755 --- a/scripts/make_fit.py +++ b/scripts/make_fit.py @@ -10,10 +10,14 @@ Usage: make_fit.py -A arm64 -n 'Linux-6.6' -O linux -o arch/arm64/boot/image.fit -k /tmp/kern/arch/arm64/boot/image.itk - @arch/arm64/boot/dts/dtbs-list -E -c gzip + -r /boot/initrd.img-6.14.0-27-generic @arch/arm64/boot/dts/dtbs-li= st + -E -c gzip =20 -Creates a FIT containing the supplied kernel and a set of devicetree files, -either specified individually or listed in a file (with an '@' prefix). +Creates a FIT containing the supplied kernel, an optional ramdisk, and a s= et of +devicetree files, either specified individually or listed in a file (with = an +'@' prefix). + +Use -r to specify an existing ramdisk/initrd file. =20 Use -E to generate an external FIT (where the data is placed after the FIT data structure). This allows parsing of the data without loading @@ -29,8 +33,6 @@ looks at the .cmd files produced by the kernel build. =20 The resulting FIT can be booted by bootloaders which support FIT, such as U-Boot, Linuxboot, Tianocore, etc. - -Note that this tool does not yet support adding a ramdisk / initrd. """ =20 import argparse @@ -81,6 +83,8 @@ def parse_args(): help=3D'Specifies the operating system') parser.add_argument('-k', '--kernel', type=3Dstr, required=3DTrue, help=3D'Specifies the (uncompressed) kernel input file (.itk)') + parser.add_argument('-r', '--ramdisk', type=3Dstr, + help=3D'Specifies the ramdisk/initrd input file') parser.add_argument('-v', '--verbose', action=3D'store_true', help=3D'Enable verbose output') parser.add_argument('dtbs', type=3Dstr, nargs=3D'*', @@ -133,7 +137,28 @@ def write_kernel(fsw, data, args): fsw.property_u32('entry', 0) =20 =20 -def finish_fit(fsw, entries): +def write_ramdisk(fsw, data, args): + """Write out the ramdisk image + + Writes a ramdisk node along with the required properties + + Args: + fsw (libfdt.FdtSw): Object to use for writing + data (bytes): Data to write (possibly compressed) + args (Namespace): Contains necessary strings: + arch: FIT architecture, e.g. 'arm64' + fit_os: Operating Systems, e.g. 'linux' + """ + with fsw.add_node('ramdisk'): + fsw.property_string('description', 'Ramdisk') + fsw.property_string('type', 'ramdisk') + fsw.property_string('arch', args.arch) + fsw.property_string('compression', 'none') + fsw.property_string('os', args.os) + fsw.property('data', data) + + +def finish_fit(fsw, entries, has_ramdisk=3DFalse): """Finish the FIT ready for use =20 Writes the /configurations node and subnodes @@ -143,6 +168,7 @@ def finish_fit(fsw, entries): entries (list of tuple): List of configurations: str: Description of model str: Compatible stringlist + has_ramdisk (bool): True if a ramdisk is included in the FIT """ fsw.end_node() seq =3D 0 @@ -154,6 +180,8 @@ def finish_fit(fsw, entries): fsw.property_string('description', model) fsw.property('fdt', bytes(''.join(f'fdt-{x}\x00' for x in = files), "ascii")) fsw.property_string('kernel', 'kernel') + if has_ramdisk: + fsw.property_string('ramdisk', 'ramdisk') fsw.end_node() =20 =20 @@ -274,6 +302,14 @@ def build_fit(args): size +=3D os.path.getsize(args.kernel) write_kernel(fsw, comp_data, args) =20 + # Handle the ramdisk if provided. Compression is not supported as it is + # already compressed. + if args.ramdisk: + with open(args.ramdisk, 'rb') as inf: + data =3D inf.read() + size +=3D len(data) + write_ramdisk(fsw, data, args) + for fname in args.dtbs: # Ignore non-DTB (*.dtb) files if os.path.splitext(fname)[1] !=3D '.dtb': @@ -296,12 +332,12 @@ def build_fit(args): =20 entries.append([model, compat, files_seq]) =20 - finish_fit(fsw, entries) + finish_fit(fsw, entries, bool(args.ramdisk)) =20 # Include the kernel itself in the returned file count fdt =3D fsw.as_fdt() fdt.pack() - return fdt.as_bytearray(), seq + 1, size + return fdt.as_bytearray(), seq + 1 + bool(args.ramdisk), size =20 =20 def run_make_fit(): --=20 2.43.0 From nobody Sun Feb 8 16:35:51 2026 Received: from mail-ot1-f67.google.com (mail-ot1-f67.google.com [209.85.210.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4409C329367 for ; Tue, 6 Jan 2026 16:28:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.67 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767716894; cv=none; b=IuLHV7OiC2+6R/VPPTuSUPm9JC2K05RPdMA+1MoETUnh6WePwgrPNfl6xT512Xuv3O7DzMU6MwpsY+W4nnQdQwth50fI865BNaHsAs4+ZfuJSaolzdO7lC52Ma3op3dQBOvhuLLgzSsLEItC0aJb8uJO9aJgIQAbuVbs/QDQ8Z0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767716894; c=relaxed/simple; bh=OJ5gjSQWKx5C84AvdM6xqDc/SoTZsEG7agwwRllLSl4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SbUhGDtlZgsF2eZ/roKpUp1Ks9Ob74STZDsPurDrvqLK90liifYl8D/6pQblwNt9hVaGsecSYy9GWDlAojy2UjZCFtor0+j5F6aMPq9iPPQOzU1sgvGFsuvZDrwIpKg3N21UD53pKdzl/vwY+b1AKwrCsM+fdQ1JocW6XpGOA+4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=mTgtQTi8; arc=none smtp.client-ip=209.85.210.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mTgtQTi8" Received: by mail-ot1-f67.google.com with SMTP id 46e09a7af769-7cdd651c884so725625a34.1 for ; Tue, 06 Jan 2026 08:28:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1767716892; x=1768321692; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OQo1oqJAVo44ptfZ9oLDxIXzqeCSewp3mycJJep0ovk=; b=mTgtQTi8Y4jDyI6gTLx3dwvkQoa61l77VuNXfMSRPMNmuQm9BFiYsQ6MaQUQbdJuhc Cw2Fcye9Ni7C7/q9HevZn00rvOyQqsXy+nVPZoR4HRs0GZFytHigBGZKi9oMjFXZ57tq VZN38iRC7UzoE3aAOGYOOcMZNVUBSewflthN8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767716892; x=1768321692; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=OQo1oqJAVo44ptfZ9oLDxIXzqeCSewp3mycJJep0ovk=; b=t3dKjDNBnVdt5G7HD++hxDtBEY4G/T4/yoGPOgOsH0anAswBATZkxKxud6NPZtGYQs VQuZX0EyaviBGvUJZd0f3PyJf4gKoS/YeNxnfxp7cCwY3gluBbK+fB/gVxo4Xm2N94d+ NvAzPfZkczWIftC6No9A17Q7cXbUj4DNVO6N9YuLHhlzp5oeVc+7V+sC3DQtSvZW9nrw nVWpzk3hBujauTtgHh571lvofKTIGjuMrmLETTAB97om1ieWTgHMu7MgFmgWWb1q1YzG 32ToAUTYGXW32phutm4tX+/zA35y3Z/I06pK/wdVPv5CtxK9EkjMwftVsNBay0rpxqwy pXAQ== X-Forwarded-Encrypted: i=1; AJvYcCUq/gwv8v9TcPD3xddHy4am0tbO6sHH0AyGiwFvOkuaHEJInjmpRtYBSYJwtr884bwaGHPOJ4b4DiNYIo8=@vger.kernel.org X-Gm-Message-State: AOJu0Yx/2PhGODU7T5L4QlYA0aQnDlBDGO5g1Ll3tN3wMaxGGZyjZJMe OFg52lU6+x/RwuinRTiUfphaoM1M5yNunYgo95FhulW4WSCu41iv0vSmeKviMlOheQ== X-Gm-Gg: AY/fxX687Z8ZdZQz4KH6ijMlfowcsV3tLk7lVKoke8T+VCPTn1asm0n3HXE1uEyjgaM V0NysNTb0dVRJYN9R8p21U22ozE33AmGGydgxYsdkotm/vTKH0wI5rl01taXV+pnStqKbX8Refw S90Gbb173XiqWN6oJaRo9yKZ0BKWE32EHGzdSPqrb9imuqTLONMYwQLvvDbxbYMvvw9z1H8cHyH weMVPFOOZtF1IJIT3X0Za1C5HGfLtNmOMHASKKj2ZTJbVS24eUh+MSTSXQG+Bd3IDZJeAnJdbHG AEU8Sjjq6O5Uu78MI9WN7Z1gO8XkYxJn2cIUhngD/c2I+USwip5Bwp9A90ih2qCEDjFqiftmf73 DerQnsDYJNq0iD6mPxL/0okXxELrrunBvVakJr6EUggaMsq+hARRnNwLxwI+//TqKsWWu2XAs4K s6t+RD X-Google-Smtp-Source: AGHT+IGuJABBFnzvQfwuTK8ad1RpY2J0r9aGrWVcqmMOekBUx5pLw74qr+O3uLebVoUpSRypznVpqQ== X-Received: by 2002:a05:6830:4588:b0:7c7:7f85:d19 with SMTP id 46e09a7af769-7ce46cae1b1mr1464100a34.8.1767716892094; Tue, 06 Jan 2026 08:28:12 -0800 (PST) Received: from chromium.org ([73.34.74.121]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7ce478af8b2sm1630951a34.15.2026.01.06.08.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 08:28:09 -0800 (PST) From: Simon Glass To: linux-arm-kernel@lists.infradead.org Cc: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , =?UTF-8?q?J=20=2E=20Neusch=C3=A4fer?= , Masahiro Yamada , Ahmad Fatoum , Nicolas Schier , Tom Rini , Chen-Yu Tsai , Simon Glass , Nicolas Schier , linux-kernel@vger.kernel.org Subject: [PATCH v9 3/6] scripts/make_fit: Move dtb processing into a function Date: Tue, 6 Jan 2026 09:27:33 -0700 Message-ID: <20260106162738.2605574-4-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260106162738.2605574-1-sjg@chromium.org> References: <20260106162738.2605574-1-sjg@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since build_fit() is getting quite long, move the dtb processing into a separate function. Change the double quotes in the write() call to single, to match the rest of the script. Signed-off-by: Simon Glass Reviewed-by: Nicolas Schier Reviewed-by: Ahmad Fatoum Reviewed-by: Chen-Yu Tsai --- (no changes since v7) Changes in v7: - Add a note about the " -> ' change scripts/make_fit.py | 67 +++++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 23 deletions(-) diff --git a/scripts/make_fit.py b/scripts/make_fit.py index 66cd73711506..7ddaf3c0d783 100755 --- a/scripts/make_fit.py +++ b/scripts/make_fit.py @@ -277,6 +277,47 @@ def process_dtb(fname, args): =20 return (model, compat, files) =20 + +def _process_dtbs(args, fsw, entries, fdts): + """Process all DTB files and add them to the FIT + + Args: + args: Program arguments + fsw: FIT writer object + entries: List to append entries to + fdts: Dictionary of processed DTBs + + Returns: + tuple: + Number of files processed + Total size of files processed + """ + seq =3D 0 + size =3D 0 + for fname in args.dtbs: + # Ignore non-DTB (*.dtb) files + if os.path.splitext(fname)[1] !=3D '.dtb': + continue + + try: + (model, compat, files) =3D process_dtb(fname, args) + except Exception as e: + sys.stderr.write(f'Error processing {fname}:\n') + raise e + + for fn in files: + if fn not in fdts: + seq +=3D 1 + size +=3D os.path.getsize(fn) + output_dtb(fsw, seq, fn, args.arch, args.compress) + fdts[fn] =3D seq + + files_seq =3D [fdts[fn] for fn in files] + entries.append([model, compat, files_seq]) + + return seq, size + + def build_fit(args): """Build the FIT from the provided files and arguments =20 @@ -289,7 +330,6 @@ def build_fit(args): int: Number of configurations generated size: Total uncompressed size of data """ - seq =3D 0 size =3D 0 fsw =3D libfdt.FdtSw() setup_fit(fsw, args.name) @@ -310,34 +350,15 @@ def build_fit(args): size +=3D len(data) write_ramdisk(fsw, data, args) =20 - for fname in args.dtbs: - # Ignore non-DTB (*.dtb) files - if os.path.splitext(fname)[1] !=3D '.dtb': - continue - - try: - (model, compat, files) =3D process_dtb(fname, args) - except Exception as e: - sys.stderr.write(f"Error processing {fname}:\n") - raise e - - for fn in files: - if fn not in fdts: - seq +=3D 1 - size +=3D os.path.getsize(fn) - output_dtb(fsw, seq, fn, args.arch, args.compress) - fdts[fn] =3D seq - - files_seq =3D [fdts[fn] for fn in files] - - entries.append([model, compat, files_seq]) + count, fdt_size =3D _process_dtbs(args, fsw, entries, fdts) + size +=3D fdt_size =20 finish_fit(fsw, entries, bool(args.ramdisk)) =20 # Include the kernel itself in the returned file count fdt =3D fsw.as_fdt() fdt.pack() - return fdt.as_bytearray(), seq + 1 + bool(args.ramdisk), size + return fdt.as_bytearray(), count + 1 + bool(args.ramdisk), size =20 =20 def run_make_fit(): --=20 2.43.0 From nobody Sun Feb 8 16:35:51 2026 Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE7723358B2 for ; Tue, 6 Jan 2026 16:28:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767716897; cv=none; b=WXP49qzSQKSBg4AWK0jRJ+39reW9bIe9vX8GseoawQ/ldVUu7v9K6H18TY+PCiKEEGpInhJ5XeVc4oritCRDr9xli0WlhUSt4re3MKdd4k3OU0g8NexTtF/gAEsEqQLXIUZ7TCQc8rJzKxj4/TjBrA0ocCNMbqmYtUdp3FvLaGg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767716897; c=relaxed/simple; bh=LrHmYMQz2JETizEwTZEg0NFEQD6BSQgY8pOFDuVF2fY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gA/Rr9Nl3kcbpLY6z7RHF2/Y0Nq3cTe+jN0CP2PKmtW4Z8RAkhyYwaRihRZyZnXH2Qsw5RLBGFsk/JRmDIPHFZWKIwHX6beok1MoaeX8NgJJuO+8WT/Gag3NXn8GI1XQmJcPR8Qy33UvDJKd7BNi2ltOTglBL3clSyApT4LhxD4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=NFeXsLRZ; arc=none smtp.client-ip=209.85.210.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="NFeXsLRZ" Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-7c6cc366884so701545a34.1 for ; Tue, 06 Jan 2026 08:28:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1767716895; x=1768321695; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ipCBgG4tAC4eMeyn2MxISmiQcln27ZuBPIR3j6YmQYw=; b=NFeXsLRZLUEsjKzxlyzu9ZxkQr0/PzpowcX98NDDB3FaUPnxjQB/P5uoMetUcgfZIh bHpC8WCoc4E5qC69y4N8f5/USzPxZPMzqExpKmqaeLIR7k8+14rmJcfAiiG98Dt53R+4 1MZBPxYf+dqX4XRH1aDPhlBvuJQ62ekOUALJM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767716895; x=1768321695; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ipCBgG4tAC4eMeyn2MxISmiQcln27ZuBPIR3j6YmQYw=; b=jpzdEWiiR4sf3CFXnRZuZ+CdEgpu3G3BMg8n8EV4SfuGusrm5QUGDn1C555x6zyzQ7 JqoCFsq31MJMXzErOCsh2AXf42PSpWW/oM2cqiXg/bpcZBXu7ZFQABvp6J9VyiB4f8AH c4gro/ElKs/wR+3PXXSIuSRDPJSgyendS1UoAhM0m9zSV3HtlQ35hj0nhCPGjHIPYiOK bJv2pr7NdA6ITHD/Uz9E9zev+V06iZxW2L6MvGJ+BJL5MTQbW/KNdVMkTK3k1niA1JXF JeCP54saPZY8wpjSmT4TpNobHjo6+cVYs/2zX9tTwbz2bJ/rTJ6UZOFVYuyuYJvzsqwg vL9g== X-Forwarded-Encrypted: i=1; AJvYcCXqKlOR4iJBr049RzUwh3LfYheIOBab04BSiCXjQnDnYWAoQtOjovHQatVKTbS+pfAVZVwCeC2+M+dyPcU=@vger.kernel.org X-Gm-Message-State: AOJu0YwV6/AlX8n2AIZiGddn7qUu6JxkkwqEmwVaMN093zW3rgeW7oR9 FDuPO0AyDyLyPdB3FcZVbTcPC9QQnAdQaZUMj3YDipLWUnieZ1a2eRG96QqjOv2uQw== X-Gm-Gg: AY/fxX4LxmaxB6IxACkru/1vketJWwnSYJfKz5Eb9OpU/I/XJT68qBGyY2Dx0avJ2/p IDCWO0Ql0pFc4cnn6dc7ELAeKNBrEPN9xOxw6o64r9th1EdU1lkKLGKLlx0QivhUSnbek8XT/YP 2a5Lh7cJSEpB+nk9BmdSbCyVl74XreQcxtJzdlsP56mca/onJbwFAo2mT7k3mCSWWanq5VP7V+3 t31hKnGxwOZNUXqCf+D4sizHOKKWx5ZzqabWXVoSzORlCQ0klgx9KPZZ5nL/jgeMHBi9psvRH2O 3PLoJbPxy29Wc22gvzWxPor5gDK8eiq+TmgjwvcaD2YbXGLA14GEnu+GeKSCpsuZyLznwYaK4Ny 9bWy/4z50TOBxPpgeiNCydqNOASFBswfD672e7rbQhjEAD0SK+zrRazPPJjDQshDqOWGLT2p9Y+ ICx5r3qYc+apXegAE= X-Google-Smtp-Source: AGHT+IG5unstQaaQcPjn0DiH3jaE5oSh1mV8bO1AA2CK0b4+WePZuy1yQ/9D0Wa0H4hxceCfnxGxBg== X-Received: by 2002:a05:6830:439e:b0:7c7:68d8:f6f5 with SMTP id 46e09a7af769-7ce4663b84dmr2566399a34.3.1767716894875; Tue, 06 Jan 2026 08:28:14 -0800 (PST) Received: from chromium.org ([73.34.74.121]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7ce478af8b2sm1630951a34.15.2026.01.06.08.28.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 08:28:13 -0800 (PST) From: Simon Glass To: linux-arm-kernel@lists.infradead.org Cc: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , =?UTF-8?q?J=20=2E=20Neusch=C3=A4fer?= , Masahiro Yamada , Ahmad Fatoum , Nicolas Schier , Tom Rini , Chen-Yu Tsai , Simon Glass , Nicolas Schier , Alice Ryhl , Ard Biesheuvel , Josh Poimboeuf , Kees Cook , Nathan Chancellor , Petr Mladek , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v9 4/6] kbuild: Support a FIT_EXTRA_ARGS environment variable Date: Tue, 6 Jan 2026 09:27:34 -0700 Message-ID: <20260106162738.2605574-5-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260106162738.2605574-1-sjg@chromium.org> References: <20260106162738.2605574-1-sjg@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable In some cases it is useful to be able to pass additional flags to the make_fit.py script. For example, since ramdisks are typically large, passing -E to use external data can be helpful. Add a new FIT_EXTRA_ARGS variable for this. Signed-off-by: Simon Glass Reviewed-by: Nicolas Schier Reviewed-by: Thomas Wei=C3=9Fschuh --- Changes in v9: - Rename the variable to FIT_EXTRA_ARGS Changes in v7: - Add a new patch with the MAKE_FIT_FLAGS change scripts/Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 28a1c08e3b22..e8da632d5348 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -400,7 +400,7 @@ FIT_COMPRESSION ?=3D gzip =20 quiet_cmd_fit =3D FIT $@ cmd_fit =3D $(MAKE_FIT) -o $@ --arch $(UIMAGE_ARCH) --os linux \ - --name '$(UIMAGE_NAME)' \ + --name '$(UIMAGE_NAME)' $(FIT_EXTRA_ARGS) \ $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \ $(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \ --compress $(FIT_COMPRESSION) -k $< @$(word 2,$^) --=20 2.43.0 From nobody Sun Feb 8 16:35:51 2026 Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC6C1237713 for ; Tue, 6 Jan 2026 16:28:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767716906; cv=none; b=fHLYobVocwlvINddzW2sgShWHlmyQtNjY23WWghtGUqtau7Bw7mU0ehYCw1GAyMAUZJL6z/+KY/oFx4KNRBYzlONbq+2zGkiMBpIW3O5hvUHmk/bk7aefaoHsuz2GjqpW+5ohEFjfX5+l50ukVNHRj0TXUr9StpfeuOL9NCCAjA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767716906; c=relaxed/simple; bh=SCbxLb8RHhDizGXF98nruFxxuJL5jkM2BziKiJ9ozrg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eSyNNYRlYcbHDkW1/zLZEKaOHe4Uq8KIKDg15W7H7iiSreFxDJCYOWh9HCXWUn0dhfI9UhINhIElobxRJlYjLRZXb9qOiBTBEvgzxC5LKaKFA6mIcP/kABaPo9AzE+WM6wae1o3NJPHCrTM4gyMawxxNgS8/0s9AQ4mIHKfdJyI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=FrWgHjyw; arc=none smtp.client-ip=209.85.210.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="FrWgHjyw" Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-7c6cc366884so701629a34.1 for ; Tue, 06 Jan 2026 08:28:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1767716903; x=1768321703; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zwWbmg1LixogQBRKNwlcpVErLo41/Cy9Uo/WwI+a3U0=; b=FrWgHjywSZMpNvHKlSvhUmSvQWeDNWpskrSAjSAWLj1HdoxNoeW5ttl8tq2Az4Kyd/ vP9CMJKqBY6MVkNSecuGgp21egWibUETDEYBtGuggUgIIB43l5m/1KmBAKwvu617aLqK o+aYLX5n8oBOQ1PEvupCNZMGCk7B19RJZH9N4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767716903; x=1768321703; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=zwWbmg1LixogQBRKNwlcpVErLo41/Cy9Uo/WwI+a3U0=; b=rjWh5FsyWy4yu2CuHfzLQjRLlHUbstf4Hs9fgomi/paf9aZCjLmtT8KtSwrLaMJSMv 4zsJ4U6pf4FxiyY7OV1iZ1zfHZ15gaSTeg6pNjtWZ3kGufHCLXKcs+z2kFq/aNMOTBKY TFOaKgDuqEpg2YhiWCPyLZk156fX52ws78XQYom0ASftRxnr80ypuM7BC4c5VHl7rDh+ rY9Qx9tvq3u5n1OFUyJHrKP1ll8opNRh2AEGXmcRw4LYINgTdEFhzfvEc2DVk+Upnh+F eBfVjDMVhTbb/aOihRo2Cjn6oMX7XIFJeq6ow7Yl2sugq+3NVgiWQJCZrZk6vHG/MxhX F61w== X-Forwarded-Encrypted: i=1; AJvYcCWdEKkk8k0rF5t1EeCpUh/qi3Wb+SG3yDVPHYz50UPRHM87s3M8oDgvNCcgwP463xq6wpW6YwPTNjTD4q0=@vger.kernel.org X-Gm-Message-State: AOJu0YxVx5MgaSQnATUrGmNiOMBjf436CYom5RFeGkkE/2jrLk1JTUSM pdzS6EVaBv/R3mPn3Y9KG7xpszESW4TdFiYxgiiJ9R9NhaICUyfJrdVD6+Utu3QsDQ== X-Gm-Gg: AY/fxX7mQpPK0AsOOMX3cQiDgvacXVC4+/l676nLuxIG/vDCb/XcXycdmWYwXINXjyq AhbmFh0e4+APDhov7UwHaFPfK8Xm0i/TbrtP7nC2kkDoPAWBfMEAhkQeV493TUEev00SVwjKZGU 0pbMv4nENLLMUlOwhY9SAVnyEAl14tsQIRy+bH1SPXZ+Bs5vlIgyxgvYcC9DrCWydnuFJR0J0Xg q5qm10NdzbKTztM0EnihnyHjFscRQGFwa11e8TLpt0T9+6AHj1H6N/hQqwiTLQke0DiISxNPOgy XI4cO+ldYNmfWbXeNbvr3v4XZgBb3kbVrVRmelKuqYrw91bhYtsmIv0/rqqVnRw2MFjOp7V6ifa ExFSj+bqtWTRiIpvMleB07Pvh3hXonQGQWHFEPcZTgQzkZ0TqrcwNtaFH0NCnwkeuj8hUPJbqmC mfPRNy X-Google-Smtp-Source: AGHT+IHK40C9f+L2GHswNDmfeFQ2PxZE58CGQqYPlGLUuwSHM6XOss0i030yV2VbmGSNJqRvDCbgNg== X-Received: by 2002:a05:6830:2985:b0:7c7:8060:e197 with SMTP id 46e09a7af769-7ce4672bd11mr2181966a34.34.1767716902698; Tue, 06 Jan 2026 08:28:22 -0800 (PST) Received: from chromium.org ([73.34.74.121]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7ce478af8b2sm1630951a34.15.2026.01.06.08.28.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 08:28:21 -0800 (PST) From: Simon Glass To: linux-arm-kernel@lists.infradead.org Cc: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , =?UTF-8?q?J=20=2E=20Neusch=C3=A4fer?= , Masahiro Yamada , Ahmad Fatoum , Nicolas Schier , Tom Rini , Chen-Yu Tsai , Simon Glass , Nicolas Schier , David Sterba , Nick Terrell , linux-kernel@vger.kernel.org Subject: [PATCH v9 5/6] scripts/make_fit: Support a few more parallel compressors Date: Tue, 6 Jan 2026 09:27:35 -0700 Message-ID: <20260106162738.2605574-6-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260106162738.2605574-1-sjg@chromium.org> References: <20260106162738.2605574-1-sjg@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support for pbzip2, xz and plzip which can compress in parallel. This speeds up the ramdisk compression. Signed-off-by: Simon Glass Reviewed-by: Nicolas Schier --- (no changes since v7) Changes in v7: - Mention xz as well, in the commit message scripts/make_fit.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/make_fit.py b/scripts/make_fit.py index 7ddaf3c0d783..defb87f223d7 100755 --- a/scripts/make_fit.py +++ b/scripts/make_fit.py @@ -50,11 +50,12 @@ import libfdt CompTool =3D collections.namedtuple('CompTool', 'ext,tools') =20 COMP_TOOLS =3D { - 'bzip2': CompTool('.bz2', 'bzip2'), + 'bzip2': CompTool('.bz2', 'pbzip2,bzip2'), 'gzip': CompTool('.gz', 'pigz,gzip'), 'lz4': CompTool('.lz4', 'lz4'), - 'lzma': CompTool('.lzma', 'lzma'), + 'lzma': CompTool('.lzma', 'plzip,lzma'), 'lzo': CompTool('.lzo', 'lzop'), + 'xz': CompTool('.xz', 'xz'), 'zstd': CompTool('.zstd', 'zstd'), } =20 @@ -207,7 +208,12 @@ def compress_data(inf, compress): done =3D False for tool in comp.tools.split(','): try: - subprocess.call([tool, '-c'], stdin=3Dinf, stdout=3Dou= tf) + # Add parallel flags for tools that support them + cmd =3D [tool] + if tool in ('zstd', 'xz'): + cmd.extend(['-T0']) # Use all available cores + cmd.append('-c') + subprocess.call(cmd, stdin=3Dinf, stdout=3Doutf) done =3D True break except FileNotFoundError: --=20 2.43.0 From nobody Sun Feb 8 16:35:51 2026 Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADDBA2EACEE for ; Tue, 6 Jan 2026 16:28:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767716911; cv=none; b=Trvgfd3pJkSC99pzIz/io0eekVm79+UJ5tfqmWxqBX6Uw8uTZ1lWkxhuUrgF1ai9CyL7BQzqkBS42toUXn+1Jl6GwpU7UcVy4Ha3cmU7oju1Y8t+KZj0wvkFqbjWQo4FkO8FToYYF+B3mP/bAFm/6qzkl5vA+4jmvhHiIGC+6Mo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767716911; c=relaxed/simple; bh=6WiN2eHlXWLKbTPNMWm+xNazMd3hRxima/bQfzAVX98=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XPgs6m8Sp1aFovoTMbPsPWvacO/CMspXZ89f3oj9WV79uOAVoQvtBbZ6sGINMj2isWIxgkaDgDP26mWaJhDs0OTzPjp0OmDNK0EsoiBJCQjRnKbwrVP2fPNf8Fr9W/oKcajPJuTK9MvGA7Q2UoXbCQmFN56EOI7s87pOLAUbIvw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Kh2hRudu; arc=none smtp.client-ip=209.85.210.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Kh2hRudu" Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-7c6da42fbd4so685678a34.1 for ; Tue, 06 Jan 2026 08:28:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1767716908; x=1768321708; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8l+PMSx1dMo0V8MdT06UoUXh18bncmRY0mnlTCdtsng=; b=Kh2hRuduSY84yycG3gd3sGFEm4Ibo9kqIgp+x9NKV1TK/t+ihSIcYwpsFtrF4hNIhV 5IV06XWn9VK+wQl8pYQIx+IA24Y6rO6OTi+frw8tsn4GWMfFCQF0cBggET9nzxmGijtF qD2QJJ9M/Cc6PcCfbhPrYV1PUMChhFuMkB1u8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767716908; x=1768321708; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=8l+PMSx1dMo0V8MdT06UoUXh18bncmRY0mnlTCdtsng=; b=ohNcLe0+yddwHeoVnMFxfx/16lno/eoLG+oH9EBg0Fp3eZuARBJnZSIb6tDjh9aj/c GhDgeV4crdSemqp6mMhspyQpUmlkt6viBNNqlHWNrq31cjbgNUKVeiwqxkf9fvgJld0u iTelpyEEQtYfbneUniGoqIF7wFOBNSYkq28+P8tqSf6e9FsqKXfIxXQbUfyNxMtEBeR5 5Te+6tYHk/G/28f9wUzzFJt07Q/AHYFBmFCNC9jML2Qf5Yfs1ZNcyVF1tQLhTl87DwnM gHBcOawOHZuchqXrO4jTQLIWMOX6K2iFZeCI5LZ61Jd5EzjqnOfNCCJ6O4M4VXcJ3lhG MZfw== X-Forwarded-Encrypted: i=1; AJvYcCWo5nIdV5vmbC53L8zylYs5FMINKtQTBwi1NfzPHjLKNdl6ucZ2ZLZcmXr+yl1wKXeNm0U8DsV0O/++tHw=@vger.kernel.org X-Gm-Message-State: AOJu0YzcjFSVYg23v09qeMnou8Lpgogr6AQM09fuDlMFp2/gTN4z08Os LmRi+MCmJnMw2FrskmhCFc03MvhoJa1+WvasQqulFM9vK1Sa1wCeQUV0AuxwXUfkkQ== X-Gm-Gg: AY/fxX6Wl6ekF6r3vRkP0cYfxCEhGMfCJIgFtwBTETkYr9v0YayXPLmIbKdZvtxWh7J fe1O40lVFU32fkjqly++iIya+P1nPr2NvF0s9z9/3b3VJjmPPr50Gp7mJ/Ortc85dOfKYHgtoDQ gxfSIMeRz7+XOmSOn7X37gjGpUF1raEHLFgrBvCP1iThflM0S0fCXcVlhk9BhAXgFWDnvw+mISK a91Y9KuQv7ghCRwAIcYUTCqCA2zvTsx4Z3LnhnlNBuNOvLTKwD/1lDsO6QyQ6QR3sgu0H7toz61 AgHVqrc8x/Y+qLxxkvRxM9T6vseco+N8//WjZlwoi5NSNhz9tHAAG+GbyfO67Wo+kJbexuivqE2 fGyU3d0oFuLqxQna8hlONRIgYBMMTszMNwFgJ1cOcR8sOUa23NHtCRyNSBcUiLp2TvTJqwJbaCs DDGUx/ X-Google-Smtp-Source: AGHT+IG1N3IU6CP3R1t+h3+E8Tm3EouijsvGbZCZNnDD2IeLB1xOLNvsC4ZitJZZxIKks46Ly/KPWQ== X-Received: by 2002:a05:6830:4489:b0:7c5:2f8f:2527 with SMTP id 46e09a7af769-7ce4654f12fmr1812171a34.0.1767716908552; Tue, 06 Jan 2026 08:28:28 -0800 (PST) Received: from chromium.org ([73.34.74.121]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7ce478af8b2sm1630951a34.15.2026.01.06.08.28.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 08:28:23 -0800 (PST) From: Simon Glass To: linux-arm-kernel@lists.infradead.org Cc: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , =?UTF-8?q?J=20=2E=20Neusch=C3=A4fer?= , Masahiro Yamada , Ahmad Fatoum , Nicolas Schier , Tom Rini , Chen-Yu Tsai , Simon Glass , linux-kernel@vger.kernel.org Subject: [PATCH v9 6/6] scripts/make_fit: Compress dtbs in parallel Date: Tue, 6 Jan 2026 09:27:36 -0700 Message-ID: <20260106162738.2605574-7-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260106162738.2605574-1-sjg@chromium.org> References: <20260106162738.2605574-1-sjg@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When there are 1500 device tree files it takes quite a while to compress them. Do it in parallel. Signed-off-by: Simon Glass --- (no changes since v8) Changes in v8: - Drop erroneous line 'kbuild: Allow adding modules into the FIT ...' scripts/make_fit.py | 56 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/scripts/make_fit.py b/scripts/make_fit.py index defb87f223d7..e923cc8b05b7 100755 --- a/scripts/make_fit.py +++ b/scripts/make_fit.py @@ -37,6 +37,7 @@ as U-Boot, Linuxboot, Tianocore, etc. =20 import argparse import collections +import multiprocessing import os import subprocess import sys @@ -225,15 +226,31 @@ def compress_data(inf, compress): return comp_data =20 =20 -def output_dtb(fsw, seq, fname, arch, compress): +def compress_dtb(fname, compress): + """Compress a single DTB file + + Args: + fname (str): Filename containing the DTB + compress (str): Compression algorithm, e.g. 'gzip' + + Returns: + tuple: (str: fname, bytes: compressed_data) + """ + with open(fname, 'rb') as inf: + compressed =3D compress_data(inf, compress) + return fname, compressed + + +def output_dtb(fsw, seq, fname, arch, compress, data=3DNone): """Write out a single devicetree to the FIT =20 Args: fsw (libfdt.FdtSw): Object to use for writing seq (int): Sequence number (1 for first) fname (str): Filename containing the DTB - arch: FIT architecture, e.g. 'arm64' + arch (str): FIT architecture, e.g. 'arm64' compress (str): Compressed algorithm, e.g. 'gzip' + data (bytes): Pre-compressed data (optional) """ with fsw.add_node(f'fdt-{seq}'): fsw.property_string('description', os.path.basename(fname)) @@ -241,9 +258,10 @@ def output_dtb(fsw, seq, fname, arch, compress): fsw.property_string('arch', arch) fsw.property_string('compression', compress) =20 - with open(fname, 'rb') as inf: - compressed =3D compress_data(inf, compress) - fsw.property('data', compressed) + if data is None: + with open(fname, 'rb') as inf: + data =3D compress_data(inf, compress) + fsw.property('data', data) =20 =20 def process_dtb(fname, args): @@ -300,6 +318,11 @@ def _process_dtbs(args, fsw, entries, fdts): """ seq =3D 0 size =3D 0 + + # First figure out the unique DTB files that need compression + todo =3D [] + file_info =3D [] # List of (fname, model, compat, files) tuples + for fname in args.dtbs: # Ignore non-DTB (*.dtb) files if os.path.splitext(fname)[1] !=3D '.dtb': @@ -311,11 +334,32 @@ def _process_dtbs(args, fsw, entries, fdts): sys.stderr.write(f'Error processing {fname}:\n') raise e =20 + file_info.append((fname, model, compat, files)) + for fn in files: + if fn not in fdts and fn not in todo: + todo.append(fn) + + # Compress all DTBs in parallel + cache =3D {} + if todo and args.compress !=3D 'none': + if args.verbose: + print(f'Compressing {len(todo)} DTBs...') + + with multiprocessing.Pool() as pool: + compress_args =3D [(fn, args.compress) for fn in todo] + # unpacks each tuple, calls compress_dtb(fn, compress) in para= llel + results =3D pool.starmap(compress_dtb, compress_args) + + cache =3D dict(results) + + # Now write all DTBs to the FIT using pre-compressed data + for fname, model, compat, files in file_info: for fn in files: if fn not in fdts: seq +=3D 1 size +=3D os.path.getsize(fn) - output_dtb(fsw, seq, fn, args.arch, args.compress) + output_dtb(fsw, seq, fn, args.arch, args.compress, + cache.get(fn)) fdts[fn] =3D seq =20 files_seq =3D [fdts[fn] for fn in files] --=20 2.43.0