mirror of
https://abf.rosa.ru/djam/livecd-tools.git
synced 2025-02-23 15:42:58 +00:00
Add aarch64 implementation
This commit is contained in:
parent
7406411194
commit
4457940a06
2 changed files with 250 additions and 1 deletions
248
0012-aarch64-implementation.patch
Normal file
248
0012-aarch64-implementation.patch
Normal file
|
@ -0,0 +1,248 @@
|
|||
diff -ur livecd-tools-27.1/imgcreate/live.py livecd-tools-27.1_patched/imgcreate/live.py
|
||||
--- livecd-tools-27.1/imgcreate/live.py 2019-04-19 18:05:15.000000000 +0300
|
||||
+++ livecd-tools-27.1_patched/imgcreate/live.py 2020-11-11 09:27:12.838307372 +0300
|
||||
@@ -1033,6 +1033,235 @@
|
||||
return ["kernel.ppc"] + \
|
||||
ppcLiveImageCreator._get_excluded_packages(self)
|
||||
|
||||
+class armLiveImageCreator(LiveImageCreatorBase):
|
||||
+ """ImageCreator for arm machines"""
|
||||
+ def __init__(self, *args, **kwargs):
|
||||
+ LiveImageCreatorBase.__init__(self, *args, **kwargs)
|
||||
+ self._efiarch = None
|
||||
+
|
||||
+ def _get_xorrisofs_options(self, isodir):
|
||||
+ options = [ "-no-emul-boot", "-graft-points",
|
||||
+ "-allow-lowercase"]
|
||||
+ options.extend([ "-eltorito-alt-boot",
|
||||
+ "-e", "EFI/BOOT/efiboot.img",
|
||||
+ "-no-emul-boot",
|
||||
+ "-J", "-D", "-R"])
|
||||
+ return options
|
||||
+
|
||||
+ def _get_required_packages(self):
|
||||
+ return ["dracut"] \
|
||||
+ + LiveImageCreatorBase._get_required_packages(self)
|
||||
+
|
||||
+ def _make_initramfs(self, version):
|
||||
+ bootdir = self._instroot + "/boot"
|
||||
+ subprocess.call(["dracut",
|
||||
+ "--gzip",
|
||||
+ "-o", "ifcfg",
|
||||
+ "-o", "lvm",
|
||||
+ "-o", "mdraid",
|
||||
+ "-o", "aufs-mount",
|
||||
+ "-o", "network",
|
||||
+ "-o", "cifs",
|
||||
+ "-o", "dm",
|
||||
+ "-o", "crypt",
|
||||
+ "-o", "dmraid",
|
||||
+ "-o", "multipath",
|
||||
+ "-o", "multipath-hostonly",
|
||||
+ "--fstab",
|
||||
+ "--add-fstab", self._instroot + "/etc/fstab",
|
||||
+ "--kmoddir", self._instroot + "/lib/modules/" + version,
|
||||
+ "--kernel-image", bootdir + "/vmlinuz-" + version,
|
||||
+ "-f", bootdir + "/initrd-" + version + ".img",
|
||||
+ version])
|
||||
+
|
||||
+ def __copy_kernel_and_initramfs(self, isodir, version, index):
|
||||
+ self._make_initramfs(version)
|
||||
+ bootdir = self._instroot + "/boot"
|
||||
+ makedirs(isodir+"/LiveOS/")
|
||||
+ shutil.copyfile(bootdir + "/vmlinuz-" + version,
|
||||
+ isodir + "/LiveOS/vmlinuz" + index)
|
||||
+ shutil.copyfile(bootdir + "/initrd-" + version + ".img",
|
||||
+ isodir + "/LiveOS/initrd" + index + ".img")
|
||||
+
|
||||
+ def __is_default_kernel(self, kernel, kernels):
|
||||
+ if len(kernels) == 1:
|
||||
+ return True
|
||||
+
|
||||
+ if kernel == self._default_kernel:
|
||||
+ return True
|
||||
+
|
||||
+ if kernel.startswith(b"kernel-") and kernel[7:] == self._default_kernel:
|
||||
+ return True
|
||||
+
|
||||
+ return False
|
||||
+
|
||||
+ @property
|
||||
+ def efiarch(self):
|
||||
+ if not self._efiarch:
|
||||
+ # for most things, we want them named boot$efiarch
|
||||
+ efiarch = {"arm": "AA32", "aarch64": "AA64"}
|
||||
+ self._efiarch = efiarch[dnf.rpm.basearch(hawkey.detect_arch())]
|
||||
+ return self._efiarch
|
||||
+
|
||||
+ def __copy_efi_files(self, isodir):
|
||||
+ """ Copy the efi files into /EFI/BOOT/
|
||||
+ If any of them are missing, return False.
|
||||
+ requires:
|
||||
+ grubcd.efi
|
||||
+ /boot/grub2/themes/*
|
||||
+ """
|
||||
+ fail = False
|
||||
+ # Grub2 signed not available on aarch64:
|
||||
+ makedirs("/boot/del/")
|
||||
+ if os.path.exists("/usr/share/grub2-efi/grubcd.efi"):
|
||||
+ shutil.copyfile("/usr/share/grub2-efi/grubcd.efi",
|
||||
+ "/boot/del/BOOTAA64.EFI")
|
||||
+ makedirs(isodir+"/EFI/BOOT/fonts/")
|
||||
+ makedirs(isodir+"/EFI/BOOT/themes/rosa/")
|
||||
+ files = [("/boot/grub2/themes/rosa/*", "/EFI/BOOT/themes/rosa/", True),
|
||||
+ ("/boot/grub2/fonts/unicode.pf2", "/EFI/BOOT/fonts/", True),
|
||||
+ ]
|
||||
+
|
||||
+ for src, dest, required in files:
|
||||
+ src_glob = glob.glob(self._instroot+src)
|
||||
+ if not src_glob:
|
||||
+ if required:
|
||||
+ logging.error("Missing EFI file (%s)" % (src,))
|
||||
+ fail = True
|
||||
+ else:
|
||||
+ for src_file in src_glob:
|
||||
+ shutil.copy(src_file, isodir+dest)
|
||||
+ return fail
|
||||
+
|
||||
+ def __get_basic_efi_config(self, **args):
|
||||
+ return """
|
||||
+set default="0"
|
||||
+
|
||||
+function load_video {
|
||||
+ if [ x$feature_all_video_module = xy ]; then
|
||||
+ insmod all_video
|
||||
+ else
|
||||
+ insmod efi_gop
|
||||
+ insmod efi_uga
|
||||
+ insmod ieee1275_fb
|
||||
+ insmod vbe
|
||||
+ insmod vga
|
||||
+ insmod video_bochs
|
||||
+ insmod video_cirrus
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+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
|
||||
+
|
||||
+search --no-floppy --set=root -l '%(isolabel)s'
|
||||
+
|
||||
+""" %args
|
||||
+
|
||||
+ def __get_efi_image_stanza(self, **args):
|
||||
+ args["rootlabel"] = "live:LABEL=%(fslabel)s" % args
|
||||
+ return """menuentry '%(long)s' --class rosa --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
|
||||
+}
|
||||
+""" %args
|
||||
+
|
||||
+ def __get_efi_image_stanzas(self, isodir, name):
|
||||
+ # FIXME: this only supports one kernel right now...
|
||||
+
|
||||
+ kernel_options = self._get_kernel_options()
|
||||
+ checkisomd5 = self._has_checkisomd5()
|
||||
+
|
||||
+ cfg = ""
|
||||
+
|
||||
+ if os.path.exists(self._instroot + "/etc/system-release"):
|
||||
+ long = subprocess.check_output("echo -n `sed 's, release .*$,,g' /etc/system-release`", shell=True)
|
||||
+ else:
|
||||
+ long = self.product
|
||||
+
|
||||
+ for index in range(0, 9):
|
||||
+ cfg += self.__get_efi_image_stanza(fslabel = self.fslabel,
|
||||
+ liveargs = kernel_options,
|
||||
+ long = "Start " + self.product,
|
||||
+ 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)
|
||||
+ cfg += """menuentry 'Boot from local drive' {
|
||||
+ reboot
|
||||
+}
|
||||
+"""
|
||||
+ break
|
||||
+
|
||||
+ return cfg
|
||||
+
|
||||
+ def _generate_efiboot(self, isodir):
|
||||
+ """Generate EFI boot images."""
|
||||
+ if not glob.glob("/boot/del/BOOTAA64.EFI"):
|
||||
+ logging.error("Missing BOOTAA64.EFI, skipping efiboot.img creation.")
|
||||
+ return
|
||||
+
|
||||
+ subprocess.call(["mkefiboot", "/boot/del",
|
||||
+ isodir + "/EFI/BOOT/efiboot.img"])
|
||||
+
|
||||
+ def _configure_efi_bootloader(self, isodir):
|
||||
+ """Set up the configuration for an EFI bootloader"""
|
||||
+ if self.__copy_efi_files(isodir):
|
||||
+ shutil.rmtree(isodir + "/EFI")
|
||||
+ logging.warning("Failed to copy EFI files, no EFI Support will be included.")
|
||||
+ return
|
||||
+
|
||||
+ cfg = self.__get_basic_efi_config(isolabel = self.fslabel,
|
||||
+ timeout = self._timeout)
|
||||
+ cfg += self.__get_efi_image_stanzas(isodir, self.name)
|
||||
+
|
||||
+ cfgf = open(isodir + "/EFI/BOOT/grub.cfg", "w")
|
||||
+ cfgf.write(cfg)
|
||||
+ cfgf.close()
|
||||
+
|
||||
+ def _configure_bootloader(self, isodir):
|
||||
+ self._configure_efi_bootloader(isodir)
|
||||
+ self._generate_efiboot(isodir)
|
||||
+ kernels = self._get_kernel_versions()
|
||||
+ index = "0"
|
||||
+ for kernel, version in ((k,v) for k in kernels for v in kernels[k]):
|
||||
+ self.__copy_kernel_and_initramfs(isodir, version, index)
|
||||
+ if index == "0":
|
||||
+ isDracut = False
|
||||
+ if os.path.exists(self._instroot + "/usr/bin/dracut"):
|
||||
+ isDracut = True
|
||||
+ 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)
|
||||
+
|
||||
arch = dnf.rpm.basearch(hawkey.detect_arch())
|
||||
if arch in ("i386", "x86_64"):
|
||||
LiveImageCreator = x86LiveImageCreator
|
||||
@@ -1041,7 +1270,7 @@
|
||||
elif arch in ("ppc64",):
|
||||
LiveImageCreator = ppc64LiveImageCreator
|
||||
elif arch.startswith(("arm", "aarch64")):
|
||||
- LiveImageCreator = LiveImageCreatorBase
|
||||
+ LiveImageCreator = armLiveImageCreator
|
||||
elif arch in ("riscv64",):
|
||||
LiveImageCreator = LiveImageCreatorBase
|
||||
else:
|
|
@ -10,7 +10,7 @@ Name: livecd-tools
|
|||
Summary: Tools for building live CDs
|
||||
Epoch: 1
|
||||
Version: 27.1
|
||||
Release: 20
|
||||
Release: 21
|
||||
License: GPLv2
|
||||
Group: System/Base
|
||||
URL: https://github.com/livecd-tools/livecd-tools
|
||||
|
@ -33,6 +33,7 @@ Patch8: 0008-Copy-all-files-that-match-a-glob.patch
|
|||
Patch9: 0009-Leave-etc-vconsole.conf-not-changed.patch
|
||||
Patch10: 0010-Off-sss-hack.patch
|
||||
Patch11: 0011-Pass-package_types-to-dnf-base-group_install-as-tupl.patch
|
||||
Patch12: 0012-aarch64-implementation.patch
|
||||
|
||||
BuildRequires: python3-devel
|
||||
# pod2man comes from perl
|
||||
|
|
Loading…
Add table
Reference in a new issue