diff options
| -rw-r--r-- | meta-fsl-arm/classes/image_types_fsl.bbclass | 76 | ||||
| -rw-r--r-- | meta-fsl-arm/classes/sdcard_image.bbclass | 55 | ||||
| -rw-r--r-- | meta-fsl-arm/conf/distro/include/fsl-default-settings.inc | 3 | ||||
| -rw-r--r-- | meta-fsl-arm/conf/machine/include/imx-base.inc | 5 |
4 files changed, 83 insertions, 56 deletions
diff --git a/meta-fsl-arm/classes/image_types_fsl.bbclass b/meta-fsl-arm/classes/image_types_fsl.bbclass new file mode 100644 index 000000000..3ae0b1722 --- /dev/null +++ b/meta-fsl-arm/classes/image_types_fsl.bbclass | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | inherit image_types | ||
| 2 | |||
| 3 | IMAGE_BOOTLOADER ?= "u-boot" | ||
| 4 | |||
| 5 | # Handle u-boot suffixes | ||
| 6 | UBOOT_SUFFIX ?= "bin" | ||
| 7 | |||
| 8 | # | ||
| 9 | # Create an image that can by written onto a SD card using dd. | ||
| 10 | # | ||
| 11 | # External variables needed: | ||
| 12 | # ${SDCARD_ROOTFS} - the rootfs image to incorporate | ||
| 13 | # ${IMAGE_BOOTLOADER} - bootloader to use {u-boot, barebox}x | ||
| 14 | # | ||
| 15 | # The disk layout used is: | ||
| 16 | # | ||
| 17 | # 0 - 1M - reserved to bootloader and other data | ||
| 18 | # 1M - BOOT_SPACE - kernel | ||
| 19 | # BOOT_SPACE - SDCARD_SIZE - rootfs | ||
| 20 | # | ||
| 21 | |||
| 22 | # Default to 3.4GiB images | ||
| 23 | SDCARD_SIZE ?= "3400" | ||
| 24 | |||
| 25 | # Boot partition volume id | ||
| 26 | BOOTDD_VOLUME_ID ?= "Boot ${MACHINE}" | ||
| 27 | |||
| 28 | # Addional space for boot partition | ||
| 29 | BOOT_SPACE ?= "5M" | ||
| 30 | |||
| 31 | IMAGE_DEPENDS_sdcard = "parted-native dosfstools-native mtools-native \ | ||
| 32 | virtual/kernel ${IMAGE_BOOTLOADER}" | ||
| 33 | |||
| 34 | IMAGE_CMD_sdcard () { | ||
| 35 | if [ -z "${SDCARD_ROOTFS}" ]; then | ||
| 36 | bberror "SDCARD_ROOTFS is undefined. To use sdcard image from Freescale's BSP it needs to be defined." | ||
| 37 | exit 1 | ||
| 38 | fi | ||
| 39 | |||
| 40 | TMP=${WORKDIR}/tmp | ||
| 41 | SDCARD=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.sdcard | ||
| 42 | |||
| 43 | dd if=/dev/zero of=${SDCARD} bs=$(expr 1000 \* 1000) count=${SDCARD_SIZE} | ||
| 44 | |||
| 45 | # Create partition table | ||
| 46 | parted -s ${SDCARD} mklabel msdos | ||
| 47 | parted -s ${SDCARD} mkpart primary 0 1M | ||
| 48 | parted -s ${SDCARD} mkpart primary 1M ${BOOT_SPACE} | ||
| 49 | parted -s ${SDCARD} mkpart primary ${BOOT_SPACE} 100% | ||
| 50 | parted ${SDCARD} print | ||
| 51 | |||
| 52 | case "${IMAGE_BOOTLOADER}" in | ||
| 53 | u-boot) | ||
| 54 | dd if=${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.${UBOOT_SUFFIX} of=${SDCARD} conv=notrunc seek=2 bs=512 | ||
| 55 | ;; | ||
| 56 | barebox) | ||
| 57 | dd if=${DEPLOY_DIR_IMAGE}/barebox-${MACHINE}.bin of=${SDCARD} conv=notrunc seek=1 skip=1 bs=512 | ||
| 58 | dd if=${DEPLOY_DIR_IMAGE}/bareboxenv-${MACHINE}.bin of=${SDCARD} conv=notrunc seek=1 bs=512k | ||
| 59 | ;; | ||
| 60 | *) | ||
| 61 | bberror "Unkown IMAGE_BOOTLOADER value" | ||
| 62 | exit 1 | ||
| 63 | ;; | ||
| 64 | esac | ||
| 65 | |||
| 66 | BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDCARD} unit b print \ | ||
| 67 | | awk '/ 2 / { print substr($3, 1, length($3 -1)) / 512 }') | ||
| 68 | mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS | ||
| 69 | mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/uImage-${MACHINE}.bin ::/uImage | ||
| 70 | |||
| 71 | dd if=${WORKDIR}/boot.img of=${SDCARD} conv=notrunc seek=1 bs=1M | ||
| 72 | dd if=${SDCARD_ROOTFS} of=${SDCARD} conv=notrunc seek=1 bs=${BOOT_SPACE} | ||
| 73 | |||
| 74 | cd ${DEPLOY_DIR_IMAGE} | ||
| 75 | ln -sf ${IMAGE_NAME}.sdcard ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.sdcard | ||
| 76 | } | ||
diff --git a/meta-fsl-arm/classes/sdcard_image.bbclass b/meta-fsl-arm/classes/sdcard_image.bbclass deleted file mode 100644 index 96f70808a..000000000 --- a/meta-fsl-arm/classes/sdcard_image.bbclass +++ /dev/null | |||
| @@ -1,55 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Create an image that can by written onto a SD card using dd. | ||
| 3 | # | ||
| 4 | # External variables needed: | ||
| 5 | # ${ROOTFS} - the rootfs image to incorporate | ||
| 6 | # ${IMAGE_BOOTLOADER} - bootloader to use {u-boot, barebox}x | ||
| 7 | |||
| 8 | inherit image | ||
| 9 | |||
| 10 | IMAGE_BOOTLOADER ?= "u-boot" | ||
| 11 | |||
| 12 | do_rootfs[depends] += "parted-native:do_populate_sysroot \ | ||
| 13 | virtual/kernel:do_deploy \ | ||
| 14 | ${IMAGE_BOOTLOADER}:do_deploy" | ||
| 15 | |||
| 16 | # Add the fstypes we need | ||
| 17 | IMAGE_FSTYPES += "sdimg" | ||
| 18 | |||
| 19 | # Default to 3.4GiB images | ||
| 20 | SDIMG_SIZE ?= "3400" | ||
| 21 | |||
| 22 | # Addional space for boot partition | ||
| 23 | BOOT_SPACE ?= "10M" | ||
| 24 | |||
| 25 | IMAGE_CMD_sdimg () { | ||
| 26 | TMP=${WORKDIR}/tmp | ||
| 27 | SDIMG=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.sdimg | ||
| 28 | |||
| 29 | dd if=/dev/zero of=${SDIMG} bs=$(expr 1000 \* 1000) count=${SDIMG_SIZE} | ||
| 30 | |||
| 31 | # Create partition table | ||
| 32 | parted -s ${SDIMG} mklabel msdos | ||
| 33 | parted -s ${SDIMG} mkpart primary ${BOOT_SPACE} 100% | ||
| 34 | parted ${SDIMG} print | ||
| 35 | |||
| 36 | case "${IMAGE_BOOTLOADER}" in | ||
| 37 | u-boot) | ||
| 38 | dd if=${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 skip=1 bs=512 | ||
| 39 | dd if=${DEPLOY_DIR_IMAGE}/uImage-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 bs=1M | ||
| 40 | ;; | ||
| 41 | barebox) | ||
| 42 | dd if=${DEPLOY_DIR_IMAGE}/barebox-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 skip=1 bs=512 | ||
| 43 | dd if=${DEPLOY_DIR_IMAGE}/bareboxenv-${MACHINE}.bin of=${SDIMG} conv=notrunc seek=1 bs=512k | ||
| 44 | ;; | ||
| 45 | *) | ||
| 46 | bberror "Unkown IMAGE_BOOTLOADER value" | ||
| 47 | exit 1 | ||
| 48 | ;; | ||
| 49 | esac | ||
| 50 | |||
| 51 | dd if=${ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=${BOOT_SPACE} | ||
| 52 | |||
| 53 | cd ${DEPLOY_DIR_IMAGE} | ||
| 54 | ln -sf ${IMAGE_NAME}.sdimg ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.sdimg | ||
| 55 | } | ||
diff --git a/meta-fsl-arm/conf/distro/include/fsl-default-settings.inc b/meta-fsl-arm/conf/distro/include/fsl-default-settings.inc new file mode 100644 index 000000000..b36e75a59 --- /dev/null +++ b/meta-fsl-arm/conf/distro/include/fsl-default-settings.inc | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | # Freescale BSP default settings | ||
| 2 | |||
| 3 | IMAGE_CLASSES += "image_types_fsl" | ||
diff --git a/meta-fsl-arm/conf/machine/include/imx-base.inc b/meta-fsl-arm/conf/machine/include/imx-base.inc index 906cc0ae1..aa1e48e7f 100644 --- a/meta-fsl-arm/conf/machine/include/imx-base.inc +++ b/meta-fsl-arm/conf/machine/include/imx-base.inc | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | # Provides the i.MX common settings | 1 | # Provides the i.MX common settings |
| 2 | 2 | ||
| 3 | include conf/distro/include/fsl-default-settings.inc | ||
| 3 | include conf/distro/include/fsl-default-versions.inc | 4 | include conf/distro/include/fsl-default-versions.inc |
| 4 | include conf/distro/include/fsl-default-revisions.inc | 5 | include conf/distro/include/fsl-default-revisions.inc |
| 5 | include conf/distro/include/fsl-default-providers.inc | 6 | include conf/distro/include/fsl-default-providers.inc |
| @@ -31,7 +32,9 @@ MACHINE_EXTRA_RRECOMMENDS += "imx-lib imx-audio \ | |||
| 31 | 32 | ||
| 32 | EXTRA_IMAGEDEPENDS = "u-boot" | 33 | EXTRA_IMAGEDEPENDS = "u-boot" |
| 33 | 34 | ||
| 34 | IMAGE_FSTYPES ?= "tar.bz2 jffs2" | 35 | SDCARD_ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3" |
| 36 | IMAGE_FSTYPES ?= "tar.bz2 ext3 sdcard" | ||
| 37 | |||
| 35 | EXTRA_IMAGECMD_jffs2 = "-lnp " | 38 | EXTRA_IMAGECMD_jffs2 = "-lnp " |
| 36 | 39 | ||
| 37 | SERIAL_CONSOLE = "115200 ttymxc0" | 40 | SERIAL_CONSOLE = "115200 ttymxc0" |
