From 08192b751ca1320b3827cf63080ae12c15d96df4 Mon Sep 17 00:00:00 2001 From: "Andrey V.Kosteltsev" Date: Fri, 5 Aug 2022 03:39:18 +0300 Subject: Improve scripts --- BIOS/README.md | 2 +- BIOS/gen-bios-tarball | 14 +++++++------- BMC/README.md | 1 - BMC/gen-image-all-tarball | 20 ++++++++++---------- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/BIOS/README.md b/BIOS/README.md index 34d8293..f0027f9 100644 --- a/BIOS/README.md +++ b/BIOS/README.md @@ -12,7 +12,7 @@ ./gen-bios-tarball \ --machine cp2-5422 \ --version 1.50 \ - --compatible-name bios-image \ + --image-name image-hostfw \ --extended-version 456555-012 \ --out obmc-bios-image-cp2-5422-1.50-456555-012.tar.gz \ 469555_012_sila_bios_test_kcs_cpuinfo.fd diff --git a/BIOS/gen-bios-tarball b/BIOS/gen-bios-tarball index 9160451..46a62ef 100755 --- a/BIOS/gen-bios-tarball +++ b/BIOS/gen-bios-tarball @@ -20,7 +20,7 @@ Options: image. -v, --version Specify the version of bios image file. -e, --extended-version Specify the Extended Version of bios image file - -c, --compatible-name Specify the name of bios image in tarball. + -i, --image-name Specify the name of bios image in tarball. Default: 'image-hostfw'. -h, --help Display this help text and exit. ' @@ -58,7 +58,7 @@ outfile="" machine="" version="" extended_version="" -compatible_name="image-hostfw" +image_name="image-hostfw" while [[ $# -gt 0 ]]; do key="$1" @@ -88,8 +88,8 @@ while [[ $# -gt 0 ]]; do extended_version="$2" shift 2 ;; - -c|--compatible-name) - compatible_name="$2" + -i|--image-name) + image_name="$2" shift 2 ;; -h|--help) @@ -156,16 +156,16 @@ manifest_location="MANIFEST" files_to_sign="$manifest_location $public_key_file" # Go to scratch_dir -cp "${file}" "${scratch_dir}/${compatible_name}" +cp "${file}" "${scratch_dir}/${image_name}" cd "${scratch_dir}" -files_to_sign+=" ${compatible_name}" +files_to_sign+=" ${image_name}" echo "Creating MANIFEST for the image" echo -e "purpose=xyz.openbmc_project.Software.Version.VersionPurpose.Host\n\ version=$version" > $manifest_location echo "ExtendedVersion=${extended_version}" >> $manifest_location -echo "CompatibleName=${compatible_name}" >> $manifest_location +echo "CompatibleName=${image_name}" >> $manifest_location if [[ -n "${machine}" ]]; then echo -e "MachineName=${machine}" >> $manifest_location diff --git a/BMC/README.md b/BMC/README.md index c43e02d..10019d4 100644 --- a/BMC/README.md +++ b/BMC/README.md @@ -13,7 +13,6 @@ --machine cp2-5422 \ --version 2.13.0-dev-270-ga8eaf1b7d-dirty \ --image-name image-bmc \ - --compatible-name image-full \ --build-id 20220803101734 \ --out obmc-phosphor-image-cp2-5422-20220803101734.tar.gz \ obmc-phosphor-image-cp2-5422-20220803101734.static.mtd diff --git a/BMC/gen-image-all-tarball b/BMC/gen-image-all-tarball index 06d3b8a..b82fa3c 100755 --- a/BMC/gen-image-all-tarball +++ b/BMC/gen-image-all-tarball @@ -22,8 +22,6 @@ Options: -b, --build-id Specify the BuildId of Full image file. -i, --image-name Specify the name of Full image in tarball. Default: 'image-bmc'. - -c, --compatible-name Specify the name of Full image in tarball. - Default: 'image-full'. -h, --help Display this help text and exit. ' @@ -58,9 +56,8 @@ private_key_path="${PRIVATE_KEY_PATH}" outfile="" machine="" version="" -build_id=`date +"%Y%m%d%H%M%S` +build_id=`date +"%Y%m%d%H%M%S"` image_name="image-bmc" -compatible_name="image-full" while [[ $# -gt 0 ]]; do key="$1" @@ -94,10 +91,6 @@ while [[ $# -gt 0 ]]; do image_name="$2" shift 2 ;; - -c|--compatible-name) - compatible_name="$2" - shift 2 - ;; -h|--help) echo "$help" exit @@ -173,6 +166,7 @@ version=$version" > $manifest_location echo "BuildId=${build_id}" >> $manifest_location if [[ "${do_sign}" == true ]]; then + signature_files= private_key_name=$(basename "${private_key_path}") key_type="${private_key_name%.*}" echo KeyType="${key_type}" >> $manifest_location @@ -180,11 +174,17 @@ if [[ "${do_sign}" == true ]]; then for file in $files_to_sign; do openssl dgst -sha256 -sign "${private_key_path}" -out "${file}.sig" "$file" + signature_files="${signature_files} ${file}.sig" done - openssl dgst -sha256 -sign "${private_key_path}" -out "${compatible_name}.sig" "${image_name}" + if [ -n "$signature_files" ]; then + sort_signature_files=`echo "$signature_files" | tr ' ' '\n' | sort | tr '\n' ' '` + cat $sort_signature_files > image-full + openssl dgst -sha256 -sign ${private_key_path} -out image-full.sig image-full + signature_files="${signature_files} image-full.sig" + fi - additional_files="*.sig" + additional_files="${signature_files}" fi if [[ -n "${machine}" ]]; then -- cgit v1.2.3