From patchwork Sun Apr 21 09:53:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3080 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id DAFD540F88 for ; Sun, 21 Apr 2024 11:53:59 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-56c1b105949sf2787883a12.3 for ; Sun, 21 Apr 2024 02:53:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713693239; cv=pass; d=google.com; s=arc-20160816; b=Gjlv/OWKTZp/jOSdJEsOcP0zlOs3VW8E39pvYs1osnHGIh6psnOc+0aaJ2jHtQmj8A d1hCh8B69IEcboPpVNKlGwrmHyCCjscYTFrDU5PyBKzWP0wIusv4aE5UScfxtBvanem3 gNlrGpLnXD52givvni++Sgr1/fYCOcbsqgGssdcSUsGXRqOahv0jJtLJFZXajrZzKG0S 0ir1BIN1qHr1BgDKrkwjkDxqmgDgIUXTahG2ZkVNqFc7xeoF9ktfUw/PihBCVdCRzx8Z 748aqZZX3dSj43Gmh7xr974OfvZUPnc5cDJbBgC007aVwuDQDuE9ho5lYP3x2v/ojlDd yB9A== 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=eM89Mec7UskAs2CKiOe8VEB33d0QRpW3MztLwllvBCU=; fh=PLPEjrR/HUtC9IwzCDQbdXVJg/SNzn32sIq+abef4iA=; b=anV7NS9uBFEK1PE8/Qiwm4pabu6JsbN5YVQNJo/Ek/X4tQqe/H00AXadmjwZ1F7ffK MzD+L7DzKAp9R19A4oR1eYVnf6EQoK+e9wQP6gxKq2UCCoWA/DrVBMqCrcqiMv5zie8+ fX6OGbvnjVWoIsavA2MBNqhURECPVKCXohotV7yWvxasmroUcyIE14rBrAH0vAGuYduU rZXMkcL7t8ejkAWK+K+4+Ux95iZ6VSH2DlwWpZfEhvCdfS9vYMCWN/SsfNK7VwO6wPcV W8Is/UcOWlTQ+Zd5uaGEIoo2KNo5M/UIc0ORZZ8T29gRD07meoVMJVpbzitmvz4Pj6WQ iNkw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=P3UrW+1d; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@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=1713693239; x=1714298039; darn=patchwork.amarulasolutions.com; 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=eM89Mec7UskAs2CKiOe8VEB33d0QRpW3MztLwllvBCU=; b=B1btccBhfVRjctDnNxGrhHFJP+Wbjisr1mwtRAbsanAS5nF7NXHsVO6rj/cwIMZy4q GCM+vZ21s0sslXg6qfAHLpxy6VwJpaELewUwLXHAPap21kMXCYRfR1UqJTtr5B1W039z cjP3bs1sPr9zxTuzJayXDFfdN1Avcga4+qTg0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713693239; x=1714298039; 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=eM89Mec7UskAs2CKiOe8VEB33d0QRpW3MztLwllvBCU=; b=AZpO7tnkhJlafaW1U/LtlODhvJAbL4/1GCo/j81epkhQxHlMGa2sBuMe3iYn40BQ7U /s9oOTAQzL09PzPpTDyob2xLv3glYJw7u7t4cAnLM1NkvFryiLKj40r93aOZ2Ic5Cm81 PN98CHQwoyCiUpNsvPjUlWh+YA4fUFrmM5KmvzwuTDp0OjN/gWAchzCnnR8Q/p0mMUIl +tyrUwZ3qa8hV2f6EArNEDvODuHtReaTBoXNmLewLcVlWakCjzcG4OGwhsjRWSyZUxRI OeK8RZm4dBYOKqITTNpCNDS8xeMpRVRXIWCWf6i+ztaZMxEG2DetvVTgCjlyC/8CTjSv gLYQ== X-Forwarded-Encrypted: i=2; AJvYcCU+EDVH55GwededQpYuSF/rO194I4yGYD/l8B8RrvhI8966n6W3gZ5eJ7GAVRqMvenZQu5qwUiwvVx2mpEMfRmWdztcAK1dnzxDvVhPGfgWntI7I/yd9OU9HJbfkg== X-Gm-Message-State: AOJu0YxJnde0tS0X3G6KLEH42I8Y29csKWWDZlACc3HiKKR4azQzSO6p WHiMqbnNT5B0tOQnH05XIevRDhuD/sCWv0TM2xGCuPrUWTUVCwhkYP5ntRmVcyNDgQ== X-Google-Smtp-Source: AGHT+IEdJgJF2SnSXSBf04cB6VROdOAvuaOWSzG3LjM6GTJKqFnAOMHTc5tCl5qZ/nXH7TbB3wmMnQ== X-Received: by 2002:a50:cd8c:0:b0:570:5b38:1bf2 with SMTP id p12-20020a50cd8c000000b005705b381bf2mr4357298edi.30.1713693239441; Sun, 21 Apr 2024 02:53:59 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:3890:b0:572:40d:913e with SMTP id 4fb4d7f45d1cf-572040d922els101584a12.1.-pod-prod-04-eu; Sun, 21 Apr 2024 02:53:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWulPGGCCqm2tt7cIoxeoDQSv5XbuHkd5uTl7EjBS2KWEXFNnyu0NiyZsQjMn7e03oE4E5tUh5Yx9U4kMSVp7XvghoE/S+GXPqsC6UFseOnATcT X-Received: by 2002:a50:cdd7:0:b0:571:cb02:418a with SMTP id h23-20020a50cdd7000000b00571cb02418amr3948396edj.40.1713693237822; Sun, 21 Apr 2024 02:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713693237; cv=none; d=google.com; s=arc-20160816; b=ZA7yR19fncjN/IqEjKaoAAwyOhwmk5ja+DgRDzoSNWIAacr03g2gIy3Txl60jzqR3L qSvlb0y1pYfvlFeDuhAz5Hb9b8lyk0X6Nl+3Rb+HHy3of1Ae8UwTlzJsJuPdpSdHtl1o asitDbgvFoIAJ3AFnSBDBkcFc/G61xqDg3sEq12Ttzo5KkHMQp7a//gZWSJk3Vl/0XJG tuMOQN1KoGxBYNrI7bn4yw5YtvqKBHDkZsZEOk3emcoSziDvzP9c9Wp1w5wRPrK8CTbq PHki9TpJB7nTaqgYXVUAJMuk8bcNTNpv78NfI8c5WnemzVB9wZ8zlZOFovVsDzLyWYU2 qJ6w== 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=29Tp5nFBIbiiAjhlfkbARueAlWqacRY5aGoBqBv1/4A=; fh=qJbyavjJb6SbapBMlTSLoL9L6caRt3XONkoHocAitCk=; b=KBI1DoyynpxdT68G4WboQnJbnEtIPyYS0i7U2daNeBVNmGzbF7uJ9qPmo2Vtft0Km9 8t4wLY4gUaX5no8AVIwhXfUhnJNewd3xfVk0yWZsh7R+RPSQX3x0uVP7ABeb5BzOP3/n nxJaST/FJRqKxMj6gMnptrp2YeUbQvxaYec3UOP+qFOQHhwRvsVkoOquW+nCPMUDcXJ0 RxmV6B1bmV75XnvEOUWMOw8qWHAI+m32tU07f6sVleUwd/EXr173OId+wij4H0Tc+54E cVqIWHkYaC+sBesVAG8bRcvz0iPn8MJzpRORxakwZGmIU4xr6nWq+vIHYSmwl0AISw1f F+3Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=P3UrW+1d; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@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 v13-20020a50d58d000000b0056c06c613dbsor1689215edi.4.2024.04.21.02.53.57 for (Google Transport Security); Sun, 21 Apr 2024 02:53:57 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXdVQCIjUCfO0fyN/z9Uk/SSGlazGjYExtKzTbi2zlxArzp6pBR4OV5M02xc6GbUQZHFzW0hI4rNauFqc5wPf83t4fGToIJ0aTYTMM8816PBuO6 X-Received: by 2002:a50:ab1a:0:b0:56e:2b31:b111 with SMTP id s26-20020a50ab1a000000b0056e2b31b111mr4422565edc.7.1713693237384; Sun, 21 Apr 2024 02:53:57 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-8-99-67.retail.telecomitalia.it. [87.8.99.67]) by smtp.gmail.com with ESMTPSA id f15-20020aa7d84f000000b00571db231915sm2318427eds.78.2024.04.21.02.53.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 02:53:57 -0700 (PDT) From: Dario Binacchi To: buildroot@buildroot.org Cc: Xuanhao Shi , Anand Gadiyar , michael@amarulasolutions.com, linux-amarula@amarulasolutions.com, Dario Binacchi Subject: [RFC PATCH 1/2] support/scripts/genimage.sh: support creating a bmap image Date: Sun, 21 Apr 2024 11:53:52 +0200 Message-ID: <20240421095353.208034-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240421095353.208034-1-dario.binacchi@amarulasolutions.com> References: <20240421095353.208034-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=P3UrW+1d; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@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: , The patch adds an option to create, in addition to the usual image, an image of type bmap that drastically reduces the amount of data that needs to be written to an SD card, resulting in time savings. This makes it possible to activate this option easily and maintain backward compatibility for all configurations already using the genimage tool for creating the image to be written to the SD card: BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT_ARGS="-c board///genimage.cfg -b" +BR2_PACKAGE_HOST_BMAP_TOOLS=y It follows that the script now assumes a broader functionality that extends beyond just being an interface for the genimage tool. An alternative implementation could have been to create another script, such as support/scripts/bmap.sh, capable of creating the bmap image using the same parameters passed to support/scripts/genimage.sh (i. e. -c board///genimage.cfg). However, in this case, the script would also need to know that the image is located in the ${BINARIES} directory. This could be achieved by adding an additional parameter, but it might cause genimage.sh to fail due to an unrecognized parameter. Signed-off-by: Dario Binacchi --- support/scripts/genimage.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/support/scripts/genimage.sh b/support/scripts/genimage.sh index 2796e19eb778..72592ebb710d 100755 --- a/support/scripts/genimage.sh +++ b/support/scripts/genimage.sh @@ -4,19 +4,26 @@ die() { cat <&2 Error: $@ -Usage: ${0} -c GENIMAGE_CONFIG_FILE +Usage: ${0} -c GENIMAGE_CONFIG_FILE [-b] + -b create bmap image + -c configuration file + EOF exit 1 } # Parse arguments and put into argument list of the script -opts="$(getopt -n "${0##*/}" -o c: -- "$@")" || exit $? +opts="$(getopt -n "${0##*/}" -o bc: -- "$@")" || exit $? eval set -- "$opts" GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" +GENIMAGE_CREATE_BMAP="no" while true ; do case "$1" in + -b) + GENIMAGE_CREATE_BMAP="yes" + shift 1 ;; -c) GENIMAGE_CFG="${2}"; shift 2 ;; @@ -46,3 +53,13 @@ genimage \ --inputpath "${BINARIES_DIR}" \ --outputpath "${BINARIES_DIR}" \ --config "${GENIMAGE_CFG}" + +if [ "${GENIMAGE_CREATE_BMAP}" = "yes" ]; then + while IFS= read -r image; do + cnt=$(grep -c "${image}" "${GENIMAGE_CFG}") + [ "${cnt}" -gt 1 ] && continue; + image_path="${BINARIES_DIR}/${image}" + bmaptool create "${image_path}" -o "${image_path}.bmap" + gzip -c "${image_path}" > "${image_path}.gz" + done < <(grep '^image ' "${GENIMAGE_CFG}" | cut -d ' ' -f 2) +fi