diff --git a/meta-digi-arm/classes/image_types_digi.bbclass b/meta-digi-arm/classes/image_types_digi.bbclass index 23a6137fe..d7758c48d 100644 --- a/meta-digi-arm/classes/image_types_digi.bbclass +++ b/meta-digi-arm/classes/image_types_digi.bbclass @@ -1,64 +1,28 @@ inherit image_types_fsl -################################################### -## Platform data to be used in different scripts ## -################################################### -# -# -# mlc, peb, leb, mio and sub might be a list of values (separated by commas) -# -# Values verified from actual modules with: -# ubiattach -m /dev/ubi_ctrl -# -# Max LEB count values calculated assuming following partition sizes: -# -# max_leb_cnt="$(($(power_of_2 $((psize / peb))) - 1))" -# psize = 524288 KiB; peb=128 KiB -> max_leb_cnt = 4095 -# psize = 524288 KiB; peb=512 KiB -> max_leb_cnt = 1023 -# psize = 262144 KiB; peb=128 KiB -> max_leb_cnt = 2047 -# -load_platform_data() { - while read _pl _mlc _peb _leb _mio _sub; do - eval "${_pl}_mlc=\"$(echo ${_mlc} | tr ',' ' ')\"" - eval "${_pl}_peb=\"$(echo ${_peb} | tr ',' ' ')\"" - eval "${_pl}_leb=\"$(echo ${_leb} | tr ',' ' ')\"" - eval "${_pl}_mio=\"$(echo ${_mio} | tr ',' ' ')\"" - eval "${_pl}_sub=\"$(echo ${_sub} | tr ',' ' ')\"" - done<<-_EOF_ - ccardimx28js 2047 128 126976 2048 - - ccimx51js 4095,1023 128,512 129024,520192 2048,4096 512,1024 - ccimx53js 4095,1023 128,512 129024,520192 2048,4096 512,1024 - cpx2 2047 128 126976 2048 - - wr21 2047 128 126976 2048 - -_EOF_ - # Set generic variables for current MACHINE - nimg="$(eval echo \${${MACHINE}_peb} | wc -w)" - for i in $(seq 1 ${nimg}); do - eval mlc${i}="$(eval echo \${${MACHINE}_mlc} | cut -d' ' -f${i})" - eval peb${i}="$(eval echo \${${MACHINE}_peb} | cut -d' ' -f${i})" - eval leb${i}="$(eval echo \${${MACHINE}_leb} | cut -d' ' -f${i})" - eval mio${i}="$(eval echo \${${MACHINE}_mio} | cut -d' ' -f${i})" - eval sub${i}="$(eval echo \${${MACHINE}_sub} | cut -d' ' -f${i})" - done -} +# Dynamically calculate max LEB count for UBIFS images +FLASH_MLC = "${@max_leb_count(d)}" +def max_leb_count(d): + _mlc = [] + _flash_peb = d.getVar('FLASH_PEB', True) + _flash_psz = d.getVar('FLASH_PSZ', True) + for i in _flash_peb.split(','): + _mlc.append(str(2 ** (int(_flash_psz)/int(i) - 1).bit_length() - 1)) + return ','.join(_mlc) IMAGE_CMD_jffs2() { - # Source platform data - load_platform_data - + nimg="$(echo ${FLASH_PEB} | awk -F, '{print NF}')" for i in $(seq 1 ${nimg}); do - eval peb_it="\${peb${i}}" + peb_it="$(echo ${FLASH_PEB} | cut -d',' -f${i})" # Do not use '-p (padding)' option. It breaks 'ccardimx28js' flash images [JIRA:DEL-218] mkfs.jffs2 -n -e ${peb_it} -d ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.${peb_it}.rootfs.jffs2 done } IMAGE_CMD_sum.jffs2() { - # Source platform data - load_platform_data - + nimg="$(echo ${FLASH_PEB} | awk -F, '{print NF}')" for i in $(seq 1 ${nimg}); do - eval peb_it="\${peb${i}}" + peb_it="$(echo ${FLASH_PEB} | cut -d',' -f${i})" # Do not use '-p (padding)' option. It breaks 'ccardimx28js' flash images [JIRA:DEL-218] mkfs.jffs2 -n -e ${peb_it} -d ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.${peb_it}.rootfs.jffs2 sumtool -e ${peb_it} -i ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.${peb_it}.rootfs.jffs2 -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.${peb_it}.rootfs.sum.jffs2 @@ -67,19 +31,16 @@ IMAGE_CMD_sum.jffs2() { } IMAGE_CMD_ubifs() { - # Source platform data - load_platform_data - + nimg="$(echo ${FLASH_PEB} | awk -F, '{print NF}')" for i in $(seq 1 ${nimg}); do - eval mlc_it="\${mlc${i}}" - eval peb_it="\${peb${i}}" - eval leb_it="\${leb${i}}" - eval mio_it="\${mio${i}}" + mlc_it="$(echo ${FLASH_MLC} | cut -d',' -f${i})" + peb_it="$(echo ${FLASH_PEB} | cut -d',' -f${i})" + leb_it="$(echo ${FLASH_LEB} | cut -d',' -f${i})" + mio_it="$(echo ${FLASH_MIO} | cut -d',' -f${i})" mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.${peb_it}.rootfs.ubifs -m ${mio_it} -e ${leb_it} -c ${mlc_it} done } - # # A copy of the original function in 'image_types.bbclass', just overriding the # part of the symlinks generation so we can create more than one symlink (one per @@ -96,8 +57,8 @@ runimagecmd_jffs2() { if [ -n "${IMAGE_LINK_NAME}" ]; then for type in ${subimages}; do for i in $(seq 1 ${nimg}); do - eval peb_it="\${peb${i}}" - ln -s ${IMAGE_NAME}.${peb_it}.rootfs.$type ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${peb_it}.$type + peb_it="$(echo ${FLASH_PEB} | cut -d',' -f${i})" + ln -sf ${IMAGE_NAME}.${peb_it}.rootfs.$type ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${peb_it}.$type done done fi diff --git a/meta-digi-arm/conf/machine/ccardimx28js.conf b/meta-digi-arm/conf/machine/ccardimx28js.conf index ecd66c99b..83888bddd 100644 --- a/meta-digi-arm/conf/machine/ccardimx28js.conf +++ b/meta-digi-arm/conf/machine/ccardimx28js.conf @@ -12,3 +12,20 @@ SERIAL_CONSOLE = "115200 ttyS0" # Use our wmiconfig instead of the one in meta-oe PREFERRED_VERSION_wmiconfig ?= "3.4p4" + +################################################# +## Flash parameters for JFFS2 and UBIFS images ## +################################################# +# partition size (KiB) +# physical eraseblock size (KiB) +# logical eraseblock size (bytes) +# minimum input/output size (bytes) +# sub-page size (bytes) +# +# PEB, LEB, MIO and SUB might be a list of comma-separated values +# +FLASH_PSZ = "262144" +FLASH_PEB = "128" +FLASH_LEB = "126976" +FLASH_MIO = "2048" +FLASH_SUB = "-" diff --git a/meta-digi-arm/conf/machine/ccimx51js.conf b/meta-digi-arm/conf/machine/ccimx51js.conf index cad66d256..8dced291a 100644 --- a/meta-digi-arm/conf/machine/ccimx51js.conf +++ b/meta-digi-arm/conf/machine/ccimx51js.conf @@ -6,3 +6,19 @@ include conf/machine/include/ccimx51.inc SERIAL_CONSOLE = "38400 ttymxc1" +################################################# +## Flash parameters for JFFS2 and UBIFS images ## +################################################# +# partition size (KiB) +# physical eraseblock size (KiB) +# logical eraseblock size (bytes) +# minimum input/output size (bytes) +# sub-page size (bytes) +# +# PEB, LEB, MIO and SUB might be a list of comma-separated values +# +FLASH_PSZ = "524288" +FLASH_PEB = "128,512" +FLASH_LEB = "129024,520192" +FLASH_MIO = "2048,4096" +FLASH_SUB = "512,1024" diff --git a/meta-digi-arm/conf/machine/ccimx53js.conf b/meta-digi-arm/conf/machine/ccimx53js.conf index 04539e863..0ae3dba90 100644 --- a/meta-digi-arm/conf/machine/ccimx53js.conf +++ b/meta-digi-arm/conf/machine/ccimx53js.conf @@ -6,3 +6,20 @@ include conf/machine/include/ccimx53.inc SERIAL_CONSOLE = "115200 ttymxc0" + +################################################# +## Flash parameters for JFFS2 and UBIFS images ## +################################################# +# partition size (KiB) +# physical eraseblock size (KiB) +# logical eraseblock size (bytes) +# minimum input/output size (bytes) +# sub-page size (bytes) +# +# PEB, LEB, MIO and SUB might be a list of comma-separated values +# +FLASH_PSZ = "524288" +FLASH_PEB = "128,512" +FLASH_LEB = "129024,520192" +FLASH_MIO = "2048,4096" +FLASH_SUB = "512,1024" diff --git a/meta-digi-arm/conf/machine/cpx2.conf b/meta-digi-arm/conf/machine/cpx2.conf index 23e782938..ca6e2f4fb 100644 --- a/meta-digi-arm/conf/machine/cpx2.conf +++ b/meta-digi-arm/conf/machine/cpx2.conf @@ -19,3 +19,20 @@ MACHINE_FIRMWARE = "firmware-mxs-ar3k" MACHINE_EXTRA_RRECOMMENDS += "${MACHINE_FIRMWARE}" # MACHINE_FEATURES_append = " wifi" + +################################################# +## Flash parameters for JFFS2 and UBIFS images ## +################################################# +# partition size (KiB) +# physical eraseblock size (KiB) +# logical eraseblock size (bytes) +# minimum input/output size (bytes) +# sub-page size (bytes) +# +# PEB, LEB, MIO and SUB might be a list of comma-separated values +# +FLASH_PSZ = "262144" +FLASH_PEB = "128" +FLASH_LEB = "126976" +FLASH_MIO = "2048" +FLASH_SUB = "-" diff --git a/meta-digi-arm/conf/machine/wr21.conf b/meta-digi-arm/conf/machine/wr21.conf index 467c6982d..8b9b9f898 100644 --- a/meta-digi-arm/conf/machine/wr21.conf +++ b/meta-digi-arm/conf/machine/wr21.conf @@ -10,3 +10,20 @@ UBOOT_ENTRYPOINT = "0x41008000" UBOOT_LOADADDRESS = "0x41008000" SERIAL_CONSOLE = "115200 ttySP1" + +################################################# +## Flash parameters for JFFS2 and UBIFS images ## +################################################# +# partition size (KiB) +# physical eraseblock size (KiB) +# logical eraseblock size (bytes) +# minimum input/output size (bytes) +# sub-page size (bytes) +# +# PEB, LEB, MIO and SUB might be a list of comma-separated values +# +FLASH_PSZ = "262144" +FLASH_PEB = "128" +FLASH_LEB = "126976" +FLASH_MIO = "2048" +FLASH_SUB = "-"