]> code.ossystems Code Review - meta-freescale.git/commitdiff
image_types_fsl.bbclass: Remove image generation code
authorOtavio Salvador <otavio@ossystems.com.br>
Tue, 24 Apr 2018 19:03:33 +0000 (16:03 -0300)
committerOtavio Salvador <otavio@ossystems.com.br>
Tue, 3 Jul 2018 21:42:32 +0000 (18:42 -0300)
In rocko, when using this we triggered a warning so users had enough
time to migrate.

We are now relying on wic to generate the uSD images and then we ought
to remove the leftover code for this release.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
(cherry picked from commit da37faff8be7ef91a828210b4d9476433ee7cc21)

classes/image_types_fsl.bbclass

index e49bb1afab458fccfaea64feead48f2e60ad0e69..5e50f476691cca8eb69a728087ec231f9140e937 100644 (file)
 inherit image_types
 
-IMAGE_BOOTLOADER ?= "u-boot"
-
 # Handle u-boot suffixes
 UBOOT_SUFFIX ?= "bin"
-UBOOT_SUFFIX_SDCARD ?= "${UBOOT_SUFFIX}"
 
 #
 # Handles i.MX mxs bootstream generation
 #
 MXSBOOT_NAND_ARGS ?= ""
 
-# U-Boot mxsboot generation to SD-Card
-UBOOT_SUFFIX_SDCARD_mxs ?= "mxsboot-sdcard"
+# U-Boot mxsboot generation for uSD
 do_image_uboot_mxsboot_sdcard[depends] += "u-boot-mxsboot-native:do_populate_sysroot \
                                            u-boot:do_deploy"
 IMAGE_CMD_uboot-mxsboot-sdcard = "mxsboot sd ${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.${UBOOT_SUFFIX} \
                                              ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.uboot-mxsboot-sdcard"
 
+# U-Boot mxsboot generation for NAND
 do_image_uboot_mxsboot_nand[depends] += "u-boot-mxsboot-native:do_populate_sysroot \
                                          u-boot:do_deploy"
 IMAGE_CMD_uboot-mxsboot-nand = "mxsboot ${MXSBOOT_NAND_ARGS} nand \
                                              ${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.${UBOOT_SUFFIX} \
                                              ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.uboot-mxsboot-nand"
 
-# Boot partition volume id
-BOOTDD_VOLUME_ID ?= "Boot ${MACHINE}"
-
-# Boot partition size [in KiB]
-BOOT_SPACE ?= "8192"
-
-# Set alignment to 4MB [in KiB]
-IMAGE_ROOTFS_ALIGNMENT = "4096"
-
-do_image_sdcard[depends] = "parted-native:do_populate_sysroot \
-                            dosfstools-native:do_populate_sysroot \
-                            mtools-native:do_populate_sysroot \
-                            virtual/kernel:do_deploy \
-                            ${@d.getVar('IMAGE_BOOTLOADER', True) and d.getVar('IMAGE_BOOTLOADER', True) + ':do_deploy' or ''}"
-
-SDCARD = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.sdcard"
-
-SDCARD_GENERATION_COMMAND_mxs = "generate_mxs_sdcard"
-SDCARD_GENERATION_COMMAND_mx25 = "generate_imx_sdcard"
-SDCARD_GENERATION_COMMAND_mx5 = "generate_imx_sdcard"
-SDCARD_GENERATION_COMMAND_mx6 = "generate_imx_sdcard"
-SDCARD_GENERATION_COMMAND_mx7 = "generate_imx_sdcard"
-SDCARD_GENERATION_COMMAND_vf = "generate_imx_sdcard"
-
-
-#
-# Generate the boot image with the boot scripts and required Device Tree
-# files
-_generate_boot_image() {
-       local boot_part=$1
-
-       # Create boot partition image
-       BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDCARD} unit b print \
-                         | awk "/ $boot_part / { print substr(\$4, 1, length(\$4 -1)) / 1024 }")
-
-       # mkdosfs will sometimes use FAT16 when it is not appropriate,
-       # resulting in a boot failure from SYSLINUX. Use FAT32 for
-       # images larger than 512MB, otherwise let mkdosfs decide.
-       if [ $(expr $BOOT_BLOCKS / 1024) -gt 512 ]; then
-               FATSIZE="-F 32"
-       fi
-
-       rm -f ${WORKDIR}/boot.img
-       mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 ${FATSIZE} -C ${WORKDIR}/boot.img $BOOT_BLOCKS
-
-       mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin ::/${KERNEL_IMAGETYPE}
-
-       # Copy boot scripts
-       for item in ${BOOT_SCRIPTS}; do
-               src=`echo $item | awk -F':' '{ print $1 }'`
-               dst=`echo $item | awk -F':' '{ print $2 }'`
-
-               mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/$src ::/$dst
-       done
-
-       # Copy device tree file
-       if test -n "${KERNEL_DEVICETREE}"; then
-               for DTS_FILE in ${KERNEL_DEVICETREE}; do
-                       DTS_BASE_NAME=`basename ${DTS_FILE} .dtb`
-                       if [ -e "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb" ]; then
-                               kernel_bin="`readlink ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin`"
-                               kernel_bin_for_dtb="`readlink ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb | sed "s,$DTS_BASE_NAME,${MACHINE},g;s,\.dtb$,.bin,g"`"
-                               if [ $kernel_bin = $kernel_bin_for_dtb ]; then
-                                       mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb ::/${DTS_BASE_NAME}.dtb
-                               fi
-                       else
-                               bbfatal "${DTS_FILE} does not exist."
-                       fi
-               done
-       fi
-
-       # Copy extlinux.conf to images that have U-Boot Extlinux support.
-       if [ "${UBOOT_EXTLINUX}" = "1" ]; then
-               mmd -i ${WORKDIR}/boot.img ::/extlinux
-               mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/extlinux.conf ::/extlinux/extlinux.conf
-       fi
-}
-
-#
-# Create an image that can by written onto a SD card using dd for use
-# with i.MX SoC family
-#
-# External variables needed:
-#   ${SDCARD_ROOTFS}    - the rootfs image to incorporate
-#   ${IMAGE_BOOTLOADER} - bootloader to use
-#
-# The disk layout used is:
-#
-#    0                      -> IMAGE_ROOTFS_ALIGNMENT         - reserved to bootloader (not partitioned)
-#    IMAGE_ROOTFS_ALIGNMENT -> BOOT_SPACE                     - kernel and other data
-#    BOOT_SPACE             -> SDIMG_SIZE                     - rootfs
-#
-#                                                     Default Free space = 1.3x
-#                                                     Use IMAGE_OVERHEAD_FACTOR to add more space
-#                                                     <--------->
-#            4MiB               8MiB           SDIMG_ROOTFS                    4MiB
-# <-----------------------> <----------> <----------------------> <------------------------------>
-#  ------------------------ ------------ ------------------------ -------------------------------
-# | IMAGE_ROOTFS_ALIGNMENT | BOOT_SPACE | ROOTFS_SIZE            |     IMAGE_ROOTFS_ALIGNMENT    |
-#  ------------------------ ------------ ------------------------ -------------------------------
-# ^                        ^            ^                        ^                               ^
-# |                        |            |                        |                               |
-# 0                      4096     4MiB +  8MiB       4MiB +  8Mib + SDIMG_ROOTFS   4MiB +  8MiB + SDIMG_ROOTFS + 4MiB
-generate_imx_sdcard () {
-       # Create partition table
-       parted -s ${SDCARD} mklabel msdos
-       parted -s ${SDCARD} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED})
-       parted -s ${SDCARD} unit KiB mkpart primary $(expr  ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED}) $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED} \+ $ROOTFS_SIZE)
-       parted ${SDCARD} print
-
-       # Burn bootloader
-       case "${IMAGE_BOOTLOADER}" in
-               u-boot)
-               if [ -n "${SPL_BINARY}" ]; then
-                       dd if=${DEPLOY_DIR_IMAGE}/${SPL_BINARY} of=${SDCARD} conv=notrunc seek=2 bs=512
-                       dd if=${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.${UBOOT_SUFFIX_SDCARD} of=${SDCARD} conv=notrunc seek=69 bs=1K
-               else
-                       dd if=${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.${UBOOT_SUFFIX_SDCARD} of=${SDCARD} conv=notrunc seek=2 bs=512
-               fi
-               ;;
-               *)
-               bberror "Unknown IMAGE_BOOTLOADER value"
-               exit 1
-               ;;
-       esac
-
-       _generate_boot_image 1
-
-       # Burn Partition
-       dd if=${WORKDIR}/boot.img of=${SDCARD} conv=notrunc,fsync seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024)
-       dd if=${SDCARD_ROOTFS} of=${SDCARD} conv=notrunc,fsync seek=1 bs=$(expr ${BOOT_SPACE_ALIGNED} \* 1024 + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024)
-}
-
-#
-# Create an image that can by written onto a SD card using dd for use
-# with i.MXS SoC family
-#
-# External variables needed:
-#   ${SDCARD_ROOTFS}    - the rootfs image to incorporate
-#   ${IMAGE_BOOTLOADER} - bootloader to use
-#
-generate_mxs_sdcard () {
-       # Create partition table
-       parted -s ${SDCARD} mklabel msdos
-
-       case "${IMAGE_BOOTLOADER}" in
-               u-boot)
-               # The disk layout used is:
-               #
-               #    1M - 2M                  - reserved to bootloader and other data
-               #    2M - BOOT_SPACE          - kernel
-               #    BOOT_SPACE - SDCARD_SIZE - rootfs
-               #
-               # The disk layout used is:
-               #
-               #    1M                     -> 2M                             - reserved to bootloader and other data
-               #    2M                     -> BOOT_SPACE                     - kernel and other data
-               #    BOOT_SPACE             -> SDIMG_SIZE                     - rootfs
-               #
-               #                                                        Default Free space = 1.3x
-               #                                                        Use IMAGE_OVERHEAD_FACTOR to add more space
-               #                                                        <--------->
-               #            4MiB                8MiB             SDIMG_ROOTFS                    4MiB
-               # <-----------------------> <-------------> <----------------------> <------------------------------>
-               #  ---------------------------------------- ------------------------ -------------------------------
-               # |      |      |                          |ROOTFS_SIZE             |     IMAGE_ROOTFS_ALIGNMENT    |
-               #  ---------------------------------------- ------------------------ -------------------------------
-               # ^      ^      ^          ^               ^                        ^                               ^
-               # |      |      |          |               |                        |                               |
-               # 0     1M     2M         4M        4MiB + BOOTSPACE   4MiB + BOOTSPACE + SDIMG_ROOTFS   4MiB + BOOTSPACE + SDIMG_ROOTFS + 4MiB
-               #
-               parted -s ${SDCARD} unit KiB mkpart primary 1024 2048
-               parted -s ${SDCARD} unit KiB mkpart primary 2048 $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED})
-               parted -s ${SDCARD} unit KiB mkpart primary $(expr  ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED}) $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED} \+ $ROOTFS_SIZE)
-
-               dd if=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.uboot-mxsboot-sdcard of=${SDCARD} conv=notrunc seek=1 bs=$(expr 1024 \* 1024)
-
-               _generate_boot_image 2
-
-               dd if=${WORKDIR}/boot.img of=${SDCARD} conv=notrunc seek=2 bs=$(expr 1024 \* 1024)
-               ;;
-               *)
-               bberror "Unknown IMAGE_BOOTLOADER value"
-               exit 1
-               ;;
-       esac
-
-       # Change partition type for mxs processor family
-       bbnote "Setting partition type to 0x53 as required for mxs' SoC family."
-       echo -n S | dd of=${SDCARD} bs=1 count=1 seek=450 conv=notrunc
-
-       parted ${SDCARD} print
-
-       dd if=${SDCARD_ROOTFS} of=${SDCARD} conv=notrunc,fsync seek=1 bs=$(expr ${BOOT_SPACE_ALIGNED} \* 1024 + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024)
-}
-
-IMAGE_CMD_sdcard () {
-       bbwarn "The '${MACHINE}' is using the i.MX 'sdcard' image format which is deprecated. This image type is going to be removed in next release so please convert this machine to use the wic tool"
-
-       if [ -z "${SDCARD_ROOTFS}" ]; then
-               bberror "SDCARD_ROOTFS is undefined. To use sdcard image from Freescale's BSP it needs to be defined."
-               exit 1
-       fi
-
-       # Align boot partition and calculate total SD card image size
-       BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1)
-       BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT})
-       SDCARD_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $ROOTFS_SIZE + ${IMAGE_ROOTFS_ALIGNMENT})
-
-       # Initialize a sparse file
-       dd if=/dev/zero of=${SDCARD} bs=1 count=0 seek=$(expr 1024 \* ${SDCARD_SIZE})
-
-       ${SDCARD_GENERATION_COMMAND}
-}
-
-# The sdcard requires the rootfs filesystem to be built before using
-# it so we must make this dependency explicit.
-IMAGE_TYPEDEP_sdcard_append = " ${@d.getVar('SDCARD_ROOTFS', 1).split('.')[-1]}"
-
-# In case we are building for i.MX23 or i.MX28 we need to have the
-# image stream built before the sdcard generation
-IMAGE_TYPEDEP_sdcard_append = " \
-    ${@bb.utils.contains('IMAGE_FSTYPES', 'uboot-mxsboot-sdcard', 'uboot-mxsboot-sdcard', '', d)} \
-"
-
 # In case we are building for i.MX23 or i.MX28 we need to have the
 # image stream built before the wic generation
 do_image_wic[depends] += " \