summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-03-26 20:27:48 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-04-01 08:14:57 +0100
commit2122dd7718f46f266e3c03b48828be8977a9baf2 (patch)
treea294b55ee18972fc6b705e78ef1ac1417d3a989f
parent3a5336108433ed99e859e812d4bc036a9c5a8223 (diff)
downloadpoky-2122dd7718f46f266e3c03b48828be8977a9baf2.tar.gz
wic: use wic-tools STAGING_DATADIR as bootimg_dir
If bootloader artifacts are not found in default bootimg_dir use wic-tools sysroot for the same purpose. This should prevent wic from failing if bootloader artifacts can't be found in image native sysroot. (From OE-Core rev: 9674bbd0585fc25ccd362f233b83d07ff8f6ff53) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-pcbios.py42
1 files changed, 20 insertions, 22 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index 11db304550..bfb8ff5a96 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -44,19 +44,16 @@ class BootimgPcbiosPlugin(SourcePlugin):
44 name = 'bootimg-pcbios' 44 name = 'bootimg-pcbios'
45 45
46 @classmethod 46 @classmethod
47 def _get_syslinux_dir(cls, bootimg_dir): 47 def _get_bootimg_dir(cls, bootimg_dir, dirname):
48 """ 48 """
49 Get path to syslinux from either default bootimg_dir 49 Check if dirname exists in default bootimg_dir or
50 or wic-tools STAGING_DIR. 50 in wic-tools STAGING_DIR.
51 """ 51 """
52 for path in (bootimg_dir, get_bitbake_var("STAGING_DATADIR", "wic-tools")): 52 for result in (bootimg_dir, get_bitbake_var("STAGING_DATADIR", "wic-tools")):
53 if not path: 53 if os.path.exists("%s/%s" % (result, dirname)):
54 continue 54 return result
55 syslinux_dir = os.path.join(path, 'syslinux')
56 if os.path.exists(syslinux_dir):
57 return syslinux_dir
58 55
59 raise WicError("Couldn't find syslinux directory, exiting") 56 raise WicError("Couldn't find correct bootimg_dir, exiting")
60 57
61 @classmethod 58 @classmethod
62 def do_install_disk(cls, disk, disk_name, creator, workdir, oe_builddir, 59 def do_install_disk(cls, disk, disk_name, creator, workdir, oe_builddir,
@@ -65,11 +62,12 @@ class BootimgPcbiosPlugin(SourcePlugin):
65 Called after all partitions have been prepared and assembled into a 62 Called after all partitions have been prepared and assembled into a
66 disk image. In this case, we install the MBR. 63 disk image. In this case, we install the MBR.
67 """ 64 """
68 syslinux_dir = cls._get_syslinux_dir(bootimg_dir) 65 bootimg_dir = cls._get_bootimg_dir(bootimg_dir, 'syslinux')
66 mbrfile = "%s/syslinux/" % bootimg_dir
69 if creator.ptable_format == 'msdos': 67 if creator.ptable_format == 'msdos':
70 mbrfile = os.path.join(syslinux_dir, "mbr.bin") 68 mbrfile += "mbr.bin"
71 elif creator.ptable_format == 'gpt': 69 elif creator.ptable_format == 'gpt':
72 mbrfile = os.path.join(syslinux_dir, "gptmbr.bin") 70 mbrfile += "gptmbr.bin"
73 else: 71 else:
74 raise WicError("Unsupported partition table: %s" % 72 raise WicError("Unsupported partition table: %s" %
75 creator.ptable_format) 73 creator.ptable_format)
@@ -155,7 +153,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
155 'prepares' the partition to be incorporated into the image. 153 'prepares' the partition to be incorporated into the image.
156 In this case, prepare content for legacy bios boot partition. 154 In this case, prepare content for legacy bios boot partition.
157 """ 155 """
158 syslinux_dir = cls._get_syslinux_dir(bootimg_dir) 156 bootimg_dir = cls._get_bootimg_dir(bootimg_dir, 'syslinux')
159 157
160 staging_kernel_dir = kernel_dir 158 staging_kernel_dir = kernel_dir
161 159
@@ -163,14 +161,14 @@ class BootimgPcbiosPlugin(SourcePlugin):
163 161
164 cmds = ("install -m 0644 %s/bzImage %s/vmlinuz" % 162 cmds = ("install -m 0644 %s/bzImage %s/vmlinuz" %
165 (staging_kernel_dir, hdddir), 163 (staging_kernel_dir, hdddir),
166 "install -m 444 %s/ldlinux.sys %s/ldlinux.sys" % 164 "install -m 444 %s/syslinux/ldlinux.sys %s/ldlinux.sys" %
167 (syslinux_dir, hdddir), 165 (bootimg_dir, hdddir),
168 "install -m 0644 %s/vesamenu.c32 %s/vesamenu.c32" % 166 "install -m 0644 %s/syslinux/vesamenu.c32 %s/vesamenu.c32" %
169 (syslinux_dir, hdddir), 167 (bootimg_dir, hdddir),
170 "install -m 444 %s/libcom32.c32 %s/libcom32.c32" % 168 "install -m 444 %s/syslinux/libcom32.c32 %s/libcom32.c32" %
171 (syslinux_dir, hdddir), 169 (bootimg_dir, hdddir),
172 "install -m 444 %s/libutil.c32 %s/libutil.c32" % 170 "install -m 444 %s/syslinux/libutil.c32 %s/libutil.c32" %
173 (syslinux_dir, hdddir)) 171 (bootimg_dir, hdddir))
174 172
175 for install_cmd in cmds: 173 for install_cmd in cmds:
176 exec_cmd(install_cmd) 174 exec_cmd(install_cmd)