From patchwork Tue Jul 25 03:51:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manoj Sai X-Patchwork-Id: 2944 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 9E1983F37D for ; Tue, 25 Jul 2023 05:51:29 +0200 (CEST) Received: by mail-yb1-f199.google.com with SMTP id 3f1490d57ef6-cbcffb18afesf4701659276.2 for ; Mon, 24 Jul 2023 20:51:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1690257088; cv=pass; d=google.com; s=arc-20160816; b=W9mMoZ9CD2w2gp3gqqf7GIdaZgRgy72fb2i0q7OAKBKUyVeXSuDeX8aglw5swcwhx+ tYFgTktUe3r0nk1vzjNVQ40BP2KItxgYW4NHLylivXT4z1HgQKB0kl3wuKMkPq3yxz/D n40C8hoURGYT1MZ5iM1yTmZGFUyZ0RkA+ZmKs+NmKYpG6uyRmk3Niu/tWGu0W7/8aCA4 lHk2zoaUernMO3foFiBc3wS4FKP1mzjwPoVZC8Dy86wVva06rrnIgUM+iH8Ik+CtPA4E 5XUZIr7FgFpUZTHIXgw3si6pWWkzhab17ymqsJGZj8GsRUMO+L+yrNk7KZEPGdSencj2 sbIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=1Kys+wblqTGpcDsjjUtHtQmBaF6hjO+Dmmh42z6Y/zM=; fh=ZtU/xXInpIejK4L8YauyoYBdqqK+nRzYacYy4t7Zzbc=; b=Xi2YXaCXNjRjwNOyJT1URcLuss0HJZiGenomAEE9XiVHh2oVt/fvhjG7x3RVZyeNaV JZmcPYZ5m0HhzIV0fpZT5NgZ66VOuXeY6xgd9RDaCxw8ljbEt8eF2Ym5kPjAspaa88oX 2DiRZsovRUr7sMySHfePCgga6sJEIM3DzZpTyScPlIw3rD9WYLhqLRhDBQZicaPY+AHv TD2w6Y684rR9dQwHZhEow1UehKM/Y4GdVFYFOg42YmSeC1n1o97i6e3luEh2y0GHNGe1 48Ep0tX1GUuTrwHQfiPxcNVmDGF97QNwwKiPKVNni5cW0nVTjOX8WxWm2Y/yTw2Owow0 RNqg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="IQ9vT/fZ"; spf=pass (google.com: domain of abbaraju.manojsai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=abbaraju.manojsai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1690257088; x=1690861888; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=1Kys+wblqTGpcDsjjUtHtQmBaF6hjO+Dmmh42z6Y/zM=; b=lRJw5gln7vxPUC22YFTTsUdGjbgCE6NCo3sgaBvEwwVkG+sQtyx14/cXmNvvF6XuqK ulRK7EcEKi8dYCxz4VFalx1dr3C848ZH4iwayCot3dV4sGfsALgePznEKfzsUZbzPhll NBghAAkANeKV1c3gQ7jXZhavr4ImMWkDn2jN4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690257088; x=1690861888; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1Kys+wblqTGpcDsjjUtHtQmBaF6hjO+Dmmh42z6Y/zM=; b=VB8IQ4hBeuGDwid5DwqplvDLUY6Q6Ob4ovSsHo+2BGQ+kBhGpHN7AWJZ4j3ZCswDDe IfJXJ+pNWVtM15smrCoYeqoaGTn+t6AWDVau/TiEVG2OVLElJRJre1Sor0edqoEpRZDg 4xX+BxycFM1CWBro1tmyL/pSW+PebtELtFbnq2F82339eGDm3k7J/7m5YhltqowOSvgz xY/SK1aEWpYvIhI8hV72macBQ3xMIW2bhPYeM5RrrrMfN/b++Qulj246pkroHd6w0e3I ZZPKQPtdYqyd01ZPp5wUohq3BTAO02ciXfHTvZrzu8bhQiFV/2tRvTAMvWAOaiARHteT OESw== X-Gm-Message-State: ABy/qLb1i64i6Nd8nR8nIkrj6iv8gg4FtZurXsh6Kk5NjYFSYDpMd3PD bl9t86O6HSGEFgfIq+fxgJmjG0gf X-Google-Smtp-Source: APBJJlEMmX+3Mg1CJPjwrXQHlkq8A0aS4RySnp4v67wFTC8mHjPY6zoajOmbxCGRc7g3GGAS7aRorw== X-Received: by 2002:a5b:1c7:0:b0:c60:3ea7:2305 with SMTP id f7-20020a5b01c7000000b00c603ea72305mr8334091ybp.26.1690257088680; Mon, 24 Jul 2023 20:51:28 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6902:124a:b0:cd0:61bf:eb6c with SMTP id t10-20020a056902124a00b00cd061bfeb6cls856162ybu.1.-pod-prod-09-us; Mon, 24 Jul 2023 20:51:28 -0700 (PDT) X-Received: by 2002:a0d:c9c5:0:b0:583:51de:e219 with SMTP id l188-20020a0dc9c5000000b0058351dee219mr7780019ywd.17.1690257087857; Mon, 24 Jul 2023 20:51:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690257087; cv=none; d=google.com; s=arc-20160816; b=pClreZcyGfDtP1mvnHQherFa1j6JI4X7s2i/GMHyIWCFzWWXUyefCJ979Un1oxiK8L +89lC4ejstVgiNCdgQN3UIN6+OxOHbIu+iVrpugqsCuWrY4mLxOnsJsOs/zGu3whlcRi sQxUcBzPExGwwUc2RECIL4RJpqJWOKsURip4zuf6RtTP1uxHz5l/rWqGA+ojA2qhzxW6 +AdmHvVssLBbfe4kVynilwYyRIGr42IDrWxxn07ySPt/TWzqr1p0ijCK1+HePMmNRoyP cCn5HK0vQzV1V3tP28KWTgPwe1dlf3qtroJGRsVYbQNVOOfqi0MBtkRxBYK0b9Nl9ABE YRTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=VVvm8TQGzRMMrDOBUY2u6TjgURnLNSkn0nDML4vqTu0=; fh=ZtU/xXInpIejK4L8YauyoYBdqqK+nRzYacYy4t7Zzbc=; b=pzzzo3GL6seWSEESpEsUjpkVPYCo2WOpFkT2EbB/VXLXlWYJsbgC0zDzbCEygGN2gp WbfBD2bUguYhrnWS3+VxNmCiUQAfBxOp99/y+pLq+QNR2pb7x2hTUdluKget3ODcAbuV kuMAV3xxHZTbZjIy99rgFYQDDc58sqCLiH7ZcWoLzs+gVaGCpvxR1wEGCwIQA9xQZoma c070ppRm0OIa5RAdfscn+2l1DNXirePDmXHgPaPIhPF9H7oT8NzRJ5u+L9TtyNZviu39 CBKh14XSQnAnCM9l2qm6J91NTY3NY0eYCafYIp/pr1GY9yN/D4XRAKR+vgV9/3w8Fz5X V+Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="IQ9vT/fZ"; spf=pass (google.com: domain of abbaraju.manojsai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=abbaraju.manojsai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id i185-20020a8191c2000000b0057000a48f13sor3005243ywg.1.2023.07.24.20.51.27 for (Google Transport Security); Mon, 24 Jul 2023 20:51:27 -0700 (PDT) Received-SPF: pass (google.com: domain of abbaraju.manojsai@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a25:2f85:0:b0:d0a:7e3:fa0 with SMTP id v127-20020a252f85000000b00d0a07e30fa0mr5350203ybv.53.1690257087461; Mon, 24 Jul 2023 20:51:27 -0700 (PDT) Received: from localhost.localdomain ([49.204.25.25]) by smtp.gmail.com with ESMTPSA id j18-20020aa78d12000000b00679fef56287sm8658399pfe.147.2023.07.24.20.51.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 20:51:27 -0700 (PDT) From: Manoj Sai To: Simon Glass , Philipp Tomsich , Kever Yang , u-boot@lists.denx.de Cc: Da Xue , dsx724 , linux-amarula@amarulasolutions.com, Jagan Teki , Suniel Mahesh , Manoj Sai Subject: [PATCH v2 4/4] spl: fit: support for booting a LZMA-compressed U-boot binary Date: Tue, 25 Jul 2023 09:21:01 +0530 Message-Id: <20230725035101.281325-5-abbaraju.manojsai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230725035101.281325-1-abbaraju.manojsai@amarulasolutions.com> References: <20230630121146.513345-1-abbaraju.manojsai@amarulasolutions.com> <20230725035101.281325-1-abbaraju.manojsai@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: abbaraju.manojsai@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="IQ9vT/fZ"; spf=pass (google.com: domain of abbaraju.manojsai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=abbaraju.manojsai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If LZMA Compression support is enabled, LZMA compressed U-Boot binary will be placed at a specified RAM location which is defined at CONFIG_SYS_LOAD_ADDR and will be assigned as the source address. image_decomp() function, will decompress the LZMA compressed U-Boot binary which is placed at source address(CONFIG_SYS_LOAD_ADDR) to the default CONFIG_SYS_TEXT_BASE location. spl_load_fit_image function will load the decompressed U-Boot binary, which is placed at the CONFIG_SYS_TEXT_BASE location. Signed-off-by: Manoj Sai Signed-off-by: Suniel Mahesh Reviewed-by: Simon Glass --- common/spl/spl_fit.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index d728ac71fc..208d2f761e 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -246,7 +246,7 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, debug("%s ", genimg_get_type_name(type)); } - if (IS_ENABLED(CONFIG_SPL_GZIP)) { + if (IS_ENABLED(CONFIG_SPL_GZIP) || IS_ENABLED(CONFIG_SPL_LZMA)) { fit_image_get_comp(fit, node, &image_comp); debug("%s ", genimg_get_comp_name(image_comp)); } @@ -280,8 +280,8 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, __func__, fit_get_name(fit, node, NULL)); return 0; } - - if ((IS_ENABLED(CONFIG_SPL_GZIP) && image_comp == IH_COMP_GZIP)) + if ((IS_ENABLED(CONFIG_SPL_GZIP) && image_comp == IH_COMP_GZIP) || + (IS_ENABLED(CONFIG_SPL_LZMA) && image_comp == IH_COMP_LZMA)) src_ptr = map_sysmem(ALIGN(CONFIG_SYS_LOAD_ADDR, ARCH_DMA_MINALIGN), len); else src_ptr = map_sysmem(ALIGN(load_addr, ARCH_DMA_MINALIGN), len); @@ -329,6 +329,16 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, return -EIO; } length = size; + } else if (IS_ENABLED(CONFIG_SPL_LZMA) && image_comp == IH_COMP_LZMA) { + size = CONFIG_SYS_BOOTM_LEN; + ulong loadEnd; + + if (image_decomp(IH_COMP_LZMA, CONFIG_SYS_LOAD_ADDR, 0, 0, + load_ptr, src, length, size, &loadEnd)) { + puts("Uncompressing error\n"); + return -EIO; + } + length = loadEnd - CONFIG_SYS_LOAD_ADDR; } else { memcpy(load_ptr, src, length); }