def do_configure_partition(cls, part, source_params, image_creator, image_creator_workdir, oe_builddir, bootimg_dir, kernel_dir, native_sysroot): """ Creates syslinux config in rootfs directory Called before do_prepare_partition() """ options = image_creator.ks.handler.bootloader.appendLine syslinux_conf = "" syslinux_conf += "PROMPT 0\n" timeout = kickstart.get_timeout(image_creator.ks) if not timeout: timeout = 0 syslinux_conf += "TIMEOUT " + str(timeout) + "\n" syslinux_conf += "ALLOWOPTIONS 1\n" # Derive SERIAL... line from from kernel boot parameters syslinux_conf += syslinux.serial_console_form_kargs(options) + "\n" syslinux_conf += "DEFAULT linux\n" syslinux_conf += "LABEL linux\n" syslinux_conf += " KERNEL /boot/bzImage\n" syslinux_conf += " APPEND label=boot root=%s %s\n" % \ (image_creator.rootdev, options) syslinux_cfg = os.path.join(image_creator.rootfs_dir['ROOTFS_DIR'], "boot", "syslinux.cfg") msger.debug("Writing syslinux config %s" % syslinux_cfg) with open(syslinux_cfg, "w") as cfg: cfg.write(syslinux_conf)
def do_configure_syslinux(cls, cr, cr_workdir): """ Create loader-specific (syslinux) config """ splash = os.path.join(cr_workdir, "/ISO/boot/splash.jpg") if os.path.exists(splash): splashline = "menu background splash.jpg" else: splashline = "" options = cr.ks.handler.bootloader.appendLine timeout = kickstart.get_timeout(cr.ks, 10) syslinux_conf = "" syslinux_conf += "PROMPT 0\n" syslinux_conf += "TIMEOUT %s \n" % timeout syslinux_conf += "\n" syslinux_conf += "ALLOWOPTIONS 1\n" syslinux_conf += "SERIAL 0 115200\n" syslinux_conf += "\n" if splashline: syslinux_conf += "%s\n" % splashline syslinux_conf += "DEFAULT boot\n" syslinux_conf += "LABEL boot\n" kernel = "/bzImage" syslinux_conf += "KERNEL " + kernel + "\n" syslinux_conf += "APPEND initrd=/initrd LABEL=boot %s\n" % options msger.debug("Writing syslinux config %s/ISO/isolinux/isolinux.cfg" \ % cr_workdir) with open("%s/ISO/isolinux/isolinux.cfg" % cr_workdir, "w") as cfg: cfg.write(syslinux_conf)
def do_configure_grubefi(cls, hdddir, cr, cr_workdir): """ Create loader-specific (grub-efi) config """ splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg") if os.path.exists(splash): splashline = "menu background splash.jpg" else: splashline = "" options = cr.ks.handler.bootloader.appendLine grubefi_conf = "" grubefi_conf += "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n" grubefi_conf += "default=boot\n" timeout = kickstart.get_timeout(cr.ks) if not timeout: timeout = 0 grubefi_conf += "timeout=%s\n" % timeout grubefi_conf += "menuentry 'boot'{\n" kernel = "/bzImage" grubefi_conf += "linux %s root=%s rootwait %s\n" \ % (kernel, cr.rootdev, options) grubefi_conf += "}\n" msger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg" \ % cr_workdir) cfg = open("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, "w") cfg.write(grubefi_conf) cfg.close()
def do_configure_grubefi(cls, hdddir, cr, cr_workdir): """ Create loader-specific (grub-efi) config """ splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg") if os.path.exists(splash): splashline = "menu background splash.jpg" else: splashline = "" options = cr.ks.handler.bootloader.appendLine grubefi_conf = "" grubefi_conf += "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n" grubefi_conf += "default=boot\n" timeout = kickstart.get_timeout(cr.ks) if not timeout: timeout = 0 grubefi_conf += "timeout=%s\n" % timeout grubefi_conf += "menuentry 'boot'{\n" kernel = "/bzImage" grubefi_conf += "linux %s root=%s rootwait %s\n" % (kernel, cr.rootdev, options) grubefi_conf += "}\n" msger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir) cfg = open("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, "w") cfg.write(grubefi_conf) cfg.close()
def do_configure_gummiboot(cls, hdddir, creator, cr_workdir): """ Create loader-specific (gummiboot) config """ install_cmd = "install -d %s/loader" % hdddir exec_cmd(install_cmd) install_cmd = "install -d %s/loader/entries" % hdddir exec_cmd(install_cmd) options = creator.ks.handler.bootloader.appendLine timeout = kickstart.get_timeout(creator.ks) if not timeout: timeout = 0 loader_conf = "" loader_conf += "default boot\n" loader_conf += "timeout %d\n" % timeout msger.debug("Writing gummiboot config %s/hdd/boot/loader/loader.conf" \ % cr_workdir) cfg = open("%s/hdd/boot/loader/loader.conf" % cr_workdir, "w") cfg.write(loader_conf) cfg.close() configfile = kickstart.get_bootloader_file(creator.ks) custom_cfg = None if configfile: custom_cfg = get_custom_config(configfile) if custom_cfg: # Use a custom configuration for gummiboot boot_conf = custom_cfg msger.debug("Using custom configuration file " "%s for gummiboots's boot.conf" % configfile) else: msger.error("configfile is specified but failed to " "get it from %s." % configfile) if not custom_cfg: # Create gummiboot configuration using parameters from wks file kernel = "/bzImage" boot_conf = "" boot_conf += "title boot\n" boot_conf += "linux %s\n" % kernel boot_conf += "options LABEL=Boot root=%s %s\n" % (creator.rootdev, options) msger.debug("Writing gummiboot config %s/hdd/boot/loader/entries/boot.conf" \ % cr_workdir) cfg = open("%s/hdd/boot/loader/entries/boot.conf" % cr_workdir, "w") cfg.write(boot_conf) cfg.close()
def do_configure_partition(self, part, source_params, cr, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, native_sysroot): """ Called before do_prepare_partition(), creates syslinux config """ hdddir = "%s/hdd/boot" % cr_workdir rm_cmd = "rm -rf " + cr_workdir exec_cmd(rm_cmd) install_cmd = "install -d %s" % hdddir exec_cmd(install_cmd) splash = os.path.join(cr_workdir, "/hdd/boot/splash.jpg") if os.path.exists(splash): splashline = "menu background splash.jpg" else: splashline = "" (rootdev, root_part_uuid) = cr._get_boot_config() options = cr.ks.handler.bootloader.appendLine syslinux_conf = "" syslinux_conf += "PROMPT 0\n" timeout = kickstart.get_timeout(cr.ks) if not timeout: timeout = 0 syslinux_conf += "TIMEOUT " + str(timeout) + "\n" syslinux_conf += "\n" syslinux_conf += "ALLOWOPTIONS 1\n" syslinux_conf += "SERIAL 0 115200\n" syslinux_conf += "\n" if splashline: syslinux_conf += "%s\n" % splashline syslinux_conf += "DEFAULT boot\n" syslinux_conf += "LABEL boot\n" kernel = "/vmlinuz" syslinux_conf += "KERNEL " + kernel + "\n" if cr._ptable_format == 'msdos': rootstr = rootdev else: raise ImageError("Unsupported partition table format found") syslinux_conf += "APPEND label=boot root=%s %s\n" % (rootstr, options) msger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg" \ % cr_workdir) cfg = open("%s/hdd/boot/syslinux.cfg" % cr_workdir, "w") cfg.write(syslinux_conf) cfg.close()
def do_configure_gummiboot(self, hdddir, cr, cr_workdir): """ Create loader-specific (gummiboot) config """ install_cmd = "install -d %s/loader" % hdddir exec_cmd(install_cmd) install_cmd = "install -d %s/loader/entries" % hdddir exec_cmd(install_cmd) (rootdev, root_part_uuid) = cr._get_boot_config() options = cr.ks.handler.bootloader.appendLine timeout = kickstart.get_timeout(cr.ks) if not timeout: timeout = 0 loader_conf = "" loader_conf += "default boot\n" loader_conf += "timeout %d\n" % timeout msger.debug("Writing gummiboot config %s/hdd/boot/loader/loader.conf" \ % cr_workdir) cfg = open("%s/hdd/boot/loader/loader.conf" % cr_workdir, "w") cfg.write(loader_conf) cfg.close() kernel = "/bzImage" if cr._ptable_format == 'msdos': rootstr = rootdev else: raise ImageError("Unsupported partition table format found") boot_conf = "" boot_conf += "title boot\n" boot_conf += "linux %s\n" % kernel boot_conf += "options LABEL=Boot root=%s %s\n" \ % (rootstr, options) msger.debug("Writing gummiboot config %s/hdd/boot/loader/entries/boot.conf" \ % cr_workdir) cfg = open("%s/hdd/boot/loader/entries/boot.conf" % cr_workdir, "w") cfg.write(boot_conf) cfg.close()
def do_configure_grubefi(cls, hdddir, creator, cr_workdir): """ Create loader-specific (grub-efi) config """ configfile = kickstart.get_bootloader_file(creator.ks) custom_cfg = None if configfile: custom_cfg = get_custom_config(configfile) if custom_cfg: # Use a custom configuration for grub grubefi_conf = custom_cfg msger.debug("Using custom configuration file " "%s for grub.cfg" % configfile) else: msger.error("configfile is specified but failed to " "get it from %s." % configfile) if not custom_cfg: # Create grub configuration using parameters from wks file options = creator.ks.handler.bootloader.appendLine grubefi_conf = "" grubefi_conf += "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n" grubefi_conf += "default=boot\n" timeout = kickstart.get_timeout(creator.ks) if not timeout: timeout = 0 grubefi_conf += "timeout=%s\n" % timeout grubefi_conf += "menuentry 'boot'{\n" kernel = "/bzImage" grubefi_conf += "linux %s root=%s rootwait %s\n" \ % (kernel, creator.rootdev, options) grubefi_conf += "}\n" msger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg" \ % cr_workdir) cfg = open("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, "w") cfg.write(grubefi_conf) cfg.close()
def do_configure_grubefi(self, hdddir, cr, cr_workdir): """ Create loader-specific (grub-efi) config """ splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg") if os.path.exists(splash): splashline = "menu background splash.jpg" else: splashline = "" (rootdev, root_part_uuid) = cr._get_boot_config() options = cr.ks.handler.bootloader.appendLine grubefi_conf = "" grubefi_conf += "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n" grubefi_conf += "default=boot\n" timeout = kickstart.get_timeout(cr.ks) if not timeout: timeout = 0 grubefi_conf += "timeout=%s\n" % timeout grubefi_conf += "menuentry 'boot'{\n" kernel = "/bzImage" if cr._ptable_format == 'msdos': rootstr = rootdev else: raise ImageError("Unsupported partition table format found") grubefi_conf += "linux %s root=%s rootwait %s\n" \ % (kernel, rootstr, options) grubefi_conf += "}\n" if splashline: syslinux_conf += "%s\n" % splashline msger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg" \ % cr_workdir) cfg = open("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, "w") cfg.write(grubefi_conf) cfg.close()
def do_configure_gummiboot(cls, hdddir, creator, cr_workdir): """ Create loader-specific (gummiboot) config """ install_cmd = "install -d %s/loader" % hdddir exec_cmd(install_cmd) install_cmd = "install -d %s/loader/entries" % hdddir exec_cmd(install_cmd) options = creator.ks.handler.bootloader.appendLine timeout = kickstart.get_timeout(creator.ks) if not timeout: timeout = 0 loader_conf = "" loader_conf += "default boot\n" loader_conf += "timeout %d\n" % timeout msger.debug("Writing gummiboot config %s/hdd/boot/loader/loader.conf" \ % cr_workdir) cfg = open("%s/hdd/boot/loader/loader.conf" % cr_workdir, "w") cfg.write(loader_conf) cfg.close() kernel = "/bzImage" boot_conf = "" boot_conf += "title boot\n" boot_conf += "linux %s\n" % kernel boot_conf += "options LABEL=Boot root=%s %s\n" % (creator.rootdev, options) msger.debug("Writing gummiboot config %s/hdd/boot/loader/entries/boot.conf" \ % cr_workdir) cfg = open("%s/hdd/boot/loader/entries/boot.conf" % cr_workdir, "w") cfg.write(boot_conf) cfg.close()
def do_configure_gummiboot(cls, hdddir, cr, cr_workdir): """ Create loader-specific (gummiboot) config """ install_cmd = "install -d %s/loader" % hdddir exec_cmd(install_cmd) install_cmd = "install -d %s/loader/entries" % hdddir exec_cmd(install_cmd) options = cr.ks.handler.bootloader.appendLine timeout = kickstart.get_timeout(cr.ks) if not timeout: timeout = 0 loader_conf = "" loader_conf += "default boot\n" loader_conf += "timeout %d\n" % timeout msger.debug("Writing gummiboot config %s/hdd/boot/loader/loader.conf" \ % cr_workdir) cfg = open("%s/hdd/boot/loader/loader.conf" % cr_workdir, "w") cfg.write(loader_conf) cfg.close() kernel = "/bzImage" boot_conf = "" boot_conf += "title boot\n" boot_conf += "linux %s\n" % kernel boot_conf += "options LABEL=Boot root=%s %s\n" % (cr.rootdev, options) msger.debug("Writing gummiboot config %s/hdd/boot/loader/entries/boot.conf" \ % cr_workdir) cfg = open("%s/hdd/boot/loader/entries/boot.conf" % cr_workdir, "w") cfg.write(boot_conf) cfg.close()
def do_configure_grubefi(cls, part, cr, cr_workdir): """ Create loader-specific (grub-efi) config """ splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg") if os.path.exists(splash): splashline = "menu background splash.jpg" else: splashline = "" options = cr.ks.handler.bootloader.appendLine grubefi_conf = "" grubefi_conf += "serial --unit=0 --speed=115200 --word=8 " grubefi_conf += "--parity=no --stop=1\n" grubefi_conf += "default=boot\n" timeout = kickstart.get_timeout(cr.ks, 10) grubefi_conf += "timeout=%s\n" % timeout grubefi_conf += "\n" grubefi_conf += "search --set=root --label %s " % part.label grubefi_conf += "\n" grubefi_conf += "menuentry 'boot'{\n" kernel = "/bzImage" grubefi_conf += "linux %s rootwait %s\n" \ % (kernel, options) grubefi_conf += "initrd /initrd \n" grubefi_conf += "}\n" if splashline: grubefi_conf += "%s\n" % splashline msger.debug("Writing grubefi config %s/EFI/BOOT/grub.cfg" \ % cr_workdir) with open("%s/EFI/BOOT/grub.cfg" % cr_workdir, "w") as cfg: cfg.write(grubefi_conf)
def do_configure_partition(cls, part, source_params, creator, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, native_sysroot): """ Called before do_prepare_partition(), creates syslinux config """ hdddir = "%s/hdd/boot" % cr_workdir rm_cmd = "rm -rf " + cr_workdir exec_cmd(rm_cmd) install_cmd = "install -d %s" % hdddir exec_cmd(install_cmd) configfile = kickstart.get_bootloader_file(creator.ks) custom_cfg = None if configfile: custom_cfg = get_custom_config(configfile) if custom_cfg: # Use a custom configuration for grub syslinux_conf = custom_cfg msger.debug("Using custom configuration file " "%s for syslinux.cfg" % configfile) else: msger.error("configfile is specified but failed to " "get it from %s." % configfile) if not custom_cfg: # Create syslinux configuration using parameters from wks file splash = os.path.join(cr_workdir, "/hdd/boot/splash.jpg") if os.path.exists(splash): splashline = "menu background splash.jpg" else: splashline = "" options = creator.ks.handler.bootloader.appendLine syslinux_conf = "" syslinux_conf += "PROMPT 0\n" timeout = kickstart.get_timeout(creator.ks) if not timeout: timeout = 0 syslinux_conf += "TIMEOUT " + str(timeout) + "\n" syslinux_conf += "\n" syslinux_conf += "ALLOWOPTIONS 1\n" syslinux_conf += "SERIAL 0 115200\n" syslinux_conf += "\n" if splashline: syslinux_conf += "%s\n" % splashline syslinux_conf += "DEFAULT boot\n" syslinux_conf += "LABEL boot\n" kernel = "/vmlinuz" syslinux_conf += "KERNEL " + kernel + "\n" syslinux_conf += "APPEND label=boot root=%s %s\n" % \ (creator.rootdev, options) msger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg" \ % cr_workdir) cfg = open("%s/hdd/boot/syslinux.cfg" % cr_workdir, "w") cfg.write(syslinux_conf) cfg.close()