summaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2012-05-01 00:31:46 -0300
committerOtavio Salvador <otavio@ossystems.com.br>2012-05-02 10:06:44 -0300
commit49c8638e97dfc568b59f8829f20fa6d8ab8dbaf8 (patch)
treee1f55d98925c786d1ecac09cae0f0299a3c97b91 /classes
parent25b9dd474a1a89bb3eef37f653de53c50e951c13 (diff)
downloadmeta-fsl-arm-49c8638e97dfc568b59f8829f20fa6d8ab8dbaf8.tar.gz
image_types_fsl.bbclass: split sdcard generation by SoC family
i.MXS and i.MX SoC families has enough partition layout differences that justify to have a specific code for each SoC family to easy maintenance and readability of code. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'classes')
-rw-r--r--classes/image_types_fsl.bbclass58
1 files changed, 48 insertions, 10 deletions
diff --git a/classes/image_types_fsl.bbclass b/classes/image_types_fsl.bbclass
index 86f4e45..89bab5a 100644
--- a/classes/image_types_fsl.bbclass
+++ b/classes/image_types_fsl.bbclass
@@ -42,18 +42,13 @@ BOOT_SPACE ?= "5M"
42IMAGE_DEPENDS_sdcard = "parted-native dosfstools-native mtools-native \ 42IMAGE_DEPENDS_sdcard = "parted-native dosfstools-native mtools-native \
43 virtual/kernel ${IMAGE_BOOTLOADER}" 43 virtual/kernel ${IMAGE_BOOTLOADER}"
44 44
45IMAGE_CMD_sdcard () { 45SDCARD = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.sdcard"
46 if [ -z "${SDCARD_ROOTFS}" ]; then
47 bberror "SDCARD_ROOTFS is undefined. To use sdcard image from Freescale's BSP it needs to be defined."
48 exit 1
49 fi
50 46
51 TMP=${WORKDIR}/tmp 47SDCARD_GENERATION_COMMAND_mxs = "generate_mxs_sdcard"
52 SDCARD=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.sdcard 48SDCARD_GENERATION_COMMAND_mx5 = "generate_imx_sdcard"
53 49SDCARD_GENERATION_COMMAND_mx6 = "generate_imx_sdcard"
54 # Initialize a sparse file
55 dd if=/dev/zero of=${SDCARD} bs=1 count=0 seek=$(expr 1000 \* 1000 \* ${SDCARD_SIZE})
56 50
51generate_imx_sdcard () {
57 # Create partition table 52 # Create partition table
58 parted -s ${SDCARD} mklabel msdos 53 parted -s ${SDCARD} mklabel msdos
59 parted -s ${SDCARD} mkpart primary 0 1M 54 parted -s ${SDCARD} mkpart primary 0 1M
@@ -89,3 +84,46 @@ IMAGE_CMD_sdcard () {
89 dd if=${WORKDIR}/boot.img of=${SDCARD} conv=notrunc seek=1 bs=1M 84 dd if=${WORKDIR}/boot.img of=${SDCARD} conv=notrunc seek=1 bs=1M
90 dd if=${SDCARD_ROOTFS} of=${SDCARD} conv=notrunc seek=1 bs=${BOOT_SPACE} 85 dd if=${SDCARD_ROOTFS} of=${SDCARD} conv=notrunc seek=1 bs=${BOOT_SPACE}
91} 86}
87
88generate_mxs_sdcard () {
89 # Create partition table
90 parted -s ${SDCARD} mklabel msdos
91 parted -s ${SDCARD} mkpart primary 1MiB 2MiB
92 parted -s ${SDCARD} mkpart primary 2MiB ${BOOT_SPACE}
93 parted -s ${SDCARD} mkpart primary ${BOOT_SPACE} 100%
94 parted ${SDCARD} print
95
96 # Change partition type for mxs processor family
97 bbnote "Setting partition type to 0x53 as required for mxs' SoC family."
98 echo -n S | dd of=${SDCARD} bs=1 count=1 seek=450 conv=notrunc
99
100 case "${IMAGE_BOOTLOADER}" in
101 u-boot)
102 dd if=${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.${UBOOT_SUFFIX_SDCARD} of=${SDCARD} conv=notrunc seek=1 skip=${UBOOT_PADDING} bs=1MiB
103 ;;
104 *)
105 bberror "Unkown IMAGE_BOOTLOADER value"
106 exit 1
107 ;;
108 esac
109
110 BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDCARD} unit b print \
111 | awk '/ 2 / { print substr($3, 1, length($3 -1)) / 512 }')
112 mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS
113 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/uImage-${MACHINE}.bin ::/uImage
114
115 dd if=${WORKDIR}/boot.img of=${SDCARD} conv=notrunc seek=2 bs=1MiB
116 dd if=${SDCARD_ROOTFS} of=${SDCARD} conv=notrunc seek=1 bs=${BOOT_SPACE}
117}
118
119IMAGE_CMD_sdcard () {
120 if [ -z "${SDCARD_ROOTFS}" ]; then
121 bberror "SDCARD_ROOTFS is undefined. To use sdcard image from Freescale's BSP it needs to be defined."
122 exit 1
123 fi
124
125 # Initialize a sparse file
126 dd if=/dev/zero of=${SDCARD} bs=1 count=0 seek=$(expr 1000 \* 1000 \* ${SDCARD_SIZE})
127
128 ${SDCARD_GENERATION_COMMAND}
129}