summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@linux.intel.com>2014-10-29 17:04:23 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-10-30 13:03:41 +0000
commit42d0334aa8bf59937262f957f2ea04abc271138b (patch)
tree1b8b5b948c3b711eb9bd666e1e25c2a03b86d917 /scripts
parent38400617febd61a1594969c86a6f1712a9d80516 (diff)
downloadpoky-42d0334aa8bf59937262f957f2ea04abc271138b.tar.gz
wic: Remove special-case bootimg_dir
The first iterations of wic very shortsightedly catered to two specific use-cases and added special-purpose params for those cases so that they could be directly given their corresponding boot artifacts. (hdddir and staging_data_dir). As more use-cases are added, it becomes rather obvious that such a scheme doens't scale, and additionally causes confusion for plugin writers. This removes those special cases and states explicitly in the help text that plugins are responsible for locating their own boot artifacts. (From OE-Core rev: 6ba3eb5ff7c47aee6b3419fb3a348a634fe74ac9) Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/image/engine.py37
-rw-r--r--scripts/lib/image/help.py2
-rw-r--r--scripts/lib/wic/imager/direct.py5
-rw-r--r--scripts/lib/wic/plugins/imager/direct_plugin.py20
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-efi.py5
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-pcbios.py3
-rwxr-xr-xscripts/wic12
7 files changed, 27 insertions, 57 deletions
diff --git a/scripts/lib/image/engine.py b/scripts/lib/image/engine.py
index f1df8b4db8..e794545e94 100644
--- a/scripts/lib/image/engine.py
+++ b/scripts/lib/image/engine.py
@@ -67,7 +67,7 @@ def find_artifacts(image_name):
67 """ 67 """
68 bitbake_env_lines = get_bitbake_env_lines() 68 bitbake_env_lines = get_bitbake_env_lines()
69 69
70 rootfs_dir = kernel_dir = hdddir = staging_data_dir = native_sysroot = "" 70 rootfs_dir = kernel_dir = bootimg_dir = native_sysroot = ""
71 71
72 for line in bitbake_env_lines.split('\n'): 72 for line in bitbake_env_lines.split('\n'):
73 if (get_line_val(line, "IMAGE_ROOTFS")): 73 if (get_line_val(line, "IMAGE_ROOTFS")):
@@ -76,17 +76,11 @@ def find_artifacts(image_name):
76 if (get_line_val(line, "STAGING_KERNEL_DIR")): 76 if (get_line_val(line, "STAGING_KERNEL_DIR")):
77 kernel_dir = get_line_val(line, "STAGING_KERNEL_DIR") 77 kernel_dir = get_line_val(line, "STAGING_KERNEL_DIR")
78 continue 78 continue
79 if (get_line_val(line, "HDDDIR")):
80 hdddir = get_line_val(line, "HDDDIR")
81 continue
82 if (get_line_val(line, "STAGING_DATADIR")):
83 staging_data_dir = get_line_val(line, "STAGING_DATADIR")
84 continue
85 if (get_line_val(line, "STAGING_DIR_NATIVE")): 79 if (get_line_val(line, "STAGING_DIR_NATIVE")):
86 native_sysroot = get_line_val(line, "STAGING_DIR_NATIVE") 80 native_sysroot = get_line_val(line, "STAGING_DIR_NATIVE")
87 continue 81 continue
88 82
89 return (rootfs_dir, kernel_dir, hdddir, staging_data_dir, native_sysroot) 83 return (rootfs_dir, kernel_dir, bootimg_dir, native_sysroot)
90 84
91 85
92CANNED_IMAGE_DIR = "lib/image/canned-wks" # relative to scripts 86CANNED_IMAGE_DIR = "lib/image/canned-wks" # relative to scripts
@@ -185,18 +179,15 @@ def list_source_plugins():
185 179
186 180
187def wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir, 181def wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir,
188 native_sysroot, hdddir, staging_data_dir, scripts_path, 182 native_sysroot, scripts_path, image_output_dir, debug,
189 image_output_dir, debug, properties_file, properties=None): 183 properties_file, properties=None):
190 """ 184 """Create image
191 Create image
192 185
193 wks_file - user-defined OE kickstart file 186 wks_file - user-defined OE kickstart file
194 rootfs_dir - absolute path to the build's /rootfs dir 187 rootfs_dir - absolute path to the build's /rootfs dir
195 bootimg_dir - absolute path to the build's boot artifacts directory 188 bootimg_dir - absolute path to the build's boot artifacts directory
196 kernel_dir - absolute path to the build's kernel directory 189 kernel_dir - absolute path to the build's kernel directory
197 native_sysroot - absolute path to the build's native sysroots dir 190 native_sysroot - absolute path to the build's native sysroots dir
198 hdddir - absolute path to the build's HDDDIR dir
199 staging_data_dir - absolute path to the build's STAGING_DATA_DIR dir
200 scripts_path - absolute path to /scripts dir 191 scripts_path - absolute path to /scripts dir
201 image_output_dir - dirname to create for image 192 image_output_dir - dirname to create for image
202 properties_file - use values from this file if nonempty i.e no prompting 193 properties_file - use values from this file if nonempty i.e no prompting
@@ -211,22 +202,14 @@ def wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir,
211 rootfs_dir: IMAGE_ROOTFS 202 rootfs_dir: IMAGE_ROOTFS
212 kernel_dir: STAGING_KERNEL_DIR 203 kernel_dir: STAGING_KERNEL_DIR
213 native_sysroot: STAGING_DIR_NATIVE 204 native_sysroot: STAGING_DIR_NATIVE
214 hdddir: HDDDIR
215 staging_data_dir: STAGING_DATA_DIR
216 205
217 In the above case, bootimg_dir remains unset and the image 206 In the above case, bootimg_dir remains unset and the
218 creation code determines which of the passed-in directories to 207 plugin-specific image creation code is responsible for finding the
219 use. 208 bootimg artifacts.
220 209
221 In the case where the values are passed in explicitly i.e 'wic -e' 210 In the case where the values are passed in explicitly i.e 'wic -e'
222 is not used but rather the individual 'wic' options are used to 211 is not used but rather the individual 'wic' options are used to
223 explicitly specify these values, hdddir and staging_data_dir will 212 explicitly specify these values.
224 be unset, but bootimg_dir must be explicit i.e. explicitly set to
225 either hdddir or staging_data_dir, depending on the image being
226 generated. The other values (rootfs_dir, kernel_dir, and
227 native_sysroot) correspond to the same values found above via
228 'bitbake -e').
229
230 """ 213 """
231 try: 214 try:
232 oe_builddir = os.environ["BUILDDIR"] 215 oe_builddir = os.environ["BUILDDIR"]
@@ -242,8 +225,6 @@ def wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir,
242 direct_args.insert(0, bootimg_dir) 225 direct_args.insert(0, bootimg_dir)
243 direct_args.insert(0, kernel_dir) 226 direct_args.insert(0, kernel_dir)
244 direct_args.insert(0, native_sysroot) 227 direct_args.insert(0, native_sysroot)
245 direct_args.insert(0, hdddir)
246 direct_args.insert(0, staging_data_dir)
247 direct_args.insert(0, "direct") 228 direct_args.insert(0, "direct")
248 229
249 if debug: 230 if debug:
diff --git a/scripts/lib/image/help.py b/scripts/lib/image/help.py
index 0963532218..6b74f57662 100644
--- a/scripts/lib/image/help.py
+++ b/scripts/lib/image/help.py
@@ -189,7 +189,7 @@ DESCRIPTION
189 -r: IMAGE_ROOTFS 189 -r: IMAGE_ROOTFS
190 -k: STAGING_KERNEL_DIR 190 -k: STAGING_KERNEL_DIR
191 -n: STAGING_DIR_NATIVE 191 -n: STAGING_DIR_NATIVE
192 -b: HDDDIR and STAGING_DATA_DIR (handlers decide which to use) 192 -b: empty (plugin-specific handlers must determine this)
193 193
194 If 'wic -e' is not used, the user needs to select the appropriate 194 If 'wic -e' is not used, the user needs to select the appropriate
195 value for -b (as well as -r, -k, and -n). 195 value for -b (as well as -r, -k, and -n).
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index 5b12856289..6b2ab3368e 100644
--- a/scripts/lib/wic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -52,8 +52,7 @@ class DirectImageCreator(BaseImageCreator):
52 """ 52 """
53 53
54 def __init__(self, oe_builddir, image_output_dir, rootfs_dir, bootimg_dir, 54 def __init__(self, oe_builddir, image_output_dir, rootfs_dir, bootimg_dir,
55 kernel_dir, native_sysroot, hdddir, staging_data_dir, 55 kernel_dir, native_sysroot, creatoropts=None):
56 creatoropts=None):
57 """ 56 """
58 Initialize a DirectImageCreator instance. 57 Initialize a DirectImageCreator instance.
59 58
@@ -74,8 +73,6 @@ class DirectImageCreator(BaseImageCreator):
74 self.bootimg_dir = bootimg_dir 73 self.bootimg_dir = bootimg_dir
75 self.kernel_dir = kernel_dir 74 self.kernel_dir = kernel_dir
76 self.native_sysroot = native_sysroot 75 self.native_sysroot = native_sysroot
77 self.hdddir = hdddir
78 self.staging_data_dir = staging_data_dir
79 76
80 def __write_fstab(self, image_rootfs): 77 def __write_fstab(self, image_rootfs):
81 """overriden to generate fstab (temporarily) in rootfs. This is called 78 """overriden to generate fstab (temporarily) in rootfs. This is called
diff --git a/scripts/lib/wic/plugins/imager/direct_plugin.py b/scripts/lib/wic/plugins/imager/direct_plugin.py
index dabd6fc3e0..5601c3f1c9 100644
--- a/scripts/lib/wic/plugins/imager/direct_plugin.py
+++ b/scripts/lib/wic/plugins/imager/direct_plugin.py
@@ -58,21 +58,19 @@ class DirectPlugin(ImagerPlugin):
58 """ 58 """
59 Create direct image, called from creator as 'direct' cmd 59 Create direct image, called from creator as 'direct' cmd
60 """ 60 """
61 if len(args) != 9: 61 if len(args) != 7:
62 raise errors.Usage("Extra arguments given") 62 raise errors.Usage("Extra arguments given")
63 63
64 staging_data_dir = args[0] 64 native_sysroot = args[0]
65 hdddir = args[1] 65 kernel_dir = args[1]
66 native_sysroot = args[2] 66 bootimg_dir = args[2]
67 kernel_dir = args[3] 67 rootfs_dir = args[3]
68 bootimg_dir = args[4]
69 rootfs_dir = args[5]
70 68
71 creatoropts = configmgr.create 69 creatoropts = configmgr.create
72 ksconf = args[6] 70 ksconf = args[4]
73 71
74 image_output_dir = args[7] 72 image_output_dir = args[5]
75 oe_builddir = args[8] 73 oe_builddir = args[6]
76 74
77 krootfs_dir = self.__rootfs_dir_to_dict(rootfs_dir) 75 krootfs_dir = self.__rootfs_dir_to_dict(rootfs_dir)
78 76
@@ -84,8 +82,6 @@ class DirectPlugin(ImagerPlugin):
84 bootimg_dir, 82 bootimg_dir,
85 kernel_dir, 83 kernel_dir,
86 native_sysroot, 84 native_sysroot,
87 hdddir,
88 staging_data_dir,
89 creatoropts) 85 creatoropts)
90 86
91 try: 87 try:
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 855bbc2ce2..e4067b6dbf 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -173,7 +173,6 @@ class BootimgEFIPlugin(SourcePlugin):
173 cr.set_bootimg_dir(bootimg_dir) 173 cr.set_bootimg_dir(bootimg_dir)
174 174
175 staging_kernel_dir = kernel_dir 175 staging_kernel_dir = kernel_dir
176 staging_data_dir = bootimg_dir
177 176
178 hdddir = "%s/hdd/boot" % cr_workdir 177 hdddir = "%s/hdd/boot" % cr_workdir
179 178
@@ -185,12 +184,12 @@ class BootimgEFIPlugin(SourcePlugin):
185 if source_params['loader'] == 'grub-efi': 184 if source_params['loader'] == 'grub-efi':
186 shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, 185 shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir,
187 "%s/grub.cfg" % cr_workdir) 186 "%s/grub.cfg" % cr_workdir)
188 cp_cmd = "cp %s/EFI/BOOT/* %s/EFI/BOOT" % (staging_data_dir, hdddir) 187 cp_cmd = "cp %s/EFI/BOOT/* %s/EFI/BOOT" % (bootimg_dir, hdddir)
189 exec_cmd(cp_cmd, True) 188 exec_cmd(cp_cmd, True)
190 shutil.move("%s/grub.cfg" % cr_workdir, 189 shutil.move("%s/grub.cfg" % cr_workdir,
191 "%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir) 190 "%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir)
192 elif source_params['loader'] == 'gummiboot': 191 elif source_params['loader'] == 'gummiboot':
193 cp_cmd = "cp %s/EFI/BOOT/* %s/EFI/BOOT" % (staging_data_dir, hdddir) 192 cp_cmd = "cp %s/EFI/BOOT/* %s/EFI/BOOT" % (bootimg_dir, hdddir)
194 exec_cmd(cp_cmd, True) 193 exec_cmd(cp_cmd, True)
195 else: 194 else:
196 msger.error("unrecognized bootimg-efi loader: %s" % source_params['loader']) 195 msger.error("unrecognized bootimg-efi loader: %s" % source_params['loader'])
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index 6057bab42d..8a1aca1ad1 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -144,7 +144,6 @@ class BootimgPcbiosPlugin(SourcePlugin):
144 cr.set_bootimg_dir(bootimg_dir) 144 cr.set_bootimg_dir(bootimg_dir)
145 145
146 staging_kernel_dir = kernel_dir 146 staging_kernel_dir = kernel_dir
147 staging_data_dir = bootimg_dir
148 147
149 hdddir = "%s/hdd/boot" % cr_workdir 148 hdddir = "%s/hdd/boot" % cr_workdir
150 149
@@ -153,7 +152,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
153 exec_cmd(install_cmd) 152 exec_cmd(install_cmd)
154 153
155 install_cmd = "install -m 444 %s/syslinux/ldlinux.sys %s/ldlinux.sys" \ 154 install_cmd = "install -m 444 %s/syslinux/ldlinux.sys %s/ldlinux.sys" \
156 % (staging_data_dir, hdddir) 155 % (bootimg_dir, hdddir)
157 exec_cmd(install_cmd) 156 exec_cmd(install_cmd)
158 157
159 du_cmd = "du -bks %s" % hdddir 158 du_cmd = "du -bks %s" % hdddir
diff --git a/scripts/wic b/scripts/wic
index 15cc9b31ef..e7df60f28e 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -131,11 +131,11 @@ def wic_create_subcommand(args, usage_str):
131 sys.exit(1) 131 sys.exit(1)
132 set_bitbake_env_lines(bitbake_env_lines) 132 set_bitbake_env_lines(bitbake_env_lines)
133 133
134 bootimg_dir = staging_data_dir = hdddir = "" 134 bootimg_dir = ""
135 135
136 if options.image_name: 136 if options.image_name:
137 (rootfs_dir, kernel_dir, hdddir, staging_data_dir, native_sysroot) = \ 137 (rootfs_dir, kernel_dir, bootimg_dir, native_sysroot) \
138 find_artifacts(options.image_name) 138 = find_artifacts(options.image_name)
139 139
140 wks_file = args[0] 140 wks_file = args[0]
141 141
@@ -172,8 +172,6 @@ def wic_create_subcommand(args, usage_str):
172 not_found = not_found_dir = "" 172 not_found = not_found_dir = ""
173 if not os.path.isdir(rootfs_dir): 173 if not os.path.isdir(rootfs_dir):
174 (not_found, not_found_dir) = ("rootfs-dir", rootfs_dir) 174 (not_found, not_found_dir) = ("rootfs-dir", rootfs_dir)
175 elif not os.path.isdir(hdddir) and not os.path.isdir(staging_data_dir):
176 (not_found, not_found_dir) = ("bootimg-dir", bootimg_dir)
177 elif not os.path.isdir(kernel_dir): 175 elif not os.path.isdir(kernel_dir):
178 (not_found, not_found_dir) = ("kernel-dir", kernel_dir) 176 (not_found, not_found_dir) = ("kernel-dir", kernel_dir)
179 elif not os.path.isdir(native_sysroot): 177 elif not os.path.isdir(native_sysroot):
@@ -197,8 +195,8 @@ def wic_create_subcommand(args, usage_str):
197 rootfs_dir = rootfs_dir_to_args(krootfs_dir) 195 rootfs_dir = rootfs_dir_to_args(krootfs_dir)
198 196
199 wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir, 197 wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir,
200 native_sysroot, hdddir, staging_data_dir, scripts_path, 198 native_sysroot, scripts_path, image_output_dir,
201 image_output_dir, options.debug, options.properties_file) 199 options.debug, options.properties_file)
202 200
203 201
204def wic_list_subcommand(args, usage_str): 202def wic_list_subcommand(args, usage_str):