FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 03-20-2009, 11:08 PM
David Cantrell
 
Default Add PPC PReP, Apple Bootstrap, and EFI boot device formats.

Looks good.

On 03/20/2009 01:05 PM, David Lehman wrote:

---
storage/formats/prepboot.py | 52 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
create mode 100644 storage/formats/prepboot.py

diff --git a/storage/formats/prepboot.py b/storage/formats/prepboot.py
new file mode 100644
index 0000000..6d2174b
--- /dev/null
+++ b/storage/formats/prepboot.py
@@ -0,0 +1,52 @@
+# prepboot.py
+# Format class for PPC PReP Boot.
+#
+# Copyright (C) 2009 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details. You should have received a copy of the
+# GNU General Public License along with this program; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): Dave Lehman<dlehman@redhat.com>
+#
+
+from ..errors import *
+from . import DeviceFormat, register_device_format
+from parted import PARTITION_PREP
+
+class PPCPRePBoot(DeviceFormat):
+ """ Generic device format. """
+ _type = "prepboot"
+ _name = "PPC PReP Boot"
+ _udevTypes = []
+ partedFlag = PARTITION_PREP
+ _formattable = True # can be formatted
+ _linuxNative = True # for clearpart
+ _bootable = True # can be used as boot
+ _maxSize = 4 # maximum size in MB
+ _minSize = 10 # minimum size in MB
+
+ def __init__(self, *args, **kwargs):
+ """ Create a PRePBoot instance.
+
+ Keyword Arguments:
+
+ device -- path to the underlying device
+ exists -- indicates whether this is an existing format
+
+ """
+ DeviceFormat.__init__(self, *args, **kwargs)
+
+
+register_device_format(PPCPRePBoot)
+



--
David Cantrell <dcantrell@redhat.com>
Red Hat / Honolulu, HI

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-20-2009, 11:09 PM
David Cantrell
 
Default Add PPC PReP, Apple Bootstrap, and EFI boot device formats.

On 03/20/2009 02:08 PM, David Cantrell wrote:

Looks good.


Well, the correct one.



On 03/20/2009 01:05 PM, David Lehman wrote:

---
storage/formats/prepboot.py | 52
+++++++++++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
create mode 100644 storage/formats/prepboot.py

diff --git a/storage/formats/prepboot.py b/storage/formats/prepboot.py
new file mode 100644
index 0000000..6d2174b
--- /dev/null
+++ b/storage/formats/prepboot.py
@@ -0,0 +1,52 @@
+# prepboot.py
+# Format class for PPC PReP Boot.
+#
+# Copyright (C) 2009 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and
conditions of
+# the GNU General Public License v.2, or (at your option) any later
version.
+# This program is distributed in the hope that it will be useful, but
WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General
+# Public License for more details. You should have received a copy of
the
+# GNU General Public License along with this program; if not, write
to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA
+# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express
permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): Dave Lehman<dlehman@redhat.com>
+#
+
+from ..errors import *
+from . import DeviceFormat, register_device_format
+from parted import PARTITION_PREP
+
+class PPCPRePBoot(DeviceFormat):
+ """ Generic device format. """
+ _type = "prepboot"
+ _name = "PPC PReP Boot"
+ _udevTypes = []
+ partedFlag = PARTITION_PREP
+ _formattable = True # can be formatted
+ _linuxNative = True # for clearpart
+ _bootable = True # can be used as boot
+ _maxSize = 4 # maximum size in MB
+ _minSize = 10 # minimum size in MB
+
+ def __init__(self, *args, **kwargs):
+ """ Create a PRePBoot instance.
+
+ Keyword Arguments:
+
+ device -- path to the underlying device
+ exists -- indicates whether this is an existing format
+
+ """
+ DeviceFormat.__init__(self, *args, **kwargs)
+
+
+register_device_format(PPCPRePBoot)
+






--
David Cantrell <dcantrell@redhat.com>
Red Hat / Honolulu, HI

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-21-2009, 02:13 AM
David Cantrell
 
Default Add PPC PReP, Apple Bootstrap, and EFI boot device formats.

Looks good.

On 03/20/2009 12:56 PM, David Lehman wrote:

---
platform.py | 13 +++++++------
storage/devices.py | 4 ++++
storage/devicetree.py | 12 ++++++++++++
storage/formats/fs.py | 44 ++++++++++++++++++++++++++++++++------------
4 files changed, 55 insertions(+), 18 deletions(-)

diff --git a/platform.py b/platform.py
index f1a20a4..6bd0fd6 100644
--- a/platform.py
+++ b/platform.py
@@ -170,8 +170,8 @@ class EFI(Platform):
if not req.format.type.startswith("ext"):
raise FSError("/boot is not ext2")
elif req.format.mountpoint == "/boot/efi":
- if not req.format.type.endswith("fat"):
- raise FSError("/boot/efi is not vfat")
+ if not req.format.type != "efi":
+ raise FSError("/boot/efi is not efi")

def setDefaultPartitioning(self):
ret = Platform.setDefaultPartitioning(self)
@@ -236,7 +236,7 @@ class IPSeriesPPC(PPC):

# We want the first PReP partition.
for device in self.anaconda.id.storage.partitions:
- if device.partedPartition.getFlag(parted.PARTITION_PR EP):
+ if device.format.name == "prepboot":
bootDev = device
break

@@ -279,9 +279,10 @@ class NewWorldPPC(PPC):
bootDev = None

for part in self.anaconda.id.storage.partitions:
- # XXX do we need to also check the size?
- if part.format.type == "hfs" and self.validBootPartSize(part.size):
+ if part.format.type == "appleboot" and self.validBootPartSize(part.size):
bootDev = part
+ # if we're only picking one, it might as well be the first
+ break

return bootDev

@@ -298,7 +299,7 @@ class NewWorldPPC(PPC):
else:
ret["boot"] = (bootDev.name, N_("Apple Bootstrap"))
for (n, device) in enumerate(self.anaconda.id.storage.partitions):
- if device.format.type == "hfs" and device.bootable and device.path != bootDev.path:
+ if device.format.type == "appleboot" and device.path != bootDev.path:
ret["boot%d" % n] = (device.path, N_("Apple Bootstrap"))

return ret
diff --git a/storage/devices.py b/storage/devices.py
index 415697c..44320b6 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -903,6 +903,10 @@ class PartitionDevice(StorageDevice):

# collect information about the partition from parted
self.probe()
+ if self.getFlag(parted.PARTITION_PREP):
+ # the only way to identify a PPC PReP Boot partition is to
+ # check the partition type/flags, so do it here.
+ self.format = getFormat("prep", device=self.path, exists=True)
else:
# XXX It might be worthwhile to create a shit-simple
# PartitionRequest class and pass one to this constructor
diff --git a/storage/devicetree.py b/storage/devicetree.py
index ae6bed9..63339dd 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1140,6 +1140,18 @@ class DeviceTree(object):
kwargs["peStart"] = udev_device_get_pv_pe_start(info)
except KeyError:
log.debug("PV %s has no pe_start" % name)
+ elif format_type == "vfat":
+ # efi magic
+ if isinstance(device, PartitionDevice) and device.bootable:
+ efi = formats.getFormat("efi")
+ if efi.minSize<= device.size<= efi.maxSize:
+ args[0] = "efi"
+ elif format_type == "hfs":
+ # apple bootstrap magic
+ if isinstance(device, PartitionDevice) and device.bootable:
+ apple = formats.getFormat("appleboot")
+ if apple.minSize<= device.size<= apple.maxSize:
+ args[0] = "appleboot"

format = formats.getFormat(*args, **kwargs)
device.format = format
diff --git a/storage/formats/fs.py b/storage/formats/fs.py
index 1939434..bc0eb58 100644
--- a/storage/formats/fs.py
+++ b/storage/formats/fs.py
@@ -783,11 +783,7 @@ register_device_format(Ext4FS)


class FATFS(FS):
- """ FAT filesystem.
-
- XXX Do we want to subclass this for EFI or twiddle bootable based
- on the platform?
- """
+ """ FAT filesystem. """
_type = "vfat"
_mkfs = "mkdosfs"
_labelfs = "dosfslabel"
@@ -797,15 +793,23 @@ class FATFS(FS):
_packages = [ "dosfstools" ]
_defaultMountOptions = ["umask=0077", "shortname=winnt"]

- @property
- def bootable(self):
- retval = self._bootable
- #if self.type in platform.bootableFSTypes:
- # retval = True
+register_device_format(FATFS)

- return retval

-register_device_format(FATFS)
+class EFIFS(FATFS):
+ _type = "efi"
+ _name = "EFI System Partition"
+ _minSize = 50
+ _maxSize = 256
+ _bootable = True
+
+ @property
+ def supported(self):
+ import platform
+ return (isinstance(platform.getPlatform(None), platform.EFI)
+ and self.utilsAvailable)
+
+register_device_format(EFIFS)


class BTRFS(FS):
@@ -928,6 +932,22 @@ class HFS(FS):
register_device_format(HFS)


+class AppleBootstrapFS(HFS):
+ _type = "appleboot"
+ _name = "Apple Bootstrap"
+ _bootable = True
+ _minSize = 800.00 / 1024.00
+ _maxSize = 1
+
+ @property
+ def supported(self):
+ import platform
+ return (isinstance(platform.getPlatform(None), platform.NewWorldPPC)
+ and self.utilsAvailable)
+
+register_device_format(AppleBootstrapFS)
+
+
# this doesn't need to be here
class HFSPlus(FS):
_type = "hfs+"



--
David Cantrell <dcantrell@redhat.com>
Red Hat / Honolulu, HI

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 04:43 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org