add livecd support for loongarch64

add ls2k500sfb.ko for loongarch64
This commit is contained in:
Wenlong Zhang 2024-05-28 07:42:08 +00:00
parent b1f1404654
commit 5f8452481f
3 changed files with 453 additions and 6 deletions

View File

@ -0,0 +1,416 @@
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

View File

@ -0,0 +1,25 @@
From b1feb98d22f577432d226aeadfc0133b72104b3a Mon Sep 17 00:00:00 2001
From: Wenlong Zhang <zhangwenlong@loongson.cn>
Date: Thu, 30 May 2024 09:40:38 +0000
Subject: [PATCH] add ls2k500sfb.ko for loongarch64
---
isomaker/80-openeuler/runtime-cleanup.tmpl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/isomaker/80-openeuler/runtime-cleanup.tmpl b/isomaker/80-openeuler/runtime-cleanup.tmpl
index 256d013..8d4b423 100644
--- a/isomaker/80-openeuler/runtime-cleanup.tmpl
+++ b/isomaker/80-openeuler/runtime-cleanup.tmpl
@@ -106,7 +106,7 @@ removekmod sound drivers/media drivers/hwmon \
removekmod drivers/char --allbut virtio_console hw_random \
virtio-rng ipmi hmcdrv
removekmod drivers/hid --allbut hid-logitech-dj hid-logitech-hidpp
-removekmod drivers/video --allbut hyperv_fb syscopyarea sysfillrect sysimgblt fb_sys_fops
+removekmod drivers/video --allbut hyperv_fb syscopyarea sysfillrect sysimgblt fb_sys_fops ls2k500sfb
remove lib/modules/*/{build,source,*.map}
## NOTE: depmod gets re-run after cleanup finishes
--
2.43.0

View File

@ -15,7 +15,7 @@ Summary: a building tool for DVD ISO making and ISO cutting
License: Mulan PSL v2
Group: System/Management
Version: 3.1.0
Release: 10
Release: 11
BuildRoot: %{_tmppath}/%{name}
Source: https://gitee.com/openeuler/oemaker/repository/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
@ -41,7 +41,8 @@ Patch0002: add-openEuler_repo.conf-for-loongarch64.patch
%ifarch riscv64
Patch0003: 0001-add-riscv64-support.patch
%endif
Patch0004: add-loongarch64-support-for-livecd.patch
Patch0005: add-ls2k500sfb.ko-for-loongarch64.patch
%description
a building tool for DVD ISO making and ISO cutting
@ -123,11 +124,9 @@ install -m 700 %{name}/isomaker/rpm.sh %{buildroot}/opt/oemaker/rpm.sh
install -m 700 %{name}/isomaker/env_record.sh %{buildroot}/opt/oemaker/env_record.sh
install -m 700 %{name}/isomaker/env_restore.sh %{buildroot}/opt/oemaker/env_restore.sh
install -m 400 %{name}/isomaker/config/rpmlist.xml %{buildroot}/opt/oemaker/config/rpmlist.xml
%ifnarch loongarch64
install -m 640 %{name}/isomaker/config/${sys_arch}/livecd/live/config_files/${sys_arch}/* %{buildroot}/opt/oemaker/config/${sys_arch}/livecd/live/config_files/${sys_arch}/
install -m 400 %{name}/isomaker/config/${sys_arch}/livecd/livecd_${sys_arch}.ks %{buildroot}/opt/oemaker/config/${sys_arch}/livecd/livecd_${sys_arch}.ks
install -m 600 %{name}/isomaker/config/${sys_arch}/livecd/rpmlist %{buildroot}/opt/oemaker/config/${sys_arch}/livecd/rpmlist
%endif
install -m 400 %{name}/isomaker/config/${sys_arch}/desktop_normal.xml %{buildroot}/opt/oemaker/config/${sys_arch}/desktop_normal.xml
install -m 400 %{name}/isomaker/config/${sys_arch}/edge_normal.xml %{buildroot}/opt/oemaker/config/${sys_arch}/edge_normal.xml
install -m 400 %{name}/isomaker/config/${sys_arch}/normal.xml %{buildroot}/opt/oemaker/config/${sys_arch}/normal.xml
@ -139,10 +138,12 @@ install -m 400 %{name}/isomaker/config/x86_64/ks.cfg %{buildroot}/opt/oemaker/co
%ifarch aarch64
install -m 700 %{name}/isomaker/config/aarch64/livecd/live/aarch64.tmpl %{buildroot}/opt/oemaker/config/aarch64/livecd/live/aarch64.tmpl
%endif
%ifnarch loongarch64
%ifarch loongarch64
install -m 700 %{name}/isomaker/config/loongarch64/livecd/live/loongarch64.tmpl %{buildroot}/opt/oemaker/config/loongarch64/livecd/live/loongarch64.tmpl
install -m 400 %{name}/isomaker/config/loongarch64/ks.cfg %{buildroot}/opt/oemaker/config/loongarch64/ks.cfg
%endif
install -m 700 %{name}/isomaker/config/common/livecd/live/* %{buildroot}/opt/oemaker/config/common/livecd/live/
install -m 400 %{name}/isomaker/config/common/livecd/root_pwd %{buildroot}/opt/oemaker/config/common/livecd/root_pwd
%endif
%ifarch riscv64
install -m 700 %{name}/isomaker/config/riscv64/livecd/live/riscv64.tmpl %{buildroot}/opt/oemaker/config/riscv64/livecd/live/riscv64.tmpl
%endif
@ -213,6 +214,11 @@ rm -rf %{buildroot}
rm -rf $RPM_BUILD_DIR/%{name}
%changelog
* Wed May 29 2024 Wenlong Zhang <zhangwenlong@loongson.cn> - 3.1.0-11
- ID:NA
- SUG:NA
- DESC: add livecd for loongarch64, add ls2k500sfb.ko for loongarch64
* Tue May 28 2024 Ouuleilei <wangliu@iscas.ac.cn> - 3.1.0-10
- add riscv64 support