dreambox-secondstage: drop machine suffix in filename to fix image creation for dm702...
[opendreambox.git] / meta-dreambox / classes / image_types_nfi.bbclass
1 inherit image_types
2
3 IMAGE_CMD_jffs2.nfi = " \
4         mkfs.jffs2 \
5                 --root=${IMAGE_ROOTFS}/boot \
6                 --disable-compressor=lzo \
7                 --compression-mode=size \
8                 --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.boot.jffs2 \
9                 ${EXTRA_IMAGECMD}; \
10         rm -rf ${IMAGE_ROOTFS}/boot/*; \
11         printf '/dev/mtdblock2\t/boot\t\tjffs2\tro\t\t\t\t0 0\n' >> ${IMAGE_ROOTFS}/etc/fstab; \
12         mkfs.jffs2 \
13                 --root=${IMAGE_ROOTFS} \
14                 --disable-compressor=lzo \
15                 --compression-mode=size \
16                 --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 \
17                 ${EXTRA_IMAGECMD}; \
18         ${DREAMBOX_BUILDIMAGE} \
19                 --boot-partition ${DREAMBOX_PART0_SIZE}:${STAGING_DATADIR}/dreambox-secondstage/secondstage.bin \
20                 --data-partition ${DREAMBOX_PART1_SIZE}:${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.boot.jffs2 \
21                 --data-partition ${DREAMBOX_PART2_SIZE}:${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 \
22                 > ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.nfi; \
23 "
24
25 IMAGE_CMD_sum.jffs2.nfi = " \
26         mkfs.jffs2 \
27                 --root=${IMAGE_ROOTFS}/boot \
28                 --disable-compressor=lzo \
29                 --compression-mode=size \
30                 --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.boot.jffs2 \
31                 ${EXTRA_IMAGECMD}; \
32         sumtool \
33                 -i ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.boot.jffs2 \
34                 -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.boot.sum.jffs2 \
35                 ${EXTRA_IMAGECMD}; \
36         rm -rf ${IMAGE_ROOTFS}/boot/*; \
37         printf '/dev/mtdblock2\t/boot\t\tjffs2\tro\t\t\t\t0 0\n' >> ${IMAGE_ROOTFS}/etc/fstab; \
38         mkfs.jffs2 \
39                 --root=${IMAGE_ROOTFS} \
40                 --disable-compressor=lzo \
41                 --compression-mode=size \
42                 --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 \
43                 ${EXTRA_IMAGECMD}; \
44         sumtool \
45                 -i ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 \
46                 -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.sum.jffs2 \
47                 ${EXTRA_IMAGECMD}; \
48         ${DREAMBOX_BUILDIMAGE} \
49                 --boot-partition ${DREAMBOX_PART0_SIZE}:${STAGING_DATADIR}/dreambox-secondstage/secondstage.bin \
50                 --data-partition ${DREAMBOX_PART1_SIZE}:${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.boot.sum.jffs2 \
51                 --data-partition ${DREAMBOX_PART2_SIZE}:${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.sum.jffs2 \
52                 > ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.nfi; \
53 "
54
55 IMAGE_CMD_ubi.nfi = " \
56         mkfs.jffs2 \
57                 --root=${IMAGE_ROOTFS}/boot \
58                 --disable-compressor=lzo \
59                 --compression-mode=size \
60                 --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.boot.jffs2 \
61                 ${EXTRA_IMAGECMD}; \
62         rm -rf ${IMAGE_ROOTFS}/boot/*; \
63         printf '/dev/mtdblock2\t/boot\t\tjffs2\tro\t\t\t\t0 0\n' >> ${IMAGE_ROOTFS}/etc/fstab; \
64         echo \[root\] > ubinize.cfg; \
65         echo mode=ubi >> ubinize.cfg; \
66         echo image=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs >> ubinize.cfg; \
67         echo vol_id=0 >> ubinize.cfg; \
68         echo vol_name=${UBI_VOLNAME} >> ubinize.cfg; \
69         echo vol_type=dynamic >> ubinize.cfg; \
70         if [ ${UBINIZE_VOLSIZE} = "0" ]; then \
71                 echo vol_flags=autoresize >> ubinize.cfg; \
72         else \
73                 echo vol_size=${UBINIZE_VOLSIZE} >> ubinize.cfg; \
74                 if [ ${UBINIZE_DATAVOLSIZE} != "0" ]; then \
75                         echo \[data\] >> ubinize.cfg; \
76                         echo mode=ubi >> ubinize.cfg; \
77                         echo vol_id=1 >> ubinize.cfg; \
78                         echo vol_type=dynamic >> ubinize.cfg; \
79                         echo vol_name=data >> ubinize.cfg; \
80                         echo vol_size=${UBINIZE_DATAVOLSIZE} >> ubinize.cfg; \
81                         echo vol_flags=autoresize >> ubinize.cfg; \
82                         printf '/dev/ubi0_1\t/data\t\tubifs\trw,nofail\t\t\t\t0 0\n' >> ${IMAGE_ROOTFS}/etc/fstab; \
83                         install -d ${IMAGE_ROOTFS}/data; \
84                 fi; \
85         fi; \
86         mkfs.ubifs \
87                 -r ${IMAGE_ROOTFS} \
88                 -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs \
89                 ${MKUBIFS_ARGS}; \
90         ubinize -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubi ${UBINIZE_ARGS} ubinize.cfg; \
91         ${DREAMBOX_BUILDIMAGE} \
92                 --boot-partition ${DREAMBOX_PART0_SIZE}:${STAGING_DATADIR}/dreambox-secondstage/secondstage.bin \
93                 --data-partition ${DREAMBOX_PART1_SIZE}:${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.boot.jffs2 \
94                 --data-partition ${DREAMBOX_PART2_SIZE}:${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubi \
95                 > ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.nfi; \
96 "
97
98 EXTRA_IMAGECMD_jffs2.nfi ?= "-e ${DREAMBOX_ERASE_BLOCK_SIZE} -n -l"
99 EXTRA_IMAGECMD_sum.jffs2.nfi ?= "-e ${DREAMBOX_ERASE_BLOCK_SIZE} -n -l"
100 EXTRA_IMAGECMD_ubi.nfi ?= "-e ${DREAMBOX_ERASE_BLOCK_SIZE} -n -l"
101
102 IMAGE_DEPENDS_jffs2.nfi = "${IMAGE_DEPENDS_jffs2} dreambox-buildimage-native"
103 IMAGE_DEPENDS_sum.jffs2.nfi = "${IMAGE_DEPENDS_sum.jffs2} dreambox-buildimage-native"
104 IMAGE_DEPENDS_ubi.nfi = "${IMAGE_DEPENDS_ubi} ${IMAGE_DEPENDS_ubifs} dreambox-buildimage-native"
105
106 IMAGE_TYPES += "jffs2.nfi sum.jffs2.nfi ubi.nfi"
107
108 runimagecmd_append() {
109     if [ -n "${IMAGE_LINK_NAME}" ]; then
110         if [ -e ${IMAGE_NAME}.nfi ]; then
111             ln -s ${IMAGE_NAME}.nfi ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.nfi
112         fi
113     fi
114 }