diff --git a/0001-support-loongarch-for-lorax.patch b/0001-support-loongarch-for-lorax.patch new file mode 100644 index 0000000000000000000000000000000000000000..f0bc1c0e7708d8ffc324035fce9a0156d3806929 --- /dev/null +++ b/0001-support-loongarch-for-lorax.patch @@ -0,0 +1,50 @@ +From adb3a4a4dcdbcd5965efa662bd9b3c9377b589f4 Mon Sep 17 00:00:00 2001 +From: Wenlong Zhang +Date: Sun, 16 Oct 2022 23:10:03 +0000 +Subject: [PATCH] support loongarch for lorax + +--- + src/pylorax/__init__.py | 7 +++++-- + src/pylorax/treebuilder.py | 1 + + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py +index 8700ff5..e757cad 100644 +--- a/src/pylorax/__init__.py ++++ b/src/pylorax/__init__.py +@@ -64,7 +64,7 @@ DRACUT_DEFAULT = ["--xz", "--install", "/.buildstamp", "--no-early-microcode", " + DEFAULT_PLATFORM_ID = "platform:f32" + + class ArchData(DataHolder): +- lib64_arches = ("x86_64", "ppc64le", "s390x", "ia64", "aarch64") ++ lib64_arches = ("x86_64", "ppc64le", "s390x", "ia64", "aarch64", "loongarch64") + bcj_arch = dict(i386="x86", x86_64="x86", + ppc64le="powerpc", + arm="arm", armhfp="arm") +@@ -351,7 +351,10 @@ class Lorax(BaseLoraxClass): + for arg in user_dracut_args: + dracut_args += arg.split(" ", 1) + +- anaconda_args = dracut_args + ["--add", "anaconda pollcdrom qemu qemu-net"] ++ if self.arch.basearch == "loongarch64": ++ anaconda_args = dracut_args + ["--add", "anaconda pollcdrom qemu qemu-net"] ++ else: ++ anaconda_args = dracut_args + ["--add", "anaconda pollcdrom qemu qemu-net prefixdevname-tools"] + + logger.info("dracut args = %s", dracut_args) + logger.info("anaconda args = %s", anaconda_args) +diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py +index 2e8d152..039109e 100644 +--- a/src/pylorax/treebuilder.py ++++ b/src/pylorax/treebuilder.py +@@ -42,6 +42,7 @@ templatemap = { + 'aarch64': 'aarch64.tmpl', + 'arm': 'arm.tmpl', + 'armhfp': 'arm.tmpl', ++ 'loongarch64': 'loongarch64.tmpl', + } + + def generate_module_info(moddir, outfile=None): +-- +2.33.0 + diff --git a/0001-sw64-modify.patch b/0001-sw64-modify.patch new file mode 100644 index 0000000000000000000000000000000000000000..63d423f878fa29ab4479c8c64b9b863f3e6bb415 --- /dev/null +++ b/0001-sw64-modify.patch @@ -0,0 +1,804 @@ +From 14fefba9691639c7909aa748b9d29f72b0b4cf83 Mon Sep 17 00:00:00 2001 +From: isoft +Date: Fri, 28 Oct 2022 02:43:32 +0000 +Subject: [PATCH 1/2] sw64 modify + +--- + .../99-generic/config_files/sw64/boot.msg | 5 + + .../99-generic/config_files/sw64/grub.conf | 13 ++ + .../config_files/sw64/grub2-efi.cfg | 40 ++++++ + .../99-generic/config_files/sw64/isolinux.cfg | 120 ++++++++++++++++ + .../live/config_files/sw64/boot.msg | 5 + + .../live/config_files/sw64/grub.conf | 13 ++ + .../live/config_files/sw64/grub2-efi.cfg | 36 +++++ + .../live/config_files/sw64/isolinux.cfg | 110 ++++++++++++++ + share/templates.d/99-generic/live/sw64.tmpl | 126 ++++++++++++++++ + share/templates.d/99-generic/sw64.tmpl | 135 ++++++++++++++++++ + src/pylorax/__init__.py | 6 +- + src/pylorax/creator.py | 13 +- + src/pylorax/mount.py | 2 +- + src/pylorax/treebuilder.py | 1 + + 14 files changed, 614 insertions(+), 11 deletions(-) + create mode 100644 share/templates.d/99-generic/config_files/sw64/boot.msg + create mode 100644 share/templates.d/99-generic/config_files/sw64/grub.conf + create mode 100644 share/templates.d/99-generic/config_files/sw64/grub2-efi.cfg + create mode 100644 share/templates.d/99-generic/config_files/sw64/isolinux.cfg + create mode 100644 share/templates.d/99-generic/live/config_files/sw64/boot.msg + create mode 100644 share/templates.d/99-generic/live/config_files/sw64/grub.conf + create mode 100644 share/templates.d/99-generic/live/config_files/sw64/grub2-efi.cfg + create mode 100644 share/templates.d/99-generic/live/config_files/sw64/isolinux.cfg + create mode 100644 share/templates.d/99-generic/live/sw64.tmpl + create mode 100644 share/templates.d/99-generic/sw64.tmpl + +diff --git a/share/templates.d/99-generic/config_files/sw64/boot.msg b/share/templates.d/99-generic/config_files/sw64/boot.msg +new file mode 100644 +index 0000000..ff54899 +--- /dev/null ++++ b/share/templates.d/99-generic/config_files/sw64/boot.msg +@@ -0,0 +1,5 @@ ++ ++splash.lss ++ ++ - Press the 0107 key to begin the installation process. ++ +diff --git a/share/templates.d/99-generic/config_files/sw64/grub.conf b/share/templates.d/99-generic/config_files/sw64/grub.conf +new file mode 100644 +index 0000000..4cf8ced +--- /dev/null ++++ b/share/templates.d/99-generic/config_files/sw64/grub.conf +@@ -0,0 +1,13 @@ ++#debug --graphics ++default=1 ++splashimage=@SPLASHPATH@ ++timeout 60 ++hiddenmenu ++title Install @PRODUCT@ @VERSION@ ++ findiso ++ kernel @KERNELPATH@ @ROOT@ quiet ++ initrd @INITRDPATH@ ++title Test this media & install @PRODUCT@ @VERSION@ ++ findiso ++ kernel @KERNELPATH@ @ROOT@ rd.live.check quiet ++ initrd @INITRDPATH@ +diff --git a/share/templates.d/99-generic/config_files/sw64/grub2-efi.cfg b/share/templates.d/99-generic/config_files/sw64/grub2-efi.cfg +new file mode 100644 +index 0000000..951fb54 +--- /dev/null ++++ b/share/templates.d/99-generic/config_files/sw64/grub2-efi.cfg +@@ -0,0 +1,40 @@ ++set default="1" ++ ++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 ext2 ++ ++set timeout=60 ++### END /etc/grub.d/00_header ### ++ ++search --no-floppy --set=root -l '@ISOLABEL@' ++ ++### BEGIN /etc/grub.d/10_linux ### ++menuentry 'Install @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { ++ linuxefi @KERNELPATH@ @ROOT@ quiet ++ initrdefi @INITRDPATH@ ++} ++menuentry 'Test this media & install @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { ++ linuxefi @KERNELPATH@ @ROOT@ rd.live.check quiet ++ initrdefi @INITRDPATH@ ++} ++submenu 'Troubleshooting -->' { ++ menuentry 'Install @PRODUCT@ @VERSION@ in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { ++ linuxefi @KERNELPATH@ @ROOT@ nomodeset quiet ++ initrdefi @INITRDPATH@ ++ } ++ menuentry 'Rescue a @PRODUCT@ system' --class fedora --class gnu-linux --class gnu --class os { ++ linuxefi @KERNELPATH@ @ROOT@ rescue quiet ++ initrdefi @INITRDPATH@ ++ } ++} +diff --git a/share/templates.d/99-generic/config_files/sw64/isolinux.cfg b/share/templates.d/99-generic/config_files/sw64/isolinux.cfg +new file mode 100644 +index 0000000..0471f42 +--- /dev/null ++++ b/share/templates.d/99-generic/config_files/sw64/isolinux.cfg +@@ -0,0 +1,120 @@ ++default vesamenu.c32 ++timeout 600 ++ ++display boot.msg ++ ++# Clear the screen when exiting the menu, instead of leaving the menu displayed. ++# For vesamenu, this means the graphical background is still displayed without ++# the menu itself for as long as the screen remains in graphics mode. ++menu clear ++menu background splash.png ++menu title @PRODUCT@ @VERSION@ ++menu vshift 8 ++menu rows 18 ++menu margin 8 ++#menu hidden ++menu helpmsgrow 15 ++menu tabmsgrow 13 ++ ++# Border Area ++menu color border * #00000000 #00000000 none ++ ++# Selected item ++menu color sel 0 #ffffffff #00000000 none ++ ++# Title bar ++menu color title 0 #ff7ba3d0 #00000000 none ++ ++# Press [Tab] message ++menu color tabmsg 0 #ff3a6496 #00000000 none ++ ++# Unselected menu item ++menu color unsel 0 #84b8ffff #00000000 none ++ ++# Selected hotkey ++menu color hotsel 0 #84b8ffff #00000000 none ++ ++# Unselected hotkey ++menu color hotkey 0 #ffffffff #00000000 none ++ ++# Help text ++menu color help 0 #ffffffff #00000000 none ++ ++# A scrollbar of some type? Not sure. ++menu color scrollbar 0 #ffffffff #ff355594 none ++ ++# Timeout msg ++menu color timeout 0 #ffffffff #00000000 none ++menu color timeout_msg 0 #ffffffff #00000000 none ++ ++# Command prompt text ++menu color cmdmark 0 #84b8ffff #00000000 none ++menu color cmdline 0 #ffffffff #00000000 none ++ ++# Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message. ++ ++menu tabmsg Press Tab for full configuration options on menu items. ++ ++menu separator # insert an empty line ++menu separator # insert an empty line ++ ++label linux ++ menu label ^Install @PRODUCT@ @VERSION@ ++ kernel vmlinuz ++ append initrd=initrd.img @ROOT@ quiet ++ ++label check ++ menu label Test this ^media & install @PRODUCT@ @VERSION@ ++ menu default ++ kernel vmlinuz ++ append initrd=initrd.img @ROOT@ rd.live.check quiet ++ ++menu separator # insert an empty line ++ ++# utilities submenu ++menu begin ^Troubleshooting ++ menu title Troubleshooting ++ ++label vesa ++ menu indent count 5 ++ menu label Install @PRODUCT@ @VERSION@ in ^basic graphics mode ++ text help ++ Try this option out if you're having trouble installing ++ @PRODUCT@ @VERSION@. ++ endtext ++ kernel vmlinuz ++ append initrd=initrd.img @ROOT@ nomodeset quiet ++ ++label rescue ++ menu indent count 5 ++ menu label ^Rescue a @PRODUCT@ system ++ text help ++ If the system will not boot, this lets you access files ++ and edit config files to try to get it booting again. ++ endtext ++ kernel vmlinuz ++ append initrd=initrd.img @ROOT@ rescue quiet ++ ++label memtest ++ menu label Run a ^memory test ++ text help ++ If your system is having issues, a problem with your ++ system's memory may be the cause. Use this utility to ++ see if the memory is working correctly. ++ endtext ++ kernel memtest ++ ++menu separator # insert an empty line ++ ++label local ++ menu label Boot from ^local drive ++ localboot 0xffff ++ ++menu separator # insert an empty line ++menu separator # insert an empty line ++ ++label returntomain ++ menu label Return to ^main menu ++ menu exit ++ ++menu end +diff --git a/share/templates.d/99-generic/live/config_files/sw64/boot.msg b/share/templates.d/99-generic/live/config_files/sw64/boot.msg +new file mode 100644 +index 0000000..ff54899 +--- /dev/null ++++ b/share/templates.d/99-generic/live/config_files/sw64/boot.msg +@@ -0,0 +1,5 @@ ++ ++splash.lss ++ ++ - Press the 0107 key to begin the installation process. ++ +diff --git a/share/templates.d/99-generic/live/config_files/sw64/grub.conf b/share/templates.d/99-generic/live/config_files/sw64/grub.conf +new file mode 100644 +index 0000000..6c4a51f +--- /dev/null ++++ b/share/templates.d/99-generic/live/config_files/sw64/grub.conf +@@ -0,0 +1,13 @@ ++#debug --graphics ++default=1 ++splashimage=@SPLASHPATH@ ++timeout 60 ++hiddenmenu ++title Start @PRODUCT@ @VERSION@ ++ findiso ++ kernel @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image quiet ++ initrd @INITRDPATH@ ++title Test this media & start @PRODUCT@ @VERSION@ ++ findiso ++ kernel @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image rd.live.check quiet ++ initrd @INITRDPATH@ +diff --git a/share/templates.d/99-generic/live/config_files/sw64/grub2-efi.cfg b/share/templates.d/99-generic/live/config_files/sw64/grub2-efi.cfg +new file mode 100644 +index 0000000..2e24b15 +--- /dev/null ++++ b/share/templates.d/99-generic/live/config_files/sw64/grub2-efi.cfg +@@ -0,0 +1,36 @@ ++set default="1" ++ ++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 ext2 ++ ++set timeout=60 ++### END /etc/grub.d/00_header ### ++ ++search --no-floppy --set=root -l '@ISOLABEL@' ++ ++### BEGIN /etc/grub.d/10_linux ### ++menuentry 'Start @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { ++ linuxefi @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image quiet ++ initrdefi @INITRDPATH@ ++} ++menuentry 'Test this media & start @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { ++ linuxefi @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image rd.live.check quiet ++ initrdefi @INITRDPATH@ ++} ++submenu 'Troubleshooting -->' { ++ menuentry 'Start @PRODUCT@ @VERSION@ in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { ++ linuxefi @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image nomodeset quiet ++ initrdefi @INITRDPATH@ ++ } ++} +diff --git a/share/templates.d/99-generic/live/config_files/sw64/isolinux.cfg b/share/templates.d/99-generic/live/config_files/sw64/isolinux.cfg +new file mode 100644 +index 0000000..bc36bb9 +--- /dev/null ++++ b/share/templates.d/99-generic/live/config_files/sw64/isolinux.cfg +@@ -0,0 +1,110 @@ ++default vesamenu.c32 ++timeout 600 ++ ++display boot.msg ++ ++# Clear the screen when exiting the menu, instead of leaving the menu displayed. ++# For vesamenu, this means the graphical background is still displayed without ++# the menu itself for as long as the screen remains in graphics mode. ++menu clear ++menu background splash.png ++menu title @PRODUCT@ @VERSION@ ++menu vshift 8 ++menu rows 18 ++menu margin 8 ++#menu hidden ++menu helpmsgrow 15 ++menu tabmsgrow 13 ++ ++# Border Area ++menu color border * #00000000 #00000000 none ++ ++# Selected item ++menu color sel 0 #ffffffff #00000000 none ++ ++# Title bar ++menu color title 0 #ff7ba3d0 #00000000 none ++ ++# Press [Tab] message ++menu color tabmsg 0 #ff3a6496 #00000000 none ++ ++# Unselected menu item ++menu color unsel 0 #84b8ffff #00000000 none ++ ++# Selected hotkey ++menu color hotsel 0 #84b8ffff #00000000 none ++ ++# Unselected hotkey ++menu color hotkey 0 #ffffffff #00000000 none ++ ++# Help text ++menu color help 0 #ffffffff #00000000 none ++ ++# A scrollbar of some type? Not sure. ++menu color scrollbar 0 #ffffffff #ff355594 none ++ ++# Timeout msg ++menu color timeout 0 #ffffffff #00000000 none ++menu color timeout_msg 0 #ffffffff #00000000 none ++ ++# Command prompt text ++menu color cmdmark 0 #84b8ffff #00000000 none ++menu color cmdline 0 #ffffffff #00000000 none ++ ++# Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message. ++ ++menu tabmsg Press Tab for full configuration options on menu items. ++ ++menu separator # insert an empty line ++menu separator # insert an empty line ++ ++label linux ++ menu label ^Start @PRODUCT@ @VERSION@ ++ kernel vmlinuz ++ append initrd=initrd.img @ROOT@ @EXTRA@ rd.live.image quiet ++ ++label check ++ menu label Test this ^media & start @PRODUCT@ @VERSION@ ++ menu default ++ kernel vmlinuz ++ append initrd=initrd.img @ROOT@ @EXTRA@ rd.live.image rd.live.check quiet ++ ++menu separator # insert an empty line ++ ++# utilities submenu ++menu begin ^Troubleshooting ++ menu title Troubleshooting ++ ++label vesa ++ menu indent count 5 ++ menu label Start @PRODUCT@ @VERSION@ in ^basic graphics mode ++ text help ++ Try this option out if you're having trouble starting ++ @PRODUCT@ @VERSION@. ++ endtext ++ kernel vmlinuz ++ append initrd=initrd.img @ROOT@ @EXTRA@ rd.live.image nomodeset quiet ++ ++label memtest ++ menu label Run a ^memory test ++ text help ++ If your system is having issues, a problem with your ++ system's memory may be the cause. Use this utility to ++ see if the memory is working correctly. ++ endtext ++ kernel memtest ++ ++menu separator # insert an empty line ++ ++label local ++ menu label Boot from ^local drive ++ localboot 0xffff ++ ++menu separator # insert an empty line ++menu separator # insert an empty line ++ ++label returntomain ++ menu label Return to ^main menu ++ menu exit ++ ++menu end +diff --git a/share/templates.d/99-generic/live/sw64.tmpl b/share/templates.d/99-generic/live/sw64.tmpl +new file mode 100644 +index 0000000..4173c0c +--- /dev/null ++++ b/share/templates.d/99-generic/live/sw64.tmpl +@@ -0,0 +1,126 @@ ++<%page args="kernels, runtime_img, basearch, inroot, outroot, product, isolabel, extra_boot_args"/> ++<% ++configdir="tmp/config_files/sw64" ++SYSLINUXDIR="usr/share/syslinux" ++PXEBOOTDIR="pxeboot" ++BOOTDIR="isolinux" ++KERNELDIR=PXEBOOTDIR ++LIVEDIR="LiveOS" ++LORAXDIR="usr/share/lorax/" ++ ++## Don't allow spaces or escape characters in the iso label ++def valid_label(ch): ++ return ch.isalnum() or ch == '_' ++ ++isolabel = ''.join(ch if valid_label(ch) else '-' for ch in isolabel) ++ ++import os ++from os.path import basename ++from pylorax.sysutils import joinpaths ++ ++# Test the runtime_img, if it is > 4GiB we need to set -iso-level to 3 ++if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3: ++ isoargs = "-iso-level 3" ++else: ++ isoargs = "" ++%> ++ ++mkdir ${LIVEDIR} ++install ${runtime_img} ${LIVEDIR}/squashfs.img ++treeinfo stage2 mainimage ${LIVEDIR}/squashfs.img ++ ++## install bootloader and config files ++mkdir ${BOOTDIR} ++install ${SYSLINUXDIR}/isolinux.bin ${BOOTDIR} ++install ${SYSLINUXDIR}/vesamenu.c32 ${BOOTDIR} ++install ${SYSLINUXDIR}/ldlinux.c32 ${BOOTDIR} ++install ${SYSLINUXDIR}/libcom32.c32 ${BOOTDIR} ++install ${SYSLINUXDIR}/libutil.c32 ${BOOTDIR} ++install ${configdir}/isolinux.cfg ${BOOTDIR} ++install ${configdir}/boot.msg ${BOOTDIR} ++install ${configdir}/grub.conf ${BOOTDIR} ++install usr/share/anaconda/boot/syslinux-splash.png ${BOOTDIR}/splash.png ++install boot/memtest* ${BOOTDIR}/memtest ++ ++## configure bootloader ++replace @VERSION@ ${product.version} ${BOOTDIR}/grub.conf ${BOOTDIR}/isolinux.cfg ${BOOTDIR}/*.msg ++replace @PRODUCT@ '${product.name}' ${BOOTDIR}/grub.conf ${BOOTDIR}/isolinux.cfg ${BOOTDIR}/*.msg ++replace @ROOT@ 'root=live:CDLABEL=${isolabel|udev}' ${BOOTDIR}/isolinux.cfg ++replace @EXTRA@ '${extra_boot_args}' ${BOOTDIR}/isolinux.cfg ++ ++## install kernels ++mkdir ${KERNELDIR} ++%for kernel in kernels: ++ %if kernel.flavor: ++ installkernel images-xen ${kernel.path} ${KERNELDIR}/vmlinuz-${kernel.flavor} ++ installinitrd images-xen ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.flavor}.img ++ %else: ++ installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz ++ installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img ++ %endif ++%endfor ++ ++hardlink ${KERNELDIR}/vmlinuz ${BOOTDIR} ++hardlink ${KERNELDIR}/initrd.img ${BOOTDIR} ++%if basearch == 'x86_64': ++ treeinfo images-xen kernel ${KERNELDIR}/vmlinuz ++ treeinfo images-xen initrd ${KERNELDIR}/initrd.img ++%endif ++ ++## WHeeeeeeee, EFI. ++<% efiargs=""; efigraft=""; efiarch32=None; efiarch64=None %> ++%if exists("boot/efi/EFI/*/gcdia32.efi"): ++ <% efiarch32 = 'IA32' %> ++%endif ++%if exists("boot/efi/EFI/*/gcdx64.efi"): ++ <% efiarch64 = 'X64' %> ++%endif ++%if (efiarch32 or efiarch64) and basearch != 'i386': ++ <% ++ efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot) ++ images = [("images/efiboot.img", "-isohybrid-gpt-basdat")] ++ if domacboot: ++ images.append(("images/macboot.img", "-isohybrid-gpt-hfsplus")) ++ %> ++ %for img, hybrid in images: ++ <% ++ efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot {1}".format(img, hybrid) ++ efigraft += " {0}={1}/{0}".format(img,outroot) ++ %> ++ treeinfo images-${basearch} ${img|basename} ${img} ++ %endfor ++ <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch32=efiarch32, efiarch64=efiarch64, isolabel=isolabel, extra_boot_args=extra_boot_args"/> ++%endif ++ ++# Create optional product.img and updates.img ++<% filegraft=""; images=["product", "updates"]; compressargs=""; %> ++%if basearch == 'i386': ++ # Limit the amount of memory xz uses on i386 ++ <% compressargs="--xz -9 --memlimit-compress=3700MiB" %> ++%endif ++%for img in images: ++ %if exists("%s/%s/" % (LORAXDIR, img)): ++ installimg ${compressargs} ${LORAXDIR}/${img}/ images/${img}.img ++ treeinfo images-${basearch} ${img}.img images/${img}.img ++ <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %> ++ %endif ++%endfor ++ ++# Add the license files ++%for f in glob("/usr/share/licenses/*-release/*"): ++ install ${f} ${f|basename} ++ <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %> ++%endfor ++ ++## make boot.iso ++runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \ ++ -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \ ++ -b ${BOOTDIR}/isolinux.bin -c ${BOOTDIR}/boot.cat \ ++ -boot-load-size 4 -boot-info-table -no-emul-boot \ ++ ${efiargs} -R -J -V '${isolabel}' \ ++ -graft-points \ ++ ${BOOTDIR}=${outroot}/${BOOTDIR} \ ++ ${KERNELDIR}=${outroot}/${KERNELDIR} \ ++ ${LIVEDIR}=${outroot}/${LIVEDIR} \ ++ ${efigraft} ${filegraft} ++treeinfo images-${basearch} boot.iso images/boot.iso +diff --git a/share/templates.d/99-generic/sw64.tmpl b/share/templates.d/99-generic/sw64.tmpl +new file mode 100644 +index 0000000..193286c +--- /dev/null ++++ b/share/templates.d/99-generic/sw64.tmpl +@@ -0,0 +1,135 @@ ++<%page args="kernels, runtime_img, runtime_base, basearch, inroot, outroot, product, isolabel"/> ++<% ++configdir="tmp/config_files/sw64" ++SYSLINUXDIR="usr/share/syslinux" ++PXEBOOTDIR="pxeboot" ++STAGE2IMG="isoft/sw64/root-image.fs.sfs" ++BOOTDIR="isolinux" ++KERNELDIR=PXEBOOTDIR ++LORAXDIR="usr/share/lorax/" ++ ++## Don't allow spaces or escape characters in the iso label ++def valid_label(ch): ++ return ch.isalnum() or ch == '_' ++ ++isolabel = ''.join(ch if valid_label(ch) else '-' for ch in isolabel) ++ ++import os ++from os.path import basename ++from pylorax.sysutils import joinpaths ++ ++# Test the runtime_img, if it is > 4GiB we need to set -iso-level to 3 ++if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3: ++ isoargs = "-iso-level 3" ++else: ++ isoargs = "" ++%> ++ ++mkdir isoft/sw64 ++install ${runtime_img} ${STAGE2IMG} ++treeinfo stage2 mainimage isoft/sw64/${runtime_base} ++ ++## install bootloader and config files ++mkdir ${BOOTDIR} ++install ${SYSLINUXDIR}/isolinux.bin ${BOOTDIR} ++install ${SYSLINUXDIR}/vesamenu.c32 ${BOOTDIR} ++install ${SYSLINUXDIR}/ldlinux.c32 ${BOOTDIR} ++install ${SYSLINUXDIR}/libcom32.c32 ${BOOTDIR} ++install ${SYSLINUXDIR}/libutil.c32 ${BOOTDIR} ++install ${configdir}/isolinux.cfg ${BOOTDIR} ++install ${configdir}/boot.msg ${BOOTDIR} ++install ${configdir}/grub.conf ${BOOTDIR} ++install usr/share/anaconda/boot/syslinux-splash.png ${BOOTDIR}/splash.png ++install boot/memtest* ${BOOTDIR}/memtest ++ ++## configure bootloader ++replace @VERSION@ ${product.version} ${BOOTDIR}/grub.conf ${BOOTDIR}/isolinux.cfg ${BOOTDIR}/*.msg ++replace @PRODUCT@ '${product.name}' ${BOOTDIR}/grub.conf ${BOOTDIR}/isolinux.cfg ${BOOTDIR}/*.msg ++replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${BOOTDIR}/isolinux.cfg ++ ++## install kernels ++mkdir ${KERNELDIR} ++%for kernel in kernels: ++ %if kernel.flavor: ++ ## i386 PAE ++ installkernel images-xen ${kernel.path} ${KERNELDIR}/vmlinuz-${kernel.flavor} ++ installinitrd images-xen ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.flavor}.img ++ %else: ++ ## normal i386, x86_64 ++ installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz ++ installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img ++ %endif ++%endfor ++ ++hardlink ${KERNELDIR}/vmlinuz ${BOOTDIR} ++hardlink ${KERNELDIR}/initrd.img ${BOOTDIR} ++%if basearch == 'x86_64': ++ treeinfo images-xen kernel ${KERNELDIR}/vmlinuz ++ treeinfo images-xen initrd ${KERNELDIR}/initrd.img ++%endif ++ ++## WHeeeeeeee, EFI. ++<% efiargs=""; efigraft=""; efiarch32=None; efiarch64=None %> ++%if exists("boot/efi/EFI/*/gcdia32.efi"): ++ <% efiarch32 = 'IA32' %> ++%endif ++%if exists("boot/efi/EFI/*/gcdx64.efi"): ++ <% efiarch64 = 'X64' %> ++%endif ++%if (efiarch32 or efiarch64) and basearch != 'i386': ++ <% ++ efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot) ++ images = [("images/efiboot.img", "-isohybrid-gpt-basdat")] ++ if domacboot: ++ images.append(("images/macboot.img", "-isohybrid-gpt-hfsplus")) ++ %> ++ %for img, hybrid in images: ++ <% ++ efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot {1}".format(img, hybrid) ++ efigraft += " {0}={1}/{0}".format(img,outroot) ++ %> ++ treeinfo images-${basearch} ${img|basename} ${img} ++ %endfor ++ <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch32=efiarch32, efiarch64=efiarch64, isolabel=isolabel"/> ++%endif ++ ++# Create optional product.img and updates.img ++<% filegraft=""; images=["product", "updates"]; compressargs=""; %> ++%if basearch == 'i386': ++ # Limit the amount of memory xz uses on i386 ++ <% compressargs="--xz -9 --memlimit-compress=3700MiB" %> ++%endif ++%for img in images: ++ %if exists("%s/%s/" % (LORAXDIR, img)): ++ installimg ${compressargs} ${LORAXDIR}/${img}/ isoft/sw64/${img}.img ++ treeinfo images-${basearch} ${img}.img isoft/sw64/${img}.img ++ <% filegraft += " images/{0}.img={1}/isoft/sw64/{0}.img".format(img, outroot) %> ++ %endif ++%endfor ++ ++# Inherit iso-graft/ if it exists from external templates ++<% ++ import os ++ if os.path.exists(workdir + "/iso-graft"): ++ filegraft += " " + workdir + "/iso-graft" ++%> ++ ++# Add the license files ++%for f in glob("/usr/share/licenses/*-release/*"): ++ install ${f} ${f|basename} ++ <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %> ++%endfor ++ ++## make boot.iso ++runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \ ++ -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \ ++ -b ${BOOTDIR}/isolinux.bin -c ${BOOTDIR}/boot.cat \ ++ -boot-load-size 4 -boot-info-table -no-emul-boot \ ++ ${efiargs} -R -J -V '${isolabel}' \ ++ -graft-points \ ++ .discinfo=${outroot}/.discinfo \ ++ ${STAGE2IMG}=${outroot}/${STAGE2IMG} \ ++ ${BOOTDIR}=${outroot}/${BOOTDIR} \ ++ ${KERNELDIR}=${outroot}/${KERNELDIR} \ ++ ${efigraft} ${filegraft} ++treeinfo images-${basearch} boot.iso images/boot.iso +diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py +index 8700ff5..1b85052 100644 +--- a/src/pylorax/__init__.py ++++ b/src/pylorax/__init__.py +@@ -61,13 +61,13 @@ else: + DRACUT_DEFAULT = ["--xz", "--install", "/.buildstamp", "--no-early-microcode", "--add", "fips"] + + # Used for DNF conf.module_platform_id +-DEFAULT_PLATFORM_ID = "platform:f32" ++DEFAULT_PLATFORM_ID = "platform:sw64" + + class ArchData(DataHolder): + lib64_arches = ("x86_64", "ppc64le", "s390x", "ia64", "aarch64") + bcj_arch = dict(i386="x86", x86_64="x86", + ppc64le="powerpc", +- arm="arm", armhfp="arm") ++ arm="arm", armhfp="arm", sw_64="sw64") + + def __init__(self, buildarch): + super(ArchData, self).__init__() +@@ -309,7 +309,7 @@ class Lorax(BaseLoraxClass): + rb.writepkgsizes(joinpaths(logdir, "final-pkgsizes.txt")) + + logger.info("creating the runtime image") +- runtime = "images/install.img" ++ runtime = "isoft/sw64/root-image.fs.sfs" + compression = self.conf.get("compression", "type") + compressargs = self.conf.get("compression", "args").split() # pylint: disable=no-member + if self.conf.getboolean("compression", "bcj"): +diff --git a/src/pylorax/creator.py b/src/pylorax/creator.py +index 7075d32..79d35fd 100644 +--- a/src/pylorax/creator.py ++++ b/src/pylorax/creator.py +@@ -51,7 +51,7 @@ from pylorax.sysutils import joinpaths, remove + DRACUT_DEFAULT = ["--xz", "--add", "livenet dmsquash-live dmsquash-live-ntfs convertfs pollcdrom qemu qemu-net", + "--omit", "plymouth", "--no-hostonly", "--debug", "--no-early-microcode"] + +-RUNTIME = "images/install.img" ++RUNTIME = "isoft/sw64/root-image.fs.sfs" + + class FakeDNF(object): + """ +@@ -336,7 +336,7 @@ def make_livecd(opts, mount_dir, work_dir): + :param opts: options passed to livemedia-creator + :type opts: argparse options + :param str mount_dir: Directory tree to compress +- :param str work_dir: Output compressed image to work_dir+images/install.img ++ :param str work_dir: Output compressed image to work_dir+isoft/sw64/root-image.fs.sfs + + This uses wwood's squashfs live initramfs method: + * put the real / into LiveOS/rootfs.img +@@ -354,7 +354,7 @@ def make_livecd(opts, mount_dir, work_dir): + # Link /images to work_dir/images to make the templates happy + if os.path.islink(joinpaths(mount_dir, "images")): + os.unlink(joinpaths(mount_dir, "images")) +- rc = execWithRedirect("/bin/ln", ["-s", joinpaths(work_dir, "images"), ++ rc = execWithRedirect("/bin/ln", ["-s", joinpaths(work_dir, "isoft/sw64"), + joinpaths(mount_dir, "images")]) + if rc: + raise RuntimeError("Failed to symlink images from mount_dir to work_dir") +@@ -529,9 +529,8 @@ def make_live_images(opts, work_dir, disk_img): + sys_root = "" + + squashfs_root_dir = joinpaths(work_dir, "squashfs_root") +- liveos_dir = joinpaths(squashfs_root_dir, "LiveOS") +- os.makedirs(liveos_dir) +- rootfs_img = joinpaths(liveos_dir, "rootfs.img") ++ os.makedirs(squashfs_root_dir) ++ rootfs_img = joinpaths(squashfs_root_dir, "root-image.fs") + + if opts.fs_image or opts.no_virt: + # Find the ostree root in the fsimage +@@ -573,7 +572,7 @@ def make_live_images(opts, work_dir, disk_img): + + log.info("Packing live rootfs image") + add_pxe_args = [] +- live_image_name = "live-rootfs.squashfs.img" ++ live_image_name = "root-image.fs.sfs" + compression, compressargs = squashfs_args(opts) + rc = mksquashfs(squashfs_root_dir, joinpaths(work_dir, live_image_name), compression, compressargs) + if rc != 0: +diff --git a/src/pylorax/mount.py b/src/pylorax/mount.py +index 19e399b..a50f5a9 100644 +--- a/src/pylorax/mount.py ++++ b/src/pylorax/mount.py +@@ -67,7 +67,7 @@ class IsoMountpoint(object): + else: + self.repo = None + self.stage2 = os.path.exists(self.mount_dir+"/LiveOS/squashfs.img") or \ +- os.path.exists(self.mount_dir+"/images/install.img") ++ os.path.exists(self.mount_dir+"/isoft/sw64/root-image.fs.sfs") + + try: + for kernel, initrd in kernel_list: +diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py +index cbb8872..9335735 100644 +--- a/src/pylorax/treebuilder.py ++++ b/src/pylorax/treebuilder.py +@@ -42,6 +42,7 @@ templatemap = { + 'aarch64': 'aarch64.tmpl', + 'arm': 'arm.tmpl', + 'armhfp': 'arm.tmpl', ++ "sw_64": 'sw64.tmpl' + } + + def generate_module_info(moddir, outfile=None): +-- +2.33.0 + diff --git a/0001-sw64-tmpl-and-treebuild-modify.patch b/0001-sw64-tmpl-and-treebuild-modify.patch new file mode 100644 index 0000000000000000000000000000000000000000..ad990a1d027511bbc0de101431e87a757b3b3163 --- /dev/null +++ b/0001-sw64-tmpl-and-treebuild-modify.patch @@ -0,0 +1,48 @@ +From 068f08269167a1f03612ed5b2b14c943e165b471 Mon Sep 17 00:00:00 2001 +From: isoft +Date: Wed, 2 Nov 2022 07:51:28 +0000 +Subject: [PATCH] sw64 tmpl and treebuild modify + +--- + share/templates.d/99-generic/sw64.tmpl | 2 -- + src/pylorax/treebuilder.py | 4 ++-- + 2 files changed, 2 insertions(+), 4 deletions(-) + +diff --git a/share/templates.d/99-generic/sw64.tmpl b/share/templates.d/99-generic/sw64.tmpl +index 3830f2e..9996923 100644 +--- a/share/templates.d/99-generic/sw64.tmpl ++++ b/share/templates.d/99-generic/sw64.tmpl +@@ -54,8 +54,6 @@ install ${configdir}/boot/grub/splash.xpm.gz ${BOOTDIR}/grub/ + install ${configdir}/boot/grub/fonts/unicode.pf2 ${BOOTDIR}/grub/fonts/ + install ${configdir}/boot/grub/locale/zh_CN.mo ${BOOTDIR}/grub/locale/ + +-ln -s ${BOOTDIR}/boot . +- + %for kernel in kernels: + %if kernel.flavor: + ## i386 PAE +diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py +index 5fbb579..cead5b2 100644 +--- a/src/pylorax/treebuilder.py ++++ b/src/pylorax/treebuilder.py +@@ -246,7 +246,7 @@ class RuntimeBuilder(object): + + # Catch problems with the rootfs being too small and clearly log them + try: +- imgutils.mkrootfsimg(self.vars.root, joinpaths(workdir, "rootfs.img"), ++ imgutils.mkrootfsimg(self.vars.root, joinpaths(workdir, "root-image.fs"), + "Anaconda", size=size) + except CalledProcessError as e: + if e.stdout and "No space left on device" in e.stdout: +@@ -254,7 +254,7 @@ class RuntimeBuilder(object): + raise + + # squash the live rootfs and clean up workdir +- rc = imgutils.mksquashfs(workdir, outfile, compression, compressargs) ++ rc = imgutils.mksquashfs(joinpaths(workdir, "root-image.fs"), outfile, compression, compressargs) + remove(workdir) + return rc + +-- +2.33.0 + diff --git a/0001-sw64-tmpl-label-modify.patch b/0001-sw64-tmpl-label-modify.patch new file mode 100644 index 0000000000000000000000000000000000000000..b901ed7ba233d24f87854130a66345d992387ec6 --- /dev/null +++ b/0001-sw64-tmpl-label-modify.patch @@ -0,0 +1,49 @@ +From 1421e85651a656cdc89d206467894e748eb8f8b9 Mon Sep 17 00:00:00 2001 +From: isoft +Date: Wed, 2 Nov 2022 06:20:04 +0000 +Subject: [PATCH] sw64 tmpl label modify + +--- + .../99-generic/config_files/sw64/boot/grub/grub.cfg | 4 ++-- + share/templates.d/99-generic/sw64.tmpl | 10 ++++++---- + 2 files changed, 8 insertions(+), 6 deletions(-) + +diff --git a/share/templates.d/99-generic/sw64.tmpl b/share/templates.d/99-generic/sw64.tmpl +index cea9225..3830f2e 100644 +--- a/share/templates.d/99-generic/sw64.tmpl ++++ b/share/templates.d/99-generic/sw64.tmpl +@@ -8,10 +8,10 @@ ISOLINUXDIR="isolinux" + LORAXDIR="usr/share/lorax/" + + ## Don't allow spaces or escape characters in the iso label +-def valid_label(ch): +- return ch.isalnum() or ch == '_' ++#def valid_label(ch): ++# return ch.isalnum() or ch == '_' + +-isolabel = ''.join(ch if valid_label(ch) else '-' for ch in isolabel) ++#isolabel = ''.join(ch if valid_label(ch) else '-' for ch in isolabel) + + import os + from os.path import basename +@@ -54,6 +54,8 @@ install ${configdir}/boot/grub/splash.xpm.gz ${BOOTDIR}/grub/ + install ${configdir}/boot/grub/fonts/unicode.pf2 ${BOOTDIR}/grub/fonts/ + install ${configdir}/boot/grub/locale/zh_CN.mo ${BOOTDIR}/grub/locale/ + ++ln -s ${BOOTDIR}/boot . ++ + %for kernel in kernels: + %if kernel.flavor: + ## i386 PAE +@@ -68,7 +70,7 @@ install ${configdir}/boot/grub/locale/zh_CN.mo ${BOOTDIR}/grub/locale/ + + replace @VERSION@ '${product.version}' ${BOOTDIR}/grub/grub.cfg + replace @PRODUCT@ '${product.name}' ${BOOTDIR}/grub/grub.cfg +-replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${BOOTDIR}/grub/grub.cfg ++replace @LABEL@ '${isolabel|udev}' ${BOOTDIR}/grub/grub.cfg + + install ${configdir}/efibootimg ${BOOTDIR}/../ + +-- +2.33.0 + diff --git a/0002-sw64-modify.patch b/0002-sw64-modify.patch new file mode 100644 index 0000000000000000000000000000000000000000..5cf8cf399d37da2313e3ff5603b3d97addc9977b --- /dev/null +++ b/0002-sw64-modify.patch @@ -0,0 +1,204 @@ +From e0b31ea90a4af94a73d0bb9498e12caa93d2a524 Mon Sep 17 00:00:00 2001 +From: isoft +Date: Tue, 1 Nov 2022 09:49:12 +0000 +Subject: [PATCH 2/2] sw64 modify + +--- + share/templates.d/99-generic/sw64.tmpl | 124 ++++++++---------- + src/pylorax/__init__.py | 2 +- + src/pylorax/treebuilder.py | 2 +- + +index 193286c..cea9225 100644 +--- a/share/templates.d/99-generic/sw64.tmpl ++++ b/share/templates.d/99-generic/sw64.tmpl +@@ -1,11 +1,10 @@ + <%page args="kernels, runtime_img, runtime_base, basearch, inroot, outroot, product, isolabel"/> + <% + configdir="tmp/config_files/sw64" +-SYSLINUXDIR="usr/share/syslinux" +-PXEBOOTDIR="pxeboot" + STAGE2IMG="isoft/sw64/root-image.fs.sfs" +-BOOTDIR="isolinux" +-KERNELDIR=PXEBOOTDIR ++#BOOTDIR="isolinux" ++BOOTDIR="boot" ++ISOLINUXDIR="isolinux" + LORAXDIR="usr/share/lorax/" + + ## Don't allow spaces or escape characters in the iso label +@@ -30,80 +29,68 @@ install ${runtime_img} ${STAGE2IMG} + treeinfo stage2 mainimage isoft/sw64/${runtime_base} + + ## install bootloader and config files +-mkdir ${BOOTDIR} +-install ${SYSLINUXDIR}/isolinux.bin ${BOOTDIR} +-install ${SYSLINUXDIR}/vesamenu.c32 ${BOOTDIR} +-install ${SYSLINUXDIR}/ldlinux.c32 ${BOOTDIR} +-install ${SYSLINUXDIR}/libcom32.c32 ${BOOTDIR} +-install ${SYSLINUXDIR}/libutil.c32 ${BOOTDIR} +-install ${configdir}/isolinux.cfg ${BOOTDIR} +-install ${configdir}/boot.msg ${BOOTDIR} +-install ${configdir}/grub.conf ${BOOTDIR} +-install usr/share/anaconda/boot/syslinux-splash.png ${BOOTDIR}/splash.png +-install boot/memtest* ${BOOTDIR}/memtest ++mkdir ${ISOLINUXDIR} ++install ${configdir}/isolinux.bin ${ISOLINUXDIR} ++install ${configdir}/isolinux.cfg ${ISOLINUXDIR} ++install ${configdir}/boot.msg ${ISOLINUXDIR} ++install ${configdir}/grub.conf ${ISOLINUXDIR} ++install usr/share/anaconda/boot/syslinux-splash.png ${ISOLINUXDIR}/splash.png + + ## configure bootloader +-replace @VERSION@ ${product.version} ${BOOTDIR}/grub.conf ${BOOTDIR}/isolinux.cfg ${BOOTDIR}/*.msg +-replace @PRODUCT@ '${product.name}' ${BOOTDIR}/grub.conf ${BOOTDIR}/isolinux.cfg ${BOOTDIR}/*.msg +-replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${BOOTDIR}/isolinux.cfg ++replace @VERSION@ ${product.version} ${ISOLINUXDIR}/grub.conf ${ISOLINUXDIR}/isolinux.cfg ${ISOLINUXDIR}/*.msg ++replace @PRODUCT@ '${product.name}' ${ISOLINUXDIR}/grub.conf ${ISOLINUXDIR}/isolinux.cfg ${ISOLINUXDIR}/*.msg ++replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${ISOLINUXDIR}/isolinux.cfg + + ## install kernels +-mkdir ${KERNELDIR} ++mkdir ${BOOTDIR} ++mkdir ${BOOTDIR}/grub ++mkdir ${BOOTDIR}/grub/fonts ++mkdir ${BOOTDIR}/grub/locale ++install ${configdir}/boot/bootloader.bin ${BOOTDIR} ++install ${configdir}/boot/grub/grub.cfg ${BOOTDIR}/grub/ ++install ${configdir}/boot/grub/grub.efi ${BOOTDIR}/grub/ ++install ${configdir}/boot/grub/kernel.* ${BOOTDIR}/grub/ ++install ${configdir}/boot/grub/splash.xpm.gz ${BOOTDIR}/grub/ ++install ${configdir}/boot/grub/fonts/unicode.pf2 ${BOOTDIR}/grub/fonts/ ++install ${configdir}/boot/grub/locale/zh_CN.mo ${BOOTDIR}/grub/locale/ ++ + %for kernel in kernels: + %if kernel.flavor: + ## i386 PAE +- installkernel images-xen ${kernel.path} ${KERNELDIR}/vmlinuz-${kernel.flavor} +- installinitrd images-xen ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.flavor}.img ++ installkernel images-xen ${kernel.path} ${BOOTDIR}/vmlinuz-${kernel.flavor} ++ installinitrd images-xen ${kernel.initrd.path} ${BOOTDIR}/initrd-${kernel.flavor}.img + %else: + ## normal i386, x86_64 +- installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz +- installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img ++ installkernel images-${basearch} ${kernel.path} ${BOOTDIR}/vmlinuz ++ installinitrd images-${basearch} ${kernel.initrd.path} ${BOOTDIR}/initrd.img + %endif + %endfor + +-hardlink ${KERNELDIR}/vmlinuz ${BOOTDIR} +-hardlink ${KERNELDIR}/initrd.img ${BOOTDIR} +-%if basearch == 'x86_64': +- treeinfo images-xen kernel ${KERNELDIR}/vmlinuz +- treeinfo images-xen initrd ${KERNELDIR}/initrd.img +-%endif +- +-## WHeeeeeeee, EFI. +-<% efiargs=""; efigraft=""; efiarch32=None; efiarch64=None %> +-%if exists("boot/efi/EFI/*/gcdia32.efi"): +- <% efiarch32 = 'IA32' %> +-%endif +-%if exists("boot/efi/EFI/*/gcdx64.efi"): +- <% efiarch64 = 'X64' %> +-%endif +-%if (efiarch32 or efiarch64) and basearch != 'i386': +- <% +- efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot) +- images = [("images/efiboot.img", "-isohybrid-gpt-basdat")] +- if domacboot: +- images.append(("images/macboot.img", "-isohybrid-gpt-hfsplus")) +- %> +- %for img, hybrid in images: +- <% +- efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot {1}".format(img, hybrid) +- efigraft += " {0}={1}/{0}".format(img,outroot) +- %> +- treeinfo images-${basearch} ${img|basename} ${img} +- %endfor +- <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch32=efiarch32, efiarch64=efiarch64, isolabel=isolabel"/> +-%endif ++replace @VERSION@ '${product.version}' ${BOOTDIR}/grub/grub.cfg ++replace @PRODUCT@ '${product.name}' ${BOOTDIR}/grub/grub.cfg ++replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${BOOTDIR}/grub/grub.cfg ++ ++install ${configdir}/efibootimg ${BOOTDIR}/../ ++ ++mkdir EFI ++mkdir EFI/BOOT ++mkdir EFI/BOOT/fonts ++mkdir EFI/BOOT/locale ++install ${configdir}/EFI/BOOT/BOOT.cfg EFI/BOOT/ ++install ${configdir}/EFI/BOOT/grub.cfg EFI/BOOT/ ++install ${configdir}/EFI/BOOT/grub.efi EFI/BOOT/ ++install ${configdir}/EFI/BOOT/kernel.* EFI/BOOT/ ++install ${configdir}/EFI/BOOT/splash.xpm.gz EFI/BOOT/ ++install ${configdir}/EFI/BOOT/fonts/unicode.pf2 EFI/BOOT/fonts/ ++install ${configdir}/EFI/BOOT/locale/zh_CN.mo EFI/BOOT/locale/ + + # Create optional product.img and updates.img +-<% filegraft=""; images=["product", "updates"]; compressargs=""; %> +-%if basearch == 'i386': +- # Limit the amount of memory xz uses on i386 +- <% compressargs="--xz -9 --memlimit-compress=3700MiB" %> +-%endif ++<% filegraft=""; images=["product", "updates"] %> + %for img in images: + %if exists("%s/%s/" % (LORAXDIR, img)): +- installimg ${compressargs} ${LORAXDIR}/${img}/ isoft/sw64/${img}.img +- treeinfo images-${basearch} ${img}.img isoft/sw64/${img}.img +- <% filegraft += " images/{0}.img={1}/isoft/sw64/{0}.img".format(img, outroot) %> ++ installimg ${LORAXDIR}/${img}/ images/${img}.img ++ treeinfo images-${basearch} ${img}.img images/${img}.img ++ <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %> + %endif + %endfor + +@@ -121,15 +108,10 @@ hardlink ${KERNELDIR}/initrd.img ${BOOTDIR} + %endfor + + ## make boot.iso ++mkdir images + runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \ +- -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \ +- -b ${BOOTDIR}/isolinux.bin -c ${BOOTDIR}/boot.cat \ ++ -b ${ISOLINUXDIR}/isolinux.bin -c ${ISOLINUXDIR}/boot.cat \ + -boot-load-size 4 -boot-info-table -no-emul-boot \ +- ${efiargs} -R -J -V '${isolabel}' \ +- -graft-points \ +- .discinfo=${outroot}/.discinfo \ +- ${STAGE2IMG}=${outroot}/${STAGE2IMG} \ +- ${BOOTDIR}=${outroot}/${BOOTDIR} \ +- ${KERNELDIR}=${outroot}/${KERNELDIR} \ +- ${efigraft} ${filegraft} ++ -R -J -V '${isolabel}' \ ++ ${filegraft} ${outroot} + treeinfo images-${basearch} boot.iso images/boot.iso +diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py +index 1b85052..c37c0e0 100644 +--- a/src/pylorax/__init__.py ++++ b/src/pylorax/__init__.py +@@ -67,7 +67,7 @@ class ArchData(DataHolder): + lib64_arches = ("x86_64", "ppc64le", "s390x", "ia64", "aarch64") + bcj_arch = dict(i386="x86", x86_64="x86", + ppc64le="powerpc", +- arm="arm", armhfp="arm", sw_64="sw64") ++ arm="arm", armhfp="arm") + + def __init__(self, buildarch): + super(ArchData, self).__init__() +diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py +index 9335735..5fbb579 100644 +--- a/src/pylorax/treebuilder.py ++++ b/src/pylorax/treebuilder.py +@@ -246,7 +246,7 @@ class RuntimeBuilder(object): + + # Catch problems with the rootfs being too small and clearly log them + try: +- imgutils.mkrootfsimg(self.vars.root, joinpaths(workdir, "LiveOS/rootfs.img"), ++ imgutils.mkrootfsimg(self.vars.root, joinpaths(workdir, "rootfs.img"), + "Anaconda", size=size) + except CalledProcessError as e: + if e.stdout and "No space left on device" in e.stdout: +-- +2.33.0 + diff --git a/add-param-name_prefix-to-make-name-used-by-register_blueprint-unique.patch b/add-param-name_prefix-to-make-name-used-by-register_blueprint-unique.patch new file mode 100644 index 0000000000000000000000000000000000000000..3bbfe470c7dfedf82961bd011a3d15ad5d7bff16 --- /dev/null +++ b/add-param-name_prefix-to-make-name-used-by-register_blueprint-unique.patch @@ -0,0 +1,32 @@ +From aaf6e6d7808f00ae0db6f1ef9c8d02fbd3f62319 Mon Sep 17 00:00:00 2001 +From: zhouyihang +Date: Sat, 23 Aug 2022 15:54:15 -0500 +Subject: [PATCH] add param name_prefix to make name used by register_blueprint() unique + +--- + src/pylorax/api/server.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/pylorax/api/server.py b/src/pylorax/api/server.py +index 1c42d94..fd2a9ff 100644 +--- a/src/pylorax/api/server.py ++++ b/src/pylorax/api/server.py +@@ -85,7 +85,7 @@ def bad_request(error): + return jsonify(status=False, errors=[{ "id": HTTP_ERROR, "code": error.code, "msg": error.name }]), error.code + + # Register the v0 API on /api/v0/ +-server.register_blueprint(v0_api, url_prefix="/api/v0/") ++server.register_blueprint(v0_api, url_prefix="/api/v0/", name_prefix="v0") + + # Register the v1 API on /api/v1/ + # Use v0 routes by default +@@ -99,5 +99,5 @@ skip_rules = [ + "/projects/source/info/", + "/projects/source/new", + ] +-server.register_blueprint(v0_api, url_prefix="/api/v1/", skip_rules=skip_rules) +-server.register_blueprint(v1_api, url_prefix="/api/v1/") ++server.register_blueprint(v0_api, url_prefix="/api/v1/", skip_rules=skip_rules, name_prefix="v1") ++server.register_blueprint(v1_api, url_prefix="/api/v1/", name_prefix="v1") +-- +2.27.0 diff --git a/backport-runtime-install-don-t-install-notification-daemon.patch b/backport-runtime-install-don-t-install-notification-daemon.patch deleted file mode 100644 index 82bea778630293d4f3d0635729fd135fec9ea69d..0000000000000000000000000000000000000000 --- a/backport-runtime-install-don-t-install-notification-daemon.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 2d8f1d789a51088dd2f4f2840734f70fb2275cf1 Mon Sep 17 00:00:00 2001 -From: Adam Williamson -Date: Fri, 4 Sep 2020 15:41:29 -0700 -Subject: [PATCH] runtime-install: don't install notification-daemon - -libnotify dropped the requirement just a couple of months after -this line was added, but we never took it back out again. - -Reference:https://github.com/weldr/lorax/commit/a87f438af10e308eb20f2eb2712abe3f820c674a -The patch was adapted to remove the useless deletion of notification-daemon in runtime-cleanup.tmpl - -Signed-off-by: Adam Williamson -Signed-off-by: Qiumiao Zhang ---- - share/templates.d/99-generic/runtime-cleanup.tmpl | 2 -- - share/templates.d/99-generic/runtime-install.tmpl | 3 --- - 2 files changed, 5 deletions(-) - -diff --git a/share/templates.d/99-generic/runtime-cleanup.tmpl b/share/templates.d/99-generic/runtime-cleanup.tmpl -index d803ee0..f3a7ebb 100644 ---- a/share/templates.d/99-generic/runtime-cleanup.tmpl -+++ b/share/templates.d/99-generic/runtime-cleanup.tmpl -@@ -44,8 +44,6 @@ removefrom initscripts /usr/sbin/* /usr/share/locale/* /usr/share/doc/* /usr/sha - removepkg pinentry - ## no storage device monitoring - removepkg device-mapper-event dmraid-events sgpio --## no notifications in anaconda --removepkg notification-daemon - ## logrotate isn't useful in anaconda - removepkg logrotate - remove /etc/logrotate.d -diff --git a/share/templates.d/99-generic/runtime-install.tmpl b/share/templates.d/99-generic/runtime-install.tmpl -index 729a55a..b6cf765 100644 ---- a/share/templates.d/99-generic/runtime-install.tmpl -+++ b/share/templates.d/99-generic/runtime-install.tmpl -@@ -182,8 +182,5 @@ installpkg wget rsync bind-utils ftp mtr vconfig - installpkg icfg spice-vdagent - installpkg gdisk hexedit sg3_utils - --## satisfy libnotify's desktop-notification-daemon with the least crazy option --installpkg notification-daemon -- - ## actually install all the requested packages - run_pkg_transaction --- -2.28.0.windows.1 - diff --git a/lorax-33.6-1.tar.gz b/lorax-34.1-1.tar.gz similarity index 58% rename from lorax-33.6-1.tar.gz rename to lorax-34.1-1.tar.gz index 6a6a2804a25a28d56bba4ed92c48da355b1cdd0d..a350d2a96d90b006c72cab8d3db32e172c768e6c 100644 Binary files a/lorax-33.6-1.tar.gz and b/lorax-34.1-1.tar.gz differ diff --git a/lorax-delete-udisk2-iscsi.patch b/lorax-delete-udisk2-iscsi.patch index 0d334676a2e66b0b0395e1e8690d86f56d450acf..86ed5245eb0be056817ed5e756185bc4699ab473 100644 --- a/lorax-delete-udisk2-iscsi.patch +++ b/lorax-delete-udisk2-iscsi.patch @@ -8,18 +8,17 @@ Subject: [PATCH] delete udisk2-iscsi 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/templates.d/99-generic/runtime-install.tmpl b/share/templates.d/99-generic/runtime-install.tmpl -index 6bee5e6..9cf6b5b 100644 +index 159222b..cad3c7c 100644 --- a/share/templates.d/99-generic/runtime-install.tmpl +++ b/share/templates.d/99-generic/runtime-install.tmpl @@ -106,7 +106,7 @@ installpkg xfsdump - + ## extra storage packages # hostname is needed for iscsi to work, see RHBZ#1593917 -installpkg udisks2 udisks2-iscsi hostname +installpkg udisks2 hostname - - ## extra libblockdev plugins - installpkg libblockdev-lvm-dbus --- -1.8.3.1 - + %if basearch in ("i386", "x86_64"): + installpkg fcoe-utils + %endif +-- +2.33.0 diff --git a/lorax.spec b/lorax.spec index 1828ebd78acdc9ee8de20bd0267de7a9ce8faf4d..14ff3128a424de938544b1383feea8f276a13e1a 100644 --- a/lorax.spec +++ b/lorax.spec @@ -2,12 +2,15 @@ %define disable_cross 0 Name: lorax -Version: 33.6 -Release: 5 +Version: 34.1 +Release: 3 Summary: A set of tools used to create bootable images License: GPLv2+ URL: https://github.com/weldr/lorax Source0: https://github.com/weldr/lorax/archive/%{name}-%{version}-1.tar.gz +%ifarch sw_64 +Source1: sw64.tar.gz +%endif Patch0: 0001-ignore-the-dir-that-without-kernel-version.patch Patch1: 0001-add-text-mode-selection-menu-in-grub-configuration.patch @@ -24,10 +27,19 @@ Patch11: backport-Do-not-use-loglevel-option-when-running-Anaconda.patch Patch12: backport-Improve-lmc-no-virt-error-handling.patch Patch13: backport-Add-POSTIN-scriptlet-error-to-the-log-monitor-list.patch Patch14: backport-Remove-LD_PRELOAD-libgomp.so.1-from-lmc-no-virt.patch -Patch15: backport-runtime-install-don-t-install-notification-daemon.patch +Patch16: add-param-name_prefix-to-make-name-used-by-register_blueprint-unique.patch +Patch100: 0001-support-loongarch-for-lorax.patch + +%ifarch sw_64 +Patch200: 0001-sw64-modify.patch +Patch201: 0002-sw64-modify.patch +Patch202: runtime-tmpl-sw64.patch +Patch203: 0001-sw64-tmpl-label-modify.patch +Patch204: 0001-sw64-tmpl-and-treebuild-modify.patch +%endif BuildRequires: python3-devel python3-sphinx_rtd_theme python3-magic -BuildRequires: python3-nose python3-pytest-mock python3-pocketlint python3-gevent +BuildRequires: python3-pytest python3-pytest-mock python3-pocketlint python3-gevent BuildRequires: python3-mock python3-urllib3 python3-dnf python3-librepo BuildRequires: python3-libselinux python3-mako python3-kickstart @@ -131,7 +143,18 @@ build images, etc. from the command line. %patch12 -p1 %patch13 -p1 %patch14 -p1 -%patch15 -p1 +%patch16 -p1 +%ifarch loongarch64 +%patch100 -p1 +%endif + +%ifarch sw_64 +%patch200 -p1 +%patch201 -p1 +%patch202 -p1 +%patch203 -p1 +%patch204 -p1 +%endif %build %make_build @@ -143,6 +166,9 @@ for toml in example-http-server.toml example-development.toml example-atlas.toml cp ./tests/pylorax/blueprints/$toml %{buildroot}/var/lib/lorax/composer/blueprints/ done +%ifarch sw_64 +tar -zxvf %SOURCE1 -C %{buildroot}/%{_datadir}/lorax/templates.d/99-generic/config_files/ +%endif %pre composer getent group weldr >/dev/null 2>&1 || groupadd -r weldr >/dev/null 2>&1 || : @@ -179,6 +205,7 @@ getent passwd weldr >/dev/null 2>&1 || useradd -r -g weldr -d / -s /sbin/nologin %dir %{_datadir}/lorax/templates.d %{_datadir}/lorax/templates.d/* %{_tmpfilesdir}/lorax.conf +%exclude %{python3_sitelib}/pylorax/api %if 0%{?disable_cross} %files lmc-virt @@ -189,7 +216,7 @@ getent passwd weldr >/dev/null 2>&1 || useradd -r -g weldr -d / -s /sbin/nologin %files composer %defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/lorax/composer.conf -%{python3_sitelib}/pylorax/api/* +%{python3_sitelib}/pylorax/api %{python3_sitelib}/lifted/* %{_sbindir}/lorax-composer %{_unitdir}/lorax-composer.* @@ -213,6 +240,38 @@ getent passwd weldr >/dev/null 2>&1 || useradd -r -g weldr -d / -s /sbin/nologin %{_mandir}/man1/*.1* %changelog +* Mon Dec 11 2022 qiuwenjuan - 34.1-3 +- Type:requirement +- ID:NA +- SUG:NA +- DESC:add patch for shenwei architecture + +* Sat Nov 26 2022 zhouyihang - 34.1-2 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:remove duplicate files in lorax + +* Fri Nov 18 2022 yanglu - 34.1-1 +- Type:requirement +- ID:NA +- SUG:NA +- DESC:update lorax version to 34.1 + +* Mon Mar 28 2022 Wenlong Zhang - 33.6-8 +- ID:NA +- SUG:NA +- DESC: add loongarch support for lorax + +* Sat Aug 13 2022 zhouyihang - 33.6-7 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:add param name_prefix to make name used by register_blueprint() unique + +* Sat May 07 2022 gaihuiying - 33.6-6 +- use python3-pytest instead of python3-nose + * Fri Apr 23 2021 zhangqiumiao - 33.6-5 - runtime-install: don't install notification-daemon diff --git a/runtime-tmpl-sw64.patch b/runtime-tmpl-sw64.patch new file mode 100644 index 0000000000000000000000000000000000000000..4fe6dd754e263bd62f290c914829a6d0bd3ca460 --- /dev/null +++ b/runtime-tmpl-sw64.patch @@ -0,0 +1,127 @@ +--- ./share/templates.d/99-generic/runtime-install.tmpl.orig 2022-11-02 01:51:10.114315928 +0000 ++++ ./share/templates.d/99-generic/runtime-install.tmpl 2022-11-02 01:59:02.845221968 +0000 +@@ -5,7 +5,7 @@ + installpkg anaconda anaconda-widgets kexec-tools-anaconda-addon anaconda-install-env-deps + ## Other available payloads + installpkg dnf +-installpkg rpm-ostree ostree ++installpkg rpm + ## speed up compression on multicore systems + installpkg pigz + +@@ -129,7 +129,7 @@ + installpkg pciutils usbutils ipmitool + installpkg mt-st smartmontools + installpkg hdparm +-%if basearch not in ("aarch64", "ppc64le", "s390x"): ++%if basearch not in ("aarch64", "ppc64le", "s390x", "sw_64"): + installpkg pcmciautils + %endif + ## see bug #1483278 +@@ -143,24 +143,24 @@ + + + ## fonts & themes +-installpkg aajohan-comfortaa-fonts ++#installpkg aajohan-comfortaa-fonts + installpkg abattis-cantarell-fonts +-installpkg bitmap-fangsongti-fonts ++#installpkg bitmap-fangsongti-fonts + installpkg dejavu-sans-fonts dejavu-sans-mono-fonts + installpkg google-noto-sans-cjk-ttc-fonts +-installpkg google-noto-sans-gurmukhi-fonts +-installpkg google-noto-sans-sinhala-vf-fonts ++#installpkg google-noto-sans-gurmukhi-fonts ++#installpkg google-noto-sans-sinhala-vf-fonts + installpkg jomolhari-fonts +-installpkg khmeros-base-fonts +-installpkg lohit-assamese-fonts +-installpkg lohit-bengali-fonts +-installpkg lohit-devanagari-fonts +-installpkg lohit-gujarati-fonts +-installpkg lohit-kannada-fonts +-installpkg lohit-marathi-fonts +-installpkg lohit-odia-fonts +-installpkg lohit-tamil-fonts +-installpkg lohit-telugu-fonts ++#installpkg khmeros-base-fonts ++#installpkg lohit-assamese-fonts ++#installpkg lohit-bengali-fonts ++#installpkg lohit-devanagari-fonts ++#installpkg lohit-gujarati-fonts ++#installpkg lohit-kannada-fonts ++#installpkg lohit-marathi-fonts ++#installpkg lohit-odia-fonts ++#installpkg lohit-tamil-fonts ++#installpkg lohit-telugu-fonts + installpkg madan-fonts + installpkg paktype-naskh-basic-fonts + installpkg sil-abyssinica-fonts +@@ -171,13 +171,13 @@ + installpkg xorg-x11-fonts-misc + + ## debugging/bug reporting tools +-installpkg gdb-gdbserver +-installpkg libreport-plugin-bugzilla libreport-plugin-reportuploader ++#installpkg gdb-gdbserver ++#installpkg libreport-plugin-bugzilla libreport-plugin-reportuploader + installpkg fpaste + installpkg python3-pyatspi + + ## extra tools not required by anaconda +-installpkg vim-minimal strace lsof dump xz less ++installpkg vim-minimal strace lsof xz less + installpkg wget rsync bind-utils ftp mtr vconfig + installpkg icfg spice-vdagent + installpkg gdisk hexedit sg3_utils +--- ./share/templates.d/99-generic/runtime-cleanup.tmpl.orig 2022-11-02 01:50:59.214295037 +0000 ++++ ./share/templates.d/99-generic/runtime-cleanup.tmpl 2022-11-02 01:53:06.014538063 +0000 +@@ -43,7 +43,7 @@ + ## Miscellanous unnecessary gpg program + removepkg pinentry + ## no storage device monitoring +-removepkg device-mapper-event dmraid-events sgpio ++## removepkg device-mapper-event dmraid-events sgpio + ## logrotate isn't useful in anaconda + removepkg logrotate + remove /etc/logrotate.d +@@ -76,12 +76,18 @@ + remove /usr/share/mime/video /usr/share/mime/x-content /usr/share/mime/x-epoc + remove /var/db /var/games /var/tmp /var/yp /var/nis /var/opt /var/local + remove /var/mail /var/spool /var/preserve /var/report +-remove /var/lib/rpm/* /var/lib/yum /var/lib/dnf ++## remove /var/lib/rpm/* /var/lib/yum /var/lib/dnf + ## clean up the files created by various '> /dev/null's + remove /dev/* + + ## icons cache + remove /usr/share/icons/*/icon-theme.cache ++remove /usr/lib/fontconfig/cache/* ++remove /lib/fontconfig/cache/* ++remove /var/lib/systemd/catalog/database ++remove /var/cache/ldconfig/aux-cache ++remove /var/log/tallylog ++remove /root/lorax-packages.log rebuildfile/rootfs/root/lorax-packages.log + + ## clean up kernel modules + removekmod sound drivers/media drivers/hwmon \ +@@ -132,7 +138,7 @@ + removefrom authconfig /usr/sbin/* /usr/share/* + removefrom bash /etc/* /usr/bin/bashbug* /usr/share/* + removefrom bind-utils /usr/bin/host /usr/bin/nsupdate +-removefrom bitmap-fangsongti-fonts /usr/share/fonts/* ++## removefrom bitmap-fangsongti-fonts /usr/share/fonts/* + removefrom ca-certificates /etc/pki/java/* + removefrom ca-certificates /etc/pki/tls/certs/ca-bundle.trust.crt /etc/ssl/* + removefrom cairo /usr/${libdir}/libcairo-script* /usr/bin/cairo-sphinx +--- ./share/templates.d/99-generic/runtime-install.tmpl.orig 2022-11-02 02:22:32.247923239 +0000 ++++ ./share/templates.d/99-generic/runtime-install.tmpl 2022-11-02 02:22:50.307957853 +0000 +@@ -105,7 +105,7 @@ + + ## extra storage packages + # hostname is needed for iscsi to work, see RHBZ#1593917 +-installpkg udisks2 udisks2-iscsi hostname ++installpkg udisks2 hostname + + ## extra libblockdev plugins + installpkg libblockdev-lvm-dbus diff --git a/sw64.tar.gz b/sw64.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..405a8aa993969e9618f05a06ee009b95d917b51f Binary files /dev/null and b/sw64.tar.gz differ