summaryrefslogtreecommitdiffstats
path: root/classes/sdcard_image-dra7xx-evm-ota.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'classes/sdcard_image-dra7xx-evm-ota.bbclass')
-rw-r--r--classes/sdcard_image-dra7xx-evm-ota.bbclass75
1 files changed, 0 insertions, 75 deletions
diff --git a/classes/sdcard_image-dra7xx-evm-ota.bbclass b/classes/sdcard_image-dra7xx-evm-ota.bbclass
deleted file mode 100644
index 179ed10..0000000
--- a/classes/sdcard_image-dra7xx-evm-ota.bbclass
+++ /dev/null
@@ -1,75 +0,0 @@
1inherit image_types
2
3# Boot partition volume id
4BOOTDD_VOLUME_ID ?= "${MACHINE}"
5
6# Boot partition size [in KiB] (will be rounded up to IMAGE_ROOTFS_ALIGNMENT)
7BOOT_SPACE ?= "4096"
8
9IMAGE_ROOTFS_ALIGNMENT = "4096"
10SDIMG_OTA_ROOTFS_TYPE ?= "otaimg"
11SDIMG_OTA_ROOTFS = "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${SDIMG_OTA_ROOTFS_TYPE}"
12
13IMAGE_TYPEDEP_dra7xx-evm-sdimg-ota = "${SDIMG_OTA_ROOTFS_TYPE}"
14IMAGE_DEPENDS_dra7xx-evm-sdimg-ota = " \
15 parted-native \
16 mtools-native \
17 dosfstools-native \
18 "
19
20SDIMG_OTA = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.dra7xx-evm-sdimg-ota"
21
22IMAGE_CMD_dra7xx-evm-sdimg-ota () {
23 OTAROOT_SIZE=`du -Lb ${SDIMG_OTA_ROOTFS} | cut -f1`
24 OTAROOT_SIZE=$(expr ${OTAROOT_SIZE} / 1024 + 1)
25 BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1)
26 BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT})
27 SDIMG_OTA_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $OTAROOT_SIZE)
28
29 echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $OTAROOT_SIZE KiB"
30
31 # Initialize sdcard image file
32 dd if=/dev/zero of=${SDIMG_OTA} bs=1024 count=0 seek=${SDIMG_OTA_SIZE}
33
34 # Create partition table
35 parted -s ${SDIMG_OTA} mklabel msdos
36 # Create boot partition and mark it as bootable
37 parted -s ${SDIMG_OTA} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT})
38 parted -s ${SDIMG_OTA} set 1 boot on
39 # Create rootfs partition to the end of disk
40 parted -s ${SDIMG_OTA} -- unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) -1s
41 parted ${SDIMG_OTA} print
42
43 # Create a vfat image with boot files
44 BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG_OTA} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }')
45 rm -f ${WORKDIR}/boot.img
46 mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS
47 sync
48
49 sync
50 #dd if=${WORKDIR}/boot.img of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
51
52 if echo "${SDIMG_OTA_ROOTFS_TYPE}" | egrep -q "*\.xz"
53 then
54 xzcat ${SDIMG_OTA_ROOTFS} | dd of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
55 else
56 dd if=${SDIMG_OTA_ROOTFS} of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
57 fi
58
59 # Optionally apply compression
60 case "${SDIMG_OTA_COMPRESSION}" in
61 "gzip")
62 gzip -k9 "${SDIMG_OTA}"
63 ;;
64 "bzip2")
65 bzip2 -k9 "${SDIMG_OTA}"
66 ;;
67 "xz")
68 xz -k "${SDIMG_OTA}"
69 ;;
70 esac
71
72 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.dra7xx-evm-sdimg-ota
73 ln -s ${IMAGE_NAME}.rootfs.dra7xx-evm-sdimg-ota ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.dra7xx-evm-sdimg-ota
74}
75