417 lines
12 KiB
Diff
417 lines
12 KiB
Diff
From a6cbb0da0f21b232dfc3386bc9f9986f6df51913 Mon Sep 17 00:00:00 2001
|
||
From: Wenlong Zhang <zhangwenlong@loongson.cn>
|
||
Date: Tue, 28 May 2024 03:48:32 +0000
|
||
Subject: [PATCH] add loongarch64 support for livecd
|
||
|
||
---
|
||
isomaker/config/common/livecd/live/efi.tmpl | 12 ++-
|
||
isomaker/config/loongarch64/ks.cfg | 28 ++++++
|
||
.../live/config_files/loongarch64/boot.msg | 5 +
|
||
.../live/config_files/loongarch64/grub.conf | 9 ++
|
||
.../config_files/loongarch64/grub2-efi.cfg | 47 ++++++++++
|
||
.../loongarch64/livecd/live/loongarch64.tmpl | 75 +++++++++++++++
|
||
.../loongarch64/livecd/livecd_loongarch64.ks | 70 ++++++++++++++
|
||
isomaker/config/loongarch64/livecd/rpmlist | 91 +++++++++++++++++++
|
||
8 files changed, 334 insertions(+), 3 deletions(-)
|
||
create mode 100644 isomaker/config/loongarch64/ks.cfg
|
||
create mode 100644 isomaker/config/loongarch64/livecd/live/config_files/loongarch64/boot.msg
|
||
create mode 100644 isomaker/config/loongarch64/livecd/live/config_files/loongarch64/grub.conf
|
||
create mode 100644 isomaker/config/loongarch64/livecd/live/config_files/loongarch64/grub2-efi.cfg
|
||
create mode 100644 isomaker/config/loongarch64/livecd/live/loongarch64.tmpl
|
||
create mode 100644 isomaker/config/loongarch64/livecd/livecd_loongarch64.ks
|
||
create mode 100644 isomaker/config/loongarch64/livecd/rpmlist
|
||
|
||
diff --git a/isomaker/config/common/livecd/live/efi.tmpl b/isomaker/config/common/livecd/live/efi.tmpl
|
||
index 9a57df4..e7a61a4 100644
|
||
--- a/isomaker/config/common/livecd/live/efi.tmpl
|
||
+++ b/isomaker/config/common/livecd/live/efi.tmpl
|
||
@@ -11,9 +11,15 @@ mkdir ${EFIBOOTDIR}/fonts/
|
||
install usr/share/shim/lockdown.efi ${EFIBOOTDIR}/
|
||
%endif
|
||
%if efiarch64:
|
||
-install boot/efi/EFI/*/shim${efiarch64|lower}.efi ${EFIBOOTDIR}/BOOT${efiarch64}.EFI
|
||
-install boot/efi/EFI/*/mm${efiarch64|lower}.efi ${EFIBOOTDIR}/
|
||
-install boot/efi/EFI/*/gcd${efiarch64|lower}.efi ${EFIBOOTDIR}/grub${efiarch64|lower}.efi
|
||
+ %if efiarch64 == 'LOONGARCH64':
|
||
+ install boot/efi/EFI/openEuler/grubloongarch64.efi ${EFIBOOTDIR}/BOOT${efiarch64}.EFI
|
||
+ install boot/efi/EFI/openEuler/grubloongarch64.efi ${EFIBOOTDIR}/BOOTLOONGARCH.EFI
|
||
+ install boot/efi/EFI/openEuler/grubloongarch64.efi ${EFIBOOTDIR}/grub${efiarch64|lower}.efi
|
||
+ %else:
|
||
+ install boot/efi/EFI/*/shim${efiarch64|lower}.efi ${EFIBOOTDIR}/BOOT${efiarch64}.EFI
|
||
+ install boot/efi/EFI/*/mm${efiarch64|lower}.efi ${EFIBOOTDIR}/
|
||
+ install boot/efi/EFI/*/gcd${efiarch64|lower}.efi ${EFIBOOTDIR}/grub${efiarch64|lower}.efi
|
||
+ %endif
|
||
%endif
|
||
install boot/efi/EFI/*/fonts/unicode.pf2 ${EFIBOOTDIR}/fonts/
|
||
|
||
diff --git a/isomaker/config/loongarch64/ks.cfg b/isomaker/config/loongarch64/ks.cfg
|
||
new file mode 100644
|
||
index 0000000..129d653
|
||
--- /dev/null
|
||
+++ b/isomaker/config/loongarch64/ks.cfg
|
||
@@ -0,0 +1,28 @@
|
||
+# version=openEuler 20.03
|
||
+# System authorization information
|
||
+
|
||
+# Use CDROM installation media
|
||
+# Use graphical install
|
||
+# Run the Setup Agent on first boot
|
||
+# Keyboard layouts
|
||
+keyboard --vckeymap=us --xlayouts='us'
|
||
+# System language
|
||
+
|
||
+# Network information
|
||
+# Root password
|
||
+# System timezone
|
||
+timezone Asia/Shanghai --isUtc --nontp
|
||
+# System bootloader configuration
|
||
+# Partition clearing information
|
||
+
|
||
+%packages --multilib
|
||
+@core
|
||
+glibc.i686
|
||
+gcc
|
||
+gdb
|
||
+make
|
||
+%end
|
||
+
|
||
+%post
|
||
+grub2-set-default 1
|
||
+%end
|
||
diff --git a/isomaker/config/loongarch64/livecd/live/config_files/loongarch64/boot.msg b/isomaker/config/loongarch64/livecd/live/config_files/loongarch64/boot.msg
|
||
new file mode 100644
|
||
index 0000000..ff54899
|
||
--- /dev/null
|
||
+++ b/isomaker/config/loongarch64/livecd/live/config_files/loongarch64/boot.msg
|
||
@@ -0,0 +1,5 @@
|
||
+
|
||
+splash.lss
|
||
+
|
||
+ - Press the 01<ENTER>07 key to begin the installation process.
|
||
+
|
||
diff --git a/isomaker/config/loongarch64/livecd/live/config_files/loongarch64/grub.conf b/isomaker/config/loongarch64/livecd/live/config_files/loongarch64/grub.conf
|
||
new file mode 100644
|
||
index 0000000..0077343
|
||
--- /dev/null
|
||
+++ b/isomaker/config/loongarch64/livecd/live/config_files/loongarch64/grub.conf
|
||
@@ -0,0 +1,9 @@
|
||
+#debug --graphics
|
||
+default=0
|
||
+splashimage=@SPLASHPATH@
|
||
+timeout 60
|
||
+hiddenmenu
|
||
+title Start @PRODUCT@ @VERSION@
|
||
+ findiso
|
||
+ kernel @KERNELPATH@ @ROOT@ rd.live.ram net.ifnames=0 biosdevname=0 rd.shell=0
|
||
+ initrd @INITRDPATH@
|
||
diff --git a/isomaker/config/loongarch64/livecd/live/config_files/loongarch64/grub2-efi.cfg b/isomaker/config/loongarch64/livecd/live/config_files/loongarch64/grub2-efi.cfg
|
||
new file mode 100644
|
||
index 0000000..37ca171
|
||
--- /dev/null
|
||
+++ b/isomaker/config/loongarch64/livecd/live/config_files/loongarch64/grub2-efi.cfg
|
||
@@ -0,0 +1,47 @@
|
||
+set default="1"
|
||
+
|
||
+function load_video {
|
||
+ if [ x$feature_all_video_module = xy ]; then
|
||
+ insmod all_video
|
||
+ else
|
||
+ insmod efi_gop
|
||
+ insmod efi_uga
|
||
+ insmod ieee1275_fb
|
||
+ insmod vbe
|
||
+ insmod vga
|
||
+ insmod video_bochs
|
||
+ insmod video_cirrus
|
||
+ fi
|
||
+}
|
||
+
|
||
+load_video
|
||
+set gfxpayload=keep
|
||
+insmod gzio
|
||
+insmod part_gpt
|
||
+insmod ext2
|
||
+insmod vfat
|
||
+
|
||
+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 red --class gnu-linux --class gnu --class os {
|
||
+ linux @KERNELPATH@ @ROOT@ ro inst.geoloc=0 console=tty0 smmu.bypassdev=0x1000:0x17 smmu.bypassdev=0x1000:0x15 video=efifb:off fpi_to_tail=off
|
||
+ initrd @INITRDPATH@
|
||
+}
|
||
+menuentry 'Test this media & install @PRODUCT@ @VERSION@' --class red --class gnu-linux --class gnu --class os {
|
||
+ linux @KERNELPATH@ @ROOT@ rd.live.check inst.geoloc=0 console=tty0 smmu.bypassdev=0x1000:0x17 smmu.bypassdev=0x1000:0x15 video=efifb:off fpi_to_tail=off
|
||
+ initrd @INITRDPATH@
|
||
+}
|
||
+submenu 'Troubleshooting -->' {
|
||
+ menuentry 'Install @PRODUCT@ @VERSION@ in basic graphics mode' --class red --class gnu-linux --class gnu --class os {
|
||
+ linux @KERNELPATH@ @ROOT@ nomodeset inst.geoloc=0 console=tty0 smmu.bypassdev=0x1000:0x17 smmu.bypassdev=0x1000:0x15 video=efifb:off fpi_to_tail=off
|
||
+ initrd @INITRDPATH@
|
||
+ }
|
||
+ menuentry 'Rescue the @PRODUCT@ system' --class red --class gnu-linux --class gnu --class os {
|
||
+ linux @KERNELPATH@ @ROOT@ rescue console=tty0 smmu.bypassdev=0x1000:0x17 smmu.bypassdev=0x1000:0x15 video=efifb:off fpi_to_tail=off
|
||
+ initrd @INITRDPATH@
|
||
+ }
|
||
+}
|
||
diff --git a/isomaker/config/loongarch64/livecd/live/loongarch64.tmpl b/isomaker/config/loongarch64/livecd/live/loongarch64.tmpl
|
||
new file mode 100644
|
||
index 0000000..cc318f4
|
||
--- /dev/null
|
||
+++ b/isomaker/config/loongarch64/livecd/live/loongarch64.tmpl
|
||
@@ -0,0 +1,75 @@
|
||
+<%page args="kernels, runtime_img, basearch, inroot, outroot, product, isolabel"/>
|
||
+<%
|
||
+configdir="tmp/config_files/loongarch64"
|
||
+PXEBOOTDIR="images/pxeboot"
|
||
+KERNELDIR=PXEBOOTDIR
|
||
+LORAXDIR="usr/share/lorax/"
|
||
+LIVEDIR="LiveOS"
|
||
+
|
||
+
|
||
+from os.path import basename
|
||
+%>
|
||
+
|
||
+## 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 = ""
|
||
+%>
|
||
+mkdir ${LIVEDIR}
|
||
+install ${runtime_img} ${LIVEDIR}/squashfs.img
|
||
+treeinfo stage2 mainimage ${LIVEDIR}/squashfs.img
|
||
+
|
||
+
|
||
+## install kernels
|
||
+mkdir ${KERNELDIR}
|
||
+%for kernel in kernels:
|
||
+ ## normal loongarch64
|
||
+ installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz
|
||
+ installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
|
||
+%endfor
|
||
+
|
||
+
|
||
+## WHeeeeeeee, EFI.
|
||
+## We could remove the basearch restriction someday..
|
||
+<% efiargs=""; efigraft="" %>
|
||
+%if exists("boot/efi/EFI/*/grubloongarch64.efi"):
|
||
+ <%
|
||
+ efiarch32 = None
|
||
+ efiarch64 = 'LOONGARCH64'
|
||
+ 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
|
||
+
|
||
+%if exists("boot/efi/EFI/*/grubloongarch64.efi"):
|
||
+## make boot.iso
|
||
+runcmd mkisofs -o ${outroot}/images/boot.iso \
|
||
+ ${efiargs} -R -J -V '${isolabel}' -T ${udfargs} \
|
||
+ -graft-points \
|
||
+ ${KERNELDIR}=${outroot}/${KERNELDIR} \
|
||
+ ${LIVEDIR}=${outroot}/${LIVEDIR} \
|
||
+ ${efigraft} ${filegraft}
|
||
+treeinfo images-${basearch} boot.iso images/boot.iso
|
||
+%endif
|
||
diff --git a/isomaker/config/loongarch64/livecd/livecd_loongarch64.ks b/isomaker/config/loongarch64/livecd/livecd_loongarch64.ks
|
||
new file mode 100644
|
||
index 0000000..192c4b1
|
||
--- /dev/null
|
||
+++ b/isomaker/config/loongarch64/livecd/livecd_loongarch64.ks
|
||
@@ -0,0 +1,70 @@
|
||
+# Minimal Disk Image
|
||
+#
|
||
+# Firewall configuration
|
||
+firewall --enabled
|
||
+# Use network installation
|
||
+url --url="INSTALL_REPO"
|
||
+# Root password
|
||
+rootpw --iscrypted ROOT_PWD
|
||
+
|
||
+# Network information
|
||
+network --bootproto=dhcp --onboot=on --activate
|
||
+# System keyboard
|
||
+keyboard --xlayouts=us --vckeymap=us
|
||
+# System language
|
||
+lang en_US.UTF-8
|
||
+# SELinux configuration
|
||
+selinux --enforcing
|
||
+# Installation logging level
|
||
+logging --level=info
|
||
+# Shutdown after installation
|
||
+shutdown
|
||
+# System timezone
|
||
+timezone Asia/Beijing
|
||
+# System bootloader configuration
|
||
+bootloader --location=mbr
|
||
+# Clear the Master Boot Record
|
||
+zerombr
|
||
+# Partition clearing information
|
||
+clearpart --all
|
||
+# Disk partitioning information
|
||
+part / --fstype="ext4" --size=40000
|
||
+part swap --size=1000
|
||
+%pre
|
||
+#!/bin/bash
|
||
+mkdir -p /mnt/sysimage/usr/lib64/
|
||
+chmod 0755 /mnt/sysimage/usr/lib64/
|
||
+cp /usr/lib64/libbep_env.so /mnt/sysimage/usr/lib64
|
||
+%end
|
||
+%post
|
||
+
|
||
+touch /etc/sysconfig/network
|
||
+
|
||
+cat << EOF > /etc/sysconfig/network-scripts/ifcfg-eth0
|
||
+TYPE=Ethernet
|
||
+BOOTPROTO=dhcp
|
||
+NAME=eth0
|
||
+DEVICE=eth0
|
||
+ONBOOT=yes
|
||
+EOF
|
||
+
|
||
+rm -rf /etc/systemd/system/multi-user.target.wants/kbox.service
|
||
+rm -rf /etc/systemd/system/multi-user.target.wants/kdump.service
|
||
+rm -rf /usr/lib/systemd/system/kbox.service
|
||
+rm -rf /usr/lib/systemd/system/kdump.service
|
||
+rm -rf /boot/initramfs*
|
||
+
|
||
+#fix shadows and shadows- time field
|
||
+awk 'BEGIN{FS=OFS=":"} {$3=18099; print $0 > "/etc/shadow"}' /etc/shadow;
|
||
+awk 'BEGIN{FS=OFS=":"} {$3=18099; print $0 > "/etc/shadow-"}' /etc/shadow-;
|
||
+
|
||
+#fix /etc/pki/ca-trust/extracted/java/cacerts time field
|
||
+rm /etc/pki/ca-trust/extracted/java/cacerts
|
||
+/usr/bin/ca-legacy install
|
||
+/usr/bin/update-ca-trust
|
||
+
|
||
+
|
||
+%end
|
||
+
|
||
+%packages --excludedocs
|
||
+%end
|
||
diff --git a/isomaker/config/loongarch64/livecd/rpmlist b/isomaker/config/loongarch64/livecd/rpmlist
|
||
new file mode 100644
|
||
index 0000000..2eb4ac9
|
||
--- /dev/null
|
||
+++ b/isomaker/config/loongarch64/livecd/rpmlist
|
||
@@ -0,0 +1,91 @@
|
||
+NetworkManager
|
||
+NetworkManager-config-server
|
||
+abattis-cantarell-fonts
|
||
+audit
|
||
+authselect
|
||
+basesystem
|
||
+bash
|
||
+bind
|
||
+bind-dnssec-utils
|
||
+boost-iostreams
|
||
+coreutils
|
||
+cronie
|
||
+cryptsetup
|
||
+curl
|
||
+dejavu-fonts
|
||
+dnf
|
||
+dnf-plugins-core
|
||
+dosfstools
|
||
+dracut-config-generic
|
||
+dracut-config-rescue
|
||
+dracut-live
|
||
+dracut-network
|
||
+e2fsprogs
|
||
+filesystem
|
||
+fipscheck
|
||
+firewalld
|
||
+glibc
|
||
+grub2-efi-loongarch64
|
||
+grub2-efi-loongarch64-cdboot
|
||
+grubby
|
||
+hostname
|
||
+initscripts
|
||
+ipmitool
|
||
+iproute
|
||
+iprutils
|
||
+iputils
|
||
+irqbalance
|
||
+kbd
|
||
+kernel
|
||
+kernel-tools
|
||
+kexec-tools
|
||
+less
|
||
+libX11
|
||
+libdaemon
|
||
+libnet
|
||
+libteam
|
||
+linux-firmware
|
||
+lshw
|
||
+lsscsi
|
||
+lvm2
|
||
+man-db
|
||
+ncurses
|
||
+net-snmp
|
||
+openEuler-latest-release
|
||
+openEuler-logos
|
||
+openEuler-release
|
||
+openssh
|
||
+openssh-clients
|
||
+openssh-server
|
||
+parted
|
||
+passwd
|
||
+policycoreutils
|
||
+procps-ng
|
||
+python3-decorator
|
||
+python3-ply
|
||
+python3-slip
|
||
+rdma-core
|
||
+rng-tools
|
||
+rootfiles
|
||
+rpm
|
||
+rsync
|
||
+rsyslog
|
||
+samba-client
|
||
+samba-libs
|
||
+security-tool
|
||
+selinux-policy-mls
|
||
+selinux-policy-targeted
|
||
+setup
|
||
+sg3_utils
|
||
+shadow
|
||
+sssd
|
||
+sudo
|
||
+sysfsutils
|
||
+systemd
|
||
+tuned
|
||
+unzip
|
||
+util-linux
|
||
+vim-minimal
|
||
+wget
|
||
+xfsprogs
|
||
+yum
|
||
--
|
||
2.43.0
|
||
|