Brad Bishop | 97cce00 | 2017-07-22 14:49:25 -0400 | [diff] [blame] | 1 | # Base image class extension, inlined into every image. |
| 2 | |
Saqib Khan | 4172347 | 2017-09-22 10:21:30 -0500 | [diff] [blame] | 3 | inherit image_version |
Brad Bishop | 97cce00 | 2017-07-22 14:49:25 -0400 | [diff] [blame] | 4 | |
Patrick Williams | b9e124c | 2022-12-14 09:10:49 -0600 | [diff] [blame] | 5 | FIT_IMAGE_INHERIT="" |
| 6 | FIT_IMAGE_INHERIT:df-obmc-static-norootfs = "fit-image" |
| 7 | inherit ${FIT_IMAGE_INHERIT} |
| 8 | |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 9 | # Phosphor image types |
| 10 | # |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 11 | # Phosphor OpenBMC supports a fixed partition mtd layout, |
| 12 | # A dynamic mtd with ubi layout, and a tar file for use with |
| 13 | # The reference BMC software update implementation. |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 14 | |
| 15 | # Image composition |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 16 | FLASH_KERNEL_IMAGE ?= "fitImage-${INITRAMFS_IMAGE}-${MACHINE}-${MACHINE}" |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 17 | FLASH_KERNEL_IMAGE:df-obmc-ubi-fs ?= "fitImage-${MACHINE}.bin" |
Brad Bishop | 8623bbe | 2018-03-09 00:04:00 -0500 | [diff] [blame] | 18 | |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 19 | IMAGE_BASETYPE ?= "squashfs-xz" |
Patrick Williams | b9e124c | 2022-12-14 09:10:49 -0600 | [diff] [blame] | 20 | IMAGE_BASETYPE:df-obmc-static-norootfs ?= "cpio" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 21 | OVERLAY_BASETYPE ?= "jffs2" |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 22 | FLASH_UBI_BASETYPE ?= "${IMAGE_BASETYPE}" |
| 23 | FLASH_UBI_OVERLAY_BASETYPE ?= "ubifs" |
Adriana Kobylak | 9b7197e | 2019-07-29 15:25:33 -0500 | [diff] [blame] | 24 | FLASH_EXT4_BASETYPE ?= "ext4" |
Adriana Kobylak | 5a5753a | 2019-07-30 11:27:46 -0500 | [diff] [blame] | 25 | FLASH_EXT4_OVERLAY_BASETYPE ?= "ext4" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 26 | |
Patrick Williams | b9e124c | 2022-12-14 09:10:49 -0600 | [diff] [blame] | 27 | PHOSPHOR_IMAGE_TYPES += " \ |
| 28 | mtd-static \ |
| 29 | mtd-static-alltar \ |
| 30 | mtd-static-tar \ |
| 31 | mtd-static-norootfs \ |
| 32 | mtd-ubi \ |
| 33 | mtd-ubi-tar \ |
| 34 | mmc-ext4-tar \ |
| 35 | " |
| 36 | IMAGE_TYPES += "${PHOSPHOR_IMAGE_TYPES}" |
| 37 | IMAGE_TYPES_MASKED += "${PHOSPHOR_IMAGE_TYPES}" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 38 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 39 | IMAGE_TYPEDEP:mtd-static = "${IMAGE_BASETYPE}" |
| 40 | IMAGE_TYPEDEP:mtd-static-tar = "${IMAGE_BASETYPE}" |
| 41 | IMAGE_TYPEDEP:mtd-static-alltar = "mtd-static" |
Patrick Williams | b9e124c | 2022-12-14 09:10:49 -0600 | [diff] [blame] | 42 | IMAGE_TYPEDEP:mtd-static-norootfs = "${IMAGE_BASETYPE}" |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 43 | IMAGE_TYPEDEP:mtd-ubi = "${FLASH_UBI_BASETYPE}" |
| 44 | IMAGE_TYPEDEP:mtd-ubi-tar = "${FLASH_UBI_BASETYPE}" |
| 45 | IMAGE_TYPEDEP:mmc-ext4-tar = "${FLASH_EXT4_BASETYPE}" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 46 | |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 47 | # Flash characteristics in KB unless otherwise noted |
Brad Bishop | dcd861c | 2019-09-24 21:16:09 -0400 | [diff] [blame] | 48 | DISTROOVERRIDES .= ":flash-${FLASH_SIZE}" |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 49 | FLASH_PEB_SIZE ?= "64" |
| 50 | # Flash page and overhead sizes in bytes |
| 51 | FLASH_PAGE_SIZE ?= "1" |
| 52 | FLASH_NOR_UBI_OVERHEAD ?= "64" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 53 | |
| 54 | # Fixed partition offsets |
Adriana Kobylak | e913dd8 | 2020-04-13 13:56:41 -0500 | [diff] [blame] | 55 | FLASH_UBOOT_SPL_SIZE ?= "64" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 56 | FLASH_UBOOT_OFFSET ?= "0" |
Patrick Williams | 80dccc8 | 2023-03-27 09:58:33 -0500 | [diff] [blame] | 57 | FLASH_MANIFEST_OFFSET ?= "380" |
Patrick Williams | 917fab2 | 2023-03-10 16:58:50 -0600 | [diff] [blame] | 58 | FLASH_MANIFEST_OFFSET:flash-65536 ?= "888" |
| 59 | FLASH_MANIFEST_OFFSET:flash-131072 ?= "888" |
Patrick Williams | 2e37529 | 2023-03-10 12:18:56 -0600 | [diff] [blame] | 60 | FLASH_UBOOT_ENV_OFFSET ?= "384" |
| 61 | FLASH_UBOOT_ENV_OFFSET:flash-65536 ?= "896" |
| 62 | FLASH_UBOOT_ENV_OFFSET:flash-131072 ?= "896" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 63 | FLASH_KERNEL_OFFSET ?= "512" |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 64 | FLASH_KERNEL_OFFSET:flash-65536 ?= "1024" |
| 65 | FLASH_KERNEL_OFFSET:flash-131072 ?= "1024" |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 66 | FLASH_UBI_OFFSET ?= "${FLASH_KERNEL_OFFSET}" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 67 | FLASH_ROFS_OFFSET ?= "4864" |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 68 | FLASH_ROFS_OFFSET:flash-65536 ?= "10240" |
| 69 | FLASH_ROFS_OFFSET:flash-131072 ?= "10240" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 70 | FLASH_RWFS_OFFSET ?= "28672" |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 71 | FLASH_RWFS_OFFSET:flash-65536 ?= "43008" |
| 72 | FLASH_RWFS_OFFSET:flash-131072 ?= "98304" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 73 | |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 74 | # UBI volume sizes in KB unless otherwise noted. |
Adriana Kobylak | b70005d | 2018-02-14 16:35:30 -0600 | [diff] [blame] | 75 | FLASH_UBI_RWFS_SIZE ?= "6144" |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 76 | FLASH_UBI_RWFS_SIZE:flash-131072 ?= "32768" |
Adriana Kobylak | b70005d | 2018-02-14 16:35:30 -0600 | [diff] [blame] | 77 | FLASH_UBI_RWFS_TXT_SIZE ?= "6MiB" |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 78 | FLASH_UBI_RWFS_TXT_SIZE:flash-131072 ?= "32MiB" |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 79 | |
Adriana Kobylak | 45a5795 | 2020-07-01 16:23:11 -0500 | [diff] [blame] | 80 | # eMMC sizes in KB unless otherwise noted. |
Adriana Kobylak | 55681e4 | 2020-11-11 15:06:50 -0600 | [diff] [blame] | 81 | MMC_UBOOT_SIZE ?= "1024" |
Adriana Kobylak | 45a5795 | 2020-07-01 16:23:11 -0500 | [diff] [blame] | 82 | MMC_BOOT_PARTITION_SIZE ?= "65536" |
| 83 | |
Lei YU | 444782b | 2023-01-18 17:35:03 +0800 | [diff] [blame] | 84 | SIGNING_PUBLIC_KEY ?= "" |
| 85 | SIGNING_PUBLIC_KEY_TYPE = "${@os.path.splitext(os.path.basename('${SIGNING_PUBLIC_KEY}'))[0]}" |
| 86 | |
Eddie James | b2b7ff6 | 2018-02-09 11:59:18 -0600 | [diff] [blame] | 87 | SIGNING_KEY ?= "${STAGING_DIR_NATIVE}${datadir}/OpenBMC.priv" |
| 88 | INSECURE_KEY = "${@'${SIGNING_KEY}' == '${STAGING_DIR_NATIVE}${datadir}/OpenBMC.priv'}" |
| 89 | SIGNING_KEY_DEPENDS = "${@oe.utils.conditional('INSECURE_KEY', 'True', 'phosphor-insecure-signing-key-native:do_populate_sysroot', '', d)}" |
| 90 | |
Adriana Kobylak | fb62a68 | 2019-10-28 16:03:12 -0500 | [diff] [blame] | 91 | VERSION_PURPOSE ?= "xyz.openbmc_project.Software.Version.VersionPurpose.BMC" |
| 92 | |
Brad Bishop | 3e37d38 | 2018-03-31 12:17:28 -0400 | [diff] [blame] | 93 | UBOOT_SUFFIX ?= "bin" |
| 94 | |
Patrick Williams | 1dc6b4a | 2023-08-04 10:41:33 -0500 | [diff] [blame] | 95 | IMAGE_NAME_SUFFIX="" |
| 96 | |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 97 | python() { |
| 98 | # Compute rwfs LEB count and LEB size. |
| 99 | page_size = d.getVar('FLASH_PAGE_SIZE', True) |
| 100 | nor_overhead_size = d.getVar('FLASH_NOR_UBI_OVERHEAD', True) |
| 101 | overhead_size = max(int(page_size), int(nor_overhead_size)) |
| 102 | peb_size = d.getVar('FLASH_PEB_SIZE', True) |
| 103 | leb_size = (int(peb_size) * 1024) - (2 * overhead_size) |
| 104 | d.setVar('FLASH_LEB_SIZE', str(leb_size)) # In bytes |
| 105 | |
| 106 | rwfs_size = d.getVar('FLASH_UBI_RWFS_SIZE', True) |
| 107 | rwfs_size = int(rwfs_size) * 1024 |
| 108 | lebs = int((rwfs_size + leb_size - 1) / leb_size) # Rounding up |
| 109 | d.setVar('FLASH_UBI_RWFS_LEBS', str(lebs)) |
| 110 | } |
| 111 | |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 112 | # Allow rwfs mkfs configuration through OVERLAY_MKFS_OPTS and OVERRIDES. However, |
| 113 | # avoid setting 'ext4' or 'jffs2' in OVERRIDES as such raw filesystem types are |
| 114 | # reserved for the primary image (and setting them currently breaks the build). |
| 115 | # Instead, prefix the overlay override value with 'rwfs-' to avoid collisions. |
| 116 | DISTROOVERRIDES .= ":static-rwfs-${OVERLAY_BASETYPE}" |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 117 | DISTROOVERRIDES .= ":ubi-rwfs-${FLASH_UBI_OVERLAY_BASETYPE}" |
Adriana Kobylak | 5a5753a | 2019-07-30 11:27:46 -0500 | [diff] [blame] | 118 | DISTROOVERRIDES .= ":mmc-rwfs-${FLASH_EXT4_OVERLAY_BASETYPE}" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 119 | |
William A. Kennington III | c230ab3 | 2019-09-16 17:44:48 -0700 | [diff] [blame] | 120 | JFFS2_RWFS_CMD = "mkfs.jffs2 --root=jffs2 --faketime --output=${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.jffs2" |
| 121 | UBIFS_RWFS_CMD = "mkfs.ubifs -r ubifs -c ${FLASH_UBI_RWFS_LEBS} -m ${FLASH_PAGE_SIZE} -e ${FLASH_LEB_SIZE} ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.ubifs" |
Adriana Kobylak | 5a5753a | 2019-07-30 11:27:46 -0500 | [diff] [blame] | 122 | EXT4_RWFS_CMD = "mkfs.ext4 -F ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.rwfs.ext4" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 123 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 124 | FLASH_STATIC_RWFS_CMD:static-rwfs-jffs2 = "${JFFS2_RWFS_CMD}" |
| 125 | FLASH_UBI_RWFS_CMD:ubi-rwfs-jffs2 = "${JFFS2_RWFS_CMD}" |
| 126 | FLASH_UBI_RWFS_CMD:ubi-rwfs-ubifs = "${UBIFS_RWFS_CMD}" |
| 127 | FLASH_EXT4_RWFS_CMD:mmc-rwfs-ext4 = "${EXT4_RWFS_CMD}" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 128 | |
Adriana Kobylak | 661cf39 | 2019-07-29 14:39:00 -0500 | [diff] [blame] | 129 | mk_empty_image() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 130 | image_dst="$1" |
| 131 | image_size_kb=$2 |
| 132 | dd if=/dev/zero bs=1k count=$image_size_kb \ |
| 133 | | tr '\000' '\377' > $image_dst |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 134 | } |
| 135 | |
Adriana Kobylak | 55681e4 | 2020-11-11 15:06:50 -0600 | [diff] [blame] | 136 | mk_empty_image_zeros() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 137 | image_dst="$1" |
| 138 | image_size_kb=$2 |
| 139 | dd if=/dev/zero of=$image_dst bs=1k count=$image_size_kb |
Adriana Kobylak | 55681e4 | 2020-11-11 15:06:50 -0600 | [diff] [blame] | 140 | } |
| 141 | |
Adriana Kobylak | f494bb5 | 2019-07-29 16:14:11 -0500 | [diff] [blame] | 142 | clean_rwfs() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 143 | type=$1 |
| 144 | shift |
Adriana Kobylak | f494bb5 | 2019-07-29 16:14:11 -0500 | [diff] [blame] | 145 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 146 | rm -f ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$type |
| 147 | rm -rf $type |
| 148 | mkdir $type |
Adriana Kobylak | f494bb5 | 2019-07-29 16:14:11 -0500 | [diff] [blame] | 149 | } |
| 150 | |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 151 | make_rwfs() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 152 | type=$1 |
| 153 | cmd=$2 |
| 154 | shift |
| 155 | shift |
| 156 | opts="$@" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 157 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 158 | mkdir -p $type |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 159 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 160 | $cmd $opts |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | do_generate_rwfs_static() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 164 | clean_rwfs ${OVERLAY_BASETYPE} |
| 165 | make_rwfs ${OVERLAY_BASETYPE} "${FLASH_STATIC_RWFS_CMD}" ${OVERLAY_MKFS_OPTS} |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 166 | } |
| 167 | do_generate_rwfs_static[dirs] = " ${S}/static" |
| 168 | do_generate_rwfs_static[depends] += " \ |
| 169 | mtd-utils-native:do_populate_sysroot \ |
| 170 | " |
| 171 | |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 172 | do_generate_rwfs_ubi() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 173 | clean_rwfs ${FLASH_UBI_OVERLAY_BASETYPE} |
| 174 | make_rwfs ${FLASH_UBI_OVERLAY_BASETYPE} "${FLASH_UBI_RWFS_CMD}" |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 175 | } |
| 176 | do_generate_rwfs_ubi[dirs] = " ${S}/ubi" |
| 177 | do_generate_rwfs_ubi[depends] += " \ |
| 178 | mtd-utils-native:do_populate_sysroot \ |
| 179 | " |
| 180 | |
Adriana Kobylak | 5a5753a | 2019-07-30 11:27:46 -0500 | [diff] [blame] | 181 | do_generate_rwfs_ext4() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 182 | clean_rwfs rwfs.${FLASH_EXT4_OVERLAY_BASETYPE} |
| 183 | mk_empty_image ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.rwfs.ext4 1024 |
| 184 | make_rwfs ${FLASH_EXT4_OVERLAY_BASETYPE} "${FLASH_EXT4_RWFS_CMD}" ${OVERLAY_MKFS_OPTS} |
Adriana Kobylak | 5a5753a | 2019-07-30 11:27:46 -0500 | [diff] [blame] | 185 | } |
| 186 | do_generate_rwfs_ext4[dirs] = " ${S}/ext4" |
| 187 | do_generate_rwfs_ext4[depends] += " \ |
| 188 | e2fsprogs-native:do_populate_sysroot \ |
| 189 | " |
| 190 | |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 191 | add_volume() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 192 | config_file=$1 |
| 193 | vol_id=$2 |
| 194 | vol_type=$3 |
| 195 | vol_name=$4 |
| 196 | image=$5 |
| 197 | vol_size=$6 |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 198 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 199 | echo \[$vol_name\] >> $config_file |
| 200 | echo mode=ubi >> $config_file |
| 201 | echo image=$image >> $config_file |
| 202 | echo vol_type=$vol_type >> $config_file |
| 203 | echo vol_name=$vol_name >> $config_file |
| 204 | echo vol_id=$vol_id >> $config_file |
| 205 | if [ ! -z $vol_size ]; then |
| 206 | echo vol_size=$vol_size >> $config_file |
| 207 | fi |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 208 | } |
| 209 | |
Saqib Khan | 4172347 | 2017-09-22 10:21:30 -0500 | [diff] [blame] | 210 | python do_generate_ubi() { |
| 211 | version_id = do_get_versionID(d) |
| 212 | d.setVar('VERSION_ID', version_id) |
| 213 | bb.build.exec_func("do_make_ubi", d) |
| 214 | } |
| 215 | do_generate_ubi[dirs] = "${S}/ubi" |
| 216 | do_generate_ubi[depends] += " \ |
| 217 | ${PN}:do_image_${@d.getVar('FLASH_UBI_BASETYPE', True).replace('-', '_')} \ |
| 218 | virtual/kernel:do_deploy \ |
Brad Bishop | 209ed52 | 2020-11-02 12:36:04 -0500 | [diff] [blame] | 219 | u-boot:do_deploy \ |
Saqib Khan | 4172347 | 2017-09-22 10:21:30 -0500 | [diff] [blame] | 220 | mtd-utils-native:do_populate_sysroot \ |
| 221 | " |
| 222 | |
| 223 | do_make_ubi() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 224 | cfg=ubinize-${IMAGE_NAME}.cfg |
| 225 | rm -f $cfg ubi-img |
| 226 | # Construct the ubinize config file |
| 227 | add_volume $cfg 0 static kernel-${VERSION_ID} \ |
| 228 | ${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE} |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 229 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 230 | add_volume $cfg 1 static rofs-${VERSION_ID} \ |
| 231 | ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${FLASH_UBI_BASETYPE} |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 232 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 233 | add_volume $cfg 2 dynamic rwfs ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${FLASH_UBI_OVERLAY_BASETYPE} ${FLASH_UBI_RWFS_TXT_SIZE} |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 234 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 235 | # Build the ubi partition image |
| 236 | ubinize -p ${FLASH_PEB_SIZE}KiB -m ${FLASH_PAGE_SIZE} -o ubi-img $cfg |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 237 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 238 | # Concatenate the uboot and ubi partitions |
| 239 | mk_empty_image ${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd ${FLASH_SIZE} |
| 240 | dd bs=1k conv=notrunc seek=${FLASH_UBOOT_OFFSET} \ |
| 241 | if=${DEPLOY_DIR_IMAGE}/u-boot.${UBOOT_SUFFIX} \ |
| 242 | of=${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd |
| 243 | dd bs=1k conv=notrunc seek=${FLASH_UBI_OFFSET} \ |
| 244 | if=ubi-img \ |
| 245 | of=${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 246 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 247 | cd ${IMGDEPLOYDIR} |
| 248 | ln -sf ${IMAGE_NAME}.ubi.mtd ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.ubi.mtd |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 249 | } |
Saqib Khan | 4172347 | 2017-09-22 10:21:30 -0500 | [diff] [blame] | 250 | do_make_ubi[dirs] = "${S}/ubi" |
| 251 | do_make_ubi[depends] += " \ |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 252 | ${PN}:do_image_${@d.getVar('FLASH_UBI_BASETYPE', True).replace('-', '_')} \ |
| 253 | virtual/kernel:do_deploy \ |
Brad Bishop | 209ed52 | 2020-11-02 12:36:04 -0500 | [diff] [blame] | 254 | u-boot:do_deploy \ |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 255 | mtd-utils-native:do_populate_sysroot \ |
| 256 | " |
| 257 | |
Alexander Filippov | 3dcf6f9 | 2018-07-17 16:41:37 +0300 | [diff] [blame] | 258 | do_mk_static_nor_image() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 259 | # Assemble the flash image |
| 260 | mk_empty_image ${IMGDEPLOYDIR}/${IMAGE_NAME}.static.mtd ${FLASH_SIZE} |
Alexander Filippov | 3dcf6f9 | 2018-07-17 16:41:37 +0300 | [diff] [blame] | 261 | } |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 262 | |
Adriana Kobylak | f1954f0 | 2020-04-27 15:20:35 -0500 | [diff] [blame] | 263 | do_generate_image_uboot_file() { |
| 264 | image_dst="$1" |
| 265 | uboot_offset=${FLASH_UBOOT_OFFSET} |
| 266 | |
| 267 | if [ ! -z ${SPL_BINARY} ]; then |
| 268 | dd bs=1k conv=notrunc seek=${FLASH_UBOOT_OFFSET} \ |
| 269 | if=${DEPLOY_DIR_IMAGE}/u-boot-spl.${UBOOT_SUFFIX} \ |
| 270 | of=${image_dst} |
| 271 | uboot_offset=${FLASH_UBOOT_SPL_SIZE} |
| 272 | fi |
| 273 | |
| 274 | dd bs=1k conv=notrunc seek=${uboot_offset} \ |
| 275 | if=${DEPLOY_DIR_IMAGE}/u-boot.${UBOOT_SUFFIX} \ |
| 276 | of=${image_dst} |
| 277 | } |
| 278 | |
Alexander Filippov | 3dcf6f9 | 2018-07-17 16:41:37 +0300 | [diff] [blame] | 279 | python do_generate_static() { |
| 280 | import subprocess |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 281 | |
Alexander Filippov | 3dcf6f9 | 2018-07-17 16:41:37 +0300 | [diff] [blame] | 282 | bb.build.exec_func("do_mk_static_nor_image", d) |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 283 | |
Alexander Filippov | 3dcf6f9 | 2018-07-17 16:41:37 +0300 | [diff] [blame] | 284 | nor_image = os.path.join(d.getVar('IMGDEPLOYDIR', True), |
| 285 | '%s.static.mtd' % d.getVar('IMAGE_NAME', True)) |
| 286 | |
| 287 | def _append_image(imgpath, start_kb, finish_kb): |
| 288 | imgsize = os.path.getsize(imgpath) |
Josh Lehan | 0a5ef2a | 2020-02-26 12:11:33 -0800 | [diff] [blame] | 289 | maxsize = (finish_kb - start_kb) * 1024 |
| 290 | bb.debug(1, 'Considering file size=' + str(imgsize) + ' name=' + imgpath) |
| 291 | bb.debug(1, 'Spanning start=' + str(start_kb) + 'K end=' + str(finish_kb) + 'K') |
| 292 | bb.debug(1, 'Compare needed=' + str(imgsize) + ' available=' + str(maxsize) + ' margin=' + str(maxsize - imgsize)) |
| 293 | if imgsize > maxsize: |
Joel Stanley | 909f33e | 2023-01-18 18:56:17 +1030 | [diff] [blame] | 294 | bb.fatal("Image '%s' is %d bytes too large!" % (imgpath, imgsize - maxsize)) |
Alexander Filippov | 3dcf6f9 | 2018-07-17 16:41:37 +0300 | [diff] [blame] | 295 | |
| 296 | subprocess.check_call(['dd', 'bs=1k', 'conv=notrunc', |
| 297 | 'seek=%d' % start_kb, |
| 298 | 'if=%s' % imgpath, |
| 299 | 'of=%s' % nor_image]) |
| 300 | |
Adriana Kobylak | e913dd8 | 2020-04-13 13:56:41 -0500 | [diff] [blame] | 301 | uboot_offset = int(d.getVar('FLASH_UBOOT_OFFSET', True)) |
| 302 | |
| 303 | spl_binary = d.getVar('SPL_BINARY', True) |
| 304 | if spl_binary: |
| 305 | _append_image(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), |
| 306 | 'u-boot-spl.%s' % d.getVar('UBOOT_SUFFIX',True)), |
| 307 | int(d.getVar('FLASH_UBOOT_OFFSET', True)), |
| 308 | int(d.getVar('FLASH_UBOOT_SPL_SIZE', True))) |
| 309 | uboot_offset += int(d.getVar('FLASH_UBOOT_SPL_SIZE', True)) |
| 310 | |
Alexander Filippov | 3dcf6f9 | 2018-07-17 16:41:37 +0300 | [diff] [blame] | 311 | _append_image(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), |
| 312 | 'u-boot.%s' % d.getVar('UBOOT_SUFFIX',True)), |
Adriana Kobylak | e913dd8 | 2020-04-13 13:56:41 -0500 | [diff] [blame] | 313 | uboot_offset, |
Patrick Williams | 2e37529 | 2023-03-10 12:18:56 -0600 | [diff] [blame] | 314 | int(d.getVar('FLASH_UBOOT_ENV_OFFSET', True))) |
Alexander Filippov | 3dcf6f9 | 2018-07-17 16:41:37 +0300 | [diff] [blame] | 315 | |
| 316 | _append_image(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), |
| 317 | d.getVar('FLASH_KERNEL_IMAGE', True)), |
| 318 | int(d.getVar('FLASH_KERNEL_OFFSET', True)), |
| 319 | int(d.getVar('FLASH_ROFS_OFFSET', True))) |
| 320 | |
| 321 | _append_image(os.path.join(d.getVar('IMGDEPLOYDIR', True), |
| 322 | '%s.%s' % ( |
| 323 | d.getVar('IMAGE_LINK_NAME', True), |
| 324 | d.getVar('IMAGE_BASETYPE', True))), |
| 325 | int(d.getVar('FLASH_ROFS_OFFSET', True)), |
| 326 | int(d.getVar('FLASH_RWFS_OFFSET', True))) |
| 327 | |
William A. Kennington III | c230ab3 | 2019-09-16 17:44:48 -0700 | [diff] [blame] | 328 | _append_image(os.path.join(d.getVar('IMGDEPLOYDIR', True), |
| 329 | '%s.%s' % ( |
| 330 | d.getVar('IMAGE_LINK_NAME', True), |
| 331 | d.getVar('OVERLAY_BASETYPE', True))), |
Alexander Filippov | 3dcf6f9 | 2018-07-17 16:41:37 +0300 | [diff] [blame] | 332 | int(d.getVar('FLASH_RWFS_OFFSET', True)), |
| 333 | int(d.getVar('FLASH_SIZE', True))) |
| 334 | |
| 335 | bb.build.exec_func("do_mk_static_symlinks", d) |
| 336 | } |
| 337 | |
| 338 | do_mk_static_symlinks() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 339 | cd ${IMGDEPLOYDIR} |
| 340 | ln -sf ${IMAGE_NAME}.static.mtd ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.static.mtd |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 341 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 342 | # Maintain non-standard legacy links |
| 343 | do_generate_image_uboot_file ${IMGDEPLOYDIR}/image-u-boot |
| 344 | ln -sf ${IMAGE_NAME}.static.mtd ${IMGDEPLOYDIR}/flash-${MACHINE} |
| 345 | ln -sf ${IMAGE_NAME}.static.mtd ${IMGDEPLOYDIR}/image-bmc |
| 346 | ln -sf ${FLASH_KERNEL_IMAGE} ${IMGDEPLOYDIR}/image-kernel |
| 347 | ln -sf ${IMAGE_LINK_NAME}.${IMAGE_BASETYPE} ${IMGDEPLOYDIR}/image-rofs |
| 348 | ln -sf ${IMAGE_LINK_NAME}.${OVERLAY_BASETYPE} ${IMGDEPLOYDIR}/image-rwfs |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 349 | } |
| 350 | do_generate_static[dirs] = "${S}/static" |
| 351 | do_generate_static[depends] += " \ |
| 352 | ${PN}:do_image_${@d.getVar('IMAGE_BASETYPE', True).replace('-', '_')} \ |
| 353 | virtual/kernel:do_deploy \ |
Brad Bishop | 209ed52 | 2020-11-02 12:36:04 -0500 | [diff] [blame] | 354 | u-boot:do_deploy \ |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 355 | " |
| 356 | |
Lei YU | f207221 | 2018-06-20 13:27:34 +0800 | [diff] [blame] | 357 | make_signatures() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 358 | signing_key="${SIGNING_KEY}" |
George Liu | f0afcf8 | 2020-12-15 09:46:10 +0800 | [diff] [blame] | 359 | |
Lei YU | 88ed273 | 2023-06-16 14:40:22 +0800 | [diff] [blame] | 360 | if [ "${INSECURE_KEY}" = "True" ] && [ -n "${SIGNING_PUBLIC_KEY}" ]; then |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 361 | echo "Using SIGNING_PUBLIC_KEY" |
| 362 | signing_key="" |
| 363 | fi |
Lei YU | 444782b | 2023-01-18 17:35:03 +0800 | [diff] [blame] | 364 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 365 | if [ -n "${signing_key}" ] && [ -n "${SIGNING_PUBLIC_KEY}" ]; then |
| 366 | echo "Both SIGNING_KEY and SIGNING_PUBLIC_KEY are defined, expecting only one" |
| 367 | exit 1 |
| 368 | fi |
Lei YU | 444782b | 2023-01-18 17:35:03 +0800 | [diff] [blame] | 369 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 370 | signature_files="" |
| 371 | if [ -n "${signing_key}" ]; then |
| 372 | for file in "$@"; do |
| 373 | openssl dgst -sha256 -sign ${signing_key} -out "${file}.sig" $file |
| 374 | signature_files="${signature_files} ${file}.sig" |
| 375 | done |
Lei YU | 444782b | 2023-01-18 17:35:03 +0800 | [diff] [blame] | 376 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 377 | if [ -n "${signature_files}" ]; then |
| 378 | sort_signature_files=$(echo "${signature_files}" | tr ' ' '\n' | sort | tr '\n' ' ') |
| 379 | cat ${sort_signature_files} > image-full |
| 380 | openssl dgst -sha256 -sign ${signing_key} -out image-full.sig image-full |
| 381 | signature_files="${signature_files} image-full.sig" |
| 382 | fi |
| 383 | fi |
Lei YU | f207221 | 2018-06-20 13:27:34 +0800 | [diff] [blame] | 384 | } |
| 385 | |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 386 | do_generate_static_alltar() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 387 | ln -sf ${S}/MANIFEST MANIFEST |
| 388 | ln -sf ${S}/publickey publickey |
| 389 | ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.static.mtd image-bmc |
Lei YU | a467494 | 2018-05-23 14:01:14 +0800 | [diff] [blame] | 390 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 391 | make_signatures image-bmc MANIFEST publickey |
Lei YU | a467494 | 2018-05-23 14:01:14 +0800 | [diff] [blame] | 392 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 393 | tar -h -cvf ${IMGDEPLOYDIR}/${IMAGE_NAME}.static.mtd.all.tar \ |
| 394 | image-bmc MANIFEST publickey ${signature_files} |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 395 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 396 | cd ${IMGDEPLOYDIR} |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 397 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 398 | ln -sf ${IMAGE_NAME}.static.mtd.all.tar \ |
| 399 | ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.static.mtd.all.tar |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 400 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 401 | # Maintain non-standard legacy link. |
| 402 | ln -sf ${IMAGE_NAME}.static.mtd.all.tar \ |
| 403 | ${IMGDEPLOYDIR}/${MACHINE}-${DATETIME}.all.tar |
Lei YU | a467494 | 2018-05-23 14:01:14 +0800 | [diff] [blame] | 404 | |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 405 | } |
| 406 | do_generate_static_alltar[vardepsexclude] = "DATETIME" |
| 407 | do_generate_static_alltar[dirs] = "${S}/static" |
Lei YU | a467494 | 2018-05-23 14:01:14 +0800 | [diff] [blame] | 408 | do_generate_static_alltar[depends] += " \ |
| 409 | openssl-native:do_populate_sysroot \ |
| 410 | ${SIGNING_KEY_DEPENDS} \ |
| 411 | ${PN}:do_copy_signing_pubkey \ |
| 412 | " |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 413 | |
Brad Bishop | de65938 | 2018-03-30 01:46:16 -0400 | [diff] [blame] | 414 | make_image_links() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 415 | rwfs=$1 |
| 416 | rofs=$2 |
| 417 | shift |
| 418 | shift |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 419 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 420 | # Create some links to help make the tar archive in the format |
| 421 | # expected by phosphor-bmc-code-mgmt. |
| 422 | do_generate_image_uboot_file image-u-boot |
| 423 | ln -sf ${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE} image-kernel |
| 424 | ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$rofs image-rofs |
| 425 | ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$rwfs image-rwfs |
Brad Bishop | de65938 | 2018-03-30 01:46:16 -0400 | [diff] [blame] | 426 | } |
| 427 | |
| 428 | make_tar_of_images() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 429 | type=$1 |
| 430 | shift |
| 431 | extra_files="$@" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 432 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 433 | # Create the tar archive |
| 434 | tar -h -cvf ${IMGDEPLOYDIR}/${IMAGE_NAME}.$type.tar \ |
| 435 | image-u-boot image-kernel image-rofs image-rwfs $extra_files |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 436 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 437 | cd ${IMGDEPLOYDIR} |
| 438 | ln -sf ${IMAGE_NAME}.$type.tar ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$type.tar |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 439 | } |
| 440 | |
| 441 | do_generate_static_tar() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 442 | ln -sf ${S}/MANIFEST MANIFEST |
| 443 | ln -sf ${S}/publickey publickey |
| 444 | make_image_links ${OVERLAY_BASETYPE} ${IMAGE_BASETYPE} |
| 445 | make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey |
| 446 | make_tar_of_images static.mtd MANIFEST publickey ${signature_files} |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 447 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 448 | # Maintain non-standard legacy link. |
| 449 | cd ${IMGDEPLOYDIR} |
| 450 | ln -sf ${IMAGE_NAME}.static.mtd.tar ${IMGDEPLOYDIR}/${MACHINE}-${DATETIME}.tar |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 451 | } |
| 452 | do_generate_static_tar[dirs] = " ${S}/static" |
| 453 | do_generate_static_tar[depends] += " \ |
| 454 | ${PN}:do_image_${@d.getVar('IMAGE_BASETYPE', True).replace('-', '_')} \ |
| 455 | virtual/kernel:do_deploy \ |
Brad Bishop | 209ed52 | 2020-11-02 12:36:04 -0500 | [diff] [blame] | 456 | u-boot:do_deploy \ |
Lei YU | a467494 | 2018-05-23 14:01:14 +0800 | [diff] [blame] | 457 | openssl-native:do_populate_sysroot \ |
| 458 | ${SIGNING_KEY_DEPENDS} \ |
| 459 | ${PN}:do_copy_signing_pubkey \ |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 460 | " |
| 461 | do_generate_static_tar[vardepsexclude] = "DATETIME" |
| 462 | |
Patrick Williams | b9e124c | 2022-12-14 09:10:49 -0600 | [diff] [blame] | 463 | python do_generate_static_norootfs() { |
Patrick Williams | 917fab2 | 2023-03-10 16:58:50 -0600 | [diff] [blame] | 464 | import hashlib |
| 465 | import json |
Patrick Williams | b9e124c | 2022-12-14 09:10:49 -0600 | [diff] [blame] | 466 | import subprocess |
| 467 | |
Patrick Williams | 917fab2 | 2023-03-10 16:58:50 -0600 | [diff] [blame] | 468 | manifest = { |
| 469 | "type": "phosphor-image-manifest", |
| 470 | "version": 1, |
| 471 | "info": { |
| 472 | "purpose": d.getVar('VERSION_PURPOSE', True), |
| 473 | "machine": d.getVar('MACHINE', True), |
| 474 | "version": do_get_version(d).strip('"'), |
| 475 | "build-id": do_get_buildID(d).strip('"'), |
| 476 | }, |
| 477 | "partitions": [], |
| 478 | # Create an empty hash-value so that the dictionary can be emitted, |
| 479 | # hashed, and then updated. |
| 480 | "manifest-sha256": "", |
| 481 | } |
| 482 | extended_version = do_get_extended_version(d).strip('"') |
| 483 | if extended_version: |
| 484 | manifest["info"]["extended-version"] = extended_version |
| 485 | compatible_names = d.getVar('OBMC_COMPATIBLE_NAMES', True) |
| 486 | if compatible_names: |
| 487 | manifest["info"]["compatible-names"] = compatible_names.split() |
| 488 | |
| 489 | manifest_json_file = os.path.join(d.getVar('IMGDEPLOYDIR', True), |
| 490 | "phosphor-image-manifest.json") |
| 491 | |
Patrick Williams | b9e124c | 2022-12-14 09:10:49 -0600 | [diff] [blame] | 492 | nor_image_basename = '%s.static.mtd' % d.getVar('IMAGE_NAME', True) |
| 493 | nor_image = os.path.join(d.getVar('IMGDEPLOYDIR', True), nor_image_basename) |
| 494 | |
Patrick Williams | 917fab2 | 2023-03-10 16:58:50 -0600 | [diff] [blame] | 495 | def _add_manifest(partname, typename, offset, size, sha256_value = None): |
| 496 | manifest["partitions"].append( |
| 497 | { |
| 498 | "name": partname, |
| 499 | "type": typename, |
| 500 | "offset": offset, |
| 501 | "size": size, |
| 502 | } |
| 503 | ) |
| 504 | if typename == "fit": |
| 505 | if "u-boot-fit" == partname: |
| 506 | manifest["partitions"][-1]["num-nodes"] = 1 |
| 507 | elif "os-fit" == partname: |
| 508 | manifest["partitions"][-1]["num-nodes"] = 3 |
| 509 | else: |
| 510 | bb.fatal(f"Unknown FIT partition type: {partname}") |
| 511 | if sha256_value: |
| 512 | manifest["partitions"][-1]["sha256"] = sha256_value |
| 513 | |
| 514 | |
| 515 | def _append_image(partname, typename, imgpath, start_kb, finish_kb): |
Patrick Williams | b9e124c | 2022-12-14 09:10:49 -0600 | [diff] [blame] | 516 | imgsize = os.path.getsize(imgpath) |
| 517 | maxsize = (finish_kb - start_kb) * 1024 |
| 518 | bb.debug(1, 'Considering file size=' + str(imgsize) + ' name=' + imgpath) |
| 519 | bb.debug(1, 'Spanning start=' + str(start_kb) + 'K end=' + str(finish_kb) + 'K') |
| 520 | bb.debug(1, 'Compare needed=' + str(imgsize) + ' available=' + str(maxsize) + ' margin=' + str(maxsize - imgsize)) |
| 521 | if imgsize > maxsize: |
| 522 | bb.fatal("Image '%s' is too large!" % imgpath) |
| 523 | |
Patrick Williams | 917fab2 | 2023-03-10 16:58:50 -0600 | [diff] [blame] | 524 | with open(imgpath, "rb") as fp: |
| 525 | sha256 = hashlib.sha256(fp.read()).hexdigest() |
| 526 | |
| 527 | _add_manifest(partname, typename, start_kb * 1024, imgsize, sha256) |
| 528 | |
Patrick Williams | b9e124c | 2022-12-14 09:10:49 -0600 | [diff] [blame] | 529 | subprocess.check_call(['dd', 'bs=1k', 'conv=notrunc', |
| 530 | 'seek=%d' % start_kb, |
| 531 | 'if=%s' % imgpath, |
| 532 | 'of=%s' % nor_image]) |
Patrick Williams | 917fab2 | 2023-03-10 16:58:50 -0600 | [diff] [blame] | 533 | |
Patrick Williams | b9e124c | 2022-12-14 09:10:49 -0600 | [diff] [blame] | 534 | uboot_offset = int(d.getVar('FLASH_UBOOT_OFFSET', True)) |
| 535 | |
| 536 | spl_binary = d.getVar('SPL_BINARY', True) |
| 537 | if spl_binary: |
Patrick Williams | 917fab2 | 2023-03-10 16:58:50 -0600 | [diff] [blame] | 538 | _append_image("spl", "u-boot", |
| 539 | os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), |
Patrick Williams | b9e124c | 2022-12-14 09:10:49 -0600 | [diff] [blame] | 540 | 'u-boot-spl.%s' % d.getVar('UBOOT_SUFFIX',True)), |
| 541 | int(d.getVar('FLASH_UBOOT_OFFSET', True)), |
| 542 | int(d.getVar('FLASH_UBOOT_SPL_SIZE', True))) |
| 543 | uboot_offset += int(d.getVar('FLASH_UBOOT_SPL_SIZE', True)) |
| 544 | |
Patrick Williams | 917fab2 | 2023-03-10 16:58:50 -0600 | [diff] [blame] | 545 | _append_image("u-boot-fit", "fit", |
| 546 | os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), |
Patrick Williams | b9e124c | 2022-12-14 09:10:49 -0600 | [diff] [blame] | 547 | 'u-boot.%s' % d.getVar('UBOOT_SUFFIX',True)), |
| 548 | uboot_offset, |
Patrick Williams | 917fab2 | 2023-03-10 16:58:50 -0600 | [diff] [blame] | 549 | int(d.getVar('FLASH_MANIFEST_OFFSET', True))) |
Patrick Williams | b9e124c | 2022-12-14 09:10:49 -0600 | [diff] [blame] | 550 | |
Patrick Williams | 917fab2 | 2023-03-10 16:58:50 -0600 | [diff] [blame] | 551 | _add_manifest("manifest", "json", |
| 552 | int(d.getVar('FLASH_MANIFEST_OFFSET', True)) * 1024, |
| 553 | (int(d.getVar('FLASH_UBOOT_ENV_OFFSET', True)) - |
| 554 | int(d.getVar('FLASH_MANIFEST_OFFSET', True))) * 1024) |
| 555 | |
| 556 | _add_manifest("u-boot-env", "data", |
| 557 | int(d.getVar('FLASH_UBOOT_ENV_OFFSET', True)) * 1024, |
| 558 | (int(d.getVar('FLASH_KERNEL_OFFSET', True)) - |
| 559 | int(d.getVar('FLASH_UBOOT_ENV_OFFSET', True))) * 1024) |
| 560 | |
| 561 | _append_image("os-fit", "fit", |
| 562 | os.path.join(d.getVar('IMGDEPLOYDIR', True), |
Patrick Williams | b9e124c | 2022-12-14 09:10:49 -0600 | [diff] [blame] | 563 | '%s.cpio.%s.fitImage' % ( |
| 564 | d.getVar('IMAGE_LINK_NAME', True), |
| 565 | d.getVar('INITRAMFS_CTYPE', True))), |
| 566 | int(d.getVar('FLASH_KERNEL_OFFSET', True)), |
| 567 | int(d.getVar('FLASH_RWFS_OFFSET', True))) |
| 568 | |
Patrick Williams | 917fab2 | 2023-03-10 16:58:50 -0600 | [diff] [blame] | 569 | _add_manifest("rwfs", "data", |
| 570 | int(d.getVar('FLASH_RWFS_OFFSET', True)) * 1024, |
| 571 | (int(d.getVar('FLASH_SIZE', True)) - |
| 572 | int(d.getVar('FLASH_RWFS_OFFSET', True))) * 1024) |
| 573 | |
| 574 | # Calculate the sha256 of the current manifest and update. |
| 575 | manifest_raw = json.dumps(manifest, indent=4) |
| 576 | manifest_raw = manifest_raw[:manifest_raw.find("manifest-sha256")] |
| 577 | manifest["manifest-sha256"] = hashlib.sha256( |
| 578 | manifest_raw.encode('utf-8')).hexdigest() |
| 579 | |
| 580 | # Write the final manifest json and add it to the image. |
| 581 | with open(manifest_json_file, "wb") as fp: |
| 582 | fp.write(json.dumps(manifest, indent=4).encode('utf-8')) |
| 583 | _append_image("manifest", "json", manifest_json_file, |
| 584 | int(d.getVar('FLASH_MANIFEST_OFFSET', True)), |
| 585 | int(d.getVar('FLASH_UBOOT_ENV_OFFSET', True))) |
| 586 | |
Patrick Williams | b9e124c | 2022-12-14 09:10:49 -0600 | [diff] [blame] | 587 | flash_symlink = os.path.join( |
| 588 | d.getVar('IMGDEPLOYDIR', True), |
| 589 | 'flash-%s' % d.getVar('MACHINE', True)) |
| 590 | if os.path.exists(flash_symlink): |
| 591 | os.remove(flash_symlink) |
| 592 | os.symlink(nor_image_basename, flash_symlink) |
| 593 | } |
| 594 | do_generate_static_norootfs[depends] += " \ |
| 595 | ${PN}:do_image_${@d.getVar('IMAGE_BASETYPE', True).replace('-', '_')} \ |
| 596 | u-boot:do_deploy \ |
| 597 | " |
| 598 | |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 599 | do_generate_ubi_tar() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 600 | ln -sf ${S}/MANIFEST MANIFEST |
| 601 | ln -sf ${S}/publickey publickey |
| 602 | make_image_links ${FLASH_UBI_OVERLAY_BASETYPE} ${FLASH_UBI_BASETYPE} |
| 603 | make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey |
| 604 | make_tar_of_images ubi.mtd MANIFEST publickey ${signature_files} |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 605 | } |
| 606 | do_generate_ubi_tar[dirs] = " ${S}/ubi" |
| 607 | do_generate_ubi_tar[depends] += " \ |
| 608 | ${PN}:do_image_${@d.getVar('FLASH_UBI_BASETYPE', True).replace('-', '_')} \ |
| 609 | virtual/kernel:do_deploy \ |
Brad Bishop | 209ed52 | 2020-11-02 12:36:04 -0500 | [diff] [blame] | 610 | u-boot:do_deploy \ |
Eddie James | b2b7ff6 | 2018-02-09 11:59:18 -0600 | [diff] [blame] | 611 | openssl-native:do_populate_sysroot \ |
| 612 | ${SIGNING_KEY_DEPENDS} \ |
| 613 | ${PN}:do_copy_signing_pubkey \ |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 614 | " |
| 615 | |
Adriana Kobylak | 9b7197e | 2019-07-29 15:25:33 -0500 | [diff] [blame] | 616 | do_generate_ext4_tar() { |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 617 | # Generate the U-Boot image |
| 618 | mk_empty_image_zeros image-u-boot ${MMC_UBOOT_SIZE} |
| 619 | do_generate_image_uboot_file image-u-boot |
Adriana Kobylak | 45a5795 | 2020-07-01 16:23:11 -0500 | [diff] [blame] | 620 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 621 | # Generate a compressed ext4 filesystem with the fitImage file in it to be |
| 622 | # flashed to the boot partition of the eMMC |
| 623 | install -d boot-image |
| 624 | install -m 644 ${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE} boot-image/fitImage |
| 625 | mk_empty_image_zeros boot-image.${FLASH_EXT4_BASETYPE} ${MMC_BOOT_PARTITION_SIZE} |
| 626 | mkfs.ext4 -F -i 4096 -d boot-image boot-image.${FLASH_EXT4_BASETYPE} |
| 627 | # Error codes 0-3 indicate successfull operation of fsck |
| 628 | fsck.ext4 -pvfD boot-image.${FLASH_EXT4_BASETYPE} || [ $? -le 3 ] |
| 629 | zstd -f -k -T0 -c ${ZSTD_COMPRESSION_LEVEL} boot-image.${FLASH_EXT4_BASETYPE} > boot-image.${FLASH_EXT4_BASETYPE}.zst |
Adriana Kobylak | 45a5795 | 2020-07-01 16:23:11 -0500 | [diff] [blame] | 630 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 631 | # Generate the compressed ext4 rootfs |
| 632 | zstd -f -k -T0 -c ${ZSTD_COMPRESSION_LEVEL} ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE} > ${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE}.zst |
Adriana Kobylak | 45a5795 | 2020-07-01 16:23:11 -0500 | [diff] [blame] | 633 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 634 | ln -sf boot-image.${FLASH_EXT4_BASETYPE}.zst image-kernel |
| 635 | ln -sf ${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE}.zst image-rofs |
| 636 | ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.rwfs.${FLASH_EXT4_OVERLAY_BASETYPE} image-rwfs |
| 637 | ln -sf ${S}/MANIFEST MANIFEST |
| 638 | ln -sf ${S}/publickey publickey |
Adriana Kobylak | 81846a2 | 2020-07-12 15:12:36 -0500 | [diff] [blame] | 639 | |
Patrick Williams | af48f63 | 2023-03-20 10:13:55 -0500 | [diff] [blame] | 640 | hostfw_update_file="${DEPLOY_DIR_IMAGE}/hostfw/update/image-hostfw" |
| 641 | if [ -e "${hostfw_update_file}" ]; then |
| 642 | ln -sf "${hostfw_update_file}" image-hostfw |
| 643 | make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey image-hostfw |
| 644 | make_tar_of_images ext4.mmc MANIFEST publickey ${signature_files} image-hostfw |
| 645 | else |
| 646 | make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey |
| 647 | make_tar_of_images ext4.mmc MANIFEST publickey ${signature_files} |
| 648 | fi |
Adriana Kobylak | 9b7197e | 2019-07-29 15:25:33 -0500 | [diff] [blame] | 649 | } |
| 650 | do_generate_ext4_tar[dirs] = " ${S}/ext4" |
| 651 | do_generate_ext4_tar[depends] += " \ |
Adriana Kobylak | 4cc866b | 2020-03-28 13:43:33 -0500 | [diff] [blame] | 652 | zstd-native:do_populate_sysroot \ |
Adriana Kobylak | 9b7197e | 2019-07-29 15:25:33 -0500 | [diff] [blame] | 653 | ${PN}:do_image_${FLASH_EXT4_BASETYPE} \ |
| 654 | virtual/kernel:do_deploy \ |
Brad Bishop | 209ed52 | 2020-11-02 12:36:04 -0500 | [diff] [blame] | 655 | u-boot:do_deploy \ |
Adriana Kobylak | 9b7197e | 2019-07-29 15:25:33 -0500 | [diff] [blame] | 656 | openssl-native:do_populate_sysroot \ |
| 657 | ${SIGNING_KEY_DEPENDS} \ |
| 658 | ${PN}:do_copy_signing_pubkey \ |
Brad Bishop | 209ed52 | 2020-11-02 12:36:04 -0500 | [diff] [blame] | 659 | phosphor-hostfw-image:do_deploy \ |
Adriana Kobylak | 9b7197e | 2019-07-29 15:25:33 -0500 | [diff] [blame] | 660 | " |
| 661 | |
Eddie James | b2b7ff6 | 2018-02-09 11:59:18 -0600 | [diff] [blame] | 662 | def get_pubkey_basedir(d): |
| 663 | return os.path.join( |
| 664 | d.getVar('STAGING_DIR_TARGET', True), |
| 665 | d.getVar('sysconfdir', True).strip(os.sep), |
| 666 | 'activationdata') |
| 667 | |
| 668 | def get_pubkey_type(d): |
| 669 | return os.listdir(get_pubkey_basedir(d))[0] |
| 670 | |
| 671 | def get_pubkey_path(d): |
| 672 | return os.path.join( |
| 673 | get_pubkey_basedir(d), |
| 674 | get_pubkey_type(d), |
| 675 | 'publickey') |
| 676 | |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 677 | python do_generate_phosphor_manifest() { |
Adriana Kobylak | fb62a68 | 2019-10-28 16:03:12 -0500 | [diff] [blame] | 678 | purpose = d.getVar('VERSION_PURPOSE', True) |
Saqib Khan | 4172347 | 2017-09-22 10:21:30 -0500 | [diff] [blame] | 679 | version = do_get_version(d) |
Adriana Kobylak | cdd91ad | 2021-10-25 15:58:19 +0000 | [diff] [blame] | 680 | build_id = do_get_buildID(d) |
Vijay Khemka | ae614bd | 2019-09-18 12:28:46 -0700 | [diff] [blame] | 681 | target_machine = d.getVar('MACHINE', True) |
Adriana Kobylak | bde7dbe | 2022-08-04 09:13:26 -0500 | [diff] [blame] | 682 | extended_version = do_get_extended_version(d) |
Justin Ledford | b4de16d | 2022-03-24 17:27:17 -0700 | [diff] [blame] | 683 | compatible_names = d.getVar('OBMC_COMPATIBLE_NAMES', True) |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 684 | with open('MANIFEST', 'w') as fd: |
Adriana Kobylak | fb62a68 | 2019-10-28 16:03:12 -0500 | [diff] [blame] | 685 | fd.write('purpose={}\n'.format(purpose)) |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 686 | fd.write('version={}\n'.format(version.strip('"'))) |
Adriana Kobylak | cdd91ad | 2021-10-25 15:58:19 +0000 | [diff] [blame] | 687 | fd.write('BuildId={}\n'.format(build_id.strip('"'))) |
Justin Ledford | b4de16d | 2022-03-24 17:27:17 -0700 | [diff] [blame] | 688 | if extended_version: |
| 689 | fd.write('ExtendedVersion={}\n'.format(extended_version)) |
| 690 | if compatible_names: |
| 691 | for name in compatible_names.split(): |
| 692 | fd.write('CompatibleName={}\n'.format(name)) |
Eddie James | b2b7ff6 | 2018-02-09 11:59:18 -0600 | [diff] [blame] | 693 | fd.write('KeyType={}\n'.format(get_pubkey_type(d))) |
| 694 | fd.write('HashType=RSA-SHA256\n') |
Vijay Khemka | ae614bd | 2019-09-18 12:28:46 -0700 | [diff] [blame] | 695 | fd.write('MachineName={}\n'.format(target_machine)) |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 696 | } |
| 697 | do_generate_phosphor_manifest[dirs] = "${S}" |
| 698 | do_generate_phosphor_manifest[depends] += " \ |
| 699 | os-release:do_populate_sysroot \ |
Eddie James | b2b7ff6 | 2018-02-09 11:59:18 -0600 | [diff] [blame] | 700 | phosphor-image-signing:do_populate_sysroot \ |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 701 | " |
| 702 | |
Eddie James | b2b7ff6 | 2018-02-09 11:59:18 -0600 | [diff] [blame] | 703 | python do_copy_signing_pubkey() { |
| 704 | with open(get_pubkey_path(d), 'r') as read_fd: |
| 705 | with open('publickey', 'w') as write_fd: |
| 706 | write_fd.write(read_fd.read()) |
| 707 | } |
| 708 | |
| 709 | do_copy_signing_pubkey[dirs] = "${S}" |
| 710 | do_copy_signing_pubkey[depends] += " \ |
| 711 | phosphor-image-signing:do_populate_sysroot \ |
| 712 | " |
| 713 | |
| 714 | addtask copy_signing_pubkey after do_rootfs |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 715 | addtask generate_phosphor_manifest after do_rootfs |
| 716 | addtask generate_rwfs_static after do_rootfs |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 717 | addtask generate_rwfs_ubi after do_rootfs |
Adriana Kobylak | 5a5753a | 2019-07-30 11:27:46 -0500 | [diff] [blame] | 718 | addtask generate_rwfs_ext4 after do_rootfs |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 719 | |
| 720 | python() { |
| 721 | types = d.getVar('IMAGE_FSTYPES', True).split() |
| 722 | |
| 723 | if any([x in types for x in ['mtd-static', 'mtd-static-alltar']]): |
| 724 | bb.build.addtask( |
| 725 | 'do_generate_static', |
| 726 | 'do_image_complete', |
| 727 | 'do_generate_rwfs_static', d) |
| 728 | if 'mtd-static-alltar' in types: |
| 729 | bb.build.addtask( |
| 730 | 'do_generate_static_alltar', |
| 731 | 'do_image_complete', |
Lei YU | a467494 | 2018-05-23 14:01:14 +0800 | [diff] [blame] | 732 | 'do_generate_static do_generate_phosphor_manifest', d) |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 733 | if 'mtd-static-tar' in types: |
| 734 | bb.build.addtask( |
| 735 | 'do_generate_static_tar', |
| 736 | 'do_image_complete', |
Lei YU | a467494 | 2018-05-23 14:01:14 +0800 | [diff] [blame] | 737 | 'do_generate_rwfs_static do_generate_phosphor_manifest', d) |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 738 | |
Patrick Williams | b9e124c | 2022-12-14 09:10:49 -0600 | [diff] [blame] | 739 | if 'mtd-static-norootfs' in types: |
| 740 | bb.build.addtask( |
| 741 | 'do_generate_static_norootfs', |
| 742 | 'do_image_complete', |
| 743 | 'do_image_cpio', d) |
| 744 | |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 745 | if 'mtd-ubi' in types: |
| 746 | bb.build.addtask( |
| 747 | 'do_generate_ubi', |
| 748 | 'do_image_complete', |
| 749 | 'do_generate_rwfs_ubi', d) |
| 750 | if 'mtd-ubi-tar' in types: |
| 751 | bb.build.addtask( |
| 752 | 'do_generate_ubi_tar', |
| 753 | 'do_image_complete', |
| 754 | 'do_generate_rwfs_ubi do_generate_phosphor_manifest', d) |
Adriana Kobylak | 9b7197e | 2019-07-29 15:25:33 -0500 | [diff] [blame] | 755 | |
| 756 | if 'mmc-ext4-tar' in types: |
| 757 | bb.build.addtask( |
| 758 | 'do_generate_ext4_tar', |
| 759 | 'do_image_complete', |
| 760 | 'do_generate_rwfs_ext4 do_generate_phosphor_manifest', d) |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 761 | } |