Re: SYSLINUX boot in F19

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



…
> Anyhow a standalone initrd entry is more legible than an appended one,
> to me.
…

This[1] patch is based on your 'bootloader.py' from
'updates-f19-extlinux.img'[2] with an increment from me - standalone
initrd entry(extlinux.conf).
Patched against anaconda's git commit
0578bafb968da06a4ae9b627ffd5de1d9871eb4d
Can be tested[4] with the updates image - 'updates-extlnx.img'[3].


poma


[1] bootloader.py-extlnx.diff(attach)
[2] http://mattdm.fedorapeople.org/updates-f19-extlinux.img
[3] ftp://ftp.leeds.ac.uk/incoming/extlinux/updates-extlnx.img
[4] "… 7 days" :)








diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 3e4442a..ca43200 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -18,6 +18,7 @@
 # Red Hat, Inc.
 #
 # Red Hat Author(s): David Lehman <dlehman@xxxxxxxxxx>
+#                    Matthew Miller <mattdm@xxxxxxxxxx> (extlinux portion)
 #
 
 import collections
@@ -2109,6 +2110,96 @@ class UBOOT(BootLoader):
         if rc:
             raise BootLoaderError("bootloader install failed")
 
+class EXTLINUX(BootLoader):
+    name = "EXTLINUX"
+    _config_file = "extlinux.conf"
+    _config_dir = "/boot/extlinux"
+
+    # stage1 device requirements
+    stage1_device_types = ["disk"]
+
+    # stage2 device requirements
+    stage2_format_types = ["ext4", "ext3", "ext2"]
+    stage2_device_types = ["partition"]
+    stage2_bootable = True
+
+    packages = ["syslinux-extlinux"]
+
+    @property
+    def config_file(self):
+        return "%s/%s" % (self._config_dir, self._config_file)
+
+    @property
+    def boot_prefix(self):
+        """ Prefix, if any, to paths in /boot. """
+        if self.stage2_device.format.mountpoint == "/":
+            prefix = "/boot"
+        else:
+            prefix = ""
+
+        return prefix
+
+    def write_config_images(self, config):
+        for image in self.images:
+            args = Arguments()
+            args.add("root=%s" % image.device.fstabSpec)
+#           args.add("initrd=%s/%s" % (self.boot_prefix, image.initrd))
+            args.update(self.boot_args)
+            log.info("bootloader.py: used boot args: %s " % args)
+            stanza = ("label %(label)s (%(version)s)\n"
+                      "\tkernel %(boot_prefix)s/%(kernel)s\n"
+                      "\tappend %(args)s\n"
+                      "\tinitrd %(boot_prefix)s/%(initrd)s\n\n"
+                      % {"label": self.image_label(image),
+                         "version": image.version,
+                         "kernel": image.kernel,
+                         "args": args,
+                         "initrd": image.initrd,
+                         "boot_prefix": self.boot_prefix})
+            config.write(stanza)
+
+    def write_config_header(self, config):
+        header = ("# extlinux.conf generated by anaconda\n\n"
+                  "ui menu.c32\n\n"
+                  "menu autoboot Welcome to %(productName)s. Automatic boot in # second{,s}. Press a key for options.\n"
+                  "menu title %(productName)s Boot Options.\n"
+                  "menu hidden\n\n"
+                  "timeout %(timeout)d\n"
+                  "#totaltimeout 9000\n\n"
+                  % { "productName": productName, "timeout": self.timeout *10,
+                     "default": self.image_label(self.default)})
+        config.write(header)
+        self.write_config_password(config)
+
+    def write_config_password(self, config):
+        if self.password:
+            config.write("menu master passwd %s\n" % self.password)
+            config.write("menu notabmsg Press [Tab] and enter the password to edit options")
+
+    def write_config_post(self):
+        etc_extlinux = os.path.normpath(ROOT_PATH + "/etc/" + self._config_file)
+        if not os.access(etc_extlinux, os.R_OK):
+            try:
+                os.symlink("../boot/%s" % self._config_file, etc_extlinux)
+            except OSError as e:
+                log.warning("failed to create /etc/extlinux.conf symlink: %s" % e)
+
+    def write_config(self):
+        super(EXTLINUX, self).write_config()
+
+    #
+    # installation
+    #
+
+    def install(self):
+        backup = "%s/backup.b" % self._config_dir
+        args = ["--install", self._config_dir]
+        rc = iutil.execWithRedirect("extlinux", args,
+                                    root=ROOT_PATH)
+
+        if rc:
+            raise BootLoaderError("bootloader install failed")
+
 
 # every platform that wants a bootloader needs to be in this dict
 bootloader_by_platform = {platform.X86: GRUB2,
@@ -2123,7 +2214,10 @@ bootloader_by_platform = {platform.X86: GRUB2,
 
 def get_bootloader():
     platform_name = platform.platform.__class__.__name__
-    cls = bootloader_by_platform.get(platform.platform.__class__, BootLoader)
+    if flags.extlinux:
+        cls = EXTLINUX
+    else:
+        cls = bootloader_by_platform.get(platform.platform.__class__, BootLoader)
     log.info("bootloader %s on %s platform" % (cls.__name__, platform_name))
     return cls()
 



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

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux