* [PR PATCH] WIP: New package: muvm-0.1.3
@ 2024-10-22 7:34 Calandracas606
2024-10-22 7:38 ` [PR PATCH] [Updated] " Calandracas606
` (23 more replies)
0 siblings, 24 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-22 7:34 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]
There is a new 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: 12616 bytes --]
From c19a2753e65fa938509fbfbebae018cfbdec5c75 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 | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+)
create mode 100644 srcpkgs/libkrunfw/template
diff --git a/common/shlibs b/common/shlibs
index 6d083594e55a51..f6cc9a3f773d49 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4538,3 +4538,4 @@ libsfdo-desktop.so.0 libsfdo-0.1.3_1
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
+libkrunfw.so.4 libkrunfw-4.4.2_1
diff --git a/srcpkgs/libkrunfw/template b/srcpkgs/libkrunfw/template
new file mode 100644
index 00000000000000..ebbafa21373650
--- /dev/null
+++ b/srcpkgs/libkrunfw/template
@@ -0,0 +1,23 @@
+# 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"
+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"
+
+post_extract() {
+ mkdir tarballs
+ vsrccopy linux-${_kernel_version}.tar.xz tarballs
+}
From 7770f3a5b373de996f78acef4e22b219c45f2972 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 | 32 ++++
5 files changed, 218 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 f6cc9a3f773d49..666c3e35419948 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4539,3 +4539,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
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..7c53f4b5fa7b57
--- /dev/null
+++ b/srcpkgs/libkrun/template
@@ -0,0 +1,32 @@
+# 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 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
+
+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 73ceb797f1c150ba1cbd2b6cc67579d7d39dfc85 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
+}
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PR PATCH] [Updated] WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
@ 2024-10-22 7:38 ` Calandracas606
2024-10-24 13:44 ` dkwo
` (22 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-22 7:38 UTC (permalink / raw)
To: ml
[-- 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: 12647 bytes --]
From 061e89343e536d20f381c31f11a72f865c994f4e 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 | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+)
create mode 100644 srcpkgs/libkrunfw/template
diff --git a/common/shlibs b/common/shlibs
index 6d083594e55a51..f6cc9a3f773d49 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4538,3 +4538,4 @@ libsfdo-desktop.so.0 libsfdo-0.1.3_1
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
+libkrunfw.so.4 libkrunfw-4.4.2_1
diff --git a/srcpkgs/libkrunfw/template b/srcpkgs/libkrunfw/template
new file mode 100644
index 00000000000000..afc488ed926c81
--- /dev/null
+++ b/srcpkgs/libkrunfw/template
@@ -0,0 +1,24 @@
+# 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"
+makedepends="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"
+
+post_extract() {
+ mkdir tarballs
+ vsrccopy linux-${_kernel_version}.tar.xz tarballs
+}
From 739ac64c31b3b39bf9c6a9c2bfd541843493a731 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 | 32 ++++
5 files changed, 218 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 f6cc9a3f773d49..666c3e35419948 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4539,3 +4539,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
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..7c53f4b5fa7b57
--- /dev/null
+++ b/srcpkgs/libkrun/template
@@ -0,0 +1,32 @@
+# 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 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
+
+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 cc236aac1564c5b8e91d3dfc177fa73578b099ac 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
+}
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
2024-10-22 7:38 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-10-24 13:44 ` dkwo
2024-10-27 12:41 ` Calandracas606
` (21 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: dkwo @ 2024-10-24 13:44 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 225 bytes --]
New comment by dkwo on void-packages repository
https://github.com/void-linux/void-packages/pull/52736#issuecomment-2435341241
Comment:
I wonder if this is not working due to `libkrun` requiring C Library static libraries.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 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
` (20 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-27 12:41 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 249 bytes --]
New comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/52736#issuecomment-2440000359
Comment:
@dkwo could you try this with removing the patch to libkrun? I only have access to a musl system atm
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (2 preceding siblings ...)
2024-10-27 12:41 ` Calandracas606
@ 2024-10-27 23:51 ` dkwo
2024-10-28 13:41 ` dkwo
` (19 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: dkwo @ 2024-10-27 23:51 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 188 bytes --]
New comment by dkwo on void-packages repository
https://github.com/void-linux/void-packages/pull/52736#issuecomment-2440225942
Comment:
I tried without patch, it fails in the same way.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (3 preceding siblings ...)
2024-10-27 23:51 ` dkwo
@ 2024-10-28 13:41 ` dkwo
2024-10-28 13:45 ` dkwo
` (18 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: dkwo @ 2024-10-28 13:41 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 234 bytes --]
New comment by dkwo on void-packages repository
https://github.com/void-linux/void-packages/pull/52736#issuecomment-2441624994
Comment:
is it possible to build `libkurn` as rust/cargo build style, and only run make at post-install?
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (4 preceding siblings ...)
2024-10-28 13:41 ` dkwo
@ 2024-10-28 13:45 ` dkwo
2024-10-31 1:47 ` [PR PATCH] [Updated] " Calandracas606
` (17 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: dkwo @ 2024-10-28 13:45 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 234 bytes --]
New comment by dkwo on void-packages repository
https://github.com/void-linux/void-packages/pull/52736#issuecomment-2441624994
Comment:
is it possible to build `libkrun` as rust/cargo build style, and only run make at post-install?
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PR PATCH] [Updated] WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (5 preceding siblings ...)
2024-10-28 13:45 ` dkwo
@ 2024-10-31 1:47 ` Calandracas606
2024-10-31 1:51 ` Calandracas606
` (16 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 1:47 UTC (permalink / raw)
To: ml
[-- 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
+}
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (6 preceding siblings ...)
2024-10-31 1:47 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-10-31 1:51 ` Calandracas606
2024-10-31 2:07 ` [PR PATCH] [Updated] " Calandracas606
` (15 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 1:51 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 394 bytes --]
New comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/52736#issuecomment-2448855958
Comment:
> is it possible to build `libkrun` as rust/cargo build style, and only run make at post-install?
probably not a good idea, since there's a bunch of other stuff being done in the makefile, such as building c code, pkgconfig file, and patchelf
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PR PATCH] [Updated] WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (7 preceding siblings ...)
2024-10-31 1:51 ` Calandracas606
@ 2024-10-31 2:07 ` Calandracas606
2024-10-31 2:21 ` Calandracas606
` (14 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 2:07 UTC (permalink / raw)
To: ml
[-- 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: 14164 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 bbe37a133a5a158080465351e5a3f300562a9393 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/makefile.patch | 22 +++
srcpkgs/libkrun/patches/musl-statx.patch | 183 +++++++++++++++++++++++
srcpkgs/libkrun/template | 34 +++++
6 files changed, 242 insertions(+)
create mode 120000 srcpkgs/libkrun-devel
create mode 120000 srcpkgs/libkrun-init
create mode 100644 srcpkgs/libkrun/patches/makefile.patch
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/makefile.patch b/srcpkgs/libkrun/patches/makefile.patch
new file mode 100644
index 00000000000000..3909cd0e534a2c
--- /dev/null
+++ b/srcpkgs/libkrun/patches/makefile.patch
@@ -0,0 +1,22 @@
+diff --git a/Makefile b/Makefile
+index c4c532f..572c898 100644
+--- a/Makefile
++++ b/Makefile
+@@ -83,7 +83,7 @@ debug: $(LIBRARY_DEBUG_$(OS)) libkrun.pc
+ ifeq ($(BUILD_INIT),1)
+ INIT_BINARY = init/init
+ $(INIT_BINARY): $(INIT_SRC)
+- gcc -O2 -static -Wall $(INIT_DEFS) -o $@ $(INIT_SRC) $(INIT_DEFS)
++ $(CC) -O2 -static -Wall $(INIT_DEFS) -o $@ $(INIT_SRC) $(INIT_DEFS)
+ endif
+
+ $(LIBRARY_RELEASE_$(OS)): $(INIT_BINARY)
+@@ -92,7 +92,7 @@ ifeq ($(SEV),1)
+ mv target/release/libkrun.so target/release/$(KRUN_BASE_$(OS))
+ endif
+ ifeq ($(OS),Linux)
+- patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/release/$(KRUN_BASE_$(OS))
++ patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/$(XBPS_CROSS_RUST_TARGET)/release/$(KRUN_BASE_$(OS))
+ else
+ ifeq ($(EFI),1)
+ ifeq ($(OS),Darwin)
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 e3fff189439b70f1dd5babd640b7129ebaac8fd2 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
+}
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PR PATCH] [Updated] WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (8 preceding siblings ...)
2024-10-31 2:07 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-10-31 2:21 ` Calandracas606
2024-10-31 15:52 ` Calandracas606
` (13 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 2:21 UTC (permalink / raw)
To: ml
[-- 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: 14202 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 bbe37a133a5a158080465351e5a3f300562a9393 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/makefile.patch | 22 +++
srcpkgs/libkrun/patches/musl-statx.patch | 183 +++++++++++++++++++++++
srcpkgs/libkrun/template | 34 +++++
6 files changed, 242 insertions(+)
create mode 120000 srcpkgs/libkrun-devel
create mode 120000 srcpkgs/libkrun-init
create mode 100644 srcpkgs/libkrun/patches/makefile.patch
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/makefile.patch b/srcpkgs/libkrun/patches/makefile.patch
new file mode 100644
index 00000000000000..3909cd0e534a2c
--- /dev/null
+++ b/srcpkgs/libkrun/patches/makefile.patch
@@ -0,0 +1,22 @@
+diff --git a/Makefile b/Makefile
+index c4c532f..572c898 100644
+--- a/Makefile
++++ b/Makefile
+@@ -83,7 +83,7 @@ debug: $(LIBRARY_DEBUG_$(OS)) libkrun.pc
+ ifeq ($(BUILD_INIT),1)
+ INIT_BINARY = init/init
+ $(INIT_BINARY): $(INIT_SRC)
+- gcc -O2 -static -Wall $(INIT_DEFS) -o $@ $(INIT_SRC) $(INIT_DEFS)
++ $(CC) -O2 -static -Wall $(INIT_DEFS) -o $@ $(INIT_SRC) $(INIT_DEFS)
+ endif
+
+ $(LIBRARY_RELEASE_$(OS)): $(INIT_BINARY)
+@@ -92,7 +92,7 @@ ifeq ($(SEV),1)
+ mv target/release/libkrun.so target/release/$(KRUN_BASE_$(OS))
+ endif
+ ifeq ($(OS),Linux)
+- patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/release/$(KRUN_BASE_$(OS))
++ patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/$(XBPS_CROSS_RUST_TARGET)/release/$(KRUN_BASE_$(OS))
+ else
+ ifeq ($(EFI),1)
+ ifeq ($(OS),Darwin)
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 3cbc6a93f9991f319b93242a616b549619225134 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 | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 srcpkgs/muvm/template
diff --git a/srcpkgs/muvm/template b/srcpkgs/muvm/template
new file mode 100644
index 00000000000000..dddbae61e3972f
--- /dev/null
+++ b/srcpkgs/muvm/template
@@ -0,0 +1,26 @@
+# Template file for 'muvm'
+pkgname=muvm
+version=0.1.3
+revision=1
+build_style=cargo
+hostmakedepends="llvm18-devel"
+makedepends="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() {
+ local _target
+ _target="target/${XBPS_CROSS_RUST_TARGET:=$XBPS_RUST_TARGET}/release"
+ vbin ${_target}/muvm
+ vbin ${_target}/muvm-guest
+ vbin ${_target}/muvm-server
+}
+
+post_install() {
+ vlicense crates/muvm/LICENSE
+}
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PR PATCH] [Updated] WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (9 preceding siblings ...)
2024-10-31 2:21 ` Calandracas606
@ 2024-10-31 15:52 ` Calandracas606
2024-10-31 15:58 ` Calandracas606
` (12 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 15:52 UTC (permalink / raw)
To: ml
[-- 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: 15413 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/4] 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 bbe37a133a5a158080465351e5a3f300562a9393 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/4] New package: libkrun-1.9.5
---
common/shlibs | 1 +
srcpkgs/libkrun-devel | 1 +
srcpkgs/libkrun-init | 1 +
srcpkgs/libkrun/patches/makefile.patch | 22 +++
srcpkgs/libkrun/patches/musl-statx.patch | 183 +++++++++++++++++++++++
srcpkgs/libkrun/template | 34 +++++
6 files changed, 242 insertions(+)
create mode 120000 srcpkgs/libkrun-devel
create mode 120000 srcpkgs/libkrun-init
create mode 100644 srcpkgs/libkrun/patches/makefile.patch
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/makefile.patch b/srcpkgs/libkrun/patches/makefile.patch
new file mode 100644
index 00000000000000..3909cd0e534a2c
--- /dev/null
+++ b/srcpkgs/libkrun/patches/makefile.patch
@@ -0,0 +1,22 @@
+diff --git a/Makefile b/Makefile
+index c4c532f..572c898 100644
+--- a/Makefile
++++ b/Makefile
+@@ -83,7 +83,7 @@ debug: $(LIBRARY_DEBUG_$(OS)) libkrun.pc
+ ifeq ($(BUILD_INIT),1)
+ INIT_BINARY = init/init
+ $(INIT_BINARY): $(INIT_SRC)
+- gcc -O2 -static -Wall $(INIT_DEFS) -o $@ $(INIT_SRC) $(INIT_DEFS)
++ $(CC) -O2 -static -Wall $(INIT_DEFS) -o $@ $(INIT_SRC) $(INIT_DEFS)
+ endif
+
+ $(LIBRARY_RELEASE_$(OS)): $(INIT_BINARY)
+@@ -92,7 +92,7 @@ ifeq ($(SEV),1)
+ mv target/release/libkrun.so target/release/$(KRUN_BASE_$(OS))
+ endif
+ ifeq ($(OS),Linux)
+- patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/release/$(KRUN_BASE_$(OS))
++ patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/$(XBPS_CROSS_RUST_TARGET)/release/$(KRUN_BASE_$(OS))
+ else
+ ifeq ($(EFI),1)
+ ifeq ($(OS),Darwin)
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 e8e76da9f8ae8898924aa0c4fba8eb052b7d5607 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Thu, 31 Oct 2024 11:50:20 -0400
Subject: [PATCH 3/4] New package: hidpipe-0.1.1
---
srcpkgs/hidpipe/template | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 srcpkgs/hidpipe/template
diff --git a/srcpkgs/hidpipe/template b/srcpkgs/hidpipe/template
new file mode 100644
index 00000000000000..dc594b7ab32a3b
--- /dev/null
+++ b/srcpkgs/hidpipe/template
@@ -0,0 +1,20 @@
+# Template file for 'hidpipe'
+pkgname=hidpipe
+version=0.1.1
+revision=1
+build_style=cargo
+hostmakedepends="pkg-config"
+makedepends="eudev-libudev-devel"
+short_desc="Pass input devices through to virtual machines"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://github.com/AsahiLinux/hidpipe"
+distfiles="https://github.com/AsahiLinux/hidpipe/archive/refs/tags/v${version}.tar.gz"
+checksum=0e64b25066c97d07f5b84bb7ab2f7257cae0205a2cd56c65bed2abcfc1e22362
+
+post_install() {
+ vlicense LICENSE
+
+ vinstall etc/systemd/user/hidpipe.socket 644 etc/systemd/user
+ vinstall etc/systemd/user/hidpipe.service 644 etc/systemd/user
+}
From 7a2ada906128b3c9834af52142c8e72629c3a37c Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 22 Oct 2024 00:34:46 +0200
Subject: [PATCH 4/4] New package: muvm-0.1.3
---
srcpkgs/muvm/template | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 srcpkgs/muvm/template
diff --git a/srcpkgs/muvm/template b/srcpkgs/muvm/template
new file mode 100644
index 00000000000000..4046ce39448aa3
--- /dev/null
+++ b/srcpkgs/muvm/template
@@ -0,0 +1,26 @@
+# Template file for 'muvm'
+pkgname=muvm
+version=0.1.3
+revision=1
+build_style=cargo
+hostmakedepends="llvm18-devel"
+makedepends="libkrun-devel"
+depends="passt hidpipe"
+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() {
+ local _target
+ _target="target/${XBPS_CROSS_RUST_TARGET:=$XBPS_RUST_TARGET}/release"
+ vbin ${_target}/muvm
+ vbin ${_target}/muvm-guest
+ vbin ${_target}/muvm-server
+}
+
+post_install() {
+ vlicense crates/muvm/LICENSE
+}
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PR PATCH] [Updated] WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (10 preceding siblings ...)
2024-10-31 15:52 ` Calandracas606
@ 2024-10-31 15:58 ` Calandracas606
2024-10-31 16:02 ` Calandracas606
` (11 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 15:58 UTC (permalink / raw)
To: ml
[-- 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: 15525 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/4] 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 bbe37a133a5a158080465351e5a3f300562a9393 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/4] New package: libkrun-1.9.5
---
common/shlibs | 1 +
srcpkgs/libkrun-devel | 1 +
srcpkgs/libkrun-init | 1 +
srcpkgs/libkrun/patches/makefile.patch | 22 +++
srcpkgs/libkrun/patches/musl-statx.patch | 183 +++++++++++++++++++++++
srcpkgs/libkrun/template | 34 +++++
6 files changed, 242 insertions(+)
create mode 120000 srcpkgs/libkrun-devel
create mode 120000 srcpkgs/libkrun-init
create mode 100644 srcpkgs/libkrun/patches/makefile.patch
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/makefile.patch b/srcpkgs/libkrun/patches/makefile.patch
new file mode 100644
index 00000000000000..3909cd0e534a2c
--- /dev/null
+++ b/srcpkgs/libkrun/patches/makefile.patch
@@ -0,0 +1,22 @@
+diff --git a/Makefile b/Makefile
+index c4c532f..572c898 100644
+--- a/Makefile
++++ b/Makefile
+@@ -83,7 +83,7 @@ debug: $(LIBRARY_DEBUG_$(OS)) libkrun.pc
+ ifeq ($(BUILD_INIT),1)
+ INIT_BINARY = init/init
+ $(INIT_BINARY): $(INIT_SRC)
+- gcc -O2 -static -Wall $(INIT_DEFS) -o $@ $(INIT_SRC) $(INIT_DEFS)
++ $(CC) -O2 -static -Wall $(INIT_DEFS) -o $@ $(INIT_SRC) $(INIT_DEFS)
+ endif
+
+ $(LIBRARY_RELEASE_$(OS)): $(INIT_BINARY)
+@@ -92,7 +92,7 @@ ifeq ($(SEV),1)
+ mv target/release/libkrun.so target/release/$(KRUN_BASE_$(OS))
+ endif
+ ifeq ($(OS),Linux)
+- patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/release/$(KRUN_BASE_$(OS))
++ patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/$(XBPS_CROSS_RUST_TARGET)/release/$(KRUN_BASE_$(OS))
+ else
+ ifeq ($(EFI),1)
+ ifeq ($(OS),Darwin)
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 917b2372453636fbf0c1612c86b4aebdf39a69dd Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Thu, 31 Oct 2024 11:50:20 -0400
Subject: [PATCH 3/4] New package: hidpipe-0.1.1
---
srcpkgs/hidpipe/template | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 srcpkgs/hidpipe/template
diff --git a/srcpkgs/hidpipe/template b/srcpkgs/hidpipe/template
new file mode 100644
index 00000000000000..a4550469b360ae
--- /dev/null
+++ b/srcpkgs/hidpipe/template
@@ -0,0 +1,24 @@
+# Template file for 'hidpipe'
+pkgname=hidpipe
+version=0.1.1
+revision=1
+build_style=cargo
+hostmakedepends="pkg-config"
+makedepends="eudev-libudev-devel"
+short_desc="Pass input devices through to virtual machines"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://github.com/AsahiLinux/hidpipe"
+distfiles="https://github.com/AsahiLinux/hidpipe/archive/refs/tags/v${version}.tar.gz"
+checksum=0e64b25066c97d07f5b84bb7ab2f7257cae0205a2cd56c65bed2abcfc1e22362
+
+if [ ! "$XBPS_TARGET_WORDSIZE" == 64 ]; then
+ broken="mismatched types expected `i64`, found `i32`"
+fi
+
+post_install() {
+ vlicense LICENSE
+
+ vinstall etc/systemd/user/hidpipe.socket 644 etc/systemd/user
+ vinstall etc/systemd/user/hidpipe.service 644 etc/systemd/user
+}
From 9dc2223b7632d7c5e737f3854862689cb04ab834 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 22 Oct 2024 00:34:46 +0200
Subject: [PATCH 4/4] New package: muvm-0.1.3
---
srcpkgs/muvm/template | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 srcpkgs/muvm/template
diff --git a/srcpkgs/muvm/template b/srcpkgs/muvm/template
new file mode 100644
index 00000000000000..4046ce39448aa3
--- /dev/null
+++ b/srcpkgs/muvm/template
@@ -0,0 +1,26 @@
+# Template file for 'muvm'
+pkgname=muvm
+version=0.1.3
+revision=1
+build_style=cargo
+hostmakedepends="llvm18-devel"
+makedepends="libkrun-devel"
+depends="passt hidpipe"
+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() {
+ local _target
+ _target="target/${XBPS_CROSS_RUST_TARGET:=$XBPS_RUST_TARGET}/release"
+ vbin ${_target}/muvm
+ vbin ${_target}/muvm-guest
+ vbin ${_target}/muvm-server
+}
+
+post_install() {
+ vlicense crates/muvm/LICENSE
+}
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (11 preceding siblings ...)
2024-10-31 15:58 ` Calandracas606
@ 2024-10-31 16:02 ` Calandracas606
2024-10-31 16:03 ` [PR PATCH] [Updated] " Calandracas606
` (10 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 16:02 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 387 bytes --]
New comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/52736#issuecomment-2450250912
Comment:
unfortunately I think that this might hard-depend on systemd.
After adding my user to the `kvm` group, I was able to use muvm successfully on my aarch64-musl systemd install, but haven't gotten it to work on my x86_64-glic runit system
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PR PATCH] [Updated] WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (12 preceding siblings ...)
2024-10-31 16:02 ` Calandracas606
@ 2024-10-31 16:03 ` Calandracas606
2024-10-31 16:24 ` Calandracas606
` (9 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 16:03 UTC (permalink / raw)
To: ml
[-- 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: 15525 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/4] 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 bbe37a133a5a158080465351e5a3f300562a9393 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/4] New package: libkrun-1.9.5
---
common/shlibs | 1 +
srcpkgs/libkrun-devel | 1 +
srcpkgs/libkrun-init | 1 +
srcpkgs/libkrun/patches/makefile.patch | 22 +++
srcpkgs/libkrun/patches/musl-statx.patch | 183 +++++++++++++++++++++++
srcpkgs/libkrun/template | 34 +++++
6 files changed, 242 insertions(+)
create mode 120000 srcpkgs/libkrun-devel
create mode 120000 srcpkgs/libkrun-init
create mode 100644 srcpkgs/libkrun/patches/makefile.patch
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/makefile.patch b/srcpkgs/libkrun/patches/makefile.patch
new file mode 100644
index 00000000000000..3909cd0e534a2c
--- /dev/null
+++ b/srcpkgs/libkrun/patches/makefile.patch
@@ -0,0 +1,22 @@
+diff --git a/Makefile b/Makefile
+index c4c532f..572c898 100644
+--- a/Makefile
++++ b/Makefile
+@@ -83,7 +83,7 @@ debug: $(LIBRARY_DEBUG_$(OS)) libkrun.pc
+ ifeq ($(BUILD_INIT),1)
+ INIT_BINARY = init/init
+ $(INIT_BINARY): $(INIT_SRC)
+- gcc -O2 -static -Wall $(INIT_DEFS) -o $@ $(INIT_SRC) $(INIT_DEFS)
++ $(CC) -O2 -static -Wall $(INIT_DEFS) -o $@ $(INIT_SRC) $(INIT_DEFS)
+ endif
+
+ $(LIBRARY_RELEASE_$(OS)): $(INIT_BINARY)
+@@ -92,7 +92,7 @@ ifeq ($(SEV),1)
+ mv target/release/libkrun.so target/release/$(KRUN_BASE_$(OS))
+ endif
+ ifeq ($(OS),Linux)
+- patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/release/$(KRUN_BASE_$(OS))
++ patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/$(XBPS_CROSS_RUST_TARGET)/release/$(KRUN_BASE_$(OS))
+ else
+ ifeq ($(EFI),1)
+ ifeq ($(OS),Darwin)
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 59dd82308ab8a09b78441a3eba2a7c48ad680a29 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Thu, 31 Oct 2024 11:50:20 -0400
Subject: [PATCH 3/4] New package: hidpipe-0.1.1
---
srcpkgs/hidpipe/template | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 srcpkgs/hidpipe/template
diff --git a/srcpkgs/hidpipe/template b/srcpkgs/hidpipe/template
new file mode 100644
index 00000000000000..52431abf907416
--- /dev/null
+++ b/srcpkgs/hidpipe/template
@@ -0,0 +1,24 @@
+# Template file for 'hidpipe'
+pkgname=hidpipe
+version=0.1.1
+revision=1
+build_style=cargo
+hostmakedepends="pkg-config"
+makedepends="eudev-libudev-devel"
+short_desc="Pass input devices through to virtual machines"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://github.com/AsahiLinux/hidpipe"
+distfiles="https://github.com/AsahiLinux/hidpipe/archive/refs/tags/v${version}.tar.gz"
+checksum=0e64b25066c97d07f5b84bb7ab2f7257cae0205a2cd56c65bed2abcfc1e22362
+
+if [ ! "$XBPS_TARGET_WORDSIZE" == 64 ]; then
+ broken="mismatched types expected 'i64', found 'i32'"
+fi
+
+post_install() {
+ vlicense LICENSE
+
+ vinstall etc/systemd/user/hidpipe.socket 644 etc/systemd/user
+ vinstall etc/systemd/user/hidpipe.service 644 etc/systemd/user
+}
From ba6e577b86dfb82534b1d1a47a012b029aebdb6b Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 22 Oct 2024 00:34:46 +0200
Subject: [PATCH 4/4] New package: muvm-0.1.3
---
srcpkgs/muvm/template | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 srcpkgs/muvm/template
diff --git a/srcpkgs/muvm/template b/srcpkgs/muvm/template
new file mode 100644
index 00000000000000..4046ce39448aa3
--- /dev/null
+++ b/srcpkgs/muvm/template
@@ -0,0 +1,26 @@
+# Template file for 'muvm'
+pkgname=muvm
+version=0.1.3
+revision=1
+build_style=cargo
+hostmakedepends="llvm18-devel"
+makedepends="libkrun-devel"
+depends="passt hidpipe"
+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() {
+ local _target
+ _target="target/${XBPS_CROSS_RUST_TARGET:=$XBPS_RUST_TARGET}/release"
+ vbin ${_target}/muvm
+ vbin ${_target}/muvm-guest
+ vbin ${_target}/muvm-server
+}
+
+post_install() {
+ vlicense crates/muvm/LICENSE
+}
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (13 preceding siblings ...)
2024-10-31 16:03 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-10-31 16:24 ` Calandracas606
2024-10-31 16:44 ` [PR PATCH] [Updated] " Calandracas606
` (8 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 16:24 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 388 bytes --]
New comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/52736#issuecomment-2450250912
Comment:
unfortunately I think that this might hard-depend on systemd.
After adding my user to the `kvm` group, I was able to use muvm successfully on my aarch64-musl systemd install, but haven't gotten it to work on my x86_64-glibc runit system
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PR PATCH] [Updated] WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (14 preceding siblings ...)
2024-10-31 16:24 ` Calandracas606
@ 2024-10-31 16:44 ` Calandracas606
2024-10-31 16:55 ` Calandracas606
` (7 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 16:44 UTC (permalink / raw)
To: ml
[-- 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: 16387 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/4] 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 bbe37a133a5a158080465351e5a3f300562a9393 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/4] New package: libkrun-1.9.5
---
common/shlibs | 1 +
srcpkgs/libkrun-devel | 1 +
srcpkgs/libkrun-init | 1 +
srcpkgs/libkrun/patches/makefile.patch | 22 +++
srcpkgs/libkrun/patches/musl-statx.patch | 183 +++++++++++++++++++++++
srcpkgs/libkrun/template | 34 +++++
6 files changed, 242 insertions(+)
create mode 120000 srcpkgs/libkrun-devel
create mode 120000 srcpkgs/libkrun-init
create mode 100644 srcpkgs/libkrun/patches/makefile.patch
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/makefile.patch b/srcpkgs/libkrun/patches/makefile.patch
new file mode 100644
index 00000000000000..3909cd0e534a2c
--- /dev/null
+++ b/srcpkgs/libkrun/patches/makefile.patch
@@ -0,0 +1,22 @@
+diff --git a/Makefile b/Makefile
+index c4c532f..572c898 100644
+--- a/Makefile
++++ b/Makefile
+@@ -83,7 +83,7 @@ debug: $(LIBRARY_DEBUG_$(OS)) libkrun.pc
+ ifeq ($(BUILD_INIT),1)
+ INIT_BINARY = init/init
+ $(INIT_BINARY): $(INIT_SRC)
+- gcc -O2 -static -Wall $(INIT_DEFS) -o $@ $(INIT_SRC) $(INIT_DEFS)
++ $(CC) -O2 -static -Wall $(INIT_DEFS) -o $@ $(INIT_SRC) $(INIT_DEFS)
+ endif
+
+ $(LIBRARY_RELEASE_$(OS)): $(INIT_BINARY)
+@@ -92,7 +92,7 @@ ifeq ($(SEV),1)
+ mv target/release/libkrun.so target/release/$(KRUN_BASE_$(OS))
+ endif
+ ifeq ($(OS),Linux)
+- patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/release/$(KRUN_BASE_$(OS))
++ patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/$(XBPS_CROSS_RUST_TARGET)/release/$(KRUN_BASE_$(OS))
+ else
+ ifeq ($(EFI),1)
+ ifeq ($(OS),Darwin)
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 59dd82308ab8a09b78441a3eba2a7c48ad680a29 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Thu, 31 Oct 2024 11:50:20 -0400
Subject: [PATCH 3/4] New package: hidpipe-0.1.1
---
srcpkgs/hidpipe/template | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 srcpkgs/hidpipe/template
diff --git a/srcpkgs/hidpipe/template b/srcpkgs/hidpipe/template
new file mode 100644
index 00000000000000..52431abf907416
--- /dev/null
+++ b/srcpkgs/hidpipe/template
@@ -0,0 +1,24 @@
+# Template file for 'hidpipe'
+pkgname=hidpipe
+version=0.1.1
+revision=1
+build_style=cargo
+hostmakedepends="pkg-config"
+makedepends="eudev-libudev-devel"
+short_desc="Pass input devices through to virtual machines"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://github.com/AsahiLinux/hidpipe"
+distfiles="https://github.com/AsahiLinux/hidpipe/archive/refs/tags/v${version}.tar.gz"
+checksum=0e64b25066c97d07f5b84bb7ab2f7257cae0205a2cd56c65bed2abcfc1e22362
+
+if [ ! "$XBPS_TARGET_WORDSIZE" == 64 ]; then
+ broken="mismatched types expected 'i64', found 'i32'"
+fi
+
+post_install() {
+ vlicense LICENSE
+
+ vinstall etc/systemd/user/hidpipe.socket 644 etc/systemd/user
+ vinstall etc/systemd/user/hidpipe.service 644 etc/systemd/user
+}
From 4547225e0b5c92ea149818cc9b42ac316af9c142 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 22 Oct 2024 00:34:46 +0200
Subject: [PATCH 4/4] New package: muvm-0.1.3
---
srcpkgs/muvm/patches/eudev.patch | 13 +++++++++++++
srcpkgs/muvm/template | 26 ++++++++++++++++++++++++++
2 files changed, 39 insertions(+)
create mode 100644 srcpkgs/muvm/patches/eudev.patch
create mode 100644 srcpkgs/muvm/template
diff --git a/srcpkgs/muvm/patches/eudev.patch b/srcpkgs/muvm/patches/eudev.patch
new file mode 100644
index 00000000000000..f0900e566b4dc2
--- /dev/null
+++ b/srcpkgs/muvm/patches/eudev.patch
@@ -0,0 +1,13 @@
+diff --git a/crates/muvm/src/guest/bin/muvm-guest.rs b/crates/muvm/src/guest/bin/muvm-guest.rs
+index 311b2ca..809bf12 100644
+--- a/crates/muvm/src/guest/bin/muvm-guest.rs
++++ b/crates/muvm/src/guest/bin/muvm-guest.rs
+@@ -38,7 +38,7 @@ fn main() -> Result<()> {
+ if let Err(err) = mount_filesystems() {
+ return Err(err).context("Failed to mount filesystems, bailing out");
+ }
+- Command::new("/usr/lib/systemd/systemd-udevd").spawn()?;
++ Command::new("/usr/bin/udevd").spawn()?;
+
+ setup_fex()?;
+
diff --git a/srcpkgs/muvm/template b/srcpkgs/muvm/template
new file mode 100644
index 00000000000000..4046ce39448aa3
--- /dev/null
+++ b/srcpkgs/muvm/template
@@ -0,0 +1,26 @@
+# Template file for 'muvm'
+pkgname=muvm
+version=0.1.3
+revision=1
+build_style=cargo
+hostmakedepends="llvm18-devel"
+makedepends="libkrun-devel"
+depends="passt hidpipe"
+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() {
+ local _target
+ _target="target/${XBPS_CROSS_RUST_TARGET:=$XBPS_RUST_TARGET}/release"
+ vbin ${_target}/muvm
+ vbin ${_target}/muvm-guest
+ vbin ${_target}/muvm-server
+}
+
+post_install() {
+ vlicense crates/muvm/LICENSE
+}
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PR PATCH] [Updated] WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (15 preceding siblings ...)
2024-10-31 16:44 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-10-31 16:55 ` Calandracas606
2024-10-31 16:58 ` Calandracas606
` (6 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 16:55 UTC (permalink / raw)
To: ml
[-- 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: 16354 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/4] 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 bbe37a133a5a158080465351e5a3f300562a9393 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/4] New package: libkrun-1.9.5
---
common/shlibs | 1 +
srcpkgs/libkrun-devel | 1 +
srcpkgs/libkrun-init | 1 +
srcpkgs/libkrun/patches/makefile.patch | 22 +++
srcpkgs/libkrun/patches/musl-statx.patch | 183 +++++++++++++++++++++++
srcpkgs/libkrun/template | 34 +++++
6 files changed, 242 insertions(+)
create mode 120000 srcpkgs/libkrun-devel
create mode 120000 srcpkgs/libkrun-init
create mode 100644 srcpkgs/libkrun/patches/makefile.patch
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/makefile.patch b/srcpkgs/libkrun/patches/makefile.patch
new file mode 100644
index 00000000000000..3909cd0e534a2c
--- /dev/null
+++ b/srcpkgs/libkrun/patches/makefile.patch
@@ -0,0 +1,22 @@
+diff --git a/Makefile b/Makefile
+index c4c532f..572c898 100644
+--- a/Makefile
++++ b/Makefile
+@@ -83,7 +83,7 @@ debug: $(LIBRARY_DEBUG_$(OS)) libkrun.pc
+ ifeq ($(BUILD_INIT),1)
+ INIT_BINARY = init/init
+ $(INIT_BINARY): $(INIT_SRC)
+- gcc -O2 -static -Wall $(INIT_DEFS) -o $@ $(INIT_SRC) $(INIT_DEFS)
++ $(CC) -O2 -static -Wall $(INIT_DEFS) -o $@ $(INIT_SRC) $(INIT_DEFS)
+ endif
+
+ $(LIBRARY_RELEASE_$(OS)): $(INIT_BINARY)
+@@ -92,7 +92,7 @@ ifeq ($(SEV),1)
+ mv target/release/libkrun.so target/release/$(KRUN_BASE_$(OS))
+ endif
+ ifeq ($(OS),Linux)
+- patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/release/$(KRUN_BASE_$(OS))
++ patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/$(XBPS_CROSS_RUST_TARGET)/release/$(KRUN_BASE_$(OS))
+ else
+ ifeq ($(EFI),1)
+ ifeq ($(OS),Darwin)
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 59dd82308ab8a09b78441a3eba2a7c48ad680a29 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Thu, 31 Oct 2024 11:50:20 -0400
Subject: [PATCH 3/4] New package: hidpipe-0.1.1
---
srcpkgs/hidpipe/template | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 srcpkgs/hidpipe/template
diff --git a/srcpkgs/hidpipe/template b/srcpkgs/hidpipe/template
new file mode 100644
index 00000000000000..52431abf907416
--- /dev/null
+++ b/srcpkgs/hidpipe/template
@@ -0,0 +1,24 @@
+# Template file for 'hidpipe'
+pkgname=hidpipe
+version=0.1.1
+revision=1
+build_style=cargo
+hostmakedepends="pkg-config"
+makedepends="eudev-libudev-devel"
+short_desc="Pass input devices through to virtual machines"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://github.com/AsahiLinux/hidpipe"
+distfiles="https://github.com/AsahiLinux/hidpipe/archive/refs/tags/v${version}.tar.gz"
+checksum=0e64b25066c97d07f5b84bb7ab2f7257cae0205a2cd56c65bed2abcfc1e22362
+
+if [ ! "$XBPS_TARGET_WORDSIZE" == 64 ]; then
+ broken="mismatched types expected 'i64', found 'i32'"
+fi
+
+post_install() {
+ vlicense LICENSE
+
+ vinstall etc/systemd/user/hidpipe.socket 644 etc/systemd/user
+ vinstall etc/systemd/user/hidpipe.service 644 etc/systemd/user
+}
From 614d7038ae5e26cb037758f3e8e48e590e4553c4 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 22 Oct 2024 00:34:46 +0200
Subject: [PATCH 4/4] New package: muvm-0.1.3
---
srcpkgs/muvm/patches/eudev.patch | 13 +++++++++++++
srcpkgs/muvm/template | 24 ++++++++++++++++++++++++
2 files changed, 37 insertions(+)
create mode 100644 srcpkgs/muvm/patches/eudev.patch
create mode 100644 srcpkgs/muvm/template
diff --git a/srcpkgs/muvm/patches/eudev.patch b/srcpkgs/muvm/patches/eudev.patch
new file mode 100644
index 00000000000000..f0900e566b4dc2
--- /dev/null
+++ b/srcpkgs/muvm/patches/eudev.patch
@@ -0,0 +1,13 @@
+diff --git a/crates/muvm/src/guest/bin/muvm-guest.rs b/crates/muvm/src/guest/bin/muvm-guest.rs
+index 311b2ca..809bf12 100644
+--- a/crates/muvm/src/guest/bin/muvm-guest.rs
++++ b/crates/muvm/src/guest/bin/muvm-guest.rs
+@@ -38,7 +38,7 @@ fn main() -> Result<()> {
+ if let Err(err) = mount_filesystems() {
+ return Err(err).context("Failed to mount filesystems, bailing out");
+ }
+- Command::new("/usr/lib/systemd/systemd-udevd").spawn()?;
++ Command::new("/usr/bin/udevd").spawn()?;
+
+ setup_fex()?;
+
diff --git a/srcpkgs/muvm/template b/srcpkgs/muvm/template
new file mode 100644
index 00000000000000..a6e05f66e6e6cd
--- /dev/null
+++ b/srcpkgs/muvm/template
@@ -0,0 +1,24 @@
+# Template file for 'muvm'
+pkgname=muvm
+version=0.1.3
+revision=1
+build_style=cargo
+hostmakedepends="llvm18-devel"
+makedepends="libkrun-devel"
+depends="passt hidpipe"
+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/${RUST_TARGET}/release/muvm
+ vbin target/${RUST_TARGET}/release/muvm-guest
+ vbin target/${RUST_TARGET}/release/muvm-server
+}
+
+post_install() {
+ vlicense crates/muvm/LICENSE
+}
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (16 preceding siblings ...)
2024-10-31 16:55 ` Calandracas606
@ 2024-10-31 16:58 ` Calandracas606
2024-10-31 17:12 ` Calandracas606
` (5 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 16:58 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 517 bytes --]
New comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/52736#issuecomment-2450377687
Comment:
@dkwo could you please try testing this again? Make sure your user is in the kvm group.
I get stuck on:
```
Error: Failed to set up user, bailing out
Caused by:
0: Failed to read directory `/dev/dri`
1: No such file or directory (os error 2)
```
I think that this is possibly because eudev doesn't setup /dev/dri in the vm, but I could be wrong
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (17 preceding siblings ...)
2024-10-31 16:58 ` Calandracas606
@ 2024-10-31 17:12 ` Calandracas606
2024-10-31 17:17 ` Calandracas606
` (4 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 17:12 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 853 bytes --]
New comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/52736#issuecomment-2450377687
Comment:
@dkwo could you please try testing this again? Make sure your user is in the kvm group.
eg: `muvm -- sh`
I get stuck on:
```
Error: Failed to set up user, bailing out
Caused by:
0: Failed to read directory `/dev/dri`
1: No such file or directory (os error 2)
```
I think that this is possibly because eudev doesn't setup /dev/dri in the vm, but I could be wrong.
When I patch out the check to open `/dev/dri`, i'm able to successfully launch sh in the vm
As aforementioned, it works on my install with systemd, although I'm not confident that its because of systemd that it works, its very possible that some other configuration difference between the systems is at play.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (18 preceding siblings ...)
2024-10-31 17:12 ` Calandracas606
@ 2024-10-31 17:17 ` Calandracas606
2024-10-31 17:17 ` Calandracas606
` (3 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 17:17 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 933 bytes --]
New comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/52736#issuecomment-2450377687
Comment:
@dkwo could you please try testing this again? Make sure your user is in the kvm group.
eg: `muvm -- sh`
I get stuck on:
```
Error: Failed to set up user, bailing out
Caused by:
0: Failed to read directory `/dev/dri`
1: No such file or directory (os error 2)
```
I think that this is possibly because eudev doesn't setup /dev/dri in the vm, but I could be wrong.
When I patch out the check to open `/dev/dri`, i'm able to successfully launch sh in the vm
As aforementioned, it works on my install with systemd, although I'm not confident that its because of systemd that it works, its very possible that some other configuration difference between the systems is at play.
hum, maybe its because libkrunfw doesn't have `CONFIG_DRM` enabled on x86_64
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (19 preceding siblings ...)
2024-10-31 17:17 ` Calandracas606
@ 2024-10-31 17:17 ` Calandracas606
2024-10-31 17:41 ` [PR PATCH] [Updated] " Calandracas606
` (2 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 17:17 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 855 bytes --]
New comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/52736#issuecomment-2450377687
Comment:
@dkwo could you please try testing this again? Make sure your user is in the kvm group.
eg: `muvm -- sh`
I get stuck on:
```
Error: Failed to set up user, bailing out
Caused by:
0: Failed to read directory `/dev/dri`
1: No such file or directory (os error 2)
```
I think that this is possibly because eudev doesn't setup /dev/dri in the vm, but I could be wrong.
When I patch out the check to open `/dev/dri`, i'm able to successfully launch sh in the vm
As aforementioned, it works on my install with systemd, although I'm not confident that its because of systemd that it works, its very possible that some other configuration difference between the systems is at play.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PR PATCH] [Updated] WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (20 preceding siblings ...)
2024-10-31 17:17 ` Calandracas606
@ 2024-10-31 17:41 ` Calandracas606
2024-10-31 17:43 ` Calandracas606
2024-11-02 20:21 ` dkwo
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 17:41 UTC (permalink / raw)
To: ml
[-- 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: 19166 bytes --]
From 297d728c3a96d336a547be995ddb0e00765113d7 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/4] New package: libkrunfw-4.4.2
---
common/shlibs | 1 +
srcpkgs/libkrunfw/patches/x86_64-drm.patch | 92 ++++++++++++++++++++++
srcpkgs/libkrunfw/template | 41 ++++++++++
3 files changed, 134 insertions(+)
create mode 100644 srcpkgs/libkrunfw/patches/x86_64-drm.patch
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/patches/x86_64-drm.patch b/srcpkgs/libkrunfw/patches/x86_64-drm.patch
new file mode 100644
index 00000000000000..2ecbf269eedee3
--- /dev/null
+++ b/srcpkgs/libkrunfw/patches/x86_64-drm.patch
@@ -0,0 +1,92 @@
+diff --git a/config-libkrunfw_x86_64 b/config-libkrunfw_x86_64
+index 588b1a3..9cf89ba 100644
+--- a/config-libkrunfw_x86_64
++++ b/config-libkrunfw_x86_64
+@@ -1370,14 +1370,27 @@ CONFIG_BCMA_POSSIBLE=y
+ #
+ # Graphics support
+ #
+-# CONFIG_DRM is not set
+-# CONFIG_DRM_DEBUG_MODESET_LOCK is not set
++CONFIG_VIDEO_CMDLINE=y
++CONFIG_VIDEO_NOMODESET=y
++# CONFIG_AUXDISPLAY is not set
++CONFIG_DRM=y
++# CONFIG_DRM_DEBUG_MM is not set
++CONFIG_DRM_KMS_HELPER=y
++# CONFIG_DRM_FBDEV_EMULATION is not set
++# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
++CONFIG_DRM_GEM_SHMEM_HELPER=y
+
+ #
+ # ARM devices
+ #
+ # end of ARM devices
+
++# CONFIG_DRM_VGEM is not set
++# CONFIG_DRM_VKMS is not set
++CONFIG_DRM_VIRTIO_GPU=y
++CONFIG_DRM_VIRTIO_GPU_KMS=y
++CONFIG_DRM_PANEL=y
++
+ #
+ # Frame buffer Devices
+ #
+@@ -1401,7 +1414,56 @@ CONFIG_DUMMY_CONSOLE_ROWS=25
+ # end of Console display driver support
+ # end of Graphics support
+
+-# CONFIG_SOUND is not set
++# CONFIG_DRM_ACCEL is not set
++CONFIG_SOUND=y
++CONFIG_SND=y
++CONFIG_SND_TIMER=y
++CONFIG_SND_PCM=y
++CONFIG_SND_JACK=y
++CONFIG_SND_JACK_INPUT_DEV=y
++# CONFIG_SND_OSSEMUL is not set
++CONFIG_SND_PCM_TIMER=y
++# CONFIG_SND_HRTIMER is not set
++# CONFIG_SND_DYNAMIC_MINORS is not set
++CONFIG_SND_SUPPORT_OLD_API=y
++CONFIG_SND_PROC_FS=y
++CONFIG_SND_VERBOSE_PROCFS=y
++# CONFIG_SND_VERBOSE_PRINTK is not set
++CONFIG_SND_CTL_FAST_LOOKUP=y
++# CONFIG_SND_DEBUG is not set
++# CONFIG_SND_CTL_INPUT_VALIDATION is not set
++# CONFIG_SND_SEQUENCER is not set
++CONFIG_SND_DRIVERS=y
++# CONFIG_SND_DUMMY is not set
++# CONFIG_SND_ALOOP is not set
++# CONFIG_SND_PCMTEST is not set
++# CONFIG_SND_MTPAV is not set
++# CONFIG_SND_SERIAL_U16550 is not set
++# CONFIG_SND_MPU401 is not set
++#
++CONFIG_SND_HDA_PREALLOC_SIZE=64
++# CONFIG_SND_SOC is not set
++CONFIG_SND_VIRTIO=y
++CONFIG_HID_SUPPORT=y
++# CONFIG_HID is not set
++CONFIG_USB_OHCI_LITTLE_ENDIAN=y
++# CONFIG_USB_SUPPORT is not set
++# CONFIG_MMC is not set
++# CONFIG_SCSI_UFSHCD is not set
++# CONFIG_MEMSTICK is not set
++# CONFIG_NEW_LEDS is not set
++# CONFIG_ACCESSIBILITY is not set
++# CONFIG_INFINIBAND is not set
++CONFIG_EDAC_SUPPORT=y
++# CONFIG_EDAC is not set
++CONFIG_RTC_LIB=y
++CONFIG_RTC_CLASS=y
++CONFIG_RTC_HCTOSYS=y
++CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
++CONFIG_RTC_SYSTOHC=y
++CONFIG_RTC_SYSTOHC_DEVICE="rtc0"
++# CONFIG_RTC_DEBUG is not set
++CONFIG_RTC_NVMEM=y
+
+ #
+ # HID support
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 73a6df118d653e2c8df0dd243a66e0bfb66d8049 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/4] New package: libkrun-1.9.5
---
common/shlibs | 1 +
srcpkgs/libkrun-devel | 1 +
srcpkgs/libkrun-init | 1 +
srcpkgs/libkrun/patches/makefile.patch | 22 +++
srcpkgs/libkrun/patches/musl-statx.patch | 183 +++++++++++++++++++++++
srcpkgs/libkrun/template | 34 +++++
6 files changed, 242 insertions(+)
create mode 120000 srcpkgs/libkrun-devel
create mode 120000 srcpkgs/libkrun-init
create mode 100644 srcpkgs/libkrun/patches/makefile.patch
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/makefile.patch b/srcpkgs/libkrun/patches/makefile.patch
new file mode 100644
index 00000000000000..3909cd0e534a2c
--- /dev/null
+++ b/srcpkgs/libkrun/patches/makefile.patch
@@ -0,0 +1,22 @@
+diff --git a/Makefile b/Makefile
+index c4c532f..572c898 100644
+--- a/Makefile
++++ b/Makefile
+@@ -83,7 +83,7 @@ debug: $(LIBRARY_DEBUG_$(OS)) libkrun.pc
+ ifeq ($(BUILD_INIT),1)
+ INIT_BINARY = init/init
+ $(INIT_BINARY): $(INIT_SRC)
+- gcc -O2 -static -Wall $(INIT_DEFS) -o $@ $(INIT_SRC) $(INIT_DEFS)
++ $(CC) -O2 -static -Wall $(INIT_DEFS) -o $@ $(INIT_SRC) $(INIT_DEFS)
+ endif
+
+ $(LIBRARY_RELEASE_$(OS)): $(INIT_BINARY)
+@@ -92,7 +92,7 @@ ifeq ($(SEV),1)
+ mv target/release/libkrun.so target/release/$(KRUN_BASE_$(OS))
+ endif
+ ifeq ($(OS),Linux)
+- patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/release/$(KRUN_BASE_$(OS))
++ patchelf --set-soname $(KRUN_SONAME_$(OS)) --output $(LIBRARY_RELEASE_$(OS)) target/$(XBPS_CROSS_RUST_TARGET)/release/$(KRUN_BASE_$(OS))
+ else
+ ifeq ($(EFI),1)
+ ifeq ($(OS),Darwin)
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 00941ea5480fafec28306bf687f7a0d5fc1c389e Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Thu, 31 Oct 2024 11:50:20 -0400
Subject: [PATCH 3/4] New package: hidpipe-0.1.1
---
srcpkgs/hidpipe/template | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 srcpkgs/hidpipe/template
diff --git a/srcpkgs/hidpipe/template b/srcpkgs/hidpipe/template
new file mode 100644
index 00000000000000..52431abf907416
--- /dev/null
+++ b/srcpkgs/hidpipe/template
@@ -0,0 +1,24 @@
+# Template file for 'hidpipe'
+pkgname=hidpipe
+version=0.1.1
+revision=1
+build_style=cargo
+hostmakedepends="pkg-config"
+makedepends="eudev-libudev-devel"
+short_desc="Pass input devices through to virtual machines"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://github.com/AsahiLinux/hidpipe"
+distfiles="https://github.com/AsahiLinux/hidpipe/archive/refs/tags/v${version}.tar.gz"
+checksum=0e64b25066c97d07f5b84bb7ab2f7257cae0205a2cd56c65bed2abcfc1e22362
+
+if [ ! "$XBPS_TARGET_WORDSIZE" == 64 ]; then
+ broken="mismatched types expected 'i64', found 'i32'"
+fi
+
+post_install() {
+ vlicense LICENSE
+
+ vinstall etc/systemd/user/hidpipe.socket 644 etc/systemd/user
+ vinstall etc/systemd/user/hidpipe.service 644 etc/systemd/user
+}
From 463a079abd2da82d86cc8ea77187d41f63ad45ba Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 22 Oct 2024 00:34:46 +0200
Subject: [PATCH 4/4] New package: muvm-0.1.3
---
srcpkgs/muvm/patches/eudev.patch | 13 +++++++++++++
srcpkgs/muvm/template | 24 ++++++++++++++++++++++++
2 files changed, 37 insertions(+)
create mode 100644 srcpkgs/muvm/patches/eudev.patch
create mode 100644 srcpkgs/muvm/template
diff --git a/srcpkgs/muvm/patches/eudev.patch b/srcpkgs/muvm/patches/eudev.patch
new file mode 100644
index 00000000000000..f0900e566b4dc2
--- /dev/null
+++ b/srcpkgs/muvm/patches/eudev.patch
@@ -0,0 +1,13 @@
+diff --git a/crates/muvm/src/guest/bin/muvm-guest.rs b/crates/muvm/src/guest/bin/muvm-guest.rs
+index 311b2ca..809bf12 100644
+--- a/crates/muvm/src/guest/bin/muvm-guest.rs
++++ b/crates/muvm/src/guest/bin/muvm-guest.rs
+@@ -38,7 +38,7 @@ fn main() -> Result<()> {
+ if let Err(err) = mount_filesystems() {
+ return Err(err).context("Failed to mount filesystems, bailing out");
+ }
+- Command::new("/usr/lib/systemd/systemd-udevd").spawn()?;
++ Command::new("/usr/bin/udevd").spawn()?;
+
+ setup_fex()?;
+
diff --git a/srcpkgs/muvm/template b/srcpkgs/muvm/template
new file mode 100644
index 00000000000000..a6e05f66e6e6cd
--- /dev/null
+++ b/srcpkgs/muvm/template
@@ -0,0 +1,24 @@
+# Template file for 'muvm'
+pkgname=muvm
+version=0.1.3
+revision=1
+build_style=cargo
+hostmakedepends="llvm18-devel"
+makedepends="libkrun-devel"
+depends="passt hidpipe"
+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/${RUST_TARGET}/release/muvm
+ vbin target/${RUST_TARGET}/release/muvm-guest
+ vbin target/${RUST_TARGET}/release/muvm-server
+}
+
+post_install() {
+ vlicense crates/muvm/LICENSE
+}
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (21 preceding siblings ...)
2024-10-31 17:41 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-10-31 17:43 ` Calandracas606
2024-11-02 20:21 ` dkwo
23 siblings, 0 replies; 25+ messages in thread
From: Calandracas606 @ 2024-10-31 17:43 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 338 bytes --]
New comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/52736#issuecomment-2450467352
Comment:
Turns out the problem is that libkrunfw has the kernel configuration for x86_64 with drm and snd disabled. Patching the .config to enable drm and snd allows applications to be run on x86_64
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: WIP: New package: muvm-0.1.3
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 Calandracas606
` (22 preceding siblings ...)
2024-10-31 17:43 ` Calandracas606
@ 2024-11-02 20:21 ` dkwo
23 siblings, 0 replies; 25+ messages in thread
From: dkwo @ 2024-11-02 20:21 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 378 bytes --]
New comment by dkwo on void-packages repository
https://github.com/void-linux/void-packages/pull/52736#issuecomment-2453117440
Comment:
Thanks, at least if I am member of kvm I can run bash.
muvm suggest something like sommelier to run wayland stuff (i could not run eg firefox), but i'm not sure we shuold patch the kernel in libkrunfw (i didn't need to do it to run bash)?
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2024-11-02 20:21 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-22 7:34 [PR PATCH] WIP: New package: muvm-0.1.3 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 ` [PR PATCH] [Updated] " Calandracas606
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
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).