Skip to contentSkip to conversation

Fix configure for s390 qemu on alpine

PATCH Superseded Christian Borntraeger 1 participant 3 messages Jan 19, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 12/12 Fix configure for s390 qemu on alpine

From: Alice Frosi <[email protected]>

In alpine docker image the qemu-system-s390x build is broken and it throws this error:
qemu-system-s390x: Initialization of device s390-ipl failed: could not load bootloader 's390-ccw.img'

The grep command of busybox uses regex. This fails on binary data (e.g. stops on every \0), so it does not identify the string BiGeNdIaN in the test case big/little. Therefore, it assumes that the architecture is little endian.

This fix solves the grep problem by printing the content of TMPO with strings

[some changes to patch description, add -a option to strings]
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
configure +2 -2
index 6d8c996..383b14e 100755
@@ -1906,9 +1906,9 @@ int main(int argc, char *argv[]) {
 EOF
 
 if compile_object ; then
-    if grep -q BiGeNdIaN $TMPO ; then
+    if strings -a $TMPO | grep -q BiGeNdIaN ; then
         bigendian="yes"
-    elif grep -q LiTtLeEnDiAn $TMPO ; then
+    elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
         bigendian="no"
     else
         echo big/little test failed
Signature · 1 line
1.8.3.1
#1 lore raw

ignore the 12/12, it is just one patch....

Quoted 39 lines · Christian Borntraeger

From: Alice Frosi <[email protected]>

In alpine docker image the qemu-system-s390x build is broken and it throws this error:
qemu-system-s390x: Initialization of device s390-ipl failed: could not load bootloader 's390-ccw.img'

The grep command of busybox uses regex. This fails on binary data (e.g. stops on every \0), so it does not identify the string BiGeNdIaN in the test case big/little. Therefore, it assumes that the architecture is little endian.

This fix solves the grep problem by printing the content of TMPO with strings

[some changes to patch description, add -a option to strings]
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
configure +2 -2
index 6d8c996..383b14e 100755
@@ -1906,9 +1906,9 @@ int main(int argc, char *argv[]) {
 EOF
 
 if compile_object ; then
-    if grep -q BiGeNdIaN $TMPO ; then
+    if strings -a $TMPO | grep -q BiGeNdIaN ; then
         bigendian="yes"
-    elif grep -q LiTtLeEnDiAn $TMPO ; then
+    elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
         bigendian="no"
     else
         echo big/little test failed
#2 lore raw

And the from email address is also wrong. (spurious x after .com)

Quoted 44 lines · Christian Borntraeger

ignore the 12/12, it is just one patch....

Quoted 39 lines · Christian Borntraeger

From: Alice Frosi <[email protected]>

In alpine docker image the qemu-system-s390x build is broken and it throws this error:
qemu-system-s390x: Initialization of device s390-ipl failed: could not load bootloader 's390-ccw.img'

The grep command of busybox uses regex. This fails on binary data (e.g. stops on every \0), so it does not identify the string BiGeNdIaN in the test case big/little. Therefore, it assumes that the architecture is little endian.

This fix solves the grep problem by printing the content of TMPO with strings

[some changes to patch description, add -a option to strings]
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
configure +2 -2
index 6d8c996..383b14e 100755
@@ -1906,9 +1906,9 @@ int main(int argc, char *argv[]) {
 EOF
 
 if compile_object ; then
-    if grep -q BiGeNdIaN $TMPO ; then
+    if strings -a $TMPO | grep -q BiGeNdIaN ; then
         bigendian="yes"
-    elif grep -q LiTtLeEnDiAn $TMPO ; then
+    elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
         bigendian="no"
     else
         echo big/little test failed