image_types_digi: make it compatible with python 2.6
Python 2.6 does not have bit_length function: 'int' object has no attribute 'bit_length' Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
parent
767fc18b85
commit
1111a3d6a0
|
|
@ -7,9 +7,16 @@ def max_leb_count(d):
|
||||||
_flash_peb = d.getVar('FLASH_PEB', True)
|
_flash_peb = d.getVar('FLASH_PEB', True)
|
||||||
_flash_psz = d.getVar('FLASH_PSZ', True)
|
_flash_psz = d.getVar('FLASH_PSZ', True)
|
||||||
for i in _flash_peb.split(','):
|
for i in _flash_peb.split(','):
|
||||||
_mlc.append(str(2 ** (int(_flash_psz)/int(i) - 1).bit_length() - 1))
|
_mlc.append(str(next_power_of_2(int(_flash_psz)/int(i)) - 1))
|
||||||
return ','.join(_mlc)
|
return ','.join(_mlc)
|
||||||
|
|
||||||
|
# Return next power_of_2 bigger than passed argument
|
||||||
|
def next_power_of_2(n):
|
||||||
|
i = 1
|
||||||
|
while (n > i):
|
||||||
|
i <<= 1
|
||||||
|
return i
|
||||||
|
|
||||||
IMAGE_CMD_jffs2() {
|
IMAGE_CMD_jffs2() {
|
||||||
nimg="$(echo ${FLASH_PEB} | awk -F, '{print NF}')"
|
nimg="$(echo ${FLASH_PEB} | awk -F, '{print NF}')"
|
||||||
for i in $(seq 1 ${nimg}); do
|
for i in $(seq 1 ${nimg}); do
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue