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 | |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 5 | # Phosphor image types |
| 6 | # |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 7 | # Phosphor OpenBMC supports a fixed partition mtd layout, |
| 8 | # A dynamic mtd with ubi layout, and a tar file for use with |
| 9 | # The reference BMC software update implementation. |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 10 | |
| 11 | # Image composition |
Brad Bishop | 8623bbe | 2018-03-09 00:04:00 -0500 | [diff] [blame] | 12 | FLASH_KERNEL_IMAGE ?= "fitImage-${INITRAMFS_IMAGE}-${MACHINE}.bin" |
| 13 | FLASH_KERNEL_IMAGE_df-obmc-ubi-fs ?= "fitImage-${MACHINE}.bin" |
| 14 | |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 15 | IMAGE_BASETYPE ?= "squashfs-xz" |
| 16 | OVERLAY_BASETYPE ?= "jffs2" |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 17 | FLASH_UBI_BASETYPE ?= "${IMAGE_BASETYPE}" |
| 18 | FLASH_UBI_OVERLAY_BASETYPE ?= "ubifs" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 19 | |
Brad Bishop | 02ee6ae | 2018-03-30 08:43:23 -0400 | [diff] [blame^] | 20 | IMAGE_TYPES += "mtd-static mtd-static-alltar mtd-static-tar mtd-ubi mtd-ubi-tar" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 21 | |
| 22 | IMAGE_TYPEDEP_mtd-static = "${IMAGE_BASETYPE}" |
| 23 | IMAGE_TYPEDEP_mtd-static-tar = "${IMAGE_BASETYPE}" |
| 24 | IMAGE_TYPEDEP_mtd-static-alltar = "mtd-static" |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 25 | IMAGE_TYPEDEP_mtd-ubi = "${FLASH_UBI_BASETYPE}" |
| 26 | IMAGE_TYPEDEP_mtd-ubi-tar = "${FLASH_UBI_BASETYPE}" |
Brad Bishop | 02ee6ae | 2018-03-30 08:43:23 -0400 | [diff] [blame^] | 27 | IMAGE_TYPES_MASKED += "mtd-static mtd-static-alltar mtd-static-tar mtd-ubi mtd-ubi-tar" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 28 | |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 29 | # Flash characteristics in KB unless otherwise noted |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 30 | FLASH_SIZE ?= "32768" |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 31 | FLASH_PEB_SIZE ?= "64" |
| 32 | # Flash page and overhead sizes in bytes |
| 33 | FLASH_PAGE_SIZE ?= "1" |
| 34 | FLASH_NOR_UBI_OVERHEAD ?= "64" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 35 | |
| 36 | # Fixed partition offsets |
| 37 | FLASH_UBOOT_OFFSET ?= "0" |
| 38 | FLASH_KERNEL_OFFSET ?= "512" |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 39 | FLASH_UBI_OFFSET ?= "${FLASH_KERNEL_OFFSET}" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 40 | FLASH_ROFS_OFFSET ?= "4864" |
| 41 | FLASH_RWFS_OFFSET ?= "28672" |
| 42 | |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 43 | # UBI volume sizes in KB unless otherwise noted. |
Adriana Kobylak | b70005d | 2018-02-14 16:35:30 -0600 | [diff] [blame] | 44 | FLASH_UBI_RWFS_SIZE ?= "6144" |
| 45 | FLASH_UBI_RWFS_TXT_SIZE ?= "6MiB" |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 46 | |
| 47 | python() { |
| 48 | # Compute rwfs LEB count and LEB size. |
| 49 | page_size = d.getVar('FLASH_PAGE_SIZE', True) |
| 50 | nor_overhead_size = d.getVar('FLASH_NOR_UBI_OVERHEAD', True) |
| 51 | overhead_size = max(int(page_size), int(nor_overhead_size)) |
| 52 | peb_size = d.getVar('FLASH_PEB_SIZE', True) |
| 53 | leb_size = (int(peb_size) * 1024) - (2 * overhead_size) |
| 54 | d.setVar('FLASH_LEB_SIZE', str(leb_size)) # In bytes |
| 55 | |
| 56 | rwfs_size = d.getVar('FLASH_UBI_RWFS_SIZE', True) |
| 57 | rwfs_size = int(rwfs_size) * 1024 |
| 58 | lebs = int((rwfs_size + leb_size - 1) / leb_size) # Rounding up |
| 59 | d.setVar('FLASH_UBI_RWFS_LEBS', str(lebs)) |
| 60 | } |
| 61 | |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 62 | # Allow rwfs mkfs configuration through OVERLAY_MKFS_OPTS and OVERRIDES. However, |
| 63 | # avoid setting 'ext4' or 'jffs2' in OVERRIDES as such raw filesystem types are |
| 64 | # reserved for the primary image (and setting them currently breaks the build). |
| 65 | # Instead, prefix the overlay override value with 'rwfs-' to avoid collisions. |
| 66 | DISTROOVERRIDES .= ":static-rwfs-${OVERLAY_BASETYPE}" |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 67 | DISTROOVERRIDES .= ":ubi-rwfs-${FLASH_UBI_OVERLAY_BASETYPE}" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 68 | |
| 69 | JFFS2_RWFS_CMD = "mkfs.jffs2 --root=jffs2 --faketime --output=rwfs.jffs2" |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 70 | UBIFS_RWFS_CMD = "mkfs.ubifs -r ubifs -c ${FLASH_UBI_RWFS_LEBS} -m ${FLASH_PAGE_SIZE} -e ${FLASH_LEB_SIZE} rwfs.ubifs" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 71 | |
| 72 | FLASH_STATIC_RWFS_CMD_static-rwfs-jffs2 = "${JFFS2_RWFS_CMD}" |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 73 | FLASH_UBI_RWFS_CMD_ubi-rwfs-jffs2 = "${JFFS2_RWFS_CMD}" |
| 74 | FLASH_UBI_RWFS_CMD_ubi-rwfs-ubifs = "${UBIFS_RWFS_CMD}" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 75 | |
| 76 | mk_nor_image() { |
| 77 | image_dst="$1" |
| 78 | image_size_kb=$2 |
| 79 | dd if=/dev/zero bs=1k count=$image_size_kb \ |
| 80 | | tr '\000' '\377' > $image_dst |
| 81 | } |
| 82 | |
| 83 | make_rwfs() { |
| 84 | type=$1 |
| 85 | cmd=$2 |
| 86 | shift |
| 87 | shift |
| 88 | opts="$@" |
| 89 | |
| 90 | rm -f rwfs.$type |
| 91 | rm -rf $type |
| 92 | mkdir $type |
| 93 | |
| 94 | $cmd $opts |
| 95 | } |
| 96 | |
| 97 | do_generate_rwfs_static() { |
| 98 | make_rwfs ${OVERLAY_BASETYPE} "${FLASH_STATIC_RWFS_CMD}" ${OVERLAY_MKFS_OPTS} |
| 99 | } |
| 100 | do_generate_rwfs_static[dirs] = " ${S}/static" |
| 101 | do_generate_rwfs_static[depends] += " \ |
| 102 | mtd-utils-native:do_populate_sysroot \ |
| 103 | " |
| 104 | |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 105 | do_generate_rwfs_ubi() { |
| 106 | make_rwfs ${FLASH_UBI_OVERLAY_BASETYPE} "${FLASH_UBI_RWFS_CMD}" |
| 107 | } |
| 108 | do_generate_rwfs_ubi[dirs] = " ${S}/ubi" |
| 109 | do_generate_rwfs_ubi[depends] += " \ |
| 110 | mtd-utils-native:do_populate_sysroot \ |
| 111 | " |
| 112 | |
| 113 | add_volume() { |
| 114 | config_file=$1 |
| 115 | vol_id=$2 |
| 116 | vol_type=$3 |
| 117 | vol_name=$4 |
| 118 | image=$5 |
| 119 | vol_size=$6 |
| 120 | |
| 121 | echo \[$vol_name\] >> $config_file |
| 122 | echo mode=ubi >> $config_file |
| 123 | echo image=$image >> $config_file |
| 124 | echo vol_type=$vol_type >> $config_file |
| 125 | echo vol_name=$vol_name >> $config_file |
| 126 | echo vol_id=$vol_id >> $config_file |
| 127 | if [ ! -z $vol_size ]; then |
| 128 | echo vol_size=$vol_size >> $config_file |
| 129 | fi |
| 130 | } |
| 131 | |
Saqib Khan | 4172347 | 2017-09-22 10:21:30 -0500 | [diff] [blame] | 132 | python do_generate_ubi() { |
| 133 | version_id = do_get_versionID(d) |
| 134 | d.setVar('VERSION_ID', version_id) |
| 135 | bb.build.exec_func("do_make_ubi", d) |
| 136 | } |
| 137 | do_generate_ubi[dirs] = "${S}/ubi" |
| 138 | do_generate_ubi[depends] += " \ |
| 139 | ${PN}:do_image_${@d.getVar('FLASH_UBI_BASETYPE', True).replace('-', '_')} \ |
| 140 | virtual/kernel:do_deploy \ |
| 141 | u-boot:do_populate_sysroot \ |
| 142 | mtd-utils-native:do_populate_sysroot \ |
| 143 | " |
| 144 | |
| 145 | do_make_ubi() { |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 146 | cfg=ubinize-${IMAGE_NAME}.cfg |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 147 | rm -f $cfg ubi-img |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 148 | # Construct the ubinize config file |
Saqib Khan | 4172347 | 2017-09-22 10:21:30 -0500 | [diff] [blame] | 149 | add_volume $cfg 0 static kernel-${VERSION_ID} \ |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 150 | ${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE} |
| 151 | |
Saqib Khan | 4172347 | 2017-09-22 10:21:30 -0500 | [diff] [blame] | 152 | add_volume $cfg 1 static rofs-${VERSION_ID} \ |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 153 | ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${FLASH_UBI_BASETYPE} |
| 154 | |
| 155 | add_volume $cfg 2 dynamic rwfs rwfs.${FLASH_UBI_OVERLAY_BASETYPE} ${FLASH_UBI_RWFS_TXT_SIZE} |
| 156 | |
| 157 | # Build the ubi partition image |
| 158 | ubinize -p ${FLASH_PEB_SIZE}KiB -m ${FLASH_PAGE_SIZE} -o ubi-img $cfg |
| 159 | |
| 160 | # Concatenate the uboot and ubi partitions |
| 161 | mk_nor_image ${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd ${FLASH_SIZE} |
| 162 | dd bs=1k conv=notrunc seek=${FLASH_UBOOT_OFFSET} \ |
| 163 | if=${DEPLOY_DIR_IMAGE}/u-boot.${UBOOT_SUFFIX} \ |
| 164 | of=${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd |
| 165 | dd bs=1k conv=notrunc seek=${FLASH_UBI_OFFSET} \ |
| 166 | if=ubi-img \ |
| 167 | of=${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd |
| 168 | |
| 169 | cd ${IMGDEPLOYDIR} |
| 170 | ln -sf ${IMAGE_NAME}.ubi.mtd ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.ubi.mtd |
| 171 | } |
Saqib Khan | 4172347 | 2017-09-22 10:21:30 -0500 | [diff] [blame] | 172 | do_make_ubi[dirs] = "${S}/ubi" |
| 173 | do_make_ubi[depends] += " \ |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 174 | ${PN}:do_image_${@d.getVar('FLASH_UBI_BASETYPE', True).replace('-', '_')} \ |
| 175 | virtual/kernel:do_deploy \ |
| 176 | u-boot:do_populate_sysroot \ |
| 177 | mtd-utils-native:do_populate_sysroot \ |
| 178 | " |
| 179 | |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 180 | do_generate_static() { |
| 181 | # Assemble the flash image |
| 182 | mk_nor_image ${IMGDEPLOYDIR}/${IMAGE_NAME}.static.mtd ${FLASH_SIZE} |
| 183 | dd bs=1k conv=notrunc seek=${FLASH_UBOOT_OFFSET} \ |
| 184 | if=${DEPLOY_DIR_IMAGE}/u-boot.${UBOOT_SUFFIX} \ |
| 185 | of=${IMGDEPLOYDIR}/${IMAGE_NAME}.static.mtd |
| 186 | |
| 187 | dd bs=1k conv=notrunc seek=${FLASH_KERNEL_OFFSET} \ |
| 188 | if=${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE} \ |
| 189 | of=${IMGDEPLOYDIR}/${IMAGE_NAME}.static.mtd |
| 190 | |
| 191 | dd bs=1k conv=notrunc seek=${FLASH_ROFS_OFFSET} \ |
| 192 | if=${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${IMAGE_BASETYPE} \ |
| 193 | of=${IMGDEPLOYDIR}/${IMAGE_NAME}.static.mtd |
| 194 | |
| 195 | dd bs=1k conv=notrunc seek=${FLASH_RWFS_OFFSET} \ |
| 196 | if=rwfs.${OVERLAY_BASETYPE} \ |
| 197 | of=${IMGDEPLOYDIR}/${IMAGE_NAME}.static.mtd |
| 198 | # File needed for generating non-standard legacy links below |
| 199 | cp rwfs.${OVERLAY_BASETYPE} ${IMGDEPLOYDIR}/rwfs.${OVERLAY_BASETYPE} |
| 200 | |
| 201 | cd ${IMGDEPLOYDIR} |
| 202 | ln -sf ${IMAGE_NAME}.static.mtd ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.static.mtd |
| 203 | |
| 204 | # Maintain non-standard legacy links |
| 205 | ln -sf ${IMAGE_NAME}.static.mtd ${IMGDEPLOYDIR}/flash-${MACHINE} |
| 206 | ln -sf ${IMAGE_NAME}.static.mtd ${IMGDEPLOYDIR}/image-bmc |
| 207 | ln -sf u-boot.${UBOOT_SUFFIX} ${IMGDEPLOYDIR}/image-u-boot |
| 208 | ln -sf ${FLASH_KERNEL_IMAGE} ${IMGDEPLOYDIR}/image-kernel |
| 209 | ln -sf ${IMAGE_LINK_NAME}.${IMAGE_BASETYPE} ${IMGDEPLOYDIR}/image-rofs |
| 210 | ln -sf rwfs.${OVERLAY_BASETYPE} ${IMGDEPLOYDIR}/image-rwfs |
| 211 | } |
| 212 | do_generate_static[dirs] = "${S}/static" |
| 213 | do_generate_static[depends] += " \ |
| 214 | ${PN}:do_image_${@d.getVar('IMAGE_BASETYPE', True).replace('-', '_')} \ |
| 215 | virtual/kernel:do_deploy \ |
| 216 | u-boot:do_populate_sysroot \ |
| 217 | " |
| 218 | |
| 219 | do_generate_static_alltar() { |
| 220 | ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.static.mtd image-bmc |
| 221 | tar -h -cvf ${IMGDEPLOYDIR}/${IMAGE_NAME}.static.mtd.all.tar image-bmc |
| 222 | |
| 223 | cd ${IMGDEPLOYDIR} |
| 224 | |
| 225 | ln -sf ${IMAGE_NAME}.static.mtd.all.tar \ |
| 226 | ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.static.mtd.all.tar |
| 227 | |
| 228 | # Maintain non-standard legacy link. |
| 229 | ln -sf ${IMAGE_NAME}.static.mtd.all.tar \ |
| 230 | ${IMGDEPLOYDIR}/${MACHINE}-${DATETIME}.all.tar |
| 231 | } |
| 232 | do_generate_static_alltar[vardepsexclude] = "DATETIME" |
| 233 | do_generate_static_alltar[dirs] = "${S}/static" |
| 234 | |
Brad Bishop | de65938 | 2018-03-30 01:46:16 -0400 | [diff] [blame] | 235 | make_image_links() { |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 236 | rwfs=$1 |
| 237 | rofs=$2 |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 238 | shift |
| 239 | shift |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 240 | |
Brad Bishop | de65938 | 2018-03-30 01:46:16 -0400 | [diff] [blame] | 241 | # Create some links to help make the tar archive in the format |
| 242 | # expected by phosphor-bmc-code-mgmt. |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 243 | ln -sf ${DEPLOY_DIR_IMAGE}/u-boot.${UBOOT_SUFFIX} image-u-boot |
| 244 | ln -sf ${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE} image-kernel |
| 245 | ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$rofs image-rofs |
| 246 | ln -sf rwfs.$rwfs image-rwfs |
Brad Bishop | de65938 | 2018-03-30 01:46:16 -0400 | [diff] [blame] | 247 | } |
| 248 | |
| 249 | make_tar_of_images() { |
| 250 | type=$1 |
| 251 | shift |
| 252 | extra_files="$@" |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 253 | |
| 254 | # Create the tar archive |
| 255 | tar -h -cvf ${IMGDEPLOYDIR}/${IMAGE_NAME}.$type.mtd.tar \ |
| 256 | image-u-boot image-kernel image-rofs image-rwfs $extra_files |
| 257 | |
| 258 | cd ${IMGDEPLOYDIR} |
| 259 | ln -sf ${IMAGE_NAME}.$type.mtd.tar ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$type.mtd.tar |
| 260 | } |
| 261 | |
| 262 | do_generate_static_tar() { |
Brad Bishop | de65938 | 2018-03-30 01:46:16 -0400 | [diff] [blame] | 263 | make_image_links ${OVERLAY_BASETYPE} ${IMAGE_BASETYPE} |
| 264 | make_tar_of_images static |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 265 | |
| 266 | # Maintain non-standard legacy link. |
| 267 | cd ${IMGDEPLOYDIR} |
| 268 | ln -sf ${IMAGE_NAME}.static.mtd.tar ${IMGDEPLOYDIR}/${MACHINE}-${DATETIME}.tar |
| 269 | } |
| 270 | do_generate_static_tar[dirs] = " ${S}/static" |
| 271 | do_generate_static_tar[depends] += " \ |
| 272 | ${PN}:do_image_${@d.getVar('IMAGE_BASETYPE', True).replace('-', '_')} \ |
| 273 | virtual/kernel:do_deploy \ |
| 274 | u-boot:do_populate_sysroot \ |
| 275 | " |
| 276 | do_generate_static_tar[vardepsexclude] = "DATETIME" |
| 277 | |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 278 | do_generate_ubi_tar() { |
| 279 | ln -sf ${S}/MANIFEST MANIFEST |
Brad Bishop | de65938 | 2018-03-30 01:46:16 -0400 | [diff] [blame] | 280 | make_image_links ${FLASH_UBI_OVERLAY_BASETYPE} ${FLASH_UBI_BASETYPE} |
| 281 | make_tar_of_images ubi MANIFEST |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 282 | } |
| 283 | do_generate_ubi_tar[dirs] = " ${S}/ubi" |
| 284 | do_generate_ubi_tar[depends] += " \ |
| 285 | ${PN}:do_image_${@d.getVar('FLASH_UBI_BASETYPE', True).replace('-', '_')} \ |
| 286 | virtual/kernel:do_deploy \ |
| 287 | u-boot:do_populate_sysroot \ |
| 288 | " |
| 289 | |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 290 | python do_generate_phosphor_manifest() { |
Saqib Khan | 4172347 | 2017-09-22 10:21:30 -0500 | [diff] [blame] | 291 | version = do_get_version(d) |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 292 | with open('MANIFEST', 'w') as fd: |
| 293 | fd.write('purpose=xyz.openbmc_project.Software.Version.VersionPurpose.BMC\n') |
| 294 | fd.write('version={}\n'.format(version.strip('"'))) |
| 295 | } |
| 296 | do_generate_phosphor_manifest[dirs] = "${S}" |
| 297 | do_generate_phosphor_manifest[depends] += " \ |
| 298 | os-release:do_populate_sysroot \ |
| 299 | " |
| 300 | |
| 301 | addtask generate_phosphor_manifest after do_rootfs |
| 302 | addtask generate_rwfs_static after do_rootfs |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 303 | addtask generate_rwfs_ubi after do_rootfs |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 304 | |
| 305 | python() { |
| 306 | types = d.getVar('IMAGE_FSTYPES', True).split() |
| 307 | |
| 308 | if any([x in types for x in ['mtd-static', 'mtd-static-alltar']]): |
| 309 | bb.build.addtask( |
| 310 | 'do_generate_static', |
| 311 | 'do_image_complete', |
| 312 | 'do_generate_rwfs_static', d) |
| 313 | if 'mtd-static-alltar' in types: |
| 314 | bb.build.addtask( |
| 315 | 'do_generate_static_alltar', |
| 316 | 'do_image_complete', |
| 317 | 'do_generate_static', d) |
| 318 | if 'mtd-static-tar' in types: |
| 319 | bb.build.addtask( |
| 320 | 'do_generate_static_tar', |
| 321 | 'do_image_complete', |
| 322 | 'do_generate_rwfs_static', d) |
Brad Bishop | 3aa1ef6 | 2017-08-04 23:48:12 -0400 | [diff] [blame] | 323 | |
| 324 | if 'mtd-ubi' in types: |
| 325 | bb.build.addtask( |
| 326 | 'do_generate_ubi', |
| 327 | 'do_image_complete', |
| 328 | 'do_generate_rwfs_ubi', d) |
| 329 | if 'mtd-ubi-tar' in types: |
| 330 | bb.build.addtask( |
| 331 | 'do_generate_ubi_tar', |
| 332 | 'do_image_complete', |
| 333 | 'do_generate_rwfs_ubi do_generate_phosphor_manifest', d) |
Brad Bishop | 19fc4f8 | 2017-08-04 23:38:54 -0400 | [diff] [blame] | 334 | } |