diff options
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/image.bbclass | 22 | ||||
-rw-r--r-- | meta/classes/image_types.bbclass | 81 | ||||
-rw-r--r-- | meta/conf/bitbake.conf | 41 |
3 files changed, 82 insertions, 62 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index eb0d970a2c..aa842c78ca 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass | |||
@@ -64,27 +64,7 @@ def get_devtable_list(d): | |||
64 | str += " %s" % bb.which(bb.data.getVar('BBPATH', d, 1), devtable) | 64 | str += " %s" % bb.which(bb.data.getVar('BBPATH', d, 1), devtable) |
65 | return str | 65 | return str |
66 | 66 | ||
67 | def get_imagecmds(d): | 67 | inherit image_types |
68 | cmds = "\n" | ||
69 | old_overrides = bb.data.getVar('OVERRIDES', d, 0) | ||
70 | for type in bb.data.getVar('IMAGE_FSTYPES', d, True).split(): | ||
71 | localdata = bb.data.createCopy(d) | ||
72 | localdata.setVar('OVERRIDES', '%s:%s' % (type, old_overrides)) | ||
73 | bb.data.update_data(localdata) | ||
74 | localdata.setVar('type', type) | ||
75 | cmd = localdata.getVar("IMAGE_CMD_" + type, True) | ||
76 | localdata.setVar('cmd', cmd) | ||
77 | cmds += localdata.getVar("runimagecmd", True) | ||
78 | return cmds | ||
79 | |||
80 | runimagecmd () { | ||
81 | # Image generation code for image type ${type} | ||
82 | ROOTFS_SIZE=`du -ks ${IMAGE_ROOTFS}|awk '{size = $1 * ${IMAGE_OVERHEAD_FACTOR}; print (size > ${IMAGE_ROOTFS_SIZE} ? size : ${IMAGE_ROOTFS_SIZE}) }'` | ||
83 | ${cmd} | ||
84 | cd ${DEPLOY_DIR_IMAGE}/ | ||
85 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${type} | ||
86 | ln -s ${IMAGE_NAME}.rootfs.${type} ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${type} | ||
87 | } | ||
88 | 68 | ||
89 | IMAGE_POSTPROCESS_COMMAND ?= "" | 69 | IMAGE_POSTPROCESS_COMMAND ?= "" |
90 | MACHINE_POSTPROCESS_COMMAND ?= "" | 70 | MACHINE_POSTPROCESS_COMMAND ?= "" |
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass new file mode 100644 index 0000000000..5c9bcd130d --- /dev/null +++ b/meta/classes/image_types.bbclass | |||
@@ -0,0 +1,81 @@ | |||
1 | def get_imagecmds(d): | ||
2 | cmds = "\n" | ||
3 | old_overrides = bb.data.getVar('OVERRIDES', d, 0) | ||
4 | for type in bb.data.getVar('IMAGE_FSTYPES', d, True).split(): | ||
5 | localdata = bb.data.createCopy(d) | ||
6 | localdata.setVar('OVERRIDES', '%s:%s' % (type, old_overrides)) | ||
7 | bb.data.update_data(localdata) | ||
8 | localdata.setVar('type', type) | ||
9 | cmd = localdata.getVar("IMAGE_CMD_" + type, True) | ||
10 | localdata.setVar('cmd', cmd) | ||
11 | cmds += localdata.getVar("runimagecmd", True) | ||
12 | return cmds | ||
13 | |||
14 | runimagecmd () { | ||
15 | # Image generation code for image type ${type} | ||
16 | ROOTFS_SIZE=`du -ks ${IMAGE_ROOTFS}|awk '{size = $1 * ${IMAGE_OVERHEAD_FACTOR}; print (size > ${IMAGE_ROOTFS_SIZE} ? size : ${IMAGE_ROOTFS_SIZE}) }'` | ||
17 | ${cmd} | ||
18 | cd ${DEPLOY_DIR_IMAGE}/ | ||
19 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${type} | ||
20 | ln -s ${IMAGE_NAME}.rootfs.${type} ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${type} | ||
21 | } | ||
22 | |||
23 | IMAGE_CMD_jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --faketime --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 ${EXTRA_IMAGECMD}" | ||
24 | IMAGE_CMD_yaffs2 = "mkyaffs2image ${EXTRA_IMAGECMD} ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.yaffs2" | ||
25 | IMAGE_CMD_cramfs = "mkcramfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cramfs ${EXTRA_IMAGECMD}" | ||
26 | IMAGE_CMD_ext2 = "genext2fs -b $ROOTFS_SIZE -d ${IMAGE_ROOTFS} ${IMAGE_EXTRA_OPTION} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext2 ${EXTRA_IMAGECMD}" | ||
27 | IMAGE_CMD_ext2.gz () { | ||
28 | rm -rf ${DEPLOY_DIR_IMAGE}/tmp.gz && mkdir ${DEPLOY_DIR_IMAGE}/tmp.gz | ||
29 | genext2fs -b ${IMAGE_ROOTFS_SIZE} -d ${IMAGE_ROOTFS} ${IMAGE_EXTRA_OPTION} ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2 ${EXTRA_IMAGECMD} | ||
30 | gzip -f -9 ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2 | ||
31 | mv ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext2.gz | ||
32 | rmdir ${DEPLOY_DIR_IMAGE}/tmp.gz | ||
33 | } | ||
34 | IMAGE_CMD_ext3 () { | ||
35 | genext2fs -b $ROOTFS_SIZE -d ${IMAGE_ROOTFS} ${IMAGE_EXTRA_OPTION} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3 ${EXTRA_IMAGECMD} | ||
36 | tune2fs -j ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3 | ||
37 | } | ||
38 | IMAGE_CMD_ext3.gz () { | ||
39 | rm -rf ${DEPLOY_DIR_IMAGE}/tmp.gz && mkdir ${DEPLOY_DIR_IMAGE}/tmp.gz | ||
40 | genext2fs -b ${IMAGE_ROOTFS_SIZE} -d ${IMAGE_ROOTFS} ${IMAGE_EXTRA_OPTION} ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3 ${EXTRA_IMAGECMD} | ||
41 | tune2fs -j ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3 | ||
42 | gzip -f -9 ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3 | ||
43 | mv ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3.gz | ||
44 | rmdir ${DEPLOY_DIR_IMAGE}/tmp.gz | ||
45 | } | ||
46 | IMAGE_CMD_squashfs = "mksquashfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs ${EXTRA_IMAGECMD} -noappend" | ||
47 | IMAGE_CMD_squashfs-lzma = "mksquashfs-lzma ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs-lzma ${EXTRA_IMAGECMD} -noappend" | ||
48 | IMAGE_CMD_tar = "cd ${IMAGE_ROOTFS} && tar -cvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar ." | ||
49 | IMAGE_CMD_tar.gz = "cd ${IMAGE_ROOTFS} && tar -zcvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.gz ." | ||
50 | IMAGE_CMD_tar.bz2 = "cd ${IMAGE_ROOTFS} && tar -jcvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.bz2 ." | ||
51 | IMAGE_CMD_cpio = "cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio)" | ||
52 | IMAGE_CMD_cpio.gz = "cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc | gzip -c -9 >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz)" | ||
53 | IMAGE_CMD_ubi () { | ||
54 | echo \[ubifs\] > ubinize.cfg | ||
55 | echo mode=ubi >> ubinize.cfg | ||
56 | echo image=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs >> ubinize.cfg | ||
57 | echo vol_id=0 >> ubinize.cfg | ||
58 | echo vol_type=dynamic >> ubinize.cfg | ||
59 | echo vol_name=${UBI_VOLNAME} >> ubinize.cfg | ||
60 | echo vol_flags=autoresize >> ubinize.cfg | ||
61 | mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs ${MKUBIFS_ARGS} && ubinize -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubi ${UBINIZE_ARGS} ubinize.cfg | ||
62 | } | ||
63 | IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.ubifs.img ${MKUBIFS_ARGS}" | ||
64 | |||
65 | EXTRA_IMAGECMD = "" | ||
66 | EXTRA_IMAGECMD_jffs2 = "--pad --little-endian --eraseblock=0x40000" | ||
67 | EXTRA_IMAGECMD_yaffs2 = "1" | ||
68 | |||
69 | IMAGE_DEPENDS = "" | ||
70 | IMAGE_DEPENDS_jffs2 = "mtd-utils-native" | ||
71 | IMAGE_DEPENDS_yaffs2 = "yaffs2-utils-native" | ||
72 | IMAGE_DEPENDS_cramfs = "cramfs-native" | ||
73 | IMAGE_DEPENDS_ext2 = "genext2fs-native" | ||
74 | IMAGE_DEPENDS_ext2.gz = "genext2fs-native" | ||
75 | IMAGE_DEPENDS_ext3 = "genext2fs-native e2fsprogs-native" | ||
76 | IMAGE_DEPENDS_ext3.gz = "genext2fs-native e2fsprogs-native" | ||
77 | IMAGE_DEPENDS_squashfs = "squashfs-tools-native" | ||
78 | IMAGE_DEPENDS_squashfs-lzma = "squashfs-lzma-tools-native" | ||
79 | IMAGE_DEPENDS_ubi = "mtd-utils-native" | ||
80 | IMAGE_DEPENDS_ubifs = "mtd-utils-native" | ||
81 | |||
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index 22532db7fe..8e89945096 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf | |||
@@ -355,47 +355,6 @@ IMAGE_OVERHEAD_FACTOR ?= 1.3 | |||
355 | # Comment this option if you want default genext2fs behavior (i.e. create minimal inode number) | 355 | # Comment this option if you want default genext2fs behavior (i.e. create minimal inode number) |
356 | IMAGE_EXTRA_OPTION ?= "-i 8192" | 356 | IMAGE_EXTRA_OPTION ?= "-i 8192" |
357 | 357 | ||
358 | IMAGE_CMD = "" | ||
359 | IMAGE_CMD_jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --faketime --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 ${EXTRA_IMAGECMD}" | ||
360 | IMAGE_CMD_yaffs2 = "mkyaffs2image ${EXTRA_IMAGECMD} ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.yaffs2" | ||
361 | IMAGE_CMD_cramfs = "mkcramfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cramfs ${EXTRA_IMAGECMD}" | ||
362 | IMAGE_CMD_ext2 = "genext2fs -b $ROOTFS_SIZE -d ${IMAGE_ROOTFS} ${IMAGE_EXTRA_OPTION} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext2 ${EXTRA_IMAGECMD}" | ||
363 | IMAGE_CMD_ext2.gz = "rm -rf ${DEPLOY_DIR_IMAGE}/tmp.gz && mkdir ${DEPLOY_DIR_IMAGE}/tmp.gz; genext2fs -b ${IMAGE_ROOTFS_SIZE} -d ${IMAGE_ROOTFS} ${IMAGE_EXTRA_OPTION} ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2 ${EXTRA_IMAGECMD}; gzip -f -9 ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2; mv ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext2.gz; rmdir ${DEPLOY_DIR_IMAGE}/tmp.gz" | ||
364 | IMAGE_CMD_ext3 = "genext2fs -b $ROOTFS_SIZE -d ${IMAGE_ROOTFS} ${IMAGE_EXTRA_OPTION} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3 ${EXTRA_IMAGECMD}; tune2fs -j ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3" | ||
365 | IMAGE_CMD_ext3.gz = "rm -rf ${DEPLOY_DIR_IMAGE}/tmp.gz && mkdir ${DEPLOY_DIR_IMAGE}/tmp.gz; genext2fs -b ${IMAGE_ROOTFS_SIZE} -d ${IMAGE_ROOTFS} ${IMAGE_EXTRA_OPTION} ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3 ${EXTRA_IMAGECMD}; tune2fs -j ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3; gzip -f -9 ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3; mv ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3.gz; rmdir ${DEPLOY_DIR_IMAGE}/tmp.gz" | ||
366 | IMAGE_CMD_squashfs = "mksquashfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs ${EXTRA_IMAGECMD} -noappend" | ||
367 | IMAGE_CMD_squashfs-lzma = "mksquashfs-lzma ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs-lzma ${EXTRA_IMAGECMD} -noappend" | ||
368 | IMAGE_CMD_tar = "cd ${IMAGE_ROOTFS} && tar -cvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar ." | ||
369 | IMAGE_CMD_tar.gz = "cd ${IMAGE_ROOTFS} && tar -zcvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.gz ." | ||
370 | IMAGE_CMD_tar.bz2 = "cd ${IMAGE_ROOTFS} && tar -jcvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.bz2 ." | ||
371 | IMAGE_CMD_cpio = "cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio)" | ||
372 | IMAGE_CMD_cpio.gz = "cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc | gzip -c -9 >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz)" | ||
373 | IMAGE_CMD_ubi = "echo \[ubifs\] > ubinize.cfg ; echo mode=ubi >> ubinize.cfg ; echo image=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs >> ubinize.cfg ; echo vol_id=0 >> ubinize.cfg ; echo vol_type=dynamic >> ubinize.cfg ; echo vol_name=${UBI_VOLNAME} >> ubinize.cfg ; echo vol_flags=autoresize >> ubinize.cfg;mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs ${MKUBIFS_ARGS} && ubinize -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubi ${UBINIZE_ARGS} ubinize.cfg" | ||
374 | IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.ubifs.img ${MKUBIFS_ARGS}" | ||
375 | |||
376 | EXTRA_IMAGECMD = "" | ||
377 | EXTRA_IMAGECMD_jffs2 = "--pad --little-endian --eraseblock=0x40000" | ||
378 | EXTRA_IMAGECMD_yaffs2 = "1" | ||
379 | EXTRA_IMAGECMD_squashfs = "" | ||
380 | EXTRA_IMAGECMD_squashfs-lzma = "" | ||
381 | EXTRA_IMAGECMD_cpio = "" | ||
382 | EXTRA_IMAGECMD_cpio.gz = "" | ||
383 | EXTRA_IMAGECMD_ubi = "" | ||
384 | EXTRA_IMAGECMD_ubifs = "" | ||
385 | |||
386 | IMAGE_DEPENDS = "" | ||
387 | IMAGE_DEPENDS_jffs2 = "mtd-utils-native" | ||
388 | IMAGE_DEPENDS_yaffs2 = "yaffs2-utils-native" | ||
389 | IMAGE_DEPENDS_cramfs = "cramfs-native" | ||
390 | IMAGE_DEPENDS_ext2 = "genext2fs-native" | ||
391 | IMAGE_DEPENDS_ext2.gz = "genext2fs-native" | ||
392 | IMAGE_DEPENDS_ext3 = "genext2fs-native e2fsprogs-native" | ||
393 | IMAGE_DEPENDS_ext3.gz = "genext2fs-native e2fsprogs-native" | ||
394 | IMAGE_DEPENDS_squashfs = "squashfs-tools-native" | ||
395 | IMAGE_DEPENDS_squashfs-lzma = "squashfs-lzma-tools-native" | ||
396 | IMAGE_DEPENDS_ubi = "mtd-utils-native" | ||
397 | IMAGE_DEPENDS_ubifs = "mtd-utils-native" | ||
398 | |||
399 | EXTRA_IMAGEDEPENDS = "" | 358 | EXTRA_IMAGEDEPENDS = "" |
400 | 359 | ||
401 | ################################################################## | 360 | ################################################################## |