diff --git a/imgcreate/live.py b/imgcreate/live.py index 9447640..961e65f 100644 --- a/imgcreate/live.py +++ b/imgcreate/live.py @@ -234,8 +234,7 @@ class LiveImageCreatorBase(LoopImageCreator): # XXX-BCL: does this need --label? subprocess.call(["mkefiboot", isodir + "/EFI/BOOT", isodir + "/isolinux/efiboot.img"]) - - def _create_bootconfig(self): + def _create_bootconfig(self): """Configure the image so that it's bootable.""" self._configure_bootloader(self.__ensure_isodir()) self._generate_efiboot(self.__ensure_isodir()) @@ -379,16 +378,13 @@ class x86LiveImageCreator(LiveImageCreatorBase): self._efiarch = None def _get_xorrisofs_options(self, isodir): - options = ["-eltorito-boot", "isolinux/isolinux.bin", - "-no-emul-boot", "-boot-info-table", "-boot-load-size", "4", - "-eltorito-catalog", "isolinux/boot.cat", - "-isohybrid-mbr", "/usr/share/syslinux/isohdpfx.bin"] - if os.path.exists(os.path.join(isodir, "isolinux/efiboot.img")): - options += ["-eltorito-alt-boot", "-e", "isolinux/efiboot.img", - "-no-emul-boot", "-isohybrid-gpt-basdat"] - if os.path.exists(os.path.join(isodir, "isolinux/macboot.img")): - options += ["-eltorito-alt-boot", "-e", "isolinux/macboot.img", - "-no-emul-boot", "-isohybrid-gpt-hfsplus"] + options = [ '-no-emul-boot', '-boot-load-size', '4', '-hide', + 'boot.catalog', '-boot-info-table', '-b', 'eltorito.img', + '--grub2-mbr', '/usr/lib/grub/i386-pc/boot_hybrid.img', + '--grub2-boot-info', isodir + '/eltorito.img', + '-append_partition', '2', '0xef', './efi.img', + '-eltorito-alt-boot', '--efi-boot', 'EFI/BOOT/BOOTx64.EFI' ] + options += ["-rational-rock", "-joliet", "-volid", self.fslabel] return options @@ -398,61 +394,94 @@ class x86LiveImageCreator(LiveImageCreatorBase): def _get_isolinux_stanzas(self, isodir): return "" - def __find_syslinux_menu(self): - for menu in ("vesamenu.c32", "menu.c32"): - for dir in ("/usr/lib/syslinux/", "/usr/share/syslinux/"): - if os.path.isfile(self._instroot + dir + menu): - return menu - - raise CreatorError("syslinux not installed : " - "no suitable *menu.c32 found") - - def __find_syslinux_mboot(self): - # - # We only need the mboot module if we have any xen hypervisors - # - if not glob.glob(self._instroot + "/boot/xen.gz*"): - return None - - return "mboot.c32" - - def __copy_syslinux_files(self, isodir, menu, mboot = None): - files = ["isolinux.bin", "ldlinux.c32", "libcom32.c32", "libutil.c32", menu] - if mboot: - files += [mboot] - - for f in files: - if os.path.exists(self._instroot + "/usr/lib/syslinux/" + f): - path = self._instroot + "/usr/lib/syslinux/" + f - elif os.path.exists(self._instroot + "/usr/share/syslinux/" + f): - path = self._instroot + "/usr/share/syslinux/" + f - if not os.path.isfile(path): - raise CreatorError("syslinux not installed : " - "%s not found" % path) - - shutil.copy(path, isodir + "/isolinux/") - - def __copy_syslinux_background(self, isodest): - background_path = self._instroot + \ - "/usr/share/anaconda/boot/syslinux-vesa-splash.jpg" - - if not os.path.exists(background_path): - # fallback to F13 location - background_path = self._instroot + \ - "/usr/lib/anaconda-runtime/syslinux-vesa-splash.jpg" - - if not os.path.exists(background_path): - return False - - shutil.copyfile(background_path, isodest) - - return True - - def __copy_kernel_and_initramfs(self, isodir, version, index): - bootdir = self._instroot + "/boot" - + def _generate_grub2_bootimg(self, isodir): + """generate grub2 boot images""" + + def __locales_cfg(self, isodir): + locales_str = self.__set_locales(isodir) + cfg = """insmod regexp +firstTime=no +export firstTime +for langstr in "en_US=English" %s ; do + regexp -s 2:langname -s 1:langcode '(.*)=(.*)' "$langstr" + menuentry "${langname}" "$langcode" { + lang=$2 + lang_utf="${2}.UTF-8" + export lang + export lang_utf + configfile ${prefix}/grub.cfg +} +done + +""" % locales_str + with open(isodir + '/EFI/BOOT/lang.cfg', 'w') as f: + print(cfg, file=f) + + def __grub_boot_img(self, bootis): + modlist=['part_msdos', 'part_gpt', 'regexp', 'gettext', + 'linux', 'loopback', 'normal', 'configfile', 'test', + 'search', 'search_fs_uuid', 'search_fs_file', 'true', + 'iso9660', 'search_label', 'gfxterm', 'gfxmenu', + 'fat', 'ext2', 'ntfs', 'cat', 'echo', 'ls', 'png', + 'reboot' ] + + with open('./grub.cfg', 'w') as f: + print('search.file /EFI/BOOT/grub.cfg root', file=f) + print('prefix=($root)/EFI/BOOT', file=f) + if bootis == 'efi': + print('bootis=UEFI:', file=f) + else: + print('bootis=""', file=f) + print('lang=ru_RU', file=f) + print('export lang', file=f) + print('export root', file=f) + print('export prefix', file=f) + print('export bootis', file=f) + print('configfile /EFI/BOOT/grub.cfg', file=f) + + if bootis == 'efi': + print('==> generating grub2 image for efi boot') + cmdlist=['grub2-mkimage', '-p', '/grub2', '-c', './grub.cfg', + '-O', 'x86_64-efi' ,'-o', isodir + '/EFI/BOOT/grubx64.efi', + '--compression=xz'] + cmdlist.extend(['efi_gop', 'efi_uga', 'efifwsetup' ]) + cmdlist.extend(modlist) + else: + print('==> generating grub2 image eltorito') + cmdlist=['grub2-mkimage', '-p', '/grub2', '-c', './grub.cfg', + '-O', 'i386-pc-eltorito', '-o', isodir + '/eltorito.img', + '--compression=xz'] + cmdlist.extend(['biosdisk', 'vbe']) + cmdlist.extend(modlist) + ecode = subprocess.call(cmdlist) + if ecode != 0: + print(f'Generating grub2 image for {bootis} - Failed') + + #os.mkdir(isodir + '/grub2/') + os.makedirs(isodir + '/EFI/BOOT/', exist_ok=True) + __grub_boot_img(self, 'bios') + __grub_boot_img(self, 'efi') + __locales_cfg(self, isodir) + os.mkdir('img_mount_point') + + open('efi.img', "w").truncate(1000 * 5000) + # zero is a 'False' for python + if not subprocess.call(['mkfs.vfat', 'efi.img']): + if not subprocess.call(['mount', '-o', 'loop', 'efi.img', 'img_mount_point']): + os.makedirs('img_mount_point/EFI/BOOT') + shim = "BOOT%s.EFI" % (self.efiarch,) + shutil.copyfile(isodir + '/EFI/BOOT/grubx64.efi', 'img_mount_point/EFI/BOOT/grubx64.efi') + shutil.copyfile(isodir + '/EFI/BOOT/' + shim, 'img_mount_point/EFI/BOOT/' + shim ) + else: + print('Error. Can not mount image') + subprocess.call(['umount', 'img_mount_point']) + else: + print('Error. Can not format image') + + + def __copy_kernel_and_initramfs(self, isodir, version, index, bootdir): shutil.copyfile(bootdir + "/vmlinuz-" + version, - isodir + "/isolinux/vmlinuz" + index) + isodir + "/vmlinuz" + index) isDracut = False if os.path.exists(self._instroot + "/usr/bin/dracut"): @@ -461,17 +490,17 @@ class x86LiveImageCreator(LiveImageCreatorBase): # FIXME: Implement a better check for how the initramfs is named... if os.path.exists(bootdir + "/initramfs-" + version + ".img"): shutil.copyfile(bootdir + "/initramfs-" + version + ".img", - isodir + "/isolinux/initrd" + index + ".img") + isodir + "/initrd" + index + ".img") elif os.path.exists(bootdir + "/initrd-" + version + ".img"): shutil.copyfile(bootdir + "/initrd-" + version + ".img", - isodir + "/isolinux/initrd" + index + ".img") + isodir + "/initrd" + index + ".img") elif not self.base_on: logging.error("No initramfs or initrd found for %s" % (version,)) is_xen = False if os.path.exists(bootdir + "/xen.gz-" + version[:-3]): shutil.copyfile(bootdir + "/xen.gz-" + version[:-3], - isodir + "/isolinux/xen" + index + ".gz") + isodir + "/xen" + index + ".gz") is_xen = True return (is_xen, isDracut) @@ -488,209 +517,28 @@ class x86LiveImageCreator(LiveImageCreatorBase): return False - def __get_basic_syslinux_config(self, **args): - return """ -default %(menu)s -timeout %(timeout)d -menu background %(background)s -menu autoboot Starting %(title)s in # second{,s}. Press any key to interrupt. - -menu clear -menu title %(title)s -menu vshift 8 -menu rows 18 -menu margin 8 -#menu hidden -menu helpmsgrow 15 -menu tabmsgrow 13 - -menu color border * #00000000 #00000000 none -menu color sel 0 #ffffffff #00000000 none -menu color title 0 #ff7ba3d0 #00000000 none -menu color tabmsg 0 #ff3a6496 #00000000 none -menu color unsel 0 #84b8ffff #00000000 none -menu color hotsel 0 #84b8ffff #00000000 none -menu color hotkey 0 #ffffffff #00000000 none -menu color help 0 #ffffffff #00000000 none -menu color scrollbar 0 #ffffffff #ff355594 none -menu color timeout 0 #ffffffff #00000000 none -menu color timeout_msg 0 #ffffffff #00000000 none -menu color cmdmark 0 #84b8ffff #00000000 none -menu color cmdline 0 #ffffffff #00000000 none - -menu tabmsg Press Tab for full configuration options on menu items. -menu separator -""" % args - - def __get_image_stanza(self, is_xen, isDracut, **args): - if isDracut: - args["rootlabel"] = "live:CDLABEL=%(fslabel)s" % args - else: - args["rootlabel"] = "CDLABEL=%(fslabel)s" % args - - if not is_xen: - template = """label %(short)s - menu label %(long)s - kernel vmlinuz%(index)s - append initrd=initrd%(index)s.img root=%(rootlabel)s rootfstype=%(isofstype)s %(liveargs)s %(extra)s -""" - else: - template = """label %(short)s - menu label %(long)s - kernel mboot.c32 - append xen%(index)s.gz --- vmlinuz%(index)s root=%(rootlabel)s rootfstype=%(isofstype)s %(liveargs)s %(extra)s --- initrd%(index)s.img -""" - if args.get("help"): - template += """ text help - %(help)s - endtext -""" - return template % args - def __get_image_stanzas(self, isodir): + def __get_kernel_initrd(self, isodir): + bootdir = self._instroot + "/boot" kernels = self._get_kernel_versions() kernel_options = self._get_kernel_options() checkisomd5 = self._has_checkisomd5() - - # Stanzas for insertion into the config template - linux = [] - basic = [] - check = [] - - index = "0" + index="0" for kernel, version in ((k,v) for k in kernels for v in kernels[k]): - (is_xen, isDracut) = self.__copy_kernel_and_initramfs(isodir, version, index) - if index == "0": - self._isDracut = isDracut - - default = self.__is_default_kernel(kernel, kernels) - - if default: - long = self.product - elif kernel.startswith(b"kernel-"): - long = "%s (%s)" % (self.product, kernel[7:]) - else: - long = "%s (%s)" % (self.product, kernel) - - # tell dracut not to ask for LUKS passwords or activate mdraid sets - if isDracut: - kern_opts = kernel_options + " rd.luks=0 rd.md=0 rd.dm=0" - else: - kern_opts = kernel_options - - linux.append(self.__get_image_stanza(is_xen, isDracut, - fslabel = self.fslabel, - isofstype = "auto", - liveargs = kern_opts, - long = "^Start " + long, - short = "linux" + index, - extra = "", - help = "", - index = index)) - - if default: - linux[-1] += " menu default\n" - - basic.append(self.__get_image_stanza(is_xen, isDracut, - fslabel = self.fslabel, - isofstype = "auto", - liveargs = kern_opts, - long = "Start " + long + " in ^basic graphics mode.", - short = "basic" + index, - extra = "nomodeset", - help = "Try this option out if you're having trouble starting.", - index = index)) - - if checkisomd5: - check.append(self.__get_image_stanza(is_xen, isDracut, - fslabel = self.fslabel, - isofstype = "auto", - liveargs = kern_opts, - long = "^Test this media & start " + long, - short = "check" + index, - extra = "rd.live.check", - help = "", - index = index)) - else: - check.append(None) - + (is_xen, isDracut) = self.__copy_kernel_and_initramfs(isodir, version, index, bootdir) index = str(int(index) + 1) + if os.path.exists(bootdir + "/pcmemtest"): + shutil.copyfile(bootdir + "/pcmemtest", + isodir + "/pcmemtest") + else: + print('pcmemtest not found') - return (linux, basic, check) - - def __get_memtest_stanza(self, isodir): - memtest = glob.glob(self._instroot + "/boot/memtest86*") - if not memtest: - return "" - - shutil.copyfile(memtest[0], isodir + "/isolinux/memtest") - - return """label memtest - menu label Run a ^memory test. - text help - If your system is having issues, an problem with your - system's memory may be the cause. Use this utility to - see if the memory is working correctly. - endtext - kernel memtest -""" def __get_local_stanza(self, isodir): return """label local menu label Boot from ^local drive localboot 0xffff """ - - def _configure_syslinux_bootloader(self, isodir): - """configure the boot loader""" - makedirs(isodir + "/isolinux") - - menu = self.__find_syslinux_menu() - - self.__copy_syslinux_files(isodir, menu, - self.__find_syslinux_mboot()) - - background = "" - if self.__copy_syslinux_background(isodir + "/isolinux/splash.jpg"): - background = "splash.jpg" - - cfg = self.__get_basic_syslinux_config(menu = menu, - background = background, - title = self.title, - timeout = self._timeout * 10) - cfg += "menu separator\n" - - linux, basic, check = self.__get_image_stanzas(isodir) - # Add linux stanzas to main menu - for s in linux: - cfg += s - cfg += "menu separator\n" - - cfg += """menu begin ^Troubleshooting - menu title Troubleshooting -""" - # Add basic video and check to submenu - for b, c in zip(basic, check): - cfg += b - if c: - cfg += c - - cfg += self.__get_memtest_stanza(isodir) - cfg += "menu separator\n" - - cfg += self.__get_local_stanza(isodir) - cfg += self._get_isolinux_stanzas(isodir) - - cfg += """menu separator -label returntomain - menu label Return to ^main menu. - menu exit -menu end -""" - cfgf = open(isodir + "/isolinux/isolinux.cfg", "w") - cfgf.write(cfg) - cfgf.close() - @property def efiarch(self): if not self._efiarch: @@ -716,13 +564,16 @@ menu end files = [("/boot/efi/EFI/*/shim%s.efi" % (self.efiarch.lower(),), "/EFI/BOOT/BOOT%s.EFI" % (self.efiarch,), True), # XXX grubcd.efi probably should contain EFI arch in its name to make 32 bit EFI possible on x86_64 (?) # Or will 32 bit shim be able to load 64 bit grub? - ("/usr/share/grub2-efi/grubcd.efi", "/EFI/BOOT/grub%s.efi" % (self.efiarch.lower(),), True), + # efi bootloader is generated now + #("/usr/share/grub2-efi/grubcd.efi", "/EFI/BOOT/grub%s.efi" % (self.efiarch.lower(),), True), ("/boot/efi/EFI/*/shimia32.efi", "/EFI/BOOT/BOOTIA32.EFI", False), # XXX gcdia32.efi does not exist yet in ROSA ("/boot/efi/EFI/*/gcdia32.efi", "/EFI/BOOT/grubia32.efi", False), ("/boot/grub2/fonts/unicode.pf2", "/EFI/BOOT/fonts/", True), + ("/boot/grub2/themes/rosa/*", "/EFI/BOOT/themes/rosa/", True), ] makedirs(isodir+"/EFI/BOOT/fonts/") + makedirs(isodir+"/EFI/BOOT/themes/rosa/") for src, dest, required in files: src_glob = glob.glob(self._instroot+src) if not src_glob: @@ -736,28 +587,73 @@ menu end def __get_basic_efi_config(self, **args): return """ -set default="1" +set default="0" function load_video { insmod efi_gop insmod efi_uga - insmod video_bochs - insmod video_cirrus - insmod all_video } load_video set gfxpayload=keep insmod gzio insmod part_gpt +insmod part_msdos insmod ext2 - +insmod iso9660 + +set gfxmode=1024x768,1024x600,800x600,640x480 +insmod gfxterm + +set localedir ${prefix}/locale +insmod gettext + +set OS=$"ROSA linux" +set start=$"Start" +set startInstall=$"Start & install" +set basicMode=$"in basic graphics mode" +set consoleMode=$"in console mode" +set rebootToEfi=$"Reboot to EFI firmware setup" +set reboot=$"Reboot" +set testMedia=$"Test this media & start" +set installer=$"Install" +set troubleshooting=$"Troubleshooting" +set backToMain=$"Back to main menu" +set loading=$"Loading" +set backToLang=$"Back to lang menu" +set pcmemtest=$"Checking RAM" + +export OS +export start +export startInstall +export basicMode +export consoleMode +export rebootToEfi +export reboot +export testMedia +export installer +export additional +export backToMain +export loading +export backToLang +export pcmemtest + +terminal_output gfxterm +insmod gfxmenu +loadfont /EFI/BOOT/themes/rosa/dejavu_sans_bold_14.pf2 +loadfont /EFI/BOOT/themes/rosa/dejavu_sans_mono_11.pf2 +loadfont /EFI/BOOT/themes/rosa/terminal_font_11.pf2 +insmod png +set theme=/EFI/BOOT/themes/rosa/theme.txt +export theme +background_image -m stretch /EFI/BOOT/themes/rosa/terminal_background.png +if test $firstTime != no ; then + configfile ${prefix}/lang.cfg +fi set timeout=%(timeout)d -### END /etc/grub.d/00_header ### search --no-floppy --set=root -l '%(isolabel)s' -### BEGIN /etc/grub.d/10_linux ### """ %args def __get_efi_image_stanza(self, **args): @@ -765,11 +661,58 @@ search --no-floppy --set=root -l '%(isolabel)s' args["rootlabel"] = "live:LABEL=%(fslabel)s" % args else: args["rootlabel"] = "CDLABEL=%(fslabel)s" % args - return """menuentry '%(long)s' --class fedora --class gnu-linux --class gnu --class os { - linuxefi /isolinux/vmlinuz%(index)s root=%(rootlabel)s %(liveargs)s %(extra)s - initrdefi /isolinux/initrd%(index)s.img + return """menuentry "%(long)s" --class rosa --class gnu-linux --class gnu --class os { + linux /vmlinuz%(index)s root=%(rootlabel)s %(liveargs)s %(extra)s \ + lang=$lang inst.lang=$lang_utf locale.LANG=$lang_utf locale.LANGUAGE=$lang_utf systemd.setenv=LC_ALL=$lang_utf + echo "$loading /vmlinuz%(index)s..." + initrd /initrd%(index)s.img + echo "$loading /initrd%(index)s.img..." } """ %args + def __set_locales(self, isodir): + os.mkdir(isodir + '/EFI/BOOT/locale') + if os.path.exists('/usr/share/livecd-tools/grub2/locales'): + for po in os.listdir('/usr/share/livecd-tools/grub2/locales'): + print('Processing: ' + po) + if po.endswith('.po'): + lng = po.split( '_' )[0] + mo = '/usr/share/locale/' + lng + '/LC_MESSAGES/grub.mo' + if os.path.exists(mo): + subprocess.call( [ 'msgunfmt', mo, '-o', lng + '.po' ]) + if subprocess.call( [ 'msgcat', lng + '.po', + '/usr/share/livecd-tools/grub2/locales/' + po, + '-o', isodir + "/EFI/BOOT/locale/" + po ] ): + print(f"Msgcat for {po} & {lng}.po file - Failed") + else: + shutil.copy('/usr/share/livecd-tools/grub2/locales/' + po, + isodir + "/EFI/BOOT/locale/" + po) + else: + shutil.copy('/usr/share/livecd-tools/grub2/locales/' + po, + isodir + "/EFI/BOOT/locale/" + po) + for po in os.listdir(isodir + '/EFI/BOOT/locale'): + if po.endswith('.po'): + # zero is a 'False' for python + if not subprocess.call(['msgfmt', isodir + + '/EFI/BOOT/locale/' + po, '-o', + isodir + '/EFI/BOOT/locale/' + + po.replace('.po', '.mo') ]): + os.remove(isodir + '/EFI/BOOT/locale/' + po) + else: + print(f"Msgfmt for {po} file - Failed") + avaliable_locales = list(map(lambda locale: locale.split('.')[0], + os.listdir(isodir + '/EFI/BOOT/locale'))) + known_locales = [ "ru_RU=Русский", "it_IT=italiano", + "de_DE=Deutsch ", "fr_FR=Français", + "pt_PT=Português", "es_ES=Español" ] + locales_str = '' + for l in known_locales: + for a in avaliable_locales: + if l.startswith(a): + locales_str += l + ' ' + print('found locales: ' + locales_str) + return locales_str + else: + return False def __get_efi_image_stanzas(self, isodir, name): # FIXME: this only supports one kernel right now... @@ -783,32 +726,71 @@ search --no-floppy --set=root -l '%(isolabel)s' # we don't support xen kernels if os.path.exists("%s/EFI/BOOT/xen%d.gz" %(isodir, index)): continue + cfg += self.__get_efi_image_stanza(fslabel = self.fslabel, liveargs = kernel_options, - long = "Start " + self.product, - extra = "", index = index) + long = "$startInstall $bootis $OS", + extra = "rhgb splash=silent logo.nologo", index = index) + + cfg += self.__get_efi_image_stanza(fslabel = self.fslabel, + liveargs = kernel_options, + long = "$installer $bootis $OS", + extra = "systemd.unit=anaconda.target ", index = index) + + cfg += r"""submenu "${troubleshooting}..." --id additional { +""" + if checkisomd5: cfg += self.__get_efi_image_stanza(fslabel = self.fslabel, liveargs = kernel_options, - long = "Test this media & start " + self.product, + long = "$testMedia " + self.product, extra = "rd.live.check", - index = index) - cfg += """ -submenu 'Troubleshooting -->' { -""" + index = index) + cfg += self.__get_efi_image_stanza(fslabel = self.fslabel, liveargs = kernel_options, - long = "Start " + self.product + " in basic graphics mode", - extra = "nomodeset", index = index) + long = "$start " + self.product + " $basicMode", + extra = "nomodeset plymouth.enable=0 noapic acpi=off loglevel=5 vga=788", index = index) + + cfg += self.__get_efi_image_stanza(fslabel = self.fslabel, + liveargs = kernel_options, + long = "$installer " + self.product + " $consoleMode", + extra = "systemd.unit=anaconda.target inst.text", index = index) + if os.path.exists(isodir + '/pcmemtest'): + cfg += """menuentry "$pcmemtest" { + echo "$loading ${pcmemtest}..." + set gfxpayload=640x400,800x600,1024x768 + linux /pcmemtest +} +""" + + cfg += """if test "$bootis" == 'UEFI:' ; then +menuentry "$rebootToEfi" { + fwsetup +} +fi - cfg+= """} +menuentry "$backToMain" { + configfile ${prefix}/grub.cfg +} + +} """ - break + cfg += """menuentry "$backToLang" --hotkey 'f2' --id 'lang' { + configfile ${prefix}/lang.cfg +} +""" + cfg += """menuentry "$reboot" { + reboot +} +""" + break return cfg def _configure_efi_bootloader(self, isodir): """Set up the configuration for an EFI bootloader""" + self.__get_kernel_initrd(isodir) if self.__copy_efi_files(isodir): shutil.rmtree(isodir + "/EFI") logging.warning("Failed to copy EFI files, no EFI Support will be included.") @@ -828,17 +810,13 @@ submenu 'Troubleshooting -->' { isodir + "/EFI/BOOT/BOOT.EFI") def _generate_efiboot(self, isodir): - LiveImageCreatorBase._generate_efiboot(self, isodir) - # add macboot data - subprocess.call(["mkefiboot", "-a", isodir + "/EFI/BOOT", - isodir + "/isolinux/macboot.img", "-l", self.product, - "-n", "/usr/share/pixmaps/bootloader/fedora-media.vol", - "-i", "/usr/share/pixmaps/bootloader/fedora.icns", - "-p", self.product]) + return True def _configure_bootloader(self, isodir): - self._configure_syslinux_bootloader(isodir) + #self._configure_syslinux_bootloader(isodir) self._configure_efi_bootloader(isodir) + self._generate_grub2_bootimg(isodir) + class ppcLiveImageCreator(LiveImageCreatorBase): def _get_xorrisofs_options(self, isodir): @@ -962,15 +940,15 @@ timeout=%(timeout)d default=linux image=/ppc/ppc64/vmlinuz - label=linux64 - alias=linux - initrd=/ppc/ppc64/initrd.img - read-only + label=linux64 + alias=linux + initrd=/ppc/ppc64/initrd.img + read-only image=/ppc/ppc32/vmlinuz - label=linux32 - initrd=/ppc/ppc32/initrd.img - read-only + label=linux32 + initrd=/ppc/ppc32/initrd.img + read-only """ % args f = open(isodir + "/etc/yaboot.conf", "w") @@ -1103,8 +1081,10 @@ class aarch64LiveImageCreator(LiveImageCreatorBase): files = [("/boot/efi/EFI/*/shim%s.efi" % (self.efiarch.lower(),), "/EFI/BOOT/BOOT%s.EFI" % (self.efiarch,), True), ("/usr/share/grub2-efi/grubcd.efi", "/EFI/BOOT/grub%s.efi" % (self.efiarch.lower(),), True), ("/boot/grub2/fonts/unicode.pf2", "/EFI/BOOT/fonts/", True), + ("/boot/grub2/themes/rosa/*", "/EFI/BOOT/themes/rosa/", True), ] makedirs(isodir+"/EFI/BOOT/fonts/") + makedirs(isodir+"/EFI/BOOT/themes/rosa/") for src, dest, required in files: src_glob = glob.glob(self._instroot+src) if not src_glob: @@ -1117,36 +1097,47 @@ class aarch64LiveImageCreator(LiveImageCreatorBase): return fail def __get_basic_efi_config(self, **args): + # code is uselessly (?) duplicated, https://github.com/livecd-tools/livecd-tools/issues/195 return """ -set default="1" +set default="0" function load_video { insmod efi_gop insmod efi_uga - insmod video_bochs - insmod video_cirrus - insmod all_video } load_video set gfxpayload=keep insmod gzio insmod part_gpt +insmod part_msdos insmod ext2 +insmod iso9660 + +set gfxmode=1024x768,1024x600,800x600,640x480 +insmod gfxterm +insmod gettext +terminal_output gfxterm +insmod gfxmenu +loadfont /EFI/BOOT/themes/rosa/dejavu_sans_bold_14.pf2 +loadfont /EFI/BOOT/themes/rosa/dejavu_sans_mono_11.pf2 +loadfont /EFI/BOOT/themes/rosa/terminal_font_11.pf2 +insmod png +set theme=/EFI/BOOT/themes/rosa/theme.txt +export theme +background_image -m stretch /EFI/BOOT/themes/rosa/terminal_background.png set timeout=%(timeout)d -### END /etc/grub.d/00_header ### search --no-floppy --set=root -l '%(isolabel)s' -### BEGIN /etc/grub.d/10_linux ### """ %args def __get_efi_image_stanza(self, **args): args["rootlabel"] = "live:LABEL=%(fslabel)s" % args return """menuentry '%(long)s' --class fedora --class gnu-linux --class gnu --class os { - linux /LiveOS/vmlinuz%(index)s root=%(rootlabel)s %(liveargs)s %(extra)s - initrd /LiveOS/initrd%(index)s.img + linux /LiveOS/vmlinuz%(index)s root=%(rootlabel)s %(liveargs)s %(extra)s + initrd /LiveOS/initrd%(index)s.img } """ %args @@ -1164,22 +1155,20 @@ search --no-floppy --set=root -l '%(isolabel)s' cfg += self.__get_efi_image_stanza(fslabel = self.fslabel, liveargs = kernel_options, long = "Start " + self.product, - extra = "", index = index) + extra = "rhgb splash=silent logo.nologo", index = index) + cfg += self.__get_efi_image_stanza(fslabel = self.fslabel, + liveargs = kernel_options, + long = "Start " + self.product + " in basic graphics mode", + extra = "nomodeset plymouth.enable=0", index = index) if checkisomd5: cfg += self.__get_efi_image_stanza(fslabel = self.fslabel, liveargs = kernel_options, long = "Test this media & start " + self.product, extra = "rd.live.check", index = index) - cfg += """ -submenu 'Troubleshooting -->' { -""" - cfg += self.__get_efi_image_stanza(fslabel = self.fslabel, - liveargs = kernel_options, - long = "Start " + self.product + " in basic graphics mode", - extra = "nomodeset", index = index) - - cfg+= """} + cfg += """menuentry 'Boot from local drive' { + reboot +} """ break