From 9dfc636fd613c5dac4717473ae2fd214f9835748 Mon Sep 17 00:00:00 2001
From: Paul Holzinger <paul.holzinger@web.de>
Date: Wed, 6 Jan 2021 23:32:40 +0100
Subject: [PATCH 1/2] Fix build for mips architecture follow-up

Follow-up to commit (1ad796677e1c). The build on mips is still
failing because SIGWINCH was not defined in the signal pkg.
Also stat_t.Rdev is unit32 on mips so we need to typecast.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
---
 pkg/signal/signal_linux_mipsx.go  |  2 ++
 pkg/specgen/generate/container.go | 16 ++++++++--------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/pkg/signal/signal_linux_mipsx.go b/pkg/signal/signal_linux_mipsx.go
index 67638e30a5..45c9d5af1e 100644
--- a/pkg/signal/signal_linux_mipsx.go
+++ b/pkg/signal/signal_linux_mipsx.go
@@ -19,6 +19,8 @@ import (
 const (
 	sigrtmin = 34
 	sigrtmax = 127
+
+	SIGWINCH = syscall.SIGWINCH
 )
 
 // signalMap is a map of Linux signals.
diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go
index 42fea02775..c771e8bc8c 100644
--- a/pkg/specgen/generate/container.go
+++ b/pkg/specgen/generate/container.go
@@ -282,8 +282,8 @@ func finishThrottleDevices(s *specgen.SpecGenerator) error {
 			if err := unix.Stat(k, &statT); err != nil {
 				return err
 			}
-			v.Major = (int64(unix.Major(statT.Rdev)))
-			v.Minor = (int64(unix.Minor(statT.Rdev)))
+			v.Major = (int64(unix.Major(uint64(statT.Rdev))))
+			v.Minor = (int64(unix.Minor(uint64(statT.Rdev))))
 			s.ResourceLimits.BlockIO.ThrottleReadBpsDevice = append(s.ResourceLimits.BlockIO.ThrottleReadBpsDevice, v)
 		}
 	}
@@ -293,8 +293,8 @@ func finishThrottleDevices(s *specgen.SpecGenerator) error {
 			if err := unix.Stat(k, &statT); err != nil {
 				return err
 			}
-			v.Major = (int64(unix.Major(statT.Rdev)))
-			v.Minor = (int64(unix.Minor(statT.Rdev)))
+			v.Major = (int64(unix.Major(uint64(statT.Rdev))))
+			v.Minor = (int64(unix.Minor(uint64(statT.Rdev))))
 			s.ResourceLimits.BlockIO.ThrottleWriteBpsDevice = append(s.ResourceLimits.BlockIO.ThrottleWriteBpsDevice, v)
 		}
 	}
@@ -304,8 +304,8 @@ func finishThrottleDevices(s *specgen.SpecGenerator) error {
 			if err := unix.Stat(k, &statT); err != nil {
 				return err
 			}
-			v.Major = (int64(unix.Major(statT.Rdev)))
-			v.Minor = (int64(unix.Minor(statT.Rdev)))
+			v.Major = (int64(unix.Major(uint64(statT.Rdev))))
+			v.Minor = (int64(unix.Minor(uint64(statT.Rdev))))
 			s.ResourceLimits.BlockIO.ThrottleReadIOPSDevice = append(s.ResourceLimits.BlockIO.ThrottleReadIOPSDevice, v)
 		}
 	}
@@ -315,8 +315,8 @@ func finishThrottleDevices(s *specgen.SpecGenerator) error {
 			if err := unix.Stat(k, &statT); err != nil {
 				return err
 			}
-			v.Major = (int64(unix.Major(statT.Rdev)))
-			v.Minor = (int64(unix.Minor(statT.Rdev)))
+			v.Major = (int64(unix.Major(uint64(statT.Rdev))))
+			v.Minor = (int64(unix.Minor(uint64(statT.Rdev))))
 			s.ResourceLimits.BlockIO.ThrottleWriteIOPSDevice = append(s.ResourceLimits.BlockIO.ThrottleWriteIOPSDevice, v)
 		}
 	}

From 65c88ec4736a7b57ef59c1f9d1a056901dd6095e Mon Sep 17 00:00:00 2001
From: Paul Holzinger <paul.holzinger@web.de>
Date: Thu, 7 Jan 2021 14:51:17 +0100
Subject: [PATCH 2/2] Add mips architecture to the cross build target

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
---
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 5f058a710e..c0c1e40037 100644
--- a/Makefile
+++ b/Makefile
@@ -106,7 +106,11 @@ CROSS_BUILD_TARGETS := \
 	bin/podman.cross.linux.arm \
 	bin/podman.cross.linux.arm64 \
 	bin/podman.cross.linux.386 \
-	bin/podman.cross.linux.s390x
+	bin/podman.cross.linux.s390x \
+	bin/podman.cross.linux.mips \
+	bin/podman.cross.linux.mipsle \
+	bin/podman.cross.linux.mips64 \
+	bin/podman.cross.linux.mips64le
 
 .PHONY: all
 all: binaries docs