Github messages for voidlinux
 help / color / mirror / Atom feed
From: travankor <travankor@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] New package: booster-0.5
Date: Thu, 01 Jul 2021 15:03:23 +0200	[thread overview]
Message-ID: <20210701130323.BpB-VsYENAvVoxwM2z_poHsHBtlehv2vx9pPc8Gp5VI@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-29434@inbox.vuxu.org>

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

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

https://github.com/travankor/void-packages booster
https://github.com/void-linux/void-packages/pull/29434

New package: booster-0.5
<!-- Mark items with [x] where applicable -->

#### General
- [X] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->

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

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

From 4afcb2e753937769c180be448dd29ad3a4212182 Mon Sep 17 00:00:00 2001
From: travankor <travankor@tuta.io>
Date: Sat, 13 Mar 2021 07:51:37 -0700
Subject: [PATCH 1/2] New package: booster-0.5

---
 srcpkgs/booster/files/kernel-hook-postinst | 15 ++++
 srcpkgs/booster/files/kernel-hook-postrm   | 11 +++
 srcpkgs/booster/patches/runit.patch        | 89 ++++++++++++++++++++++
 srcpkgs/booster/template                   | 40 ++++++++++
 4 files changed, 155 insertions(+)
 create mode 100644 srcpkgs/booster/files/kernel-hook-postinst
 create mode 100644 srcpkgs/booster/files/kernel-hook-postrm
 create mode 100644 srcpkgs/booster/patches/runit.patch
 create mode 100644 srcpkgs/booster/template

diff --git a/srcpkgs/booster/files/kernel-hook-postinst b/srcpkgs/booster/files/kernel-hook-postinst
new file mode 100644
index 000000000000..68d2eaf6caf6
--- /dev/null
+++ b/srcpkgs/booster/files/kernel-hook-postinst
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# Kernel post-install hook for booster.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+if [ ! -x usr/bin/booster ]; then
+	exit 0
+fi
+
+usr/bin/booster -force -output boot/initramfs-${VERSION}.img -kernelVersion ${VERSION}
+exit $?
diff --git a/srcpkgs/booster/files/kernel-hook-postrm b/srcpkgs/booster/files/kernel-hook-postrm
new file mode 100644
index 000000000000..ef13d1967a67
--- /dev/null
+++ b/srcpkgs/booster/files/kernel-hook-postrm
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# Kernel post-remove hook for booster.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+rm -f boot/initramfs-${VERSION}.img
+exit $?
diff --git a/srcpkgs/booster/patches/runit.patch b/srcpkgs/booster/patches/runit.patch
new file mode 100644
index 000000000000..fc478269fa16
--- /dev/null
+++ b/srcpkgs/booster/patches/runit.patch
@@ -0,0 +1,89 @@
+From 47041269c6a9912839e6382e32e8b37c66711ffb Mon Sep 17 00:00:00 2001
+From: Anatol Pomozov <anatol.pomozov@gmail.com>
+Date: Tue, 29 Jun 2021 16:01:45 -0700
+Subject: [PATCH] Move all auxiliary mount points from initramfs to host fs
+
+At initram stage booster mounts several filesystems that needed for
+successful boot process. At this moment we preserve /run (because it contains
+udev state) and other mountpoints are unmounted.
+
+It turns out runit used at Void Linux expects that /dev is present from the very
+beginning. And it differs from systemd that parses fstab and mount the fs before
+it tries to use.
+
+Help runit and move `/dev` `/sys` `/proc` to host filesystem. It fixes the runit
+"unable to open /dev/console" warning.
+
+Closes #92
+---
+ init/main.go | 45 +++++++++++++++++++++------------------------
+ 1 file changed, 21 insertions(+), 24 deletions(-)
+
+diff --git a/init/main.go b/init/main.go
+index c0c2633..38f43f9 100644
+--- a/init/main.go
++++ b/init/main.go
+@@ -348,23 +348,28 @@ func isSystemd(path string) (bool, error) {
+ 	return strings.HasSuffix(myRealpath, "/systemd"), nil
+ }
+ 
+-// moveSlashRunMountpoint moves some of the initramfs mounts into the main image
+-func moveSlashRunMountpoint() error {
+-	// remount root as it might contain udev state that we need to pass to the new root
+-	_, err := os.Stat(newRoot + "/run")
+-	if os.IsNotExist(err) {
+-		// let's print a warning and hope that the new root works without initrd udev state
+-		warning("/run does not exist at the newly mounted root filesystem")
+-
+-		// unmount /run so its directory can be removed and reclaimed
+-		if err := unix.Unmount("/run", 0); err != nil {
+-			return fmt.Errorf("unmount(/run): %v", err)
++// moveMountpointsToHost moves some of the initramfs mounts into the host filesystem
++// it is needed for example in following cases:
++//    /run might contain some udev state that needs to be passed from initramfs to host
++//    runit expects that /dev/ is mounted at the moment runit starts
++func moveMountpointsToHost() error {
++	for _, m := range []string{"/run", "/dev", "/proc", "/sys"} {
++		// remount root as it might contain state that we need to pass to the new root
++		_, err := os.Stat(newRoot + m)
++		if os.IsNotExist(err) {
++			// let's print a warning and hope that host OS setup the filesystem if needed
++			warning("%s does not exist at the newly mounted root filesystem", m)
++
++			// unmount the directory so its directory can be removed and reclaimed
++			if err := unix.Unmount(m, unix.MNT_DETACH); err != nil {
++				return fmt.Errorf("unmount(%s): %v", m, err)
++			}
++			continue
+ 		}
+-		return nil
+-	}
+ 
+-	if err := unix.Mount("/run", newRoot+"/run", "", unix.MS_MOVE, ""); err != nil {
+-		return fmt.Errorf("move /run to new root: %v", err)
++		if err := unix.Mount(m, newRoot+m, "", unix.MS_MOVE, ""); err != nil {
++			return fmt.Errorf("move %s to new root: %v", m, err)
++		}
+ 	}
+ 
+ 	return nil
+@@ -464,18 +469,10 @@ func deleteRamfs() error {
+ 
+ // https://github.com/mirror/busybox/blob/9aa751b08ab03d6396f86c3df77937a19687981b/util-linux/switch_root.c#L297
+ func switchRoot() error {
+-	if err := moveSlashRunMountpoint(); err != nil {
++	if err := moveMountpointsToHost(); err != nil {
+ 		return err
+ 	}
+ 
+-	// note that /run has been unmounted earlier
+-	for _, m := range []string{"/dev", "/proc", "/sys"} {
+-		// some drivers (e.g. GPU) might use these filesystems, unmount it lazily
+-		if err := unix.Unmount(m, unix.MNT_DETACH); err != nil {
+-			return fmt.Errorf("unmount(%s): %v", m, err)
+-		}
+-	}
+-
+ 	if err := deleteRamfs(); err != nil {
+ 		return fmt.Errorf("wiping ramfs: %v", err)
+ 	}
diff --git a/srcpkgs/booster/template b/srcpkgs/booster/template
new file mode 100644
index 000000000000..9e1822b7fdcd
--- /dev/null
+++ b/srcpkgs/booster/template
@@ -0,0 +1,40 @@
+# Template file for 'booster'
+pkgname=booster
+version=0.5
+revision=1
+build_style=go
+go_import_path=github.com/anatol/booster
+go_package="${go_import_path}/generator ${go_import_path}/init"
+hostmakedepends="git ruby-ronn"
+depends="busybox-static"
+short_desc="Fast and secure initramfs generator"
+maintainer="travankor <travankor@tuta.io>"
+license="MIT"
+homepage="https://github.com/anatol/booster"
+distfiles="https://github.com/anatol/booster/archive/${version}.tar.gz"
+checksum=aea7e30cad1987bcc61de0c18b4273b477782c57a331ca47d92d0146860529b0
+conf_files="/etc/booster.yaml"
+
+pre_build() {
+	export CGO_ENABLED=0
+}
+
+do_install() {
+	if [ "$CROSS_BUILD" ]; then
+		vbin ${GOPATH}/bin/linux_${GOARCH}/generator booster
+		vinstall ${GOPATH}/bin/linux_${GOARCH}/init 755 usr/lib/booster
+	else
+		vbin ${GOPATH}/bin/generator booster
+		vinstall ${GOPATH}/bin/init 755 usr/lib/booster
+	fi
+	ronn docs/manpage.md
+	vman docs/manpage.1 booster.1
+	echo "busybox: true" > booster.yaml
+}
+
+post_install() {
+	vconf booster.yaml
+	vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-booster
+	vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-booster
+	vlicense LICENSE
+}

From a328299017082e691781a7b0de4268e815391ce5 Mon Sep 17 00:00:00 2001
From: travankor <travankor@tuta.io>
Date: Thu, 1 Jul 2021 06:02:25 -0700
Subject: [PATCH 2/2] booster: add support to initramfs-regenerate hook

---
 srcpkgs/booster/files/kernel-hook-postinst       |  1 +
 srcpkgs/xbps-triggers/files/initramfs-regenerate | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/booster/files/kernel-hook-postinst b/srcpkgs/booster/files/kernel-hook-postinst
index 68d2eaf6caf6..7313b69da6a5 100644
--- a/srcpkgs/booster/files/kernel-hook-postinst
+++ b/srcpkgs/booster/files/kernel-hook-postinst
@@ -11,5 +11,6 @@ if [ ! -x usr/bin/booster ]; then
 	exit 0
 fi
 
+umask 0077
 usr/bin/booster -force -output boot/initramfs-${VERSION}.img -kernelVersion ${VERSION}
 exit $?
diff --git a/srcpkgs/xbps-triggers/files/initramfs-regenerate b/srcpkgs/xbps-triggers/files/initramfs-regenerate
index 780c3580829f..9fb3f04fcc4e 100755
--- a/srcpkgs/xbps-triggers/files/initramfs-regenerate
+++ b/srcpkgs/xbps-triggers/files/initramfs-regenerate
@@ -8,8 +8,8 @@
 #
 #     INITRAMFS_GENERATOR=<generator>
 #
-# where <generator> is one of "dracut", "mkinitcpio" or "none". By default, a
-# value of "dracut" is assumed.
+# where <generator> is one of "dracut", "mkinitcpio", "booster" or "none".
+# By default, a # value of "dracut" is assumed.
 #
 # Arguments:	$ACTION = [run/targets]
 #		$TARGET = [post-install/post-remove]
@@ -61,6 +61,17 @@ case "${INITRAMFS_GENERATOR:-dracut}" in
 			done
 		fi
 		;;
+	booster)
+		if command -v booster >dev/null 2>&1; then
+			echo "Regenerating initramfs with booster"
+			# Regenerate images for every kernel version with modules
+			for kdir in usr/lib/modules/*; do
+				[ -d "${kdir}/kernel" ] || continue
+				kver="${kdir##*/}"
+				booster -force -output "boot/initramfs-${kver}.img" -kernelVersion "${kver}"
+			done
+		fi
+		;;
 	none)
 		;;
 	*)

  parent reply	other threads:[~2021-07-01 13:03 UTC|newest]

Thread overview: 141+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-13 14:53 [PR PATCH] New package: booster-0.3 travankor
2021-03-13 15:16 ` [PR REVIEW] " ericonr
2021-03-13 22:55 ` travankor
2021-03-13 23:10 ` travankor
2021-03-13 23:11 ` travankor
2021-03-13 23:30 ` ericonr
2021-03-15  3:06 ` [PR PATCH] [Updated] " travankor
2021-03-15  3:17 ` travankor
2021-03-15  3:32 ` travankor
2021-03-15  3:35 ` travankor
2021-03-15  3:50 ` travankor
2021-03-15  3:55 ` travankor
2021-03-16 14:03 ` travankor
2021-04-11  4:01 ` [PR REVIEW] " ericonr
2021-04-11 17:31 ` [PR PATCH] [Updated] New package: booster-0.4 travankor
2021-04-12 13:21 ` travankor
2021-04-25  2:03 ` travankor
2021-04-25  3:38 ` travankor
2021-04-25  3:51 ` travankor
2021-04-25 13:16 ` travankor
2021-04-25 17:08 ` [PR REVIEW] " travankor
2021-04-25 17:14 ` [PR PATCH] [Updated] " travankor
2021-04-25 17:17 ` travankor
2021-04-25 17:19 ` [PR PATCH] [Updated] " travankor
2021-05-13 13:19 ` travankor
2021-05-15 13:36 ` [PR PATCH] [Updated] New package: booster-0.5 travankor
2021-05-18 14:13 ` UsernameRandomlyGenerated
2021-05-24 16:15 ` dkwo
2021-05-27 18:50 ` dkwo
2021-06-01 19:13 ` travankor
2021-06-06  8:39 ` dkwo
2021-06-12 17:23 ` dkwo
2021-06-12 17:24 ` dkwo
2021-06-12 17:26 ` dkwo
2021-06-12 17:52 ` paper42
2021-06-12 17:52 ` paper42
2021-06-12 18:15 ` dkwo
2021-06-23  3:08 ` anatol
2021-06-30  8:33 ` dkwo
2021-06-30  9:14 ` travankor
2021-06-30 13:06 ` [PR PATCH] [Updated] " travankor
2021-07-01  3:51 ` [PR REVIEW] " ericonr
2021-07-01  3:51 ` ericonr
2021-07-01  3:58 ` ericonr
2021-07-01  4:01 ` ericonr
2021-07-01 13:03 ` travankor [this message]
2021-07-01 13:05 ` travankor
2021-07-01 13:08 ` [PR PATCH] [Updated] " travankor
2021-07-01 15:15 ` anatol
2021-07-02  9:36 ` dkwo
2021-07-20 17:12 ` anatol
2021-07-21 15:48 ` [PR PATCH] [Updated] " travankor
2021-07-22  7:43 ` New package: booster-0.6 dkwo
2021-09-11 23:27 ` anatol
2021-09-12  6:31 ` dkwo
2021-09-12 10:36 ` [PR REVIEW] " paper42
2021-09-12 10:36 ` paper42
2021-09-12 10:36 ` paper42
2021-09-12 11:28 ` ahesford
2021-09-12 11:36 ` paper42
2021-09-13 14:42 ` [PR PATCH] [Updated] " travankor
2021-09-13 14:44 ` travankor
2021-09-14 14:02 ` travankor
2021-09-14 14:08 ` travankor
2021-09-14 14:16 ` travankor
2021-09-14 14:25 ` travankor
2021-09-14 22:57 ` travankor
2021-09-27 23:37 ` anatol
2021-10-12  8:48 ` dkwo
2021-10-14 19:32 ` anatol
2021-10-16 11:56 ` dkwo
2021-10-16 12:21 ` dkwo
2021-11-07  9:54 ` dkwo
2021-11-07 10:19 ` dkwo
2021-11-07 14:14 ` anatol
2021-11-07 14:15 ` anatol
2021-11-07 15:17 ` anatol
2021-11-08 10:01 ` dkwo
2021-11-08 14:04 ` anatol
2021-11-08 17:19 ` dkwo
2021-11-08 20:45 ` anatol
2021-11-09 13:13 ` dkwo
2021-11-09 19:05 ` nilium
2021-11-09 20:59 ` anatol
2021-11-09 21:17 ` nilium
2021-11-10  9:25 ` dkwo
2021-11-10 15:22 ` anatol
2021-11-10 21:38 ` [PR PATCH] [Updated] " travankor
2021-11-10 21:48 ` travankor
2021-11-10 23:12 ` [PR REVIEW] New package: booster-0.7 anatol
2021-11-11  7:59 ` travankor
2021-11-12  1:31 ` anatol
2021-11-12 10:12 ` dkwo
2021-11-12 16:03 ` anatol
2021-11-12 21:46 ` [PR PATCH] [Updated] " travankor
2021-11-12 21:47 ` [PR REVIEW] " travankor
2021-11-13  9:29 ` dkwo
2021-12-03  2:56 ` anatol
2022-03-06 21:13 ` anatol
2022-05-28  0:07 ` [PR PATCH] [Updated] " travankor
2022-07-03 11:46 ` dkwo
2022-07-03 13:05 ` anatol
2022-07-03 13:08 ` anatol
2022-07-03 13:10 ` anatol
2022-07-03 18:58 ` dkwo
2022-07-18  1:57 ` anatol
2022-07-23  9:09 ` oynqr
2022-07-31 23:01 ` CameronNemo
2022-07-31 23:45 ` CameronNemo
2022-08-01  3:56 ` anatol
2022-08-01  3:59 ` [PR REVIEW] " anatol
2022-08-01 13:40 ` [PR PATCH] [Updated] " travankor
2022-08-01 13:42 ` travankor
2022-08-01 13:46 ` [PR PATCH] [Updated] New package: booster-0.8 travankor
2022-08-01 14:55 ` [PR REVIEW] " CameronNemo
2022-08-01 14:55 ` CameronNemo
2022-08-01 19:57 ` [PR PATCH] [Updated] " travankor
2022-08-26 10:42 ` JamiKettunen
2022-09-08 20:08 ` [PR PATCH] [Updated] " travankor
2022-09-26 12:21 ` New package: booster-0.9 ahesford
2022-10-03 15:08 ` dkwo
2022-10-09 20:36 ` [PR PATCH] [Updated] " travankor
2022-10-09 23:11 ` [PR REVIEW] " CameronNemo
2022-10-09 23:31 ` ahesford
2022-10-09 23:33 ` ahesford
2022-10-10  2:51 ` CameronNemo
2022-10-10  6:58 ` [PR PATCH] [Updated] " travankor
2022-10-10 14:02 ` ahesford
2022-10-10 14:33 ` ahesford
2022-10-10 14:49 ` ahesford
2022-10-10 14:58 ` ahesford
2022-10-10 14:59 ` ahesford
2022-10-10 18:14 ` CameronNemo
2022-10-10 18:14 ` CameronNemo
2022-10-10 18:26 ` ahesford
2022-10-10 20:51 ` anatol
2022-10-10 20:51 ` anatol
2022-10-10 22:03 ` ahesford
2022-10-14 20:13 ` dkwo
2022-10-14 20:41 ` [PR PATCH] [Closed]: " ahesford
2022-10-14 20:41 ` ahesford

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20210701130323.BpB-VsYENAvVoxwM2z_poHsHBtlehv2vx9pPc8Gp5VI@z \
    --to=travankor@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

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

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