title: How to calculate file size to pad in BitBake?
body: <p>I've written a <code>.bbappend</code> file to pad the generated image for <code>16-byte alignment</code>. However I can not write the padding logic in <code>bash</code> or <code>python</code> in <code>.bbappend</code> file, as it throws error.</p>
  <p>Here's the fragment from the file:</p>
  <pre class="lang-sh prettyprint-override"><code># Anonymous python function to set the padding size variable
  python () {
      d.setVar(&quot;TEE_SIZE&quot;, &quot;0xac000&quot;)
  }
  
  do_deploy () {
      install -d ${DEPLOYDIR}
      ${TARGET_PREFIX}objcopy -O binary ${B}/core/tee.elf ${DEPLOYDIR}/tee_tmp.bin
  
      # Padding for 16 byte alignment
      bbnote &quot;Padding to ${TEE_SIZE}&quot;
      ${TARGET_PREFIX}objcopy -I binary -O binary --pad-to ${TEE_SIZE} --gap-fill=0x0 ${DEPLOYDIR}/tee_tmp.bin ${DEPLOYDIR}/tee.${PLATFORM_FLAVOR}.bin
  
      # Deleting temp TEE, after padding
      rm -f  ${DEPLOYDIR}/tee_tmp.bin
  }
  </code></pre>
  <p>I would like to get the size of <code>${DEPLOYDIR}/tee_tmp.bin</code> and pad it to the next number divisible by <code>0x10</code>.</p>
  <ol>
  <li>Can someone help me achieving this?</li>
  <li>How can I perform arithmetic operations in <code>bitbake</code> file?</li>
  </ol>
  <p>Thanks in advance.</p>