* [wic][PATCH 0/6] new wks option --system-id
@ 2016-04-22 9:31 Ed Bartosh
2016-04-22 9:31 ` [wic][PATCH 1/6] wic: add --system-id wks option Ed Bartosh
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Ed Bartosh @ 2016-04-22 9:31 UTC (permalink / raw)
To: openembedded-core
Hi,
This patchset contains implementation of --system-id option. The option sets
system id for the partition if specified.
For example with this wks file:
part /boot --ondisk sda --align 1024 --fstype vfat --source bootimg-pcbios --size 64M --system-id 1
part / --ondisk sda --align 1024 --fstype ext4 --source rootfs --size 1000M --system-id 2
part /opt --ondisk sda --align 1024 --fstype ext4 --size 1000M --system-id 3
The image layout is the following: (pay attention to the system ids 1,2,3)
Device Boot Start End #cyls #blocks Id System
img/build/system-id-201604221223-sda.direct1 16 1040- 1025- 65552 1 FAT12
img/build/system-id-201604221223-sda.direct2 1056 21855 20800 1331200 2 XENIX root
img/build/system-id-201604221223-sda.direct3 21856 37855 16000 1024000 3 XENIX usr
The following changes since commit 6c1c01392d91f512e2949ad1d57a75a8077478ba:
build-appliance-image: Update to krogoth head revision (2016-04-19 21:26:33 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib ed/wic/part-system-id-9096
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/wic/part-system-id-9096
Ed Bartosh (6):
wic: add --system-id wks option
wic: add sfdisk to the list of utilities
wic: add system_id attribute to Partition
wic: add system_id argument to Image.add_partition
wic: set partition system id
wic: add help for --system-id option
scripts/lib/wic/help.py | 4 ++++
scripts/lib/wic/imager/direct.py | 3 ++-
scripts/lib/wic/ksparser.py | 19 +++++++++++++++++++
scripts/lib/wic/partition.py | 1 +
scripts/lib/wic/utils/oe/misc.py | 1 +
scripts/lib/wic/utils/partitionedfs.py | 9 +++++++--
6 files changed, 34 insertions(+), 3 deletions(-)
--
Regards,
Ed
^ permalink raw reply [flat|nested] 7+ messages in thread
* [wic][PATCH 1/6] wic: add --system-id wks option
2016-04-22 9:31 [wic][PATCH 0/6] new wks option --system-id Ed Bartosh
@ 2016-04-22 9:31 ` Ed Bartosh
2016-04-22 9:32 ` [wic][PATCH 2/6] wic: add sfdisk to the list of utilities Ed Bartosh
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Ed Bartosh @ 2016-04-22 9:31 UTC (permalink / raw)
To: openembedded-core
Added new option --system-id to wks parser. The option
will be used to set partition system id.
[YOCTO #9096]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
scripts/lib/wic/ksparser.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 8c3f808..10d0d7c 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -92,6 +92,24 @@ def cannedpathtype(arg):
raise ArgumentTypeError("file not found: %s" % arg)
return result
+def systemidtype(arg):
+ """
+ Custom type for ArgumentParser
+ Checks if the argument sutisfies system id requirements,
+ i.e. if it's one byte long integer > 0
+ """
+ error = "Invalid system type: %s. must be hex "\
+ "between 0x1 and 0xFF" % arg
+ try:
+ result = int(arg, 16)
+ except ValueError:
+ raise ArgumentTypeError(error)
+
+ if result <= 0 or result > 0xff:
+ raise ArgumentTypeError(error)
+
+ return arg
+
class KickStart(object):
""""Kickstart parser implementation."""
@@ -121,6 +139,7 @@ class KickStart(object):
part.add_argument('--size', type=sizetype, default=0)
part.add_argument('--source')
part.add_argument('--sourceparams')
+ part.add_argument('--system-id', type=systemidtype)
part.add_argument('--use-uuid', action='store_true')
part.add_argument('--uuid')
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [wic][PATCH 2/6] wic: add sfdisk to the list of utilities
2016-04-22 9:31 [wic][PATCH 0/6] new wks option --system-id Ed Bartosh
2016-04-22 9:31 ` [wic][PATCH 1/6] wic: add --system-id wks option Ed Bartosh
@ 2016-04-22 9:32 ` Ed Bartosh
2016-04-22 9:32 ` [wic][PATCH 3/6] wic: add system_id attribute to Partition Ed Bartosh
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Ed Bartosh @ 2016-04-22 9:32 UTC (permalink / raw)
To: openembedded-core
Added sfdisk -> util-linux pair to the dictionary
executable -> recipe as sfdisk is going to be used by wic
to set partition system id.
[YOCTO #9096]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
scripts/lib/wic/utils/oe/misc.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py
index 81239ac..a3cbe5f 100644
--- a/scripts/lib/wic/utils/oe/misc.py
+++ b/scripts/lib/wic/utils/oe/misc.py
@@ -43,6 +43,7 @@ NATIVE_RECIPES = {"mcopy": "mtools",
"mksquashfs": "squashfs-tools",
"mkswap": "util-linux",
"parted": "parted",
+ "sfdisk": "util-linux",
"sgdisk": "gptfdisk",
"syslinux": "syslinux"
}
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [wic][PATCH 3/6] wic: add system_id attribute to Partition
2016-04-22 9:31 [wic][PATCH 0/6] new wks option --system-id Ed Bartosh
2016-04-22 9:31 ` [wic][PATCH 1/6] wic: add --system-id wks option Ed Bartosh
2016-04-22 9:32 ` [wic][PATCH 2/6] wic: add sfdisk to the list of utilities Ed Bartosh
@ 2016-04-22 9:32 ` Ed Bartosh
2016-04-22 9:32 ` [wic][PATCH 4/6] wic: add system_id argument to Image.add_partition Ed Bartosh
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Ed Bartosh @ 2016-04-22 9:32 UTC (permalink / raw)
To: openembedded-core
Added Partition.system_id attribute and initialized it
from parse result of wks option --system-id. It will be
used by the wic code below the call stack to set partition
system id.
[YOCTO #9096]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
scripts/lib/wic/partition.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index f40d1bc..227b685 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -57,6 +57,7 @@ class Partition(object):
self.size = args.size
self.source = args.source
self.sourceparams = args.sourceparams
+ self.system_id = args.system_id
self.use_uuid = args.use_uuid
self.uuid = args.uuid
if args.use_uuid and not self.uuid:
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [wic][PATCH 4/6] wic: add system_id argument to Image.add_partition
2016-04-22 9:31 [wic][PATCH 0/6] new wks option --system-id Ed Bartosh
` (2 preceding siblings ...)
2016-04-22 9:32 ` [wic][PATCH 3/6] wic: add system_id attribute to Partition Ed Bartosh
@ 2016-04-22 9:32 ` Ed Bartosh
2016-04-22 9:32 ` [wic][PATCH 5/6] wic: set partition system id Ed Bartosh
2016-04-22 9:32 ` [wic][PATCH 6/6] wic: add help for --system-id option Ed Bartosh
5 siblings, 0 replies; 7+ messages in thread
From: Ed Bartosh @ 2016-04-22 9:32 UTC (permalink / raw)
To: openembedded-core
Added new argument to add_partition call to pass partition
system id down the stack.
[YOCTO #9096]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
scripts/lib/wic/imager/direct.py | 3 ++-
scripts/lib/wic/utils/partitionedfs.py | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index a1b4249..1937042 100644
--- a/scripts/lib/wic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -267,7 +267,8 @@ class DirectImageCreator(BaseImageCreator):
align=part.align,
no_table=part.no_table,
part_type=part.part_type,
- uuid=part.uuid)
+ uuid=part.uuid,
+ system_id=part.system_id)
if fstab_path:
shutil.move(fstab_path + ".orig", fstab_path)
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
index ad596d2..9da4a7f 100644
--- a/scripts/lib/wic/utils/partitionedfs.py
+++ b/scripts/lib/wic/utils/partitionedfs.py
@@ -87,7 +87,7 @@ class Image(object):
def add_partition(self, size, disk_name, mountpoint, source_file=None, fstype=None,
label=None, fsopts=None, boot=False, align=None, no_table=False,
- part_type=None, uuid=None):
+ part_type=None, uuid=None, system_id=None):
""" Add the next partition. Prtitions have to be added in the
first-to-last order. """
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [wic][PATCH 5/6] wic: set partition system id
2016-04-22 9:31 [wic][PATCH 0/6] new wks option --system-id Ed Bartosh
` (3 preceding siblings ...)
2016-04-22 9:32 ` [wic][PATCH 4/6] wic: add system_id argument to Image.add_partition Ed Bartosh
@ 2016-04-22 9:32 ` Ed Bartosh
2016-04-22 9:32 ` [wic][PATCH 6/6] wic: add help for --system-id option Ed Bartosh
5 siblings, 0 replies; 7+ messages in thread
From: Ed Bartosh @ 2016-04-22 9:32 UTC (permalink / raw)
To: openembedded-core
Used sfdisk to set partition system id if --system-id parameter
is used for a partition in wks file.
[YOCTO #9096]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
scripts/lib/wic/utils/partitionedfs.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
index 9da4a7f..4170ec1 100644
--- a/scripts/lib/wic/utils/partitionedfs.py
+++ b/scripts/lib/wic/utils/partitionedfs.py
@@ -110,7 +110,8 @@ class Image(object):
'align': align, # Partition alignment
'no_table' : no_table, # Partition does not appear in partition table
'part_type' : part_type, # Partition type
- 'uuid': uuid} # Partition UUID
+ 'uuid': uuid, # Partition UUID
+ 'system_id': system_id} # Partition system id
self.__add_partition(part)
@@ -310,6 +311,10 @@ class Image(object):
exec_native_cmd("parted -s %s set %d %s on" % \
(disk['disk'].device, part['num'], flag_name),
self.native_sysroot)
+ if part['system_id']:
+ exec_native_cmd("sfdisk --part-type %s %s %s" % \
+ (disk['disk'].device, part['num'], part['system_id']),
+ self.native_sysroot)
# Parted defaults to enabling the lba flag for fat16 partitions,
# which causes compatibility issues with some firmware (and really
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [wic][PATCH 6/6] wic: add help for --system-id option
2016-04-22 9:31 [wic][PATCH 0/6] new wks option --system-id Ed Bartosh
` (4 preceding siblings ...)
2016-04-22 9:32 ` [wic][PATCH 5/6] wic: set partition system id Ed Bartosh
@ 2016-04-22 9:32 ` Ed Bartosh
5 siblings, 0 replies; 7+ messages in thread
From: Ed Bartosh @ 2016-04-22 9:32 UTC (permalink / raw)
To: openembedded-core
Added explanation of --system-id option to the output of
wic help kickstart.
[YOCTO #9096]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
scripts/lib/wic/help.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
index 405d25a..394e3fd 100644
--- a/scripts/lib/wic/help.py
+++ b/scripts/lib/wic/help.py
@@ -738,6 +738,10 @@ DESCRIPTION
in bootloader configuration before running wic. In this case .wks file can
be generated or modified to set preconfigured parition UUID using this option.
+ --system-id: This option is specific to wic. It specifies partition system id. It's useful
+ for the harware that requires non-default partition system ids. The parameter
+ in one byte long hex number either with 0x prefix or without it.
+
* bootloader
This command allows the user to specify various bootloader
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-04-22 11:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-22 9:31 [wic][PATCH 0/6] new wks option --system-id Ed Bartosh
2016-04-22 9:31 ` [wic][PATCH 1/6] wic: add --system-id wks option Ed Bartosh
2016-04-22 9:32 ` [wic][PATCH 2/6] wic: add sfdisk to the list of utilities Ed Bartosh
2016-04-22 9:32 ` [wic][PATCH 3/6] wic: add system_id attribute to Partition Ed Bartosh
2016-04-22 9:32 ` [wic][PATCH 4/6] wic: add system_id argument to Image.add_partition Ed Bartosh
2016-04-22 9:32 ` [wic][PATCH 5/6] wic: set partition system id Ed Bartosh
2016-04-22 9:32 ` [wic][PATCH 6/6] wic: add help for --system-id option Ed Bartosh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox