summaryrefslogtreecommitdiffstats
path: root/meta/classes/image_types.bbclass
diff options
context:
space:
mode:
authorLaurentiu Palcu <laurentiu.palcu@intel.com>2013-12-18 18:02:18 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-11 11:53:38 +0000
commit7fc9bdaeed5aa3f2dd8b83a660eb97797bd2fcf4 (patch)
treefe2f2286820d9b484e721a323e8c8eacc1af39b9 /meta/classes/image_types.bbclass
parent85cc53a5a09e4076a0940c938374e6be8795db80 (diff)
downloadpoky-7fc9bdaeed5aa3f2dd8b83a660eb97797bd2fcf4.tar.gz
Activate the new python rootfs/image creation routines
This commit will: * remove old bash code common to all backends; * create a new do_rootfs() python function that will use the new rootfs/image creation routines; * allow creation of dpkg based images; * fail for rpm/opkg (not implemented yet); (From OE-Core rev: a83144bac8d67704ff66f5dc0fc56f5b63979694) Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/image_types.bbclass')
-rw-r--r--meta/classes/image_types.bbclass113
1 files changed, 0 insertions, 113 deletions
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 48675b8794..393bfa82eb 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -1,122 +1,9 @@
1def get_imagecmds(d):
2 cmds = "\n"
3 old_overrides = d.getVar('OVERRIDES', 0)
4
5 alltypes = d.getVar('IMAGE_FSTYPES', True).split()
6 types = []
7 ctypes = d.getVar('COMPRESSIONTYPES', True).split()
8 cimages = {}
9
10 # Image type b depends on a having been generated first
11 def addtypedepends(a, b):
12 if a in alltypes:
13 alltypes.remove(a)
14 if b not in alltypes:
15 alltypes.append(b)
16 alltypes.append(a)
17
18 # The elf image depends on the cpio.gz image already having
19 # been created, so we add that explicit ordering here.
20 addtypedepends("elf", "cpio.gz")
21
22 # jffs2 sumtool'd images need jffs2
23 addtypedepends("sum.jffs2", "jffs2")
24
25 # Filter out all the compressed images from alltypes
26 for type in alltypes:
27 basetype = None
28 for ctype in ctypes:
29 if type.endswith("." + ctype):
30 basetype = type[:-len("." + ctype)]
31 if basetype not in types:
32 types.append(basetype)
33 if basetype not in cimages:
34 cimages[basetype] = []
35 if ctype not in cimages[basetype]:
36 cimages[basetype].append(ctype)
37 break
38 if not basetype and type not in types:
39 types.append(type)
40
41 # Live and VMDK images will be processed via inheriting
42 # bbclass and does not get processed here.
43 # vmdk depend on live images also depend on ext3 so ensure its present
44 # Note: we need to ensure ext3 is in alltypes, otherwise, subimages may
45 # not contain ext3 and the .rootfs.ext3 file won't be created.
46 if "vmdk" in types:
47 if "ext3" not in types:
48 types.append("ext3")
49 if "ext3" not in alltypes:
50 alltypes.append("ext3")
51 types.remove("vmdk")
52 if "live" in types or "iso" in types or "hddimg" in types:
53 if "ext3" not in types:
54 types.append("ext3")
55 if "ext3" not in alltypes:
56 alltypes.append("ext3")
57 if "live" in types:
58 types.remove("live")
59 if "iso" in types:
60 types.remove("iso")
61 if "hddimg" in types:
62 types.remove("hddimg")
63
64 if d.getVar('IMAGE_LINK_NAME', True):
65 if d.getVar('RM_OLD_IMAGE', True) == "1":
66 # Remove the old image
67 cmds += "\trm -f `find ${DEPLOY_DIR_IMAGE} -maxdepth 1 -type l -name ${IMAGE_LINK_NAME}'.*' -exec readlink -f {} \;`"
68 # Remove the symlink
69 cmds += "\n\trm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.*"
70
71 for type in types:
72 ccmd = []
73 subimages = []
74 localdata = bb.data.createCopy(d)
75 localdata.setVar('OVERRIDES', '%s:%s' % (type, old_overrides))
76 bb.data.update_data(localdata)
77 localdata.setVar('type', type)
78 if type in cimages:
79 for ctype in cimages[type]:
80 ccmd.append("\t" + localdata.getVar("COMPRESS_CMD_" + ctype, True))
81 subimages.append(type + "." + ctype)
82 if type not in alltypes:
83 ccmd.append(localdata.expand("\trm ${IMAGE_NAME}.rootfs.${type}"))
84 else:
85 subimages.append(type)
86 localdata.setVar('ccmd', "\n".join(ccmd))
87 localdata.setVar('subimages', " ".join(subimages))
88 cmd = localdata.getVar("IMAGE_CMD", True)
89 localdata.setVar('cmd', cmd)
90 cmds += "\n" + localdata.getVar("runimagecmd", True)
91 return cmds
92 1
93# The default aligment of the size of the rootfs is set to 1KiB. In case 2# The default aligment of the size of the rootfs is set to 1KiB. In case
94# you're using the SD card emulation of a QEMU system simulator you may 3# you're using the SD card emulation of a QEMU system simulator you may
95# set this value to 2048 (2MiB alignment). 4# set this value to 2048 (2MiB alignment).
96IMAGE_ROOTFS_ALIGNMENT ?= "1" 5IMAGE_ROOTFS_ALIGNMENT ?= "1"
97 6
98runimagecmd () {
99 # Image generation code for image type ${type}
100 # The base_size gets calculated:
101 # - initial size determined by `du -ks` of the IMAGE_ROOTFS
102 # - then multiplied by the IMAGE_OVERHEAD_FACTOR
103 # - tested against IMAGE_ROOTFS_SIZE
104 # - round up ROOTFS_SIZE to IMAGE_ROOTFS_ALIGNMENT
105 ROOTFS_SIZE=`du -ks ${IMAGE_ROOTFS} | awk '{base_size = $1 * ${IMAGE_OVERHEAD_FACTOR}; base_size = ((base_size > ${IMAGE_ROOTFS_SIZE} ? base_size : ${IMAGE_ROOTFS_SIZE}) + ${IMAGE_ROOTFS_EXTRA_SPACE}); if (base_size != int(base_size)) base_size = int(base_size + 1); base_size = base_size + ${IMAGE_ROOTFS_ALIGNMENT} - 1; base_size -= base_size % ${IMAGE_ROOTFS_ALIGNMENT}; print base_size }'`
106 ${cmd}
107 # Now create the needed compressed versions
108 cd ${DEPLOY_DIR_IMAGE}/
109 ${ccmd}
110 # And create the symlinks
111 if [ -n "${IMAGE_LINK_NAME}" ]; then
112 for type in ${subimages}; do
113 if [ -e ${IMAGE_NAME}.rootfs.$type ]; then
114 ln -s ${IMAGE_NAME}.rootfs.$type ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.$type
115 fi
116 done
117 fi
118}
119
120def imagetypes_getdepends(d): 7def imagetypes_getdepends(d):
121 def adddep(depstr, deps): 8 def adddep(depstr, deps):
122 for i in (depstr or "").split(): 9 for i in (depstr or "").split():