* [wic][PATCH 0/7] wic: Fixed support of GPT partition table
@ 2015-06-02 14:01 Ed Bartosh
2015-06-02 14:01 ` [wic][PATCH 1/7] wic: set legacy_boot flag for gpt partitions Ed Bartosh
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Ed Bartosh @ 2015-06-02 14:01 UTC (permalink / raw)
To: openembedded-core
Hi,
This is a set of fixes for GPT partition table support in wic.
Added new canned .wks and correspondent testcase were added to the codebase.
Result direct-gpt core-minimal image was successfully booted on NUC.
Ed Bartosh (7):
wic: set legacy_boot flag for gpt partitions
wic: check if part_type is set only for msdos partition table
wic: Add gpt to the list of supported partition table formats
wic: Use gptmbr.bin MBR for gpt partitions
wic: Make _ptable_format public
wic: create directdisk-gpt.wks
wic: Test creation of directdisk image with GPT table
meta/lib/oeqa/selftest/wic.py | 6 ++++++
scripts/lib/image/canned-wks/directdisk-gpt.wks | 10 ++++++++++
scripts/lib/wic/imager/direct.py | 6 +++---
scripts/lib/wic/plugins/source/bootimg-efi.py | 4 ++--
scripts/lib/wic/plugins/source/bootimg-pcbios.py | 8 ++++++--
scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py | 12 ++++++++++--
scripts/lib/wic/utils/partitionedfs.py | 4 ++--
7 files changed, 39 insertions(+), 11 deletions(-)
create mode 100644 scripts/lib/image/canned-wks/directdisk-gpt.wks
--
Regards,
Ed
^ permalink raw reply [flat|nested] 8+ messages in thread
* [wic][PATCH 1/7] wic: set legacy_boot flag for gpt partitions
2015-06-02 14:01 [wic][PATCH 0/7] wic: Fixed support of GPT partition table Ed Bartosh
@ 2015-06-02 14:01 ` Ed Bartosh
2015-06-02 14:02 ` [wic][PATCH 2/7] wic: check if part_type is set only for msdos partition table Ed Bartosh
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ed Bartosh @ 2015-06-02 14:01 UTC (permalink / raw)
To: openembedded-core
This flag is used to tell special purpose software that
the GPT partition may be bootable.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
index 1c9e3ea..06d4eac 100644
--- a/scripts/lib/wic/utils/partitionedfs.py
+++ b/scripts/lib/wic/utils/partitionedfs.py
@@ -312,7 +312,7 @@ class Image:
parted_fs_type, p['start'], p['size'])
if p['boot']:
- flag_name = "boot"
+ flag_name = "legacy_boot" if d['ptable_format'] == 'gpt' else "boot"
msger.debug("Set '%s' flag for partition '%s' on disk '%s'" % \
(flag_name, p['num'], d['disk'].device))
self.__run_parted(["-s", d['disk'].device, "set",
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [wic][PATCH 2/7] wic: check if part_type is set only for msdos partition table
2015-06-02 14:01 [wic][PATCH 0/7] wic: Fixed support of GPT partition table Ed Bartosh
2015-06-02 14:01 ` [wic][PATCH 1/7] wic: set legacy_boot flag for gpt partitions Ed Bartosh
@ 2015-06-02 14:02 ` Ed Bartosh
2015-06-02 14:02 ` [wic][PATCH 3/7] wic: Add gpt to the list of supported partition table formats Ed Bartosh
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ed Bartosh @ 2015-06-02 14:02 UTC (permalink / raw)
To: openembedded-core
Specifying partition type(GUID) makes sense for gpt partition table.
Current code checks if part-type is specified and throws exception
if it is. This makes sense to do only for msdos partition table.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
index 06d4eac..eacf267 100644
--- a/scripts/lib/wic/utils/partitionedfs.py
+++ b/scripts/lib/wic/utils/partitionedfs.py
@@ -138,7 +138,7 @@ class Image:
raise ImageError("No disk %s for partition %s" \
% (p['disk_name'], p['mountpoint']))
- if p['part_type']:
+ if ptable_format == 'msdos' and p['part_type']:
# The --part-type can also be implemented for MBR partitions,
# in which case it would map to the 1-byte "partition type"
# filed at offset 3 of the partition entry.
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [wic][PATCH 3/7] wic: Add gpt to the list of supported partition table formats
2015-06-02 14:01 [wic][PATCH 0/7] wic: Fixed support of GPT partition table Ed Bartosh
2015-06-02 14:01 ` [wic][PATCH 1/7] wic: set legacy_boot flag for gpt partitions Ed Bartosh
2015-06-02 14:02 ` [wic][PATCH 2/7] wic: check if part_type is set only for msdos partition table Ed Bartosh
@ 2015-06-02 14:02 ` Ed Bartosh
2015-06-02 14:02 ` [wic][PATCH 4/7] wic: Use gptmbr.bin MBR for gpt partitions Ed Bartosh
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ed Bartosh @ 2015-06-02 14:02 UTC (permalink / raw)
To: openembedded-core
Only msdos partition table format was supported by wic source
plugins.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 2fc0357..22c7b0a 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -61,7 +61,7 @@ class BootimgEFIPlugin(SourcePlugin):
kernel = "/bzImage"
- if cr._ptable_format == 'msdos':
+ if cr._ptable_format in ('msdos', 'gpt'):
rootstr = rootdev
else:
raise ImageError("Unsupported partition table format found")
@@ -106,7 +106,7 @@ class BootimgEFIPlugin(SourcePlugin):
kernel = "/bzImage"
- if cr._ptable_format == 'msdos':
+ if cr._ptable_format in ('msdos', 'gpt'):
rootstr = rootdev
else:
raise ImageError("Unsupported partition table format found")
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index 9c63855..c28b9af 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -100,7 +100,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
kernel = "/vmlinuz"
syslinux_conf += "KERNEL " + kernel + "\n"
- if cr._ptable_format == 'msdos':
+ if cr._ptable_format in ('msdos', 'gpt'):
rootstr = rootdev
else:
raise ImageError("Unsupported partition table format found")
diff --git a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
index ebf95ae..29c873d 100644
--- a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
+++ b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
@@ -101,7 +101,7 @@ class RootfsPlugin(SourcePlugin):
syslinux_conf += "LABEL linux\n"
syslinux_conf += " KERNEL /boot/bzImage\n"
- if image_creator._ptable_format == 'msdos':
+ if image_creator._ptable_format in ('msdos', 'gpt'):
rootstr = rootdev
else:
raise ImageError("Unsupported partition table format found")
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [wic][PATCH 4/7] wic: Use gptmbr.bin MBR for gpt partitions
2015-06-02 14:01 [wic][PATCH 0/7] wic: Fixed support of GPT partition table Ed Bartosh
` (2 preceding siblings ...)
2015-06-02 14:02 ` [wic][PATCH 3/7] wic: Add gpt to the list of supported partition table formats Ed Bartosh
@ 2015-06-02 14:02 ` Ed Bartosh
2015-06-02 14:02 ` [wic][PATCH 5/7] wic: Make _ptable_format public Ed Bartosh
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ed Bartosh @ 2015-06-02 14:02 UTC (permalink / raw)
To: openembedded-core
Used proper syslinux MBR gptmbr.bin for GPT partitons.
Added check for unsupported partition formats.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index c28b9af..ab62b7a 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -46,6 +46,10 @@ class BootimgPcbiosPlugin(SourcePlugin):
mbrfile = "%s/syslinux/" % bootimg_dir
if cr._ptable_format == 'msdos':
mbrfile += "mbr.bin"
+ elif cr._ptable_format == 'gpt':
+ mbrfile += "gptmbr.bin"
+ else:
+ msger.error("Unsupported partition table: %s" % cr._ptable_format)
if not os.path.exists(mbrfile):
msger.error("Couldn't find %s. If using the -e option, do you have the right MACHINE set in local.conf? If not, is the bootimg_dir path correct?" % mbrfile)
diff --git a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
index 29c873d..cdd7c84 100644
--- a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
+++ b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
@@ -169,7 +169,15 @@ class RootfsPlugin(SourcePlugin):
Called after all partitions have been prepared and assembled into a
disk image. In this case, we install the MBR.
"""
- mbrfile = os.path.join(native_sysroot, "usr/share/syslinux/mbr.bin")
+ mbrfile = os.path.join(native_sysroot, "usr/share/syslinux/")
+ if image_creator._ptable_format == 'msdos':
+ mbrfile += "mbr.bin"
+ elif image_creator._ptable_format == 'gpt':
+ mbrfile += "gptmbr.bin"
+ else:
+ msger.error("Unsupported partition table: %s" % \
+ image_creator._ptable_format)
+
if not os.path.exists(mbrfile):
msger.error("Couldn't find %s. Has syslinux-native been baked?" % mbrfile)
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [wic][PATCH 5/7] wic: Make _ptable_format public
2015-06-02 14:01 [wic][PATCH 0/7] wic: Fixed support of GPT partition table Ed Bartosh
` (3 preceding siblings ...)
2015-06-02 14:02 ` [wic][PATCH 4/7] wic: Use gptmbr.bin MBR for gpt partitions Ed Bartosh
@ 2015-06-02 14:02 ` Ed Bartosh
2015-06-02 14:02 ` [wic][PATCH 6/7] wic: create directdisk-gpt.wks Ed Bartosh
2015-06-02 14:02 ` [wic][PATCH 7/7] wic: Test creation of directdisk image with GPT table Ed Bartosh
6 siblings, 0 replies; 8+ messages in thread
From: Ed Bartosh @ 2015-06-02 14:02 UTC (permalink / raw)
To: openembedded-core
Names with one leasding underscore considered protected in Python.
_ptable_format is accessed outside of its class.
Made it public by removing underscore.
This pylint warning should be fixed now:
Access to a protected member _ptable_format of a client class
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index 9a7d0f5..83f9688 100644
--- a/scripts/lib/wic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -62,7 +62,7 @@ class DirectImageCreator(BaseImageCreator):
self.__disks = {}
self.__disk_format = "direct"
self._disk_names = []
- self._ptable_format = self.ks.handler.bootloader.ptable
+ self.ptable_format = self.ks.handler.bootloader.ptable
self.oe_builddir = oe_builddir
if image_output_dir:
@@ -83,7 +83,7 @@ class DirectImageCreator(BaseImageCreator):
if n == num:
if p.no_table:
return 0
- if self._ptable_format == 'msdos' and realnum > 3:
+ if self.ptable_format == 'msdos' and realnum > 3:
# account for logical partition numbering, ex. sda5..
return realnum + 1
return realnum
@@ -276,7 +276,7 @@ class DirectImageCreator(BaseImageCreator):
self._restore_fstab(fstab)
- self.__image.layout_partitions(self._ptable_format)
+ self.__image.layout_partitions(self.ptable_format)
self.__imgdir = self.workdir
for disk_name, disk in self.__image.disks.items():
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 22c7b0a..400e3a2 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -61,7 +61,7 @@ class BootimgEFIPlugin(SourcePlugin):
kernel = "/bzImage"
- if cr._ptable_format in ('msdos', 'gpt'):
+ if cr.ptable_format in ('msdos', 'gpt'):
rootstr = rootdev
else:
raise ImageError("Unsupported partition table format found")
@@ -106,7 +106,7 @@ class BootimgEFIPlugin(SourcePlugin):
kernel = "/bzImage"
- if cr._ptable_format in ('msdos', 'gpt'):
+ if cr.ptable_format in ('msdos', 'gpt'):
rootstr = rootdev
else:
raise ImageError("Unsupported partition table format found")
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index ab62b7a..1c3c6e6 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -44,12 +44,12 @@ class BootimgPcbiosPlugin(SourcePlugin):
disk image. In this case, we install the MBR.
"""
mbrfile = "%s/syslinux/" % bootimg_dir
- if cr._ptable_format == 'msdos':
+ if cr.ptable_format == 'msdos':
mbrfile += "mbr.bin"
- elif cr._ptable_format == 'gpt':
+ elif cr.ptable_format == 'gpt':
mbrfile += "gptmbr.bin"
else:
- msger.error("Unsupported partition table: %s" % cr._ptable_format)
+ msger.error("Unsupported partition table: %s" % cr.ptable_format)
if not os.path.exists(mbrfile):
msger.error("Couldn't find %s. If using the -e option, do you have the right MACHINE set in local.conf? If not, is the bootimg_dir path correct?" % mbrfile)
@@ -104,7 +104,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
kernel = "/vmlinuz"
syslinux_conf += "KERNEL " + kernel + "\n"
- if cr._ptable_format in ('msdos', 'gpt'):
+ if cr.ptable_format in ('msdos', 'gpt'):
rootstr = rootdev
else:
raise ImageError("Unsupported partition table format found")
diff --git a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
index cdd7c84..50b2213 100644
--- a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
+++ b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
@@ -101,7 +101,7 @@ class RootfsPlugin(SourcePlugin):
syslinux_conf += "LABEL linux\n"
syslinux_conf += " KERNEL /boot/bzImage\n"
- if image_creator._ptable_format in ('msdos', 'gpt'):
+ if image_creator.ptable_format in ('msdos', 'gpt'):
rootstr = rootdev
else:
raise ImageError("Unsupported partition table format found")
@@ -170,13 +170,13 @@ class RootfsPlugin(SourcePlugin):
disk image. In this case, we install the MBR.
"""
mbrfile = os.path.join(native_sysroot, "usr/share/syslinux/")
- if image_creator._ptable_format == 'msdos':
+ if image_creator.ptable_format == 'msdos':
mbrfile += "mbr.bin"
- elif image_creator._ptable_format == 'gpt':
+ elif image_creator.ptable_format == 'gpt':
mbrfile += "gptmbr.bin"
else:
msger.error("Unsupported partition table: %s" % \
- image_creator._ptable_format)
+ image_creator.ptable_format)
if not os.path.exists(mbrfile):
msger.error("Couldn't find %s. Has syslinux-native been baked?" % mbrfile)
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [wic][PATCH 6/7] wic: create directdisk-gpt.wks
2015-06-02 14:01 [wic][PATCH 0/7] wic: Fixed support of GPT partition table Ed Bartosh
` (4 preceding siblings ...)
2015-06-02 14:02 ` [wic][PATCH 5/7] wic: Make _ptable_format public Ed Bartosh
@ 2015-06-02 14:02 ` Ed Bartosh
2015-06-02 14:02 ` [wic][PATCH 7/7] wic: Test creation of directdisk image with GPT table Ed Bartosh
6 siblings, 0 replies; 8+ messages in thread
From: Ed Bartosh @ 2015-06-02 14:02 UTC (permalink / raw)
To: openembedded-core
directdisk-gpt is the same as directdisk with only one difference:
it uses GPT partition table.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
create mode 100644 scripts/lib/image/canned-wks/directdisk-gpt.wks
diff --git a/scripts/lib/image/canned-wks/directdisk-gpt.wks b/scripts/lib/image/canned-wks/directdisk-gpt.wks
new file mode 100644
index 0000000..76fda1f
--- /dev/null
+++ b/scripts/lib/image/canned-wks/directdisk-gpt.wks
@@ -0,0 +1,10 @@
+# short-description: Create a 'pcbios' direct disk image
+# long-description: Creates a partitioned legacy BIOS disk image that the user
+# can directly dd to boot media.
+
+
+part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024
+part / --source rootfs --ondisk sda --fstype=ext3 --label platform --align 1024
+
+bootloader --ptable gpt --timeout=0 --append="rootwait rootfstype=ext3 video=vesafb vga=0x318 console=tty0"
+
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [wic][PATCH 7/7] wic: Test creation of directdisk image with GPT table
2015-06-02 14:01 [wic][PATCH 0/7] wic: Fixed support of GPT partition table Ed Bartosh
` (5 preceding siblings ...)
2015-06-02 14:02 ` [wic][PATCH 6/7] wic: create directdisk-gpt.wks Ed Bartosh
@ 2015-06-02 14:02 ` Ed Bartosh
6 siblings, 0 replies; 8+ messages in thread
From: Ed Bartosh @ 2015-06-02 14:02 UTC (permalink / raw)
To: openembedded-core
Added new wic testcase to the sute - creation of directdisk-gpt
image.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index a2ce2cb..e97dd1d 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -73,3 +73,9 @@ class Wic(oeSelfTest):
"-r tmp/work/qemux86-poky-linux/"
"core-image-minimal/1.0-r0/rootfs").status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
+
+ def test06_gpt_image(self):
+ """Test creation of core-image-minimal with gpt table"""
+ self.assertEqual(0, runCmd("wic create directdisk-gpt "
+ "--image-name core-image-minimal").status)
+ self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-06-02 15:56 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02 14:01 [wic][PATCH 0/7] wic: Fixed support of GPT partition table Ed Bartosh
2015-06-02 14:01 ` [wic][PATCH 1/7] wic: set legacy_boot flag for gpt partitions Ed Bartosh
2015-06-02 14:02 ` [wic][PATCH 2/7] wic: check if part_type is set only for msdos partition table Ed Bartosh
2015-06-02 14:02 ` [wic][PATCH 3/7] wic: Add gpt to the list of supported partition table formats Ed Bartosh
2015-06-02 14:02 ` [wic][PATCH 4/7] wic: Use gptmbr.bin MBR for gpt partitions Ed Bartosh
2015-06-02 14:02 ` [wic][PATCH 5/7] wic: Make _ptable_format public Ed Bartosh
2015-06-02 14:02 ` [wic][PATCH 6/7] wic: create directdisk-gpt.wks Ed Bartosh
2015-06-02 14:02 ` [wic][PATCH 7/7] wic: Test creation of directdisk image with GPT table Ed Bartosh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox