File 0001-replace-ppc64le-by-s390x-in-virto-ccw-driver.patch of Package qemu

From 0139357d0e6e3078ac148b460b5add9d2e06a100 Mon Sep 17 00:00:00 2001
From: Thomas Blume <Thomas.Blume@suse.com>
Date: Mon, 31 Mar 2025 13:18:42 +0200
Subject: [PATCH] replace ppc64le by s390x in virto-ccw driver

---
 pc-bios/s390-ccw/netmain.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c
index 719a547ada..da424c8e17 100644
--- a/pc-bios/s390-ccw/netmain.c
+++ b/pc-bios/s390-ccw/netmain.c
@@ -153,6 +153,37 @@ static int tftp_load(filename_ip_t *fnip, void *buffer, int len)
     return rc;
 }
 
+void replaceArchstring(char *str, const char *oldWord, const char *newWord) {
+    char result[1000];
+    char *pos, temp[1000];
+    int index = 0;
+    int oldWordLen = strlen(oldWord);
+
+    // Copy original string to temp
+    strcpy(temp, str);
+
+    while ((pos = strstr(temp, oldWord)) != NULL) {
+        // Copy characters before the oldWord
+        int lenBefore = pos - temp;
+        strncpy(result + index, temp, lenBefore);
+        index += lenBefore;
+
+        // Copy the newWord
+        strcpy(result + index, newWord);
+        index += strlen(newWord);
+
+        // Move past the oldWord in temp
+        strcpy(temp, pos + oldWordLen);
+    }
+
+    // Copy the remaining part of temp
+    strcpy(result + index, temp);
+
+    // Copy result back to original string
+    strcpy(str, result);
+}
+
+
 static int net_init_ip(filename_ip_t *fn_ip)
 {
     int rc;
@@ -203,6 +234,8 @@ static int net_init_ip(filename_ip_t *fn_ip)
     }
 
     if (strlen(fn_ip->filename) > 0) {
+        //tblume hier
+        replaceArchtring(fn_ip->filename, "ppc64le", "s390x");
         printf("  Bootfile name: '%s'\n", fn_ip->filename);
     }
 
-- 
2.48.1

openSUSE Build Service is sponsored by