Github messages for voidlinux
 help / color / mirror / Atom feed
From: Calandracas606 <Calandracas606@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] WIP: New package: muvm-0.1.3
Date: Thu, 31 Oct 2024 02:47:43 +0100	[thread overview]
Message-ID: <20241031014743.14D142E6AE@inbox.vuxu.org> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-52736@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages muvm
https://github.com/void-linux/void-packages/pull/52736

WIP: New package: muvm-0.1.3
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly** (haven't gotten it working properly yet though)

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, aarch64-musl
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64

A patch file from https://github.com/void-linux/void-packages/pull/52736.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-muvm-52736.patch --]
[-- Type: text/x-diff, Size: 12963 bytes --]

From d8d47c69e0282dd8d27da2b849238e6912485fef Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 21 Oct 2024 15:38:51 +0200
Subject: [PATCH 1/3] New package: libkrunfw-4.4.2

---
 common/shlibs              |  1 +
 srcpkgs/libkrunfw/template | 41 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 srcpkgs/libkrunfw/template

diff --git a/common/shlibs b/common/shlibs
index 338c0eb0b3709e..93428776dd0e8b 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4537,3 +4537,4 @@ libsfdo-desktop-file.so.0 libsfdo-0.1.3_1
 libsfdo-icon.so.0 libsfdo-0.1.3_1
 libKMahjongg6.so.6 libkmahjongg-24.08.2_1
 libflashrom.so.1 flashrom-1.4.0_1
+libkrunfw.so.4 libkrunfw-4.4.2_1
diff --git a/srcpkgs/libkrunfw/template b/srcpkgs/libkrunfw/template
new file mode 100644
index 00000000000000..9bff54c881e4b2
--- /dev/null
+++ b/srcpkgs/libkrunfw/template
@@ -0,0 +1,41 @@
+# Template file for 'libkrunfw'
+pkgname=libkrunfw
+version=4.4.2
+revision=1
+_kernel_version=6.6.52
+archs="x86_64* aarch64*"
+build_style=gnu-makefile
+hostmakedepends="python3-pyelftools tar xz bc cpio flex perl elfutils-devel"
+short_desc="Dynamic library bundling the guest payload consumed by libkrun"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="GPL-2.0-only AND LGPL-2.1-only"
+homepage="https://github.com/containers/libkrunfw"
+distfiles="https://github.com/containers/libkrunfw/archive/refs/tags/v${version}.tar.gz
+${KERNEL_SITE}/kernel/v${_kernel_version%%.*}.x/linux-${_kernel_version}.tar.xz"
+checksum="26a348bcb0a43a56ee98d67178a78fa6c9b6378a64532b2ad0bc9fe1f4cc3297
+ 1591ab348399d4aa53121158525056a69c8cf0fe0e90935b0095e9a58e37b4b8"
+
+skip_extraction="linux-${_kernel_version}.tar.xz"
+
+
+do_build() {
+	local _arch _cross
+
+	case "$XBPS_TARGET_MACHINE" in
+		x86_64*) _arch=x86_64;;
+		aarch64*) _arch=arm64 ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		_cross="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
+	fi
+
+	export LDFLAGS=
+
+	make ARCH=$_arch ${_cross} ${makejobs}
+}
+
+post_extract() {
+	mkdir tarballs
+	vsrccopy linux-${_kernel_version}.tar.xz tarballs
+}

From 3b8c93dc1400f4490f6585c7bacbcc9f7898e783 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 21 Oct 2024 23:48:49 +0200
Subject: [PATCH 2/3] New package: libkrun-1.9.5

---
 common/shlibs                            |   1 +
 srcpkgs/libkrun-devel                    |   1 +
 srcpkgs/libkrun-init                     |   1 +
 srcpkgs/libkrun/patches/musl-statx.patch | 183 +++++++++++++++++++++++
 srcpkgs/libkrun/template                 |  34 +++++
 5 files changed, 220 insertions(+)
 create mode 120000 srcpkgs/libkrun-devel
 create mode 120000 srcpkgs/libkrun-init
 create mode 100644 srcpkgs/libkrun/patches/musl-statx.patch
 create mode 100644 srcpkgs/libkrun/template

diff --git a/common/shlibs b/common/shlibs
index 93428776dd0e8b..169d33a8841cf1 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4538,3 +4538,4 @@ libsfdo-icon.so.0 libsfdo-0.1.3_1
 libKMahjongg6.so.6 libkmahjongg-24.08.2_1
 libflashrom.so.1 flashrom-1.4.0_1
 libkrunfw.so.4 libkrunfw-4.4.2_1
+libkrun.so.1 libkrun-1.9.5_1
diff --git a/srcpkgs/libkrun-devel b/srcpkgs/libkrun-devel
new file mode 120000
index 00000000000000..e33274fc2461c8
--- /dev/null
+++ b/srcpkgs/libkrun-devel
@@ -0,0 +1 @@
+libkrun
\ No newline at end of file
diff --git a/srcpkgs/libkrun-init b/srcpkgs/libkrun-init
new file mode 120000
index 00000000000000..e33274fc2461c8
--- /dev/null
+++ b/srcpkgs/libkrun-init
@@ -0,0 +1 @@
+libkrun
\ No newline at end of file
diff --git a/srcpkgs/libkrun/patches/musl-statx.patch b/srcpkgs/libkrun/patches/musl-statx.patch
new file mode 100644
index 00000000000000..da0c6d9c084b28
--- /dev/null
+++ b/srcpkgs/libkrun/patches/musl-statx.patch
@@ -0,0 +1,183 @@
+commit 1acd6a975adf824f821a99211b4fda3fdf6dbbfb
+Author: Daniel Martinez <danielmartinez@cock.li>
+Date:   Mon Oct 21 15:58:19 2024 +0200
+
+    Revert "virtio/fs/linux: announce submounts"
+    
+    This reverts commit 240ea9647017c05fc257ab8b6a875a1239872f98.
+
+diff --git a/src/devices/src/virtio/fs/linux/passthrough.rs b/src/devices/src/virtio/fs/linux/passthrough.rs
+index 38ec1e7..d774b28 100644
+--- a/src/devices/src/virtio/fs/linux/passthrough.rs
++++ b/src/devices/src/virtio/fs/linux/passthrough.rs
+@@ -39,15 +39,12 @@ type Handle = u64;
+ struct InodeAltKey {
+     ino: libc::ino64_t,
+     dev: libc::dev_t,
+-    mnt_id: u64,
+ }
+ 
+ struct InodeData {
+     inode: Inode,
+     // Most of these aren't actually files but ¯\_(ツ)_/¯.
+     file: File,
+-    dev: u64,
+-    mnt_id: u64,
+     refcount: AtomicU64,
+ }
+ 
+@@ -156,56 +153,6 @@ fn stat(f: &File) -> io::Result<libc::stat64> {
+     }
+ }
+ 
+-fn statx(f: &File) -> io::Result<(libc::stat64, u64)> {
+-    let mut stx = MaybeUninit::<libc::statx>::zeroed();
+-
+-    // Safe because this is a constant value and a valid C string.
+-    let pathname = unsafe { CStr::from_bytes_with_nul_unchecked(EMPTY_CSTR) };
+-
+-    // Safe because the kernel will only write data in `st` and we check the return
+-    // value.
+-    let res = unsafe {
+-        libc::statx(
+-            f.as_raw_fd(),
+-            pathname.as_ptr(),
+-            libc::AT_EMPTY_PATH | libc::AT_SYMLINK_NOFOLLOW,
+-            libc::STATX_BASIC_STATS | libc::STATX_MNT_ID,
+-            stx.as_mut_ptr(),
+-        )
+-    };
+-    if res >= 0 {
+-        // Safe because the kernel guarantees that the struct is now fully initialized.
+-        let stx = unsafe { stx.assume_init() };
+-
+-        // Unfortunately, we cannot use an initializer to create the stat64 object,
+-        // because it may contain padding and reserved fields (depending on the
+-        // architecture), and it does not implement the Default trait.
+-        // So we take a zeroed struct and set what we can. (Zero in all fields is
+-        // wrong, but safe.)
+-        let mut st = unsafe { MaybeUninit::<libc::stat64>::zeroed().assume_init() };
+-
+-        st.st_dev = libc::makedev(stx.stx_dev_major, stx.stx_dev_minor);
+-        st.st_ino = stx.stx_ino;
+-        st.st_mode = stx.stx_mode as _;
+-        st.st_nlink = stx.stx_nlink as _;
+-        st.st_uid = stx.stx_uid;
+-        st.st_gid = stx.stx_gid;
+-        st.st_rdev = libc::makedev(stx.stx_rdev_major, stx.stx_rdev_minor);
+-        st.st_size = stx.stx_size as _;
+-        st.st_blksize = stx.stx_blksize as _;
+-        st.st_blocks = stx.stx_blocks as _;
+-        st.st_atime = stx.stx_atime.tv_sec;
+-        st.st_atime_nsec = stx.stx_atime.tv_nsec as _;
+-        st.st_mtime = stx.stx_mtime.tv_sec;
+-        st.st_mtime_nsec = stx.stx_mtime.tv_nsec as _;
+-        st.st_ctime = stx.stx_ctime.tv_sec;
+-        st.st_ctime_nsec = stx.stx_ctime.tv_nsec as _;
+-        Ok((st, stx.stx_mnt_id))
+-    } else {
+-        Err(io::Error::last_os_error())
+-    }
+-}
+-
+ /// The caching policy that the file system should report to the FUSE client. By default the FUSE
+ /// protocol uses close-to-open consistency. This means that any cached contents of the file are
+ /// invalidated the next time that file is opened.
+@@ -340,7 +287,6 @@ pub struct PassthroughFs {
+     // Whether writeback caching is enabled for this directory. This will only be true when
+     // `cfg.writeback` is true and `init` was called with `FsOptions::WRITEBACK_CACHE`.
+     writeback: AtomicBool,
+-    announce_submounts: AtomicBool,
+ 
+     cfg: Config,
+ }
+@@ -390,7 +336,6 @@ impl PassthroughFs {
+             proc_self_fd,
+ 
+             writeback: AtomicBool::new(false),
+-            announce_submounts: AtomicBool::new(false),
+             cfg,
+         })
+     }
+@@ -492,21 +437,11 @@ impl PassthroughFs {
+         // Safe because we just opened this fd.
+         let f = unsafe { File::from_raw_fd(fd) };
+ 
+-        let (st, mnt_id) = statx(&f)?;
+-
+-        let mut attr_flags: u32 = 0;
+-
+-        if st.st_mode & libc::S_IFMT == libc::S_IFDIR
+-            && self.announce_submounts.load(Ordering::Relaxed)
+-            && (st.st_dev != p.dev || mnt_id != p.mnt_id)
+-        {
+-            attr_flags |= fuse::ATTR_SUBMOUNT;
+-        }
++        let st = stat(&f)?;
+ 
+         let altkey = InodeAltKey {
+             ino: st.st_ino,
+             dev: st.st_dev,
+-            mnt_id,
+         };
+         let data = self.inodes.read().unwrap().get_alt(&altkey).cloned();
+ 
+@@ -524,13 +459,10 @@ impl PassthroughFs {
+                 InodeAltKey {
+                     ino: st.st_ino,
+                     dev: st.st_dev,
+-                    mnt_id,
+                 },
+                 Arc::new(InodeData {
+                     inode,
+                     file: f,
+-                    dev: st.st_dev,
+-                    mnt_id,
+                     refcount: AtomicU64::new(1),
+                 }),
+             );
+@@ -544,7 +476,7 @@ impl PassthroughFs {
+             inode,
+             generation: 0,
+             attr: st,
+-            attr_flags,
++            attr_flags: 0,
+             attr_timeout: self.cfg.attr_timeout,
+             entry_timeout: self.cfg.entry_timeout,
+         })
+@@ -798,7 +730,7 @@ impl FileSystem for PassthroughFs {
+         // Safe because we just opened this fd above.
+         let f = unsafe { File::from_raw_fd(fd) };
+ 
+-        let (st, mnt_id) = statx(&f)?;
++        let st = stat(&f)?;
+ 
+         // Safe because this doesn't modify any memory and there is no need to check the return
+         // value because this system call always succeeds. We need to clear the umask here because
+@@ -813,13 +745,10 @@ impl FileSystem for PassthroughFs {
+             InodeAltKey {
+                 ino: st.st_ino,
+                 dev: st.st_dev,
+-                mnt_id,
+             },
+             Arc::new(InodeData {
+                 inode: fuse::ROOT_ID,
+                 file: f,
+-                dev: st.st_dev,
+-                mnt_id,
+                 refcount: AtomicU64::new(2),
+             }),
+         );
+@@ -829,12 +758,6 @@ impl FileSystem for PassthroughFs {
+             opts |= FsOptions::WRITEBACK_CACHE;
+             self.writeback.store(true, Ordering::Relaxed);
+         }
+-
+-        if capable.contains(FsOptions::SUBMOUNTS) {
+-            opts |= FsOptions::SUBMOUNTS;
+-            self.announce_submounts.store(true, Ordering::Relaxed);
+-        }
+-
+         Ok(opts)
+     }
+ 
diff --git a/srcpkgs/libkrun/template b/srcpkgs/libkrun/template
new file mode 100644
index 00000000000000..4227ee1a4daab2
--- /dev/null
+++ b/srcpkgs/libkrun/template
@@ -0,0 +1,34 @@
+# Template file for 'libkrun'
+pkgname=libkrun
+version=1.9.5
+revision=1
+build_style=gnu-makefile
+build_helper=rust
+make_build_args="BLK=1 GPU=1 NET=1 SND=1 BUILD_INIT=1"
+hostmakedepends="patchelf cargo pkg-config llvm18-devel"
+makedepends="libkrunfw cargo libepoxy-devel libdrm-devel virglrenderer-devel pipewire-devel"
+short_desc="Library providing Virtualization-based process isolation capabilities"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://github.com/containers/libkrun"
+distfiles="https://github.com/containers/libkrun/archive/refs/tags/v${version}.tar.gz"
+checksum=17533ce6a2c76565816b3d80d69779a5972075998c34795ad98c589206549a12
+
+export XBPS_CROSS_RUST_TARGET
+
+libkrun-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}
+
+libkrun-init_package() {
+	short_desc+=" - init binary"
+	pkg_install() {
+		vbin init/init libkrun-init
+	}
+}

From 2793f1dbe4603598dd0fc1edb0b54cfeef697a66 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 22 Oct 2024 00:34:46 +0200
Subject: [PATCH 3/3] New package: muvm-0.1.3

---
 srcpkgs/muvm/template | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 srcpkgs/muvm/template

diff --git a/srcpkgs/muvm/template b/srcpkgs/muvm/template
new file mode 100644
index 00000000000000..edd169d342b5f1
--- /dev/null
+++ b/srcpkgs/muvm/template
@@ -0,0 +1,23 @@
+# Template file for 'muvm'
+pkgname=muvm
+version=0.1.3
+revision=1
+build_style=cargo
+makedepends="llvm18-devel libkrun-devel"
+depends="passt"
+short_desc="Run programs from your system in a microVM"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT AND Apache-2.0"
+homepage="https://github.com/AsahiLinux/muvm"
+distfiles="https://github.com/AsahiLinux/muvm/archive/refs/tags/muvm-${version}.tar.gz"
+checksum=bf721e1fdf3c7b3f7a1c83aaa78d1913d4c17b6a740dca3ca1a726698423e477
+
+do_install() {
+	vbin target/${XBPS_RUST_TARGET}/release/muvm
+	vbin target/${XBPS_RUST_TARGET}/release/muvm-guest
+	vbin target/${XBPS_RUST_TARGET}/release/muvm-server
+}
+
+post_install() {
+	vlicense crates/muvm/LICENSE
+}

  parent reply	other threads:[~2024-10-31  1:47 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22  7:34 [PR PATCH] " Calandracas606
2024-10-22  7:38 ` [PR PATCH] [Updated] " Calandracas606
2024-10-24 13:44 ` dkwo
2024-10-27 12:41 ` Calandracas606
2024-10-27 23:51 ` dkwo
2024-10-28 13:41 ` dkwo
2024-10-28 13:45 ` dkwo
2024-10-31  1:47 ` Calandracas606 [this message]
2024-10-31  1:51 ` Calandracas606
2024-10-31  2:07 ` [PR PATCH] [Updated] " Calandracas606
2024-10-31  2:21 ` Calandracas606
2024-10-31 15:52 ` Calandracas606
2024-10-31 15:58 ` Calandracas606
2024-10-31 16:02 ` Calandracas606
2024-10-31 16:03 ` [PR PATCH] [Updated] " Calandracas606
2024-10-31 16:24 ` Calandracas606
2024-10-31 16:44 ` [PR PATCH] [Updated] " Calandracas606
2024-10-31 16:55 ` Calandracas606
2024-10-31 16:58 ` Calandracas606
2024-10-31 17:12 ` Calandracas606
2024-10-31 17:17 ` Calandracas606
2024-10-31 17:17 ` Calandracas606
2024-10-31 17:41 ` [PR PATCH] [Updated] " Calandracas606
2024-10-31 17:43 ` Calandracas606
2024-11-02 20:21 ` dkwo
2025-02-01  2:00 ` github-actions
2025-02-06 23:26 ` Calandracas606
2025-02-17 22:03 ` [PR PATCH] [Updated] " Calandracas606
2025-02-17 22:21 ` Calandracas606
2025-05-19  2:13 ` github-actions
2025-06-02  2:14 ` [PR PATCH] [Closed]: " github-actions

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241031014743.14D142E6AE@inbox.vuxu.org \
    --to=calandracas606@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).