!45 riscv64: 用musl替换不支持的dietlibc
From: @laokz Reviewed-by: @Charlie_li Signed-off-by: @Charlie_li
This commit is contained in:
commit
db27639f62
@ -0,0 +1,36 @@
|
|||||||
|
From 9a0d078dc35fde7a715666bce6c765ed5fe5e916 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||||
|
Date: Fri, 10 Nov 2023 08:55:25 +0000
|
||||||
|
Subject: [PATCH 12/13] src/format_ext2_kernel.ml: Rename function file ->
|
||||||
|
kernel
|
||||||
|
|
||||||
|
No change, just rename the function.
|
||||||
|
---
|
||||||
|
src/format_ext2_kernel.ml | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml
|
||||||
|
index 4589552..36514c6 100644
|
||||||
|
--- a/src/format_ext2_kernel.ml
|
||||||
|
+++ b/src/format_ext2_kernel.ml
|
||||||
|
@@ -54,7 +54,7 @@ let rec build_kernel debug host_cpu copy_kernel kernel =
|
||||||
|
printf "supermin: kernel: modpath %s\n%!" modpath;
|
||||||
|
);
|
||||||
|
|
||||||
|
- copy_or_symlink_file copy_kernel kernel_file kernel;
|
||||||
|
+ copy_or_symlink_kernel copy_kernel kernel_file kernel;
|
||||||
|
|
||||||
|
(kernel_version, modpath)
|
||||||
|
|
||||||
|
@@ -308,7 +308,7 @@ and read_string chan offset len =
|
||||||
|
really_input chan buf 0 len;
|
||||||
|
Bytes.to_string buf
|
||||||
|
|
||||||
|
-and copy_or_symlink_file copy_kernel src dest =
|
||||||
|
+and copy_or_symlink_kernel copy_kernel src dest =
|
||||||
|
if not copy_kernel then
|
||||||
|
symlink src dest
|
||||||
|
else (
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
||||||
72
9101-src-Uncompress-kernel-on-RISC-V.patch
Normal file
72
9101-src-Uncompress-kernel-on-RISC-V.patch
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
From 5230e2c3cd07e82bd6431e871e239f7056bf25ad Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||||
|
Date: Fri, 10 Nov 2023 10:20:49 +0000
|
||||||
|
Subject: [PATCH 13/13] src: Uncompress kernel on RISC-V
|
||||||
|
|
||||||
|
---
|
||||||
|
src/format_ext2_kernel.ml | 35 ++++++++++++++++++++++++++++++++++-
|
||||||
|
1 file changed, 34 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml
|
||||||
|
index 36514c6..09a3f21 100644
|
||||||
|
--- a/src/format_ext2_kernel.ml
|
||||||
|
+++ b/src/format_ext2_kernel.ml
|
||||||
|
@@ -25,6 +25,20 @@ open Ext2fs
|
||||||
|
open Fnmatch
|
||||||
|
open Glob
|
||||||
|
|
||||||
|
+(* Similar but not the same as get_file_type in mode_build. There
|
||||||
|
+ * is a case for deriving a common base utility. XXX
|
||||||
|
+ *)
|
||||||
|
+type compression_type = GZip | Uncompressed
|
||||||
|
+let get_compression_type file =
|
||||||
|
+ let chan = open_in file in
|
||||||
|
+ let buf = Bytes.create 512 in
|
||||||
|
+ let len = input chan buf 0 (Bytes.length buf) in
|
||||||
|
+ close_in chan;
|
||||||
|
+ let buf = Bytes.to_string buf in
|
||||||
|
+ if len >= 3 && buf.[0] = '\x1f' && buf.[1] = '\x8b' && buf.[2] = '\x08'
|
||||||
|
+ then GZip
|
||||||
|
+ else Uncompressed (* or other unknown compression type *)
|
||||||
|
+
|
||||||
|
let rec build_kernel debug host_cpu copy_kernel kernel =
|
||||||
|
(* Locate the kernel.
|
||||||
|
* SUPERMIN_* environment variables override everything. If those
|
||||||
|
@@ -54,7 +68,19 @@ let rec build_kernel debug host_cpu copy_kernel kernel =
|
||||||
|
printf "supermin: kernel: modpath %s\n%!" modpath;
|
||||||
|
);
|
||||||
|
|
||||||
|
- copy_or_symlink_kernel copy_kernel kernel_file kernel;
|
||||||
|
+ (* RISC-V relies on the bootloader or firmware to uncompress the
|
||||||
|
+ * kernel and doesn't have a concept of self-extracting kernels.
|
||||||
|
+ * On Arm which is similar, qemu -kernel will automatically uncompress
|
||||||
|
+ * the kernel, but qemu-system-riscv won't do that and the code is a
|
||||||
|
+ * big mess so I don't fancy fixing it. So we have to detect that
|
||||||
|
+ * case here and uncompress the kernel.
|
||||||
|
+ *)
|
||||||
|
+ let kernel_compression_type = get_compression_type kernel_file in
|
||||||
|
+ if string_prefix "riscv" host_cpu && kernel_compression_type <> Uncompressed
|
||||||
|
+ then
|
||||||
|
+ copy_and_uncompress_kernel kernel_compression_type kernel_file kernel
|
||||||
|
+ else
|
||||||
|
+ copy_or_symlink_kernel copy_kernel kernel_file kernel;
|
||||||
|
|
||||||
|
(kernel_version, modpath)
|
||||||
|
|
||||||
|
@@ -308,6 +334,13 @@ and read_string chan offset len =
|
||||||
|
really_input chan buf 0 len;
|
||||||
|
Bytes.to_string buf
|
||||||
|
|
||||||
|
+and copy_and_uncompress_kernel compression_type src dest =
|
||||||
|
+ let cmd =
|
||||||
|
+ match compression_type with
|
||||||
|
+ | GZip -> sprintf "zcat %s > %s" (quote src) (quote dest)
|
||||||
|
+ | Uncompressed -> sprintf "cp %s %s" (quote src) (quote dest) in
|
||||||
|
+ run_command cmd
|
||||||
|
+
|
||||||
|
and copy_or_symlink_kernel copy_kernel src dest =
|
||||||
|
if not copy_kernel then
|
||||||
|
symlink src dest
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: supermin
|
Name: supermin
|
||||||
Version: 5.3.3
|
Version: 5.3.3
|
||||||
Release: 3
|
Release: 4
|
||||||
Summary: A tool for building supermin appliances, required by libguestfs
|
Summary: A tool for building supermin appliances, required by libguestfs
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: http://libguestfs.org/
|
URL: http://libguestfs.org/
|
||||||
@ -11,8 +11,14 @@ Patch0002: 0002-use-installed-packages-instead-of-dnf-downloading.patch
|
|||||||
Patch9001: add-pie-and-bind_now-flags.patch
|
Patch9001: add-pie-and-bind_now-flags.patch
|
||||||
Patch9002: 9002-fix-cannot-detect-package-manager-on-UnionTech.patch
|
Patch9002: 9002-fix-cannot-detect-package-manager-on-UnionTech.patch
|
||||||
Patch0004: 0001-fix-cannot-detect-package-manager-on-NestOS.patch
|
Patch0004: 0001-fix-cannot-detect-package-manager-on-NestOS.patch
|
||||||
|
%ifarch riscv64
|
||||||
BuildRequires: augeas dietlibc-devel dnf dnf-plugins-core e2fsprogs-devel
|
Patch9100: 9100-src-format_ext2_kernel.ml-Rename-function-file-kerne.patch
|
||||||
|
Patch9101: 9101-src-Uncompress-kernel-on-RISC-V.patch
|
||||||
|
BuildRequires: musl-gcc musl-libc-static
|
||||||
|
%else
|
||||||
|
BuildRequires: dietlibc-devel
|
||||||
|
%endif
|
||||||
|
BuildRequires: augeas dnf dnf-plugins-core e2fsprogs-devel
|
||||||
BuildRequires: findutils gnupg2 grubby hivex ocaml ocaml-findlib-devel
|
BuildRequires: findutils gnupg2 grubby hivex ocaml ocaml-findlib-devel
|
||||||
BuildRequires: rpm rpm-devel systemd-udev tar
|
BuildRequires: rpm rpm-devel systemd-udev tar
|
||||||
BuildRequires: /usr/bin/pod2man /usr/bin/pod2html /usr/sbin/mke2fs
|
BuildRequires: /usr/bin/pod2man /usr/bin/pod2html /usr/sbin/mke2fs
|
||||||
@ -46,7 +52,11 @@ This contains man files for the using of supermin.
|
|||||||
|
|
||||||
%build
|
%build
|
||||||
%configure --disable-network-tests
|
%configure --disable-network-tests
|
||||||
|
%ifarch riscv64
|
||||||
|
make -C init CC="musl-gcc"
|
||||||
|
%else
|
||||||
make -C init CC="diet gcc"
|
make -C init CC="diet gcc"
|
||||||
|
%endif
|
||||||
%make_build
|
%make_build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
@ -69,6 +79,9 @@ install -m 0755 %{SOURCE2} $RPM_BUILD_ROOT%{_rpmconfigdir}/
|
|||||||
%{_mandir}/man1/*
|
%{_mandir}/man1/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Apr 22 2024 laokz <zhangkai@iscas.ac.cn> - 5.3.3-4
|
||||||
|
- riscv64: use musl instead of unsupported dietlibc
|
||||||
|
|
||||||
* Thu Nov 30 2023 chendexi <chendexi@kylinos.cn> - 5.3.3-3
|
* Thu Nov 30 2023 chendexi <chendexi@kylinos.cn> - 5.3.3-3
|
||||||
- Modify release file name due to release package name change
|
- Modify release file name due to release package name change
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user