From bb85d80bc68cb5740590463e59bc0d04b83e3eb2 Mon Sep 17 00:00:00 2001 From: zhangfeilong Date: Fri, 28 Nov 2025 16:33:10 +0800 Subject: [PATCH] fix sw64 build --- 0001-add-sw64-architecture.patch | 774 +++++++++++++------------------ lorax.spec | 6 +- 2 files changed, 332 insertions(+), 448 deletions(-) diff --git a/0001-add-sw64-architecture.patch b/0001-add-sw64-architecture.patch index 0cf72c2..a04d566 100644 --- a/0001-add-sw64-architecture.patch +++ b/0001-add-sw64-architecture.patch @@ -1,29 +1,35 @@ -From 14fefba9691639c7909aa748b9d29f72b0b4cf83 Mon Sep 17 00:00:00 2001 -From: isoft -Date: Fri, 28 Oct 2022 02:43:32 +0000 -Subject: Patch sw64 modify +From: zhangfeilong +Date: Fri, 28 Nov 2025 16:33:43 +0800 +Subject: [PATCH] add sw64 support. -diff -Naru lorax-lorax-34.1-1/share/templates.d/99-generic/live/config_files/sw64/boot.msg lorax-lorax-34.1-1.bak/share/templates.d/99-generic/live/config_files/sw64/boot.msg ---- lorax-lorax-34.1-1/share/templates.d/99-generic/live/config_files/sw64/boot.msg 1970-01-01 08:00:00.000000000 +0800 -+++ lorax-lorax-34.1-1.bak/share/templates.d/99-generic/live/config_files/sw64/boot.msg 2023-05-19 13:31:05.147962280 +0800 +--- +diff -urN lorax-lorax-34.1-1/share/templates.d/99-generic/config_files/sw_64/boot.msg lorax-lorax-34.1-1.sw64/share/templates.d/99-generic/config_files/sw_64/boot.msg +--- lorax-lorax-34.1-1/share/templates.d/99-generic/config_files/sw_64/boot.msg 1970-01-01 08:00:00.000000000 +0800 ++++ lorax-lorax-34.1-1.sw64/share/templates.d/99-generic/config_files/sw_64/boot.msg 2025-11-21 10:35:04.402246819 +0800 @@ -0,0 +1,5 @@ + +splash.lss + + - Press the 0107 key to begin the installation process. + -diff -Naru lorax-lorax-34.1-1/share/templates.d/99-generic/live/config_files/sw64/grub2-efi.cfg lorax-lorax-34.1-1.bak/share/templates.d/99-generic/live/config_files/sw64/grub2-efi.cfg ---- lorax-lorax-34.1-1/share/templates.d/99-generic/live/config_files/sw64/grub2-efi.cfg 1970-01-01 08:00:00.000000000 +0800 -+++ lorax-lorax-34.1-1.bak/share/templates.d/99-generic/live/config_files/sw64/grub2-efi.cfg 2023-05-19 13:31:05.147962280 +0800 -@@ -0,0 +1,36 @@ +diff -urN lorax-lorax-34.1-1/share/templates.d/99-generic/config_files/sw_64/grub2-efi.cfg lorax-lorax-34.1-1.sw64/share/templates.d/99-generic/config_files/sw_64/grub2-efi.cfg +--- lorax-lorax-34.1-1/share/templates.d/99-generic/config_files/sw_64/grub2-efi.cfg 1970-01-01 08:00:00.000000000 +0800 ++++ lorax-lorax-34.1-1.sw64/share/templates.d/99-generic/config_files/sw_64/grub2-efi.cfg 2025-11-21 10:35:04.402246819 +0800 +@@ -0,0 +1,46 @@ +set default="1" + +function load_video { -+ insmod efi_gop -+ insmod efi_uga -+ insmod video_bochs -+ insmod video_cirrus -+ insmod all_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 @@ -38,297 +44,72 @@ diff -Naru lorax-lorax-34.1-1/share/templates.d/99-generic/live/config_files/sw6 +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 'Install @PRODUCT@ @VERSION@' --class red --class gnu-linux --class gnu --class os { ++ linux @KERNELPATH@ @ROOT@ ro ++ initrd @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@ ++menuentry 'Test this media & install @PRODUCT@ @VERSION@' --class red --class gnu-linux --class gnu --class os { ++ linux @KERNELPATH@ @ROOT@ rd.live.check ++ initrd @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@ ++ menuentry 'Install @PRODUCT@ @VERSION@ in basic graphics mode' --class red --class gnu-linux --class gnu --class os { ++ linux @KERNELPATH@ @ROOT@ nomodeset ++ initrd @INITRDPATH@ ++ } ++ menuentry 'Rescue a @PRODUCT@ system' --class red --class gnu-linux --class gnu --class os { ++ linux @KERNELPATH@ @ROOT@ rescue ++ initrd @INITRDPATH@ + } +} -diff -Naru lorax-lorax-34.1-1/share/templates.d/99-generic/live/config_files/sw64/grub.conf lorax-lorax-34.1-1.bak/share/templates.d/99-generic/live/config_files/sw64/grub.conf ---- lorax-lorax-34.1-1/share/templates.d/99-generic/live/config_files/sw64/grub.conf 1970-01-01 08:00:00.000000000 +0800 -+++ lorax-lorax-34.1-1.bak/share/templates.d/99-generic/live/config_files/sw64/grub.conf 2023-05-19 13:31:05.147962280 +0800 +diff -urN lorax-lorax-34.1-1/share/templates.d/99-generic/config_files/sw_64/grub.conf lorax-lorax-34.1-1.sw64/share/templates.d/99-generic/config_files/sw_64/grub.conf +--- lorax-lorax-34.1-1/share/templates.d/99-generic/config_files/sw_64/grub.conf 1970-01-01 08:00:00.000000000 +0800 ++++ lorax-lorax-34.1-1.sw64/share/templates.d/99-generic/config_files/sw_64/grub.conf 2025-11-21 10:35:04.402246819 +0800 @@ -0,0 +1,13 @@ +#debug --graphics -+default=1 ++default=0 +splashimage=@SPLASHPATH@ -+timeout 60 ++timeout 5 +hiddenmenu -+title Start @PRODUCT@ @VERSION@ ++title Install @PRODUCT@ @VERSION@ + findiso -+ kernel @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image quiet ++ kernel @KERNELPATH@ @ROOT@ quiet + initrd @INITRDPATH@ -+title Test this media & start @PRODUCT@ @VERSION@ ++title Test this media & install @PRODUCT@ @VERSION@ + findiso -+ kernel @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image rd.live.check quiet ++ kernel @KERNELPATH@ @ROOT@ rd.live.check quiet + initrd @INITRDPATH@ -diff -Naru lorax-lorax-34.1-1/share/templates.d/99-generic/live/config_files/sw64/isolinux.cfg lorax-lorax-34.1-1.bak/share/templates.d/99-generic/live/config_files/sw64/isolinux.cfg ---- lorax-lorax-34.1-1/share/templates.d/99-generic/live/config_files/sw64/isolinux.cfg 1970-01-01 08:00:00.000000000 +0800 -+++ lorax-lorax-34.1-1.bak/share/templates.d/99-generic/live/config_files/sw64/isolinux.cfg 2023-05-19 13:31:05.147962280 +0800 -@@ -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 -Naru lorax-lorax-34.1-1/share/templates.d/99-generic/runtime-cleanup.tmpl lorax-lorax-34.1-1.bak/share/templates.d/99-generic/runtime-cleanup.tmpl ---- lorax-lorax-34.1-1/share/templates.d/99-generic/runtime-cleanup.tmpl 2020-09-15 05:55:20.000000000 +0800 -+++ lorax-lorax-34.1-1.bak/share/templates.d/99-generic/runtime-cleanup.tmpl 2023-05-19 13:31:46.827962280 +0800 -@@ -38,7 +38,7 @@ - removefrom initscripts /usr/sbin/* /usr/share/locale/* /usr/share/doc/* /usr/share/man/* - - ## 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 -@@ -71,12 +71,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 \ -@@ -122,7 +128,7 @@ - removefrom audit-libs /etc/* /${libdir}/libauparse* - 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 - removefrom cairo /usr/${libdir}/libcairo-script* /usr/bin/cairo-sphinx -diff -Naru lorax-lorax-34.1-1/share/templates.d/99-generic/runtime-install.tmpl lorax-lorax-34.1-1.bak/share/templates.d/99-generic/runtime-install.tmpl ---- lorax-lorax-34.1-1/share/templates.d/99-generic/runtime-install.tmpl 2023-05-19 13:42:58.557962280 +0800 -+++ lorax-lorax-34.1-1.bak/share/templates.d/99-generic/runtime-install.tmpl 2023-05-19 13:31:55.717962280 +0800 -@@ -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 - -@@ -106,7 +106,7 @@ - - ## extra storage packages - # hostname is needed for iscsi to work, see RHBZ#1593917 --installpkg udisks2 udisks2-iscsi hostname -+installpkg udisks2 hostname - %if basearch in ("i386", "x86_64"): - installpkg fcoe-utils - %endif -@@ -140,7 +140,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 -@@ -154,24 +154,24 @@ +diff -urN lorax-lorax-34.1-1/share/templates.d/99-generic/live/live-install.tmpl lorax-lorax-34.1-1.sw64/share/templates.d/99-generic/live/live-install.tmpl +--- lorax-lorax-34.1-1/share/templates.d/99-generic/live/live-install.tmpl 2020-09-15 05:55:20.000000000 +0800 ++++ lorax-lorax-34.1-1.sw64/share/templates.d/99-generic/live/live-install.tmpl 2025-11-21 10:38:11.843373115 +0800 +@@ -2,6 +2,10 @@ + <%page args="basearch"/> - - ## 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 paktype-naskh-basic-fonts - installpkg sil-abyssinica-fonts - installpkg sil-padauk-fonts -@@ -181,14 +181,14 @@ - 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 nano nano-default-editor --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 -diff -Naru lorax-lorax-34.1-1/share/templates.d/99-generic/sw64.tmpl lorax-lorax-34.1-1.bak/share/templates.d/99-generic/sw64.tmpl ---- lorax-lorax-34.1-1/share/templates.d/99-generic/sw64.tmpl 1970-01-01 08:00:00.000000000 +0800 -+++ lorax-lorax-34.1-1.bak/share/templates.d/99-generic/sw64.tmpl 2023-05-19 13:32:03.017962280 +0800 -@@ -0,0 +1,96 @@ -+<%page args="kernels, runtime_img, runtime_base, basearch, inroot, outroot, product, isolabel"/> + ## arch-specific bootloader packages ++%if basearch == "sw_64": ++ installpkg efibootmgr ++ installpkg grub2-efi shim ++%endif + %if basearch == "aarch64": + installpkg efibootmgr + installpkg grub2-efi-aa64-cdboot shim-aa64 +diff -urN lorax-lorax-34.1-1/share/templates.d/99-generic/live/sw_64.tmpl lorax-lorax-34.1-1.sw64/share/templates.d/99-generic/live/sw_64.tmpl +--- lorax-lorax-34.1-1/share/templates.d/99-generic/live/sw_64.tmpl 1970-01-01 08:00:00.000000000 +0800 ++++ lorax-lorax-34.1-1.sw64/share/templates.d/99-generic/live/sw_64.tmpl 2025-11-21 10:39:21.863793853 +0800 +@@ -0,0 +1,84 @@ ++<%page args="kernels, runtime_img, basearch, inroot, outroot, product, isolabel, extra_boot_args"/> +<% -+configdir="tmp/config_files/sw64" -+STAGE2IMG="isoft/sw64/root-image.fs.sfs" -+#BOOTDIR="isolinux" -+BOOTDIR="boot" -+ISOLINUXDIR="isolinux" ++configdir="tmp/config_files/sw_64" ++PXEBOOTDIR="images/pxeboot" ++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 == '_' ++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 @@ -341,186 +122,285 @@ diff -Naru lorax-lorax-34.1-1/share/templates.d/99-generic/sw64.tmpl lorax-lorax + isoargs = "" +%> + -+mkdir isoft/sw64 -+install ${runtime_img} ${STAGE2IMG} -+treeinfo stage2 mainimage isoft/sw64/${runtime_base} -+ -+## install bootloader and config files -+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 -+install ${configdir}/isolinux/anaconda_configure_user.sh ${ISOLINUXDIR} -+install ${configdir}/isolinux/.bashrc ${ISOLINUXDIR} -+ -+## configure bootloader -+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 ++mkdir ${LIVEDIR} ++install ${runtime_img} ${LIVEDIR}/squashfs.img ++treeinfo stage2 mainimage ${LIVEDIR}/squashfs.img + +## install kernels -+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/ -+ ++mkdir ${KERNELDIR} +%for kernel in kernels: -+ %if kernel.flavor: -+ ## i386 PAE -+ 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} ${BOOTDIR}/vmlinuz -+ installinitrd images-${basearch} ${kernel.initrd.path} ${BOOTDIR}/initrd.img ++ ## normal sw_64 ++ installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz ++ installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img ++%endfor ++ ++#FIXME: this will need adjusted when we have a real bootloader. ++## WHeeeeeeee, EFI. ++## We could remove the basearch restriction someday.. ++<% efiargs=""; efigraft="" %> ++%if exists("boot/efi/EFI/*/gcdaa64.efi"): ++ <% ++ efiarch32 = None ++ efiarch64 = 'AA64' ++ efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot) ++ images = ["images/efiboot.img"] ++ %> ++ %for img in images: ++ <% ++ efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot".format(img) ++ 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"] %> ++%for img in images: ++ %if exists("%s/%s/" % (LORAXDIR, img)): ++ 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 + -+replace @VERSION@ '${product.version}' ${BOOTDIR}/grub/grub.cfg -+replace @PRODUCT@ '${product.name}' ${BOOTDIR}/grub/grub.cfg -+replace @LABEL@ '${isolabel|udev}' ${BOOTDIR}/grub/grub.cfg ++# 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 ++ ++%if exists("boot/efi/EFI/*/gcdaa64.efi"): ++## make boot.iso ++runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \ ++ ${efiargs} -R -J -V '${isolabel}' \ ++ -graft-points \ ++ ${KERNELDIR}=${outroot}/${KERNELDIR} \ ++ ${LIVEDIR}=${outroot}/${LIVEDIR} \ ++ ${efigraft} ${filegraft} ++treeinfo images-${basearch} boot.iso images/boot.iso ++%endif +diff -urN lorax-lorax-34.1-1/share/templates.d/99-generic/sw_64.tmpl lorax-lorax-34.1-1.sw64/share/templates.d/99-generic/sw_64.tmpl +--- lorax-lorax-34.1-1/share/templates.d/99-generic/sw_64.tmpl 1970-01-01 08:00:00.000000000 +0800 ++++ lorax-lorax-34.1-1.sw64/share/templates.d/99-generic/sw_64.tmpl 2025-11-21 13:47:32.761726494 +0800 +@@ -0,0 +1,89 @@ ++<%page args="kernels, runtime_img, basearch, inroot, outroot, product, isolabel"/> ++<% ++configdir="tmp/config_files/sw_64" ++PXEBOOTDIR="images/pxeboot" ++KERNELDIR=PXEBOOTDIR ++STAGE2IMG="images/install.img" ++LORAXDIR="usr/share/lorax/" + -+install ${configdir}/efibootimg ${BOOTDIR}/../ ++import os ++from os.path import basename ++from pylorax.sysutils import joinpaths + -+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/ ++## Test ${runtime_img} to see if udf is needed ++<% ++ import os ++ from pylorax.sysutils import joinpaths ++ if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3: ++ udfargs = "-allow-limited-size" ++ else: ++ udfargs = "" ++%> + -+## make boot.iso +mkdir images ++install ${runtime_img} ${STAGE2IMG} ++treeinfo stage2 mainimage ${STAGE2IMG} ++ ++## install kernels ++mkdir ${KERNELDIR} ++%for kernel in kernels: ++ ## normal sw_64 ++ installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz ++ installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img ++%endfor ++ ++#FIXME: this will need adjusted when we have a real bootloader. ++## WHeeeeeeee, EFI. ++## We could remove the basearch restriction someday.. ++<% efiargs=""; efigraft="" %> ++%if exists("boot/efi/EFI/*/gcdsw64.efi"): ++ <% ++ efiarch32 = None ++ efiarch64 = 'sw64' ++ efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot) ++ images = ["images/efiboot.img"] ++ %> ++ %for img in images: ++ <% ++ efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot".format(img) ++ 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"] %> ++%for img in images: ++ %if exists("%s/%s/" % (LORAXDIR, img)): ++ 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 ++ ++# 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 ++ ++%if exists("boot/efi/EFI/*/gcdsw_64.efi"): ++## make boot.iso +runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \ -+ -b ${ISOLINUXDIR}/isolinux.bin -c ${ISOLINUXDIR}/boot.cat \ -+ -boot-load-size 4 -boot-info-table -no-emul-boot \ -+ -R -J -V '${isolabel}' \ -+ ${outroot} ++ ${efiargs} -R -J -V '${isolabel}' \ ++ -graft-points \ ++ .discinfo=${outroot}/.discinfo \ ++ ${KERNELDIR}=${outroot}/${KERNELDIR} \ ++ ${STAGE2IMG}=${outroot}/${STAGE2IMG} \ ++ ${efigraft} ${filegraft} +treeinfo images-${basearch} boot.iso images/boot.iso -diff -Naru lorax-lorax-34.1-1/src/pylorax/creator.py lorax-lorax-34.1-1.bak/src/pylorax/creator.py ---- lorax-lorax-34.1-1/src/pylorax/creator.py 2020-09-15 05:55:20.000000000 +0800 -+++ lorax-lorax-34.1-1.bak/src/pylorax/creator.py 2023-05-19 13:32:39.407962280 +0800 -@@ -51,7 +51,7 @@ - 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" ++%endif +diff -urN lorax-lorax-34.1-1/src/pylorax/api/compose.py lorax-lorax-34.1-1.sw64/src/pylorax/api/compose.py +--- lorax-lorax-34.1-1/src/pylorax/api/compose.py 2020-09-15 05:55:20.000000000 +0800 ++++ lorax-lorax-34.1-1.sw64/src/pylorax/api/compose.py 2025-11-21 10:40:07.574068517 +0800 +@@ -878,6 +878,7 @@ + "arm": ["alibaba", "ami", "google", "hyper-v", "vhd", "vmdk"], + "armhfp": ["alibaba", "ami", "google", "hyper-v", "vhd", "vmdk"], + "aarch64": ["alibaba", "google", "hyper-v", "vhd", "vmdk"], ++ "sw_64": ["alibaba", "google", "hyper-v", "vhd", "vmdk"], + "ppc": ["alibaba", "ami", "google", "hyper-v", "vhd", "vmdk"], + "ppc64": ["alibaba", "ami", "google", "hyper-v", "vhd", "vmdk"], + "ppc64le": ["alibaba", "ami", "google", "hyper-v", "vhd", "vmdk"], +diff -urN lorax-lorax-34.1-1/src/pylorax/treebuilder.py lorax-lorax-34.1-1.sw64/src/pylorax/treebuilder.py +--- lorax-lorax-34.1-1/src/pylorax/treebuilder.py 2025-11-21 13:48:35.282104419 +0800 ++++ lorax-lorax-34.1-1.sw64/src/pylorax/treebuilder.py 2025-11-21 10:41:22.474518539 +0800 +@@ -42,6 +42,7 @@ + 'aarch64': 'aarch64.tmpl', + 'arm': 'arm.tmpl', + 'armhfp': 'arm.tmpl', ++ 'sw_64': 'sw_64.tmpl', + } - class FakeDNF(object): - """ -@@ -332,7 +332,7 @@ - :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 + def generate_module_info(moddir, outfile=None): +diff -urN lorax-lorax-34.1-1/src/sbin/mkksiso lorax-lorax-34.1-1.sw64/src/sbin/mkksiso +--- lorax-lorax-34.1-1/src/sbin/mkksiso 2020-09-15 05:55:20.000000000 +0800 ++++ lorax-lorax-34.1-1.sw64/src/sbin/mkksiso 2025-11-21 10:42:20.524867264 +0800 +@@ -158,6 +158,28 @@ + raise RuntimeError("implantisomd5 failed") - This uses wwood's squashfs live initramfs method: - * put the real / into LiveOS/rootfs.img -@@ -350,7 +350,7 @@ - # 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") -@@ -525,9 +525,8 @@ - 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") ++class Mkisofs_sw_64(MakeISOTool): ++ """Use the mkisofs tool to create the final iso (sw_64)""" ++ tools = ["mkisofs", "implantisomd5"] ++ arches = ["sw_64", "sw_64"] ++ ++ def run(self, tmpdir, grafts, volume_name, output_iso, efimode=NO_EFI): ++ cmd = ["mkisofs", "-o", output_iso, "-R", "-J", "-V", volume_name, ++ "-T"] ++ if log.root.level < log.INFO: ++ cmd.append("--verbose") ++ if efimode > NO_EFI: ++ cmd.extend(["-eltorito-alt-boot", "-e", "images/efiboot.img", "-no-emul-boot"]) ++ if efimode > EFIBOOT: ++ cmd.extend(["-eltorito-alt-boot", "-e", "images/macboot.img", "-no-emul-boot"]) ++ ++ if self.check_file_sizes(grafts): ++ cmd.append("-allow-limited-size") ++ ++ # Create the iso and implant the md5 checksums ++ self._exec(cmd, grafts, output_iso, implantmd5=True) ++ ++ + class Mkisofs_aarch64(MakeISOTool): + """Use the mkisofs tool to create the final iso (aarch64)""" + tools = ["mkisofs", "implantisomd5"] +@@ -268,6 +290,28 @@ + self._exec(cmd, grafts, output_iso, efimode, implantmd5=True) - if opts.fs_image or opts.no_virt: - # Find the ostree root in the fsimage -@@ -569,7 +568,7 @@ - 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 -Naru lorax-lorax-34.1-1/src/pylorax/__init__.py lorax-lorax-34.1-1.bak/src/pylorax/__init__.py ---- lorax-lorax-34.1-1/src/pylorax/__init__.py 2023-05-19 13:38:47.357962280 +0800 -+++ lorax-lorax-34.1-1.bak/src/pylorax/__init__.py 2023-05-19 13:32:33.807962280 +0800 -@@ -61,7 +61,7 @@ - DRACUT_DEFAULT = ["--xz", "--install", "/.buildstamp", "--no-early-microcode", "--add", "fips"] ++class Xorrisofs_sw_64(MakeISOTool): ++ """Use the xorrisofs tool to create the final iso (sw_64)""" ++ tools = ["xorrisofs", "implantisomd5"] ++ requirements = [] ++ arches = ["sw_64", "sw_64"] ++ ++ def run(self, tmpdir, grafts, volume_name, output_iso, efimode): ++ cmd = ["xorrisofs", "-o", output_iso, ++ "-R", "-J", "-V", volume_name] ++ if log.root.level < log.INFO: ++ cmd.append("--verbose") ++ if efimode == EFIBOOT: ++ cmd.extend(["-eltorito-alt-boot", "-e", "images/efiboot.img", "-no-emul-boot"]) ++ if efimode == MACBOOT: ++ cmd.extend(["-eltorito-alt-boot", "-e", "images/macboot.img", "-no-emul-boot"]) ++ ++ if self.check_file_sizes(grafts): ++ cmd.extend(["-iso-level", "3"]) ++ ++ # Create the iso and implant the md5 checksums ++ self._exec(cmd, grafts, output_iso, implantmd5=True) ++ + class Xorrisofs_aarch64(MakeISOTool): + """Use the xorrisofs tool to create the final iso (aarch64)""" + tools = ["xorrisofs", "implantisomd5"] +@@ -361,10 +405,10 @@ - # 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") -@@ -309,7 +309,7 @@ - rb.writepkgsizes(joinpaths(logdir, "final-pkgsizes.txt")) + # xorrisofs based classes +-XorrisofsTools = [Xorrisofs_aarch64, Xorrisofs_ppc64le, Xorrisofs_s390, Xorrisofs_x86_64] ++XorrisofsTools = [Xorrisofs_aarch64, Xorrisofs_sw_64, Xorrisofs_ppc64le, Xorrisofs_s390, Xorrisofs_x86_64] - 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 -Naru lorax-lorax-34.1-1/src/pylorax/mount.py lorax-lorax-34.1-1.bak/src/pylorax/mount.py ---- lorax-lorax-34.1-1/src/pylorax/mount.py 2020-09-15 05:55:20.000000000 +0800 -+++ lorax-lorax-34.1-1.bak/src/pylorax/mount.py 2023-05-19 13:32:55.777962280 +0800 -@@ -67,7 +67,7 @@ - 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") + # mkisofs based classes +-MkisofsTools = [Mkisofs_aarch64, Mkisofs_ppc, Mkisofs_ppc64le, Mkisofs_s390, Mkisofs_x86_64] ++MkisofsTools = [Mkisofs_aarch64, Mkisofs_sw_64, Mkisofs_ppc, Mkisofs_ppc64le, Mkisofs_s390, Mkisofs_x86_64] - try: - for kernel, initrd in kernel_list: -diff -Naru lorax-lorax-34.1-1/src/pylorax/treebuilder.py lorax-lorax-34.1-1.bak/src/pylorax/treebuilder.py ---- lorax-lorax-34.1-1/src/pylorax/treebuilder.py 2023-05-19 13:38:47.357962280 +0800 -+++ lorax-lorax-34.1-1.bak/src/pylorax/treebuilder.py 2023-05-19 13:32:45.077962280 +0800 -@@ -42,6 +42,7 @@ - 'aarch64': 'aarch64.tmpl', - 'arm': 'arm.tmpl', - 'armhfp': 'arm.tmpl', -+ "sw_64": 'sw64.tmpl' - } - def generate_module_info(moddir, outfile=None): -@@ -248,7 +249,7 @@ + class MakeKickstartISO(): +diff -urN lorax-lorax-34.1-1/tests/cli/test_build_and_deploy_aws.sh lorax-lorax-34.1-1.sw64/tests/cli/test_build_and_deploy_aws.sh +--- lorax-lorax-34.1-1/tests/cli/test_build_and_deploy_aws.sh 2020-09-15 05:55:20.000000000 +0800 ++++ lorax-lorax-34.1-1.sw64/tests/cli/test_build_and_deploy_aws.sh 2025-11-21 10:44:01.855475987 +0800 +@@ -139,6 +139,9 @@ - # 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, "root-image.fs"), - "Anaconda", size=size) - except CalledProcessError as e: - if e.stdout and "No space left on device" in e.stdout: -@@ -256,7 +257,7 @@ - raise + # create an image from the imported selected snapshot + AMI_ARCH="$(uname -m)" ++ if [ "$AMI_ARCH" == "sw_64" ]; then ++ AMI_ARCH="sw_64" ++ fi + if [ "$AMI_ARCH" == "aarch64" ]; then + AMI_ARCH="arm64" + fi +@@ -159,6 +162,9 @@ - # 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 - + rlPhaseStartTest "Start EC2 instance" + INSTANCE_TYPE="t2.small" ++ if [ "$(uname -m)" == "sw_64" ]; then ++ INSTANCE_TYPE="a1.medium" ++ fi + if [ "$(uname -m)" == "aarch64" ]; then + INSTANCE_TYPE="a1.medium" + fi +diff -urN lorax-lorax-34.1-1/tests/pylorax/test_compose.py lorax-lorax-34.1-1.sw64/tests/pylorax/test_compose.py +--- lorax-lorax-34.1-1/tests/pylorax/test_compose.py 2020-09-15 05:55:20.000000000 +0800 ++++ lorax-lorax-34.1-1.sw64/tests/pylorax/test_compose.py 2025-11-21 10:44:39.205700360 +0800 +@@ -820,6 +820,7 @@ + "aarch64": "shim-aa64", + "arm": "grub2-efi-arm-cdboot", + "armhfp": "grub2-efi-arm-cdboot", ++ "sw_64": "grub2-efi-sw64-cdboot", + "x86_64": "shim-x64", + "i386": "memtest86+", + "ppc64le": "powerpc-utils", diff --git a/lorax.spec b/lorax.spec index f7db76a..0e88220 100644 --- a/lorax.spec +++ b/lorax.spec @@ -3,7 +3,7 @@ Name: lorax Version: 34.1 -Release: 9 +Release: 10 Summary: A set of tools used to create bootable images License: GPLv2+ URL: https://github.com/weldr/lorax @@ -238,6 +238,10 @@ getent passwd weldr >/dev/null 2>&1 || useradd -r -g weldr -d / -s /sbin/nologin %{_mandir}/man1/*.1* %changelog +* Tue Oct 21 2025 zhangfeilon - 34.1-10 +- change sw64.tar.gz unicode.pf2,zh_CN.mo permission +- fix sw64 patch + * Thu Sep 25 2025 zhangshaoning - 34.1-9 - Remove unnecessary fonts -- Gitee