From patchwork Tue May 21 06:51:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 13668937 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 41C704F885 for ; Tue, 21 May 2024 06:51:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716274278; cv=none; b=sCV1DZegxi6Y2t3vyZ2TaEP97utTSvec1vLpng3MoVJTVcsWd+nvYlQTKwiUHX+NxhpkKTFLeWqUSm5cKrG7croGdufAw1VL7wr67/WN6VhQg4bZwP+mnycfw9JV4jRxyA+kdUBLS92z9tksoLlDwDZNFc4cKOQDP4Ml3N67Oww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716274278; c=relaxed/simple; bh=tlZwiytyy7GUSuUxcwpKbDSIVmkSh/Ozgpm8JddXkGk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cylqZvEcIJjSj8LkBE3XBhN9WiQ1AbHlzuPC1baid3beTNoBUbi8YKzsPXDr8h/PX4nKBUNFlnSOJty40S94/Wo4ZkO+5GN6+qKj3LcVuciN5Afzm6+h9KSMLUjZ4A9x7NP0+UvT3byOo0hqtlZ/7rNHxnbBYk7BO+MoqTQYFSE= 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=eJyuYSfR; arc=none smtp.client-ip=209.85.214.173 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="eJyuYSfR" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1ecd3867556so100902835ad.0 for ; Mon, 20 May 2024 23:51:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1716274276; x=1716879076; 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=LiOnX2/+/NaKrnz1dB8iIjPpDkqOamcc1T4O8qQETy8=; b=eJyuYSfRkvrN0xS5Zvk/jVk9fBGIH44YvVVYl2mlnexQ6UJLNc85cwLaZEU0NFMd3r DXIpqh6gA8m0s1kKtBFuSESXviSsKUQg+tcHv2EPx5Oc67w3kpspbJX9RqYGdESjSsZX yf/BKVlFeGbnV/mVXC8YoOuZA9euGvpF3yJ2A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716274276; x=1716879076; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LiOnX2/+/NaKrnz1dB8iIjPpDkqOamcc1T4O8qQETy8=; b=dOjN9Rq7PLPhO/KibN3C9St6BILtsZ7A2TNU0Djk141PDkUZ1SIlZWtJlRz/nJDtdn 6OfJbi4Rkka48pUdgvD0jFVE7SibuTyer2bXHODZ+H5Y8mSz4G8ApgGW0SycI4M4pN9R SG9sQuzVg+Hu0bHwPfAVY+6jdtofj6z4/IhIBH4K+COf8cKjs1XFjxf+ZMHuMJ0azcoA f6G1SupM9liSXKhCRfaMMIZSsmxs+ouWlDplgG7hBSmCHE3QQSuay0vVQBGd68EpNl0g hIYjgnlO7qL6ddvDg02JHqbnlEm9bqRYeMb6tEUJiIINTry0s3fK5JQQ74UmFPdmZUO0 yYnQ== X-Forwarded-Encrypted: i=1; AJvYcCXXHnxHbbwwykNtrGwvYDRSg6LkOQi5XNAnTWa4I2YZe3dfGK99ntmPA1HaRpAXl7REgDXHTw+waH0FoZi6riaveLQcPP/58kaSPzdB X-Gm-Message-State: AOJu0YwwAXQcOst0Qd7TsHIvjEz2HoXnxFC3PDOwZ1eAcF7PKbp8FZxg 7E7PFNVNLkbhl0MK3KRZTiLoVPy0NieYdrAeqUBSanu6InwUBMwJ6lioVPn35A== X-Google-Smtp-Source: AGHT+IFRGCP8dFUwAhY6qs1u8kwpNhPXOrM44sdM7NC90XH1PWwnNaqP5n/f4xBogtT8DcTByxtu5g== X-Received: by 2002:a05:6a20:9746:b0:1aa:6a28:cf6e with SMTP id adf61e73a8af0-1afde1c5506mr29051396637.48.1716274276630; Mon, 20 May 2024 23:51:16 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:f8a5:77aa:5a0d:e30c]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f30644ad48sm23100985ad.169.2024.05.20.23.51.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 23:51:16 -0700 (PDT) From: Chen-Yu Tsai To: Simon Glass , Masahiro Yamada , Nathan Chancellor , Nicolas Schier Cc: Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: [PATCH 1/2] scripts/make_fit: Drop fdt image entry compatible string Date: Tue, 21 May 2024 14:51:04 +0800 Message-ID: <20240521065107.30371-2-wenst@chromium.org> X-Mailer: git-send-email 2.45.0.215.g3402c0e53f-goog In-Reply-To: <20240521065107.30371-1-wenst@chromium.org> References: <20240521065107.30371-1-wenst@chromium.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 According to the FIT image spec, the compatible string in the fdt image node or any image node specifies the method to load the image, not the compatible string embedded in the FDT or used for matching. Drop the compatible string from the fdt image entry node. While at it also fix up a typo in the document section of output_dtb. Fixes: 7a23b027ec17 ("arm64: boot: Support Flat Image Tree") Signed-off-by: Chen-Yu Tsai --- scripts/make_fit.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/make_fit.py b/scripts/make_fit.py index 3de90c5a094b..263147df80a4 100755 --- a/scripts/make_fit.py +++ b/scripts/make_fit.py @@ -190,7 +190,7 @@ def output_dtb(fsw, seq, fname, arch, compress): Args: fsw (libfdt.FdtSw): Object to use for writing seq (int): Sequence number (1 for first) - fmame (str): Filename containing the DTB + fname (str): Filename containing the DTB arch: FIT architecture, e.g. 'arm64' compress (str): Compressed algorithm, e.g. 'gzip' @@ -211,7 +211,6 @@ def output_dtb(fsw, seq, fname, arch, compress): fsw.property_string('type', 'flat_dt') fsw.property_string('arch', arch) fsw.property_string('compression', compress) - fsw.property('compatible', bytes(compat)) with open(fname, 'rb') as inf: compressed = compress_data(inf, compress) From patchwork Tue May 21 06:51:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 13668938 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 8A09C51C43 for ; Tue, 21 May 2024 06:51:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716274281; cv=none; b=m2Ve7OjKuHwIqbEwoP92M1mWKyxkR7j1+mPEeuE8THSOU75BxSxCx4MWfD/Y879FYi3E8W14lD/TsHR59oie53UlO01DnEsWG8Z5g3o14CWrngD+pXTAcaZyBG7vnfyiFZ6Wrt8BZzRr/0SLMRlaIrq2vKiwXEfTTVNqq4xc95Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716274281; c=relaxed/simple; bh=OH4cLngpr688D6c6flc0xYeuNkIFvmRIGHw0APLbxfU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RqfsgtBKsSGpKVciE6yKl7Pjj4h6WZk8mWXa3QViwAhRs06sLdNLDBWLFO56j25En0bwIyGxCQLD6MYLGXDduJ9/t0c8LPRtmwBtJNbPlRVfaPsISSwddJU2oT7FmdNsYA9ryRAFkSDL0/NkSZ7Z6RdJytM4jGswOVopD1fp/+Q= 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=mPHjtAxr; arc=none smtp.client-ip=209.85.214.181 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="mPHjtAxr" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1ee7963db64so31561915ad.1 for ; Mon, 20 May 2024 23:51:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1716274279; x=1716879079; 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=vOkWGMmTQVEt7UvShsfEX9Q7OP2nXlbFbaBQoutTKvo=; b=mPHjtAxrxDL2UF6NtlHhTc8chXwN6GdzHjoecsCaQg41uxN5ztOYmcZLbjzNRWuNIS DOQvYYjUa6mFMNcdklStrv0BYe9yg85cQ3+Nu9yCnvk7G2VJsvJ9QIa9T6UcuTYYClBA WumyskxqVLCSfWzfrbwvZdaBn/pngV+DBCwIw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716274279; x=1716879079; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vOkWGMmTQVEt7UvShsfEX9Q7OP2nXlbFbaBQoutTKvo=; b=vMpS2MQ/XNOauTdNh/HjHgw0eLZWF5MU9wSnbyuUfE3SPES239bU8mfBvQ9WTeIRCU 9ei8d8YK5+Ip58zqGEldiG57N/yGnHxwUDxXgLEVnz3sYfFSUfu2k7x1scxkPJwPclr9 UofTOYGfWEeeoQ0KBmFWRmEzr6vMbMVagRaJd9ZQCb601mhI9lKdmtYZaqEsZnrXvD7f e/0GBQNqaJrhWvxT/dxFP/AmysJ5ALaiGHKHw3hv0uMfJxCUIIVISJIbugjS5UvB7/75 2TK7JTAVm6ka0m5ZquUnMm5eV6HuLAhFAP33LRjq/KHsJbClUZaYTP4osu5Hu++dOFO4 9kag== X-Forwarded-Encrypted: i=1; AJvYcCXTdjIULOL1Rome1p49QGwh+V7WqF9+AZyb7Go+rDE9mYfWTSLvJfVIxrYGPvS7aSw+K7DUjm5EVGHxbBnuHLhsvbrFQ1C4LUK94Bcy X-Gm-Message-State: AOJu0Yy8wMMjkmXiIBn57LeCQdqZRcxhHWpK9kO7WpjTrON+Avcuk1gy G8CScduCqopgJQ1s3oFE+pt8k+RuJDZY7DjFhYtBep/LhlUhEbx/Pc/cWUnkbg== X-Google-Smtp-Source: AGHT+IEe1eZFm8OQhme98CfuDT2vPG0NOgmo3lGuwwSKsHDgjQxj8mKdLiIdPioZKeAtoWh2bQX69g== X-Received: by 2002:a05:6a21:998d:b0:1b1:d823:3ea2 with SMTP id adf61e73a8af0-1b1d8233f35mr6544797637.12.1716274278853; Mon, 20 May 2024 23:51:18 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:f8a5:77aa:5a0d:e30c]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f30644ad48sm23100985ad.169.2024.05.20.23.51.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 23:51:18 -0700 (PDT) From: Chen-Yu Tsai To: Simon Glass , Masahiro Yamada , Nathan Chancellor , Nicolas Schier Cc: Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: [PATCH 2/2] scripts/make_fit: Add option to disable compression for DTBs Date: Tue, 21 May 2024 14:51:05 +0800 Message-ID: <20240521065107.30371-3-wenst@chromium.org> X-Mailer: git-send-email 2.45.0.215.g3402c0e53f-goog In-Reply-To: <20240521065107.30371-1-wenst@chromium.org> References: <20240521065107.30371-1-wenst@chromium.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Old bootloaders found on RK3399 and MT8173 based Chromebooks only support compression for the kernel image in the FIT image, and not the DTBs. While compression could be disabled, aforementioned bootloaders also limit the kernel image size to 32 MiB, making compression necessary for any practical setup. Add an option to disable DTB compression to support this case. Signed-off-by: Chen-Yu Tsai --- scripts/Makefile.lib | 1 + scripts/make_fit.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 9f06f6aaf7fc..84d9b0166cc0 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -522,6 +522,7 @@ quiet_cmd_fit = FIT $@ cmd_fit = $(MAKE_FIT) -o $@ --arch $(UIMAGE_ARCH) --os linux \ --name '$(UIMAGE_NAME)' \ $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \ + $(if $(FIT_DISABLE_DTB_COMPRESSION),--no-dtb-compression) \ --compress $(FIT_COMPRESSION) -k $< @$(word 2,$^) # XZ diff --git a/scripts/make_fit.py b/scripts/make_fit.py index 263147df80a4..626cf3422079 100755 --- a/scripts/make_fit.py +++ b/scripts/make_fit.py @@ -22,6 +22,10 @@ the entire FIT. Use -c to compress the data, using bzip2, gzip, lz4, lzma, lzo and zstd algorithms. +Use -C to disable compression for DTBs regardless of the setting of '-c'. +This is intended for old bootloaders that support compression of the +kernel image but not the devicetree blobs. + The resulting FIT can be booted by bootloaders which support FIT, such as U-Boot, Linuxboot, Tianocore, etc. @@ -64,6 +68,8 @@ def parse_args(): help='Specifies the architecture') parser.add_argument('-c', '--compress', type=str, default='none', help='Specifies the compression') + parser.add_argument('-C', '--no-dtb-compression', action='store_true', + help='Disables compression for included DTBs') parser.add_argument('-E', '--external', action='store_true', help='Convert the FIT to use external data') parser.add_argument('-n', '--name', type=str, required=True, @@ -247,7 +253,10 @@ def build_fit(args): if os.path.splitext(fname)[1] == '.dtb': seq += 1 size += os.path.getsize(fname) - model, compat = output_dtb(fsw, seq, fname, args.arch, args.compress) + compress = args.compress + if args.no_dtb_compression: + compress = 'none' + model, compat = output_dtb(fsw, seq, fname, args.arch, compress) entries.append([model, compat]) finish_fit(fsw, entries)