diff --git a/main/postmarketos-mkinitfs/0001-add-compile-time-flag-to-disable-Go-GC-MR-56.patch b/main/postmarketos-mkinitfs/0001-add-compile-time-flag-to-disable-Go-GC-MR-56.patch new file mode 100644 index 0000000000000000000000000000000000000000..325b9441e11345525d33f221d0201170fe96d063 --- /dev/null +++ b/main/postmarketos-mkinitfs/0001-add-compile-time-flag-to-disable-Go-GC-MR-56.patch @@ -0,0 +1,59 @@ +From d63e60061419cb1cb1591c9f7f5f238d1201b7f1 Mon Sep 17 00:00:00 2001 +From: Clayton Craft <clayton@craftyguy.net> +Date: Sat, 28 Sep 2024 08:11:19 -0700 +Subject: [PATCH] add compile-time flag to disable Go GC (MR 56) + +I hate this, but it's the only good way I could find to allow working around this ugly QEMU bug: +https://gitlab.com/qemu-project/qemu/-/issues/2560 +--- + Makefile | 5 +++++ + cmd/mkinitfs/main.go | 8 ++++++++ + 2 files changed, 13 insertions(+) + +diff --git a/Makefile b/Makefile +index e4fbcdd..0b1e841 100644 +--- a/Makefile ++++ b/Makefile +@@ -13,6 +13,11 @@ GOFLAGS?= + LDFLAGS+=-s -w -X main.Version=$(VERSION) + RM?=rm -f + GOTEST=go test -count=1 -race ++DISABLE_GOGC?= ++ ++ifeq ($(DISABLE_GOGC),1) ++ LDFLAGS+=-X main.DisableGC=true ++endif + + GOSRC!=find * -name '*.go' + GOSRC+=go.mod go.sum +diff --git a/cmd/mkinitfs/main.go b/cmd/mkinitfs/main.go +index 138667b..6494504 100644 +--- a/cmd/mkinitfs/main.go ++++ b/cmd/mkinitfs/main.go +@@ -9,6 +9,8 @@ import ( + "log" + "os" + "path/filepath" ++ "runtime/debug" ++ "strings" + "time" + + "gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/archive" +@@ -26,8 +28,14 @@ import ( + + // set at build time + var Version string ++var DisableGC string + + func main() { ++ // To allow working around silly GC-related issues, like https://gitlab.com/qemu-project/qemu/-/issues/2560 ++ if strings.ToLower(DisableGC) == "true" { ++ debug.SetGCPercent(-1) ++ } ++ + retCode := 0 + defer func() { os.Exit(retCode) }() + +-- +2.46.2 + diff --git a/main/postmarketos-mkinitfs/APKBUILD b/main/postmarketos-mkinitfs/APKBUILD index ee62ecf6dafa077b06009888a6fc193771d9e1b8..2866f684f581cbff61fd1b8dbd033e081210848e 100644 --- a/main/postmarketos-mkinitfs/APKBUILD +++ b/main/postmarketos-mkinitfs/APKBUILD @@ -2,7 +2,7 @@ # Co-Maintainer: Clayton Craft <clayton@craftyguy.net> pkgname=postmarketos-mkinitfs pkgver=2.5.1 -pkgrel=0 +pkgrel=1 pkgdesc="Tool to generate initramfs images for postmarketOS" url="https://postmarketos.org" depends=" @@ -26,6 +26,7 @@ triggers="$pkgname.trigger=\ source=" https://gitlab.com/postmarketOS/postmarketos-mkinitfs/-/archive/$pkgver/postmarketos-mkinitfs-$pkgver.tar.gz https://gitlab.com/api/v4/projects/postmarketOS%2Fpostmarketos-mkinitfs/packages/generic/mkinitfs-vendor-$pkgver/$pkgver/mkinitfs-vendor-$pkgver.tar.gz + 0001-add-compile-time-flag-to-disable-Go-GC-MR-56.patch " install="$pkgname.post-upgrade" @@ -47,7 +48,14 @@ prepare() { build() { unset LDFLAGS # passed to Go as linker flags, which are invalid - make VERSION="$pkgver" + + # For https://gitlab.com/qemu-project/qemu/-/issues/2560 + case "$CARCH" in + x86_64) + make VERSION="$pkgver" DISABLE_GOGC=1 ;; + *) + make VERSION="$pkgver" ;; + esac } package() { @@ -61,4 +69,5 @@ check() { sha512sums=" 6f2e5c8281a8e6b340f2288b31fb102dcc98480e8bf905bf57a54a81d36a5615b194f0a56f5cd3be207784278257eb6ee3dfecaccb60c3332f4d0f45bafedaa3 postmarketos-mkinitfs-2.5.1.tar.gz 420e4bd8126f765c18b3ea48b2dc7356727958826dbe1086b753f5d46bc9b56d25ed668db8f9f4e8c9d5b1e943105850071c9c3ce442daf12eaa80516e973372 mkinitfs-vendor-2.5.1.tar.gz +2af899c69cbdc84ca85f2a5fe609974b2b9e4c0389d9487596d86d403e55b09fdc2e7daf4452bf33b8a27a2b37339d9311b8d1f903074a1410689665425b7d68 0001-add-compile-time-flag-to-disable-Go-GC-MR-56.patch "