aports/main/s390-tools/0011-tools-Fix-compilation-with-musl-and-gcc-14.patch
L. E. Segovia 391cc3a191 main/s390-tools: fix creating merged image post linux-lts update to 6.6
Linux kernels post 6.1 go beyond the 8MB offset which has been hardcoded
in many alternative implementations of IBM's s390-tools's mk-s390image.

This is a known issue from over at Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1891778

I tried switching over to the official script, and amend it to set
the correct LPSW, but that image caused the following kernel panic:

```
KASLR disabled: CPU has no PRNG
KASLR disabled: CPU has no PRNG
[    1.863539] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
[    1.864887] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.6.43-0-lts #1-Alpine
[    1.865167] Hardware name: QEMU 8561 QEMU (KVM/Linux)
[    1.865346] Call Trace:
[    1.865437]  [<0000000000b46892>] dump_stack_lvl+0x62/0x88
[    1.865944]  [<000000000018d6c8>] panic+0x320/0x338
[    1.866000]  [<00000000014401d6>] mount_root_generic+0x20e/0x4a0
[    1.866045]  [<000000000144090c>] prepare_namespace+0xc4/0x3f8
[    1.866084]  [<000000000143f23a>] kernel_init_freeable+0x5ba/0x698
[    1.866142]  [<0000000000b73026>] kernel_init+0x2e/0x1f0
[    1.866191]  [<00000000001034a4>] __ret_from_fork+0x3c/0x50
[    1.866232]  [<0000000000b885da>] ret_from_fork+0xa/0x30
```

The approach taken here is to just preserve the fixed offset if the
compressed kernel image is < 8MB, and adjust it otherwise. A future
FIXME would be to migrate to the official script altogether and
investigate why the image it produces is invalid.

Fixes #16310
2024-09-05 15:39:00 +00:00

85 lines
2.2 KiB
Diff

From 45007a0525eb10a15003550a91cacc2f6e878765 Mon Sep 17 00:00:00 2001
From: "L. E. Segovia" <amy@amyspark.me>
Date: Sun, 4 Aug 2024 14:04:23 -0300
Subject: [PATCH] tools: Fix compilation with musl and gcc 14
lscss.c: In function 'is_sch_vfio':
lscss.c:392:20: error: implicit declaration of function 'basename' [-Wimplicit-function-declaration]
392 | if (strcmp(basename(driver_path), "vfio_ccw") == 0)
device.c: In function 'device_read_active_attrib':
device.c:426:45: error: implicit declaration of function 'basename'; did you mean 'rename'? [-Wimplicit-function-declaration]
426 | value = misc_strdup(basename(link));
| ^~~~~~~~
| rename
---
zconf/css/lscss.c | 1 +
zdev/src/ccw.c | 1 +
zdev/src/ccwgroup.c | 1 +
zdev/src/device.c | 1 +
zdev/src/generic_ccw.c | 1 +
5 files changed, 5 insertions(+)
diff --git a/zconf/css/lscss.c b/zconf/css/lscss.c
index fd58bb3..e75b2b2 100644
--- a/zconf/css/lscss.c
+++ b/zconf/css/lscss.c
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <libgen.h>
#include "lib/ccw.h"
#include "lib/util_base.h"
diff --git a/zdev/src/ccw.c b/zdev/src/ccw.c
index e8c40f9..3507049 100644
--- a/zdev/src/ccw.c
+++ b/zdev/src/ccw.c
@@ -8,6 +8,7 @@
*/
#include <inttypes.h>
+#include <libgen.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/zdev/src/ccwgroup.c b/zdev/src/ccwgroup.c
index 61e12cc..6a35d6c 100644
--- a/zdev/src/ccwgroup.c
+++ b/zdev/src/ccwgroup.c
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h>
#include "lib/util_base.h"
#include "lib/util_path.h"
diff --git a/zdev/src/device.c b/zdev/src/device.c
index 61647df..63767b6 100644
--- a/zdev/src/device.c
+++ b/zdev/src/device.c
@@ -11,6 +11,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
+#include <libgen.h>
#include "lib/util_path.h"
diff --git a/zdev/src/generic_ccw.c b/zdev/src/generic_ccw.c
index c7f144a..637ccfc 100644
--- a/zdev/src/generic_ccw.c
+++ b/zdev/src/generic_ccw.c
@@ -8,6 +8,7 @@
*/
#include <string.h>
+#include <libgen.h>
#include "lib/util_path.h"
--
2.45.2