From d2567bfbdf0e9fa6db0a6ed1534831ec859a3e03 Mon Sep 17 00:00:00 2001
From: davidovski <david@davidovski.xyz>
Date: Wed, 15 Jun 2022 20:02:02 +0100
Subject: added deps for qemu

---
 repo/ceph/10-musl-fixes.patch                |  15 +++
 repo/ceph/11-dump_time_header_impl.patch     |  34 +++++++
 repo/ceph/11-parse_rfc1123_alt.patch         |  53 ++++++++++
 repo/ceph/11-s3_expiration_header.patch      |  30 ++++++
 repo/ceph/12-package.json-resolutions.patch  |  31 ++++++
 repo/ceph/20-pci.patch                       |  63 ++++++++++++
 repo/ceph/30-32bit_fix.patch.noauto          | 110 +++++++++++++++++++++
 repo/ceph/30-cypress.patch.noauto            |  14 +++
 repo/ceph/30-ubuntu-32bit-fixes.patch.noauto | 137 +++++++++++++++++++++++++
 repo/ceph/31-32bit_fix_tests.patch.noauto    |  66 +++++++++++++
 repo/ceph/32-PurgeQueue.cc-cast.patch        |  85 ++++++++++++++++
 repo/ceph/32-upstream32bit.patch             |  92 +++++++++++++++++
 repo/ceph/32-upstream32bitcleanup.patch      | 143 +++++++++++++++++++++++++++
 repo/ceph/35-fix_ErasureCodeShec.patch       |  17 ++++
 repo/ceph/37-fix_tests.patch                 |  86 ++++++++++++++++
 repo/ceph/42-no-virtualenvs.patch            |  71 +++++++++++++
 repo/ceph/43-LogClock.h.patch                |  18 ++++
 repo/ceph/44-aarch64-erasure.patch           | 129 ++++++++++++++++++++++++
 repo/ceph/44-cmake-buildtype.patch           |  38 +++++++
 repo/ceph/44-missing-include.patch           |  16 +++
 repo/ceph/44-staticcast.patch                |  13 +++
 repo/ceph/ceph-user.pre-install              |   5 +
 repo/ceph/ceph.confd                         |  17 ++++
 repo/ceph/ceph.initd                         | 118 ++++++++++++++++++++++
 repo/ceph/ceph.xibuild                       | 120 ++++++++++++++++++++++
 25 files changed, 1521 insertions(+)
 create mode 100644 repo/ceph/10-musl-fixes.patch
 create mode 100644 repo/ceph/11-dump_time_header_impl.patch
 create mode 100644 repo/ceph/11-parse_rfc1123_alt.patch
 create mode 100644 repo/ceph/11-s3_expiration_header.patch
 create mode 100644 repo/ceph/12-package.json-resolutions.patch
 create mode 100644 repo/ceph/20-pci.patch
 create mode 100644 repo/ceph/30-32bit_fix.patch.noauto
 create mode 100644 repo/ceph/30-cypress.patch.noauto
 create mode 100644 repo/ceph/30-ubuntu-32bit-fixes.patch.noauto
 create mode 100644 repo/ceph/31-32bit_fix_tests.patch.noauto
 create mode 100644 repo/ceph/32-PurgeQueue.cc-cast.patch
 create mode 100644 repo/ceph/32-upstream32bit.patch
 create mode 100644 repo/ceph/32-upstream32bitcleanup.patch
 create mode 100644 repo/ceph/35-fix_ErasureCodeShec.patch
 create mode 100644 repo/ceph/37-fix_tests.patch
 create mode 100644 repo/ceph/42-no-virtualenvs.patch
 create mode 100644 repo/ceph/43-LogClock.h.patch
 create mode 100644 repo/ceph/44-aarch64-erasure.patch
 create mode 100644 repo/ceph/44-cmake-buildtype.patch
 create mode 100644 repo/ceph/44-missing-include.patch
 create mode 100644 repo/ceph/44-staticcast.patch
 create mode 100644 repo/ceph/ceph-user.pre-install
 create mode 100644 repo/ceph/ceph.confd
 create mode 100644 repo/ceph/ceph.initd
 create mode 100644 repo/ceph/ceph.xibuild

(limited to 'repo/ceph')

diff --git a/repo/ceph/10-musl-fixes.patch b/repo/ceph/10-musl-fixes.patch
new file mode 100644
index 0000000..1b7c907
--- /dev/null
+++ b/repo/ceph/10-musl-fixes.patch
@@ -0,0 +1,15 @@
+fix for musl
+
+diff -Nurp a/src/tools/rbd_nbd/rbd-nbd.cc b/src/tools/rbd_nbd/rbd-nbd.cc
+--- a/src/tools/rbd_nbd/rbd-nbd.cc      2020-11-21 08:06:35.834423310 +0000
++++ b/src/tools/rbd_nbd/rbd-nbd.cc      2020-11-21 08:21:12.067978842 +0000
+@@ -576,7 +576,8 @@ private:
+     for (unsigned i = 0; i < cmdline.size(); i++) {
+       char *arg = &cmdline[i];
+       if (i == 0) {
+-        if (strcmp(basename(arg) , "rbd-nbd") != 0) {
++        const char *fname = strrchr(arg, '/');
++        if (strcmp(fname ? fname+1 : arg, "rbd-nbd") != 0) {
+           return -EINVAL;
+         }
+       } else {
diff --git a/repo/ceph/11-dump_time_header_impl.patch b/repo/ceph/11-dump_time_header_impl.patch
new file mode 100644
index 0000000..d19e7ed
--- /dev/null
+++ b/repo/ceph/11-dump_time_header_impl.patch
@@ -0,0 +1,34 @@
+Patch by Robin Mueller
+
+The strftime method of the libmusl writes 'UTC' instead of 'GMT' when
+the character Z is used in the format pattern, and it looks like the
+S3 clients don't like 'UTC' in the date strings.
+
+This patch replaces 'UTC' with 'GMT' at the relevant location.
+
+--- a/src/rgw/rgw_rest.cc	2021-07-08 16:03:56.000000000 +0200
++++ b/src/rgw/rgw_rest.cc	2021-08-19 09:48:30.339492024 +0200
+@@ -436,8 +436,21 @@
+     return 0;
+   }
+ 
+-  return strftime(timestr, sizeof(timestr),
+-                  "%a, %d %b %Y %H:%M:%S %Z", tmp);
++  size_t len = strftime(timestr, sizeof(timestr),
++                        "%a, %d %b %Y %H:%M:%S %Z", tmp);
++
++  int position = 0;
++  while (timestr[position] != 'U' && len - position > 3)
++    position++;
++
++  if (len - position == 3) {
++    char substr[4];
++    memcpy(substr, &timestr[position], 4);
++
++    if (strcmp(substr, "UTC") == 0)
++      memcpy(&timestr[position], "GMT", 3);
++  }
++  return len;
+ }
+ 
+ void dump_time_header(struct req_state *s, const char *name, real_time t)
diff --git a/repo/ceph/11-parse_rfc1123_alt.patch b/repo/ceph/11-parse_rfc1123_alt.patch
new file mode 100644
index 0000000..5b54c4e
--- /dev/null
+++ b/repo/ceph/11-parse_rfc1123_alt.patch
@@ -0,0 +1,53 @@
+Patch by Robin Mueller
+
+libmusl doesn't support the z character in the format pattern for strptime this 
+is a special functionality of glibc.
+
+patch is slightly adapted version of glibc code:
+https://elixir.bootlin.com/glibc/latest/source/time/strptime_l.c#L776
+
+--- a/src/rgw/rgw_common.cc	2021-07-08 16:03:56.000000000 +0200
++++ b/src/rgw/rgw_common.cc	2021-08-18 13:08:22.938903459 +0200
+@@ -531,7 +531,41 @@
+ {
+   // FIPS zeroization audit 20191115: this memset is not security related.
+   memset(t, 0, sizeof(*t));
+-  return check_str_end(strptime(s, "%a, %d %b %Y %H:%M:%S %z", t));
++  s = strptime(s, "%a, %d %b %Y %H:%M:%S", t);
++  if (s) {
++    s++;
++    int val;
++    val = 0;
++    while (isspace(*s))
++      ++s;
++    if (*s == 'Z') {
++        ++s;
++        t->tm_gmtoff = 0;
++    } else {
++      if (*s != '+' && *s != '-')
++        return 0;
++      bool neg = *s++ == '-';
++      int n = 0;
++      while (n < 4 && *s >= '0' && *s <= '9') {
++        val = val * 10 + *s++ - '0';
++        ++n;
++        if (*s == ':' && n == 2 && isdigit (*(s + 1)))
++          ++s;
++      }
++      if (n == 2)
++        val *= 100;
++      else if (n != 4)
++        /* Only two or four digits recognized.  */
++        return 0;
++      else if (val % 100 >= 60)
++        /* Minutes valid range is 0 through 59.  */
++        return 0;
++      t->tm_gmtoff = (val / 100) * 3600 + (val % 100) * 60;
++      if (neg)
++        t->tm_gmtoff = -t->tm_gmtoff;
++    }
++  }
++  return check_str_end(s);
+ }
+ 
+ bool parse_rfc2616(const char *s, struct tm *t)
diff --git a/repo/ceph/11-s3_expiration_header.patch b/repo/ceph/11-s3_expiration_header.patch
new file mode 100644
index 0000000..ac12a83
--- /dev/null
+++ b/repo/ceph/11-s3_expiration_header.patch
@@ -0,0 +1,30 @@
+Patch by Robin Mueller
+
+Fix musl date handling
+
+--- a/src/rgw/rgw_lc.cc	2021-09-16 16:27:19.000000000 +0200
++++ b/src/rgw/rgw_lc.cc	2021-10-01 09:17:06.996639952 +0200
+@@ -2238,8 +2238,21 @@
+     // Fri, 23 Dec 2012 00:00:00 GMT
+     char exp_buf[100];
+     time_t exp = ceph::real_clock::to_time_t(*expiration_date);
+-    if (std::strftime(exp_buf, sizeof(exp_buf),
+-		      "%a, %d %b %Y %T %Z", std::gmtime(&exp))) {
++    std::size_t len = std::strftime(exp_buf, sizeof(exp_buf), "%a, %d %b %Y %T %Z", std::gmtime(&exp));
++
++    if (len) {
++      int position = 0;
++      while (exp_buf[position] != 'U' && len - position > 3)
++        position++;
++
++      if (len - position == 3) {
++        char substr[4];
++        memcpy(substr, &exp_buf[position], 4);
++
++        if (strcmp(substr, "UTC") == 0)
++          memcpy(&exp_buf[position], "GMT", 3);
++      }
++
+       hdr = fmt::format("expiry-date=\"{0}\", rule-id=\"{1}\"", exp_buf,
+ 			*rule_id);
+     } else {
diff --git a/repo/ceph/12-package.json-resolutions.patch b/repo/ceph/12-package.json-resolutions.patch
new file mode 100644
index 0000000..ddc4ea2
--- /dev/null
+++ b/repo/ceph/12-package.json-resolutions.patch
@@ -0,0 +1,31 @@
+--- a/src/pybind/mgr/dashboard/CMakeLists.txt
++++ b/src/pybind/mgr/dashboard/CMakeLists.txt
+@@ -76,7 +76,7 @@
+ 
+ add_npm_command(
+   OUTPUT "${CMAKE_SOURCE_DIR}/src/pybind/mgr/dashboard/frontend/node_modules"
+-  COMMAND CYPRESS_CACHE_FOLDER=${CMAKE_SOURCE_DIR}/build/src/pybind/mgr/dashboard/cypress NG_CLI_ANALYTICS=false npm ci ${mgr-dashboard-userconfig}
++  COMMAND CYPRESS_CACHE_FOLDER=${CMAKE_SOURCE_DIR}/build/src/pybind/mgr/dashboard/cypress NG_CLI_ANALYTICS=false yarn install --network-timeout 600000 --frozen-lockfile ${mgr-dashboard-userconfig}
+   DEPENDS frontend/package.json
+   WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/pybind/mgr/dashboard/frontend
+   COMMENT "dashboard frontend dependencies are being installed"
+@@ -119,7 +119,7 @@
+ 
+ add_npm_command(
+   OUTPUT "${CMAKE_SOURCE_DIR}/src/pybind/mgr/dashboard/frontend/dist"
+-  COMMAND DASHBOARD_FRONTEND_LANGS="${DASHBOARD_FRONTEND_LANGS}" npm run build:localize -- ${npm_args}
++  COMMAND DASHBOARD_FRONTEND_LANGS="${DASHBOARD_FRONTEND_LANGS}" yarn run build:localize ${npm_args}
+   DEPENDS ${frontend_src} frontend/node_modules
+   WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/pybind/mgr/dashboard/frontend
+   COMMENT "dashboard frontend is being created"
+--- a/src/pybind/mgr/dashboard/frontend/package.json
++++ b/src/pybind/mgr/dashboard/frontend/package.json
+@@ -142,8 +142,5 @@
+     "ts-node": "9.0.0",
+     "tslint": "6.1.3",
+     "typescript": "4.1.6"
+-  },
+-  "resolutions": {
+-    "fsevents": "2.1.3"
+   }
+ }
diff --git a/repo/ceph/20-pci.patch b/repo/ceph/20-pci.patch
new file mode 100644
index 0000000..c16e276
--- /dev/null
+++ b/repo/ceph/20-pci.patch
@@ -0,0 +1,63 @@
+Musl patch for pci
+
+diff -Nurp a/src/spdk/dpdk/drivers/bus/pci/linux/pci_uio.c b/src/spdk/dpdk/drivers/bus/pci/linux/pci_uio.c
+--- a/src/spdk/dpdk/drivers/bus/pci/linux/pci_uio.c	2020-11-21 13:07:44.255206657 +0000
++++ b/src/spdk/dpdk/drivers/bus/pci/linux/pci_uio.c	2020-11-21 13:04:06.488285583 +0000
+@@ -14,6 +14,32 @@
+ 
+ #if defined(RTE_ARCH_X86)
+ #include <sys/io.h>
++#if defined(__GLIBC__)
++#define pci_uio_outl_p outl_p
++#define pci_uio_outw_p outw_p
++#define pci_uio_outb_p outb_p
++#else
++static inline void
++pci_uio_outl_p(unsigned int value, unsigned short int port)
++{
++       __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80" : : "a" (value),
++                             "Nd" (port));
++}
++
++static inline void
++pci_uio_outw_p(unsigned short int value, unsigned short int port)
++{
++       __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80" : : "a" (value),
++                             "Nd" (port));
++}
++
++static inline void
++pci_uio_outb_p(unsigned char value, unsigned short int port)
++{
++       __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value),
++                             "Nd" (port));
++}
++#endif
+ #endif
+ 
+ #include <rte_string_fns.h>
+@@ -528,21 +554,21 @@ pci_uio_ioport_write(struct rte_pci_iopo
+ 		if (len >= 4) {
+ 			size = 4;
+ #if defined(RTE_ARCH_X86)
+-			outl_p(*(const uint32_t *)s, reg);
++			pci_uio_outl_p(*(const uint32_t *)s, reg);
+ #else
+ 			*(volatile uint32_t *)reg = *(const uint32_t *)s;
+ #endif
+ 		} else if (len >= 2) {
+ 			size = 2;
+ #if defined(RTE_ARCH_X86)
+-			outw_p(*(const uint16_t *)s, reg);
++			pci_uio_outw_p(*(const uint16_t *)s, reg);
+ #else
+ 			*(volatile uint16_t *)reg = *(const uint16_t *)s;
+ #endif
+ 		} else {
+ 			size = 1;
+ #if defined(RTE_ARCH_X86)
+-			outb_p(*s, reg);
++			pci_uio_outb_p(*s, reg);
+ #else
+ 			*(volatile uint8_t *)reg = *s;
+ #endif
diff --git a/repo/ceph/30-32bit_fix.patch.noauto b/repo/ceph/30-32bit_fix.patch.noauto
new file mode 100644
index 0000000..aba21d6
--- /dev/null
+++ b/repo/ceph/30-32bit_fix.patch.noauto
@@ -0,0 +1,110 @@
+32bit specific patches
+
+diff -uNr ceph-15.2.4/src/client/Client.cc ceph-15.2.4-arm32_fix/src/client/Client.cc
+--- ceph-15.2.4/src/client/Client.cc	2020-07-01 01:10:51.000000000 +0930
++++ ceph-15.2.4-arm32_fix/src/client/Client.cc	2020-11-21 22:11:16.061796876 +1030
+@@ -10948,7 +10948,7 @@
+   ldout(cct, 20) << __func__ << " " << in << " " << in->ino << " -> " << in->ll_ref << dendl;
+ }
+ 
+-int Client::_ll_put(Inode *in, uint64_t num)
++int Client::_ll_put(Inode *in, size_t num)
+ {
+   in->ll_put(num);
+   ldout(cct, 20) << __func__ << " " << in << " " << in->ino << " " << num << " -> " << in->ll_ref << dendl;
+@@ -10989,7 +10989,7 @@
+   }
+ }
+ 
+-bool Client::_ll_forget(Inode *in, uint64_t count)
++bool Client::_ll_forget(Inode *in, size_t count)
+ {
+   inodeno_t ino = in->ino;
+ 
+@@ -11018,7 +11018,7 @@
+   return last;
+ }
+ 
+-bool Client::ll_forget(Inode *in, uint64_t count)
++bool Client::ll_forget(Inode *in, size_t count)
+ {
+   std::lock_guard lock(client_lock);
+   return _ll_forget(in, count);
+diff -uNr ceph-15.2.4/src/mds/PurgeQueue.h ceph-15.2.4-arm32_fix/src/mds/PurgeQueue.h
+--- ceph-15.2.4/src/mds/PurgeQueue.h	2020-07-01 01:10:51.000000000 +0930
++++ ceph-15.2.4-arm32_fix/src/mds/PurgeQueue.h	2020-11-21 22:11:16.065796889 +1030
+@@ -219,6 +219,6 @@
+   size_t purge_item_journal_size;
+ 
+   uint64_t ops_high_water = 0;
+-  uint64_t files_high_water = 0;
++  size_t files_high_water = 0;
+ };
+ #endif
+diff -uNr ceph-15.2.4/src/test/common/test_json_formattable.cc ceph-15.2.4-arm32_fix/src/test/common/test_json_formattable.cc
+--- ceph-15.2.4/src/test/common/test_json_formattable.cc	2020-07-01 01:10:51.000000000 +0930
++++ ceph-15.2.4-arm32_fix/src/test/common/test_json_formattable.cc	2020-11-21 22:11:16.065796889 +1030
+@@ -371,7 +371,7 @@
+ 
+   struct2() {
+     void *p = (void *)this;
+-    long i = (long)p;
++    unsigned long i = (unsigned long)p;
+     v.resize((i >> 16) % 16 + 1);
+   }
+ 
+diff -uNr ceph-15.2.4/src/test/libcephfs/ceph_pthread_self.h ceph-15.2.4-arm32_fix/src/test/libcephfs/ceph_pthread_self.h
+--- ceph-15.2.4/src/test/libcephfs/ceph_pthread_self.h	2020-07-01 01:10:51.000000000 +0930
++++ ceph-15.2.4-arm32_fix/src/test/libcephfs/ceph_pthread_self.h	2020-11-21 22:11:16.066796893 +1030
+@@ -25,7 +25,7 @@
+   static_assert(std::is_convertible_v<decltype(me), uint64_t> ||
+                 std::is_pointer_v<decltype(me)>,
+                 "we need to use pthread_self() for the owner parameter");
+-  return reinterpret_cast<uint64_t>(me);
++  return reinterpret_cast<uint64_t>((uint64_t) me);
+ }
+ 
+ #endif
+diff -uNr ceph-15.2.4/src/test/rbd_mirror/image_deleter/test_mock_TrashWatcher.cc ceph-15.2.4-arm32_fix/src/test/rbd_mirror/image_deleter/test_mock_TrashWatcher.cc
+--- ceph-15.2.4/src/test/rbd_mirror/image_deleter/test_mock_TrashWatcher.cc	2020-07-01 01:10:51.000000000 +0930
++++ ceph-15.2.4-arm32_fix/src/test/rbd_mirror/image_deleter/test_mock_TrashWatcher.cc	2020-11-21 22:11:16.066796893 +1030
+@@ -162,7 +162,7 @@
+                          int r) {
+     bufferlist bl;
+     encode(last_image_id, bl);
+-    encode(static_cast<size_t>(1024), bl);
++    encode(static_cast<uint64_t>(1024), bl);
+ 
+     bufferlist out_bl;
+     encode(images, out_bl);
+diff -Nurp a/src/client/Client.h b/src/client/Client.h
+--- a/src/client/Client.h
++++ b/src/client/Client.h
+@@ -525,7 +525,7 @@
+   int ll_lookupx(Inode *parent, const char *name, Inode **out,
+ 			struct ceph_statx *stx, unsigned want, unsigned flags,
+ 			const UserPerm& perms);
+-  bool ll_forget(Inode *in, uint64_t count);
++  bool ll_forget(Inode *in, size_t count);
+   bool ll_put(Inode *in);
+   int ll_get_snap_ref(snapid_t snap);
+ 
+@@ -1241,7 +1241,7 @@
+   void _fragmap_remove_stopped_mds(Inode *in, mds_rank_t mds);
+ 
+   void _ll_get(Inode *in);
+-  int _ll_put(Inode *in, uint64_t num);
++  int _ll_put(Inode *in, size_t num);
+   void _ll_drop_pins();
+ 
+   Fh *_create_fh(Inode *in, int flags, int cmode, const UserPerm& perms);
+@@ -1405,7 +1405,7 @@
+   int _lookup_parent(Inode *in, const UserPerm& perms, Inode **parent=NULL);
+   int _lookup_name(Inode *in, Inode *parent, const UserPerm& perms);
+   int _lookup_vino(vinodeno_t ino, const UserPerm& perms, Inode **inode=NULL);
+-  bool _ll_forget(Inode *in, uint64_t count);
++  bool _ll_forget(Inode *in, size_t count);
+ 
+   void collect_and_send_metrics();
+   void collect_and_send_global_metrics();
+ 
diff --git a/repo/ceph/30-cypress.patch.noauto b/repo/ceph/30-cypress.patch.noauto
new file mode 100644
index 0000000..fecf055
--- /dev/null
+++ b/repo/ceph/30-cypress.patch.noauto
@@ -0,0 +1,14 @@
+remove cypress as not availiable on 32bit platforms
+
+diff -Nurp a/src/pybind/mgr/dashboard/frontend/package.json b/src/pybind/mgr/dashboard/frontend/package.json
+--- a/src/pybind/mgr/dashboard/frontend/package.json    2021-04-03 08:58:07.611941559 +0100
++++ b/src/pybind/mgr/dashboard/frontend/package.json    2021-04-03 08:59:13.903122038 +0100
+@@ -119,8 +119,6 @@
+     "@types/node": "12.12.62",
+     "@types/simplebar": "5.1.1",
+     "codelyzer": "6.0.1",
+-    "cypress": "5.3.0",
+-    "cypress-multi-reporters": "1.4.0",
+     "html-linter": "1.1.1",
+     "htmllint-cli": "0.0.7",
+     "identity-obj-proxy": "3.0.0",
diff --git a/repo/ceph/30-ubuntu-32bit-fixes.patch.noauto b/repo/ceph/30-ubuntu-32bit-fixes.patch.noauto
new file mode 100644
index 0000000..9b9318d
--- /dev/null
+++ b/repo/ceph/30-ubuntu-32bit-fixes.patch.noauto
@@ -0,0 +1,137 @@
+Description: Misc fixes for 32 bit architecture builds.
+Author: James Page <james.page@ubuntu.com>
+Forwarded: no
+
+--- a/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc
++++ b/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc
+@@ -235,7 +235,8 @@ bool Replayer<I>::get_replay_status(std:
+ 
+   json_spirit::mObject root_obj;
+   root_obj["replay_state"] = replay_state;
+-  root_obj["remote_snapshot_timestamp"] = remote_snap_info->timestamp.sec();
++  root_obj["remote_snapshot_timestamp"] = static_cast<uint64_t>(
++    remote_snap_info->timestamp.sec());
+ 
+   auto matching_remote_snap_id = util::compute_remote_snap_id(
+     m_state_builder->local_image_ctx->image_lock,
+@@ -249,8 +250,8 @@ bool Replayer<I>::get_replay_status(std:
+     // use the timestamp from the matching remote image since
+     // the local snapshot would just be the time the snapshot was
+     // synced and not the consistency point in time.
+-    root_obj["local_snapshot_timestamp"] =
+-      matching_remote_snap_it->second.timestamp.sec();
++    root_obj["local_snapshot_timestamp"] = static_cast<uint64_t>(
++      matching_remote_snap_it->second.timestamp.sec());
+   }
+ 
+   matching_remote_snap_it = m_state_builder->remote_image_ctx->snap_info.find(
+@@ -258,7 +259,8 @@ bool Replayer<I>::get_replay_status(std:
+   if (m_remote_snap_id_end != CEPH_NOSNAP &&
+       matching_remote_snap_it !=
+         m_state_builder->remote_image_ctx->snap_info.end()) {
+-    root_obj["syncing_snapshot_timestamp"] = remote_snap_info->timestamp.sec();
++    root_obj["syncing_snapshot_timestamp"] = static_cast<uint64_t>(
++        remote_snap_info->timestamp.sec());
+     root_obj["syncing_percent"] = static_cast<uint64_t>(
+         100 * m_local_mirror_snap_ns.last_copied_object_number /
+         static_cast<float>(std::max<uint64_t>(1U, m_local_object_count)));
+--- a/src/s3select/include/s3select_functions.h
++++ b/src/s3select/include/s3select_functions.h
+@@ -585,7 +585,7 @@ struct _fn_diff_timestamp : public base_
+     {
+       boost::gregorian::date_period dp =
+         boost::gregorian::date_period( val_dt1.timestamp()->date(), val_dt2.timestamp()->date());
+-      result->set_value( dp.length().days() );
++      result->set_value( (int64_t)dp.length().days() );
+     }
+     else if (strcmp(val_date_part.str(), "hours") == 0)
+     {
+--- a/src/os/bluestore/BlueFS.cc
++++ b/src/os/bluestore/BlueFS.cc
+@@ -3744,11 +3744,11 @@ int BlueFS::do_replay_recovery_read(File
+ 
+ size_t BlueFS::probe_alloc_avail(int dev, uint64_t alloc_size)
+ {
+-  size_t total = 0;
+-  auto iterated_allocation = [&](size_t off, size_t len) {
++  uint64_t total = 0;
++  auto iterated_allocation = [&](uint64_t off, uint64_t len) {
+     //only count in size that is alloc_size aligned
+-    size_t dist_to_alignment;
+-    size_t offset_in_block = off & (alloc_size - 1);
++    uint64_t dist_to_alignment;
++    uint64_t offset_in_block = off & (alloc_size - 1);
+     if (offset_in_block == 0)
+       dist_to_alignment = 0;
+     else
+--- a/src/tools/neorados.cc
++++ b/src/tools/neorados.cc
+@@ -146,7 +146,7 @@ void create(R::RADOS& r, const std::vect
+ 			     obj, pname));
+ }
+ 
+-inline constexpr std::size_t io_size = 4 << 20;
++inline constexpr std::uint64_t io_size = 4 << 20;
+ 
+ void write(R::RADOS& r, const std::vector<std::string>& p, s::yield_context y)
+ {
+@@ -156,7 +156,7 @@ void write(R::RADOS& r, const std::vecto
+ 
+   bs::error_code ec;
+   std::unique_ptr<char[]> buf = std::make_unique<char[]>(io_size);
+-  std::size_t off = 0;
++  std::uint64_t off = 0;
+   boost::io::ios_exception_saver ies(std::cin);
+ 
+   std::cin.exceptions(std::istream::badbit);
+@@ -203,7 +203,7 @@ void read(R::RADOS& r, const std::vector
+ 		    obj, pname));
+   }
+ 
+-  std::size_t off = 0;
++  std::uint64_t off = 0;
+   ceph::buffer::list bl;
+   while (auto toread = std::max(len - off, io_size)) {
+     R::ReadOp op;
+--- a/src/tools/cephfs_mirror/FSMirror.cc
++++ b/src/tools/cephfs_mirror/FSMirror.cc
+@@ -334,7 +334,7 @@ void FSMirror::handle_acquire_directory(
+     std::scoped_lock locker(m_lock);
+     m_directories.emplace(dir_path);
+     m_service_daemon->add_or_update_fs_attribute(m_filesystem.fscid, SERVICE_DAEMON_DIR_COUNT_KEY,
+-                                                 m_directories.size());
++                                                 static_cast<uint64_t>(m_directories.size()));
+ 
+     for (auto &[peer, peer_replayer] : m_peer_replayers) {
+       dout(10) << ": peer=" << peer << dendl;
+@@ -352,7 +352,7 @@ void FSMirror::handle_release_directory(
+     if (it != m_directories.end()) {
+       m_directories.erase(it);
+       m_service_daemon->add_or_update_fs_attribute(m_filesystem.fscid, SERVICE_DAEMON_DIR_COUNT_KEY,
+-                                                   m_directories.size());
++                                                   static_cast<uint64_t>(m_directories.size()));
+       for (auto &[peer, peer_replayer] : m_peer_replayers) {
+         dout(10) << ": peer=" << peer << dendl;
+         peer_replayer->remove_directory(dir_path);
+--- a/src/librbd/object_map/DiffRequest.cc
++++ b/src/librbd/object_map/DiffRequest.cc
+@@ -175,7 +175,7 @@ void DiffRequest<I>::handle_load_object_
+     m_object_map.resize(num_objs);
+   }
+ 
+-  size_t prev_object_diff_state_size = m_object_diff_state->size();
++  uint64_t prev_object_diff_state_size = m_object_diff_state->size();
+   if (prev_object_diff_state_size < num_objs) {
+     // the diff state should be the largest of all snapshots in the set
+     m_object_diff_state->resize(num_objs);
+--- a/src/SimpleRADOSStriper.cc
++++ b/src/SimpleRADOSStriper.cc
+@@ -140,7 +140,7 @@ int SimpleRADOSStriper::remove()
+   return 0;
+ }
+ 
+-int SimpleRADOSStriper::truncate(uint64_t size)
++int SimpleRADOSStriper::truncate(size_t size)
+ {
+   d(5) << size << dendl;
+ 
diff --git a/repo/ceph/31-32bit_fix_tests.patch.noauto b/repo/ceph/31-32bit_fix_tests.patch.noauto
new file mode 100644
index 0000000..939c550
--- /dev/null
+++ b/repo/ceph/31-32bit_fix_tests.patch.noauto
@@ -0,0 +1,66 @@
+--- a/src/test/objectstore/test_bdev.cc
++++ b/src/test/objectstore/test_bdev.cc
+@@ -54,8 +54,8 @@
+     BlockDevice::create(g_ceph_context, bdev.path, NULL, NULL,
+       [](void* handle, void* aio) {}, NULL));
+   bufferlist bl;
+-  // writing a bit less than 4GB
+-  for (auto i = 0; i < 4000; i++) {
++  // writing a bit less than 1GB
++  for (auto i = 0; i < 1000; i++) {
+     string s(1048576, 'a' + (i % 28));
+     bl.append(s);
+   }
+--- a/src/test/objectstore/test_bluefs.cc
++++ b/src/test/objectstore/test_bluefs.cc
+@@ -237,7 +237,7 @@
+ }
+ 
+ TEST(BlueFS, very_large_write) {
+-  // we'll write a ~5G file, so allocate more than that for the whole fs
++  // we'll write a ~1G file, so allocate more than that for the whole fs
+   uint64_t size = 1048576 * 1024 * 6ull;
+   TempBdev bdev{size};
+   BlueFS fs(g_ceph_context);
+@@ -260,12 +260,12 @@
+     BlueFS::FileWriter *h;
+     ASSERT_EQ(0, fs.mkdir("dir"));
+     ASSERT_EQ(0, fs.open_for_write("dir", "bigfile", &h, false));
+-    for (unsigned i = 0; i < 3*1024*1048576ull / sizeof(buf); ++i) {
++    for (unsigned i = 0; i < 1*1024*1048576ull / sizeof(buf); ++i) {
+       h->append(buf, sizeof(buf));
+       total_written += sizeof(buf);
+     }
+     fs.fsync(h);
+-    for (unsigned i = 0; i < 2*1024*1048576ull / sizeof(buf); ++i) {
++    for (unsigned i = 0; i < 1*1024*1048576ull / sizeof(buf); ++i) {
+       h->append(buf, sizeof(buf));
+       total_written += sizeof(buf);
+     }
+@@ -278,7 +278,7 @@
+     bufferlist bl;
+     BlueFS::FileReaderBuffer readbuf(10485760);
+     ASSERT_EQ(h->file->fnode.size, total_written);
+-    for (unsigned i = 0; i < 3*1024*1048576ull / sizeof(buf); ++i) {
++    for (unsigned i = 0; i < 1*1024*1048576ull / sizeof(buf); ++i) {
+       bl.clear();
+       fs.read(h, &readbuf, i * sizeof(buf), sizeof(buf), &bl, NULL);
+       int r = memcmp(buf, bl.c_str(), sizeof(buf));
+@@ -288,7 +288,7 @@
+       }
+       ASSERT_EQ(0, r);
+     }
+-    for (unsigned i = 0; i < 2*1024*1048576ull / sizeof(buf); ++i) {
++    for (unsigned i = 0; i < 1*1024*1048576ull / sizeof(buf); ++i) {
+       bl.clear();
+       fs.read(h, &readbuf, i * sizeof(buf), sizeof(buf), &bl, NULL);
+       int r = memcmp(buf, bl.c_str(), sizeof(buf));
+@@ -313,7 +313,7 @@
+ }
+ 
+ TEST(BlueFS, very_large_write2) {
+-  // we'll write a ~5G file, so allocate more than that for the whole fs
++  // we'll write a ~1G file, so allocate more than that for the whole fs
+   uint64_t size_full = 1048576 * 1024 * 6ull;
+   uint64_t size = 1048576 * 1024 * 5ull;
+   TempBdev bdev{ size_full };
diff --git a/repo/ceph/32-PurgeQueue.cc-cast.patch b/repo/ceph/32-PurgeQueue.cc-cast.patch
new file mode 100644
index 0000000..19a0719
--- /dev/null
+++ b/repo/ceph/32-PurgeQueue.cc-cast.patch
@@ -0,0 +1,85 @@
+Submitted as: https://github.com/ceph/ceph/pull/41235
+
+commit 953e7dc0f911f84a4bb377aee45b22e2ffad6867
+Author: Duncan Bellamy <dunk@denkimushi.com>
+Date:   Sat May 8 11:52:35 2021 +0100
+
+    mds: PurgeQueue.cc add static cast for 32bit compilation
+    
+    files_high_water is defined as uint64_t but when compiling on 32bit these max functions
+    fail as they are both not considered uint64_t by gcc 10 even though they are
+    
+      files_high_water = std::max(files_high_water,
+                                   static_cast<uint64_t>(in_flight.size()));
+    
+    Fixes: https://tracker.ceph.com/issues/50707
+    
+    Signed-off-by: Duncan Bellamy <dunk@denkimushi.com>
+
+diff --git a/src/mds/PurgeQueue.cc b/src/mds/PurgeQueue.cc
+index 977be2c118..3104a3ccc4 100644
+--- a/src/mds/PurgeQueue.cc
++++ b/src/mds/PurgeQueue.cc
+@@ -7,9 +7,9 @@
+  *
+  * This is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Lesser General Public
+- * License version 2.1, as published by the Free Software 
++ * License version 2.1, as published by the Free Software
+  * Foundation.  See file COPYING.
+- * 
++ *
+  */
+ 
+ #include "common/debug.h"
+@@ -594,8 +594,8 @@ void PurgeQueue::_execute_item(
+ 
+   in_flight[expire_to] = item;
+   logger->set(l_pq_executing, in_flight.size());
+-  files_high_water = std::max(files_high_water,
+-                              static_cast<uint64_t>(in_flight.size()));
++  files_high_water = std::max<uint64_t>(files_high_water,
++                              in_flight.size());
+   logger->set(l_pq_executing_high_water, files_high_water);
+   auto ops = _calculate_ops(item);
+   ops_in_flight += ops;
+@@ -662,8 +662,8 @@ void PurgeQueue::_execute_item(
+     logger->set(l_pq_executing_ops_high_water, ops_high_water);
+     in_flight.erase(expire_to);
+     logger->set(l_pq_executing, in_flight.size());
+-    files_high_water = std::max(files_high_water,
+-                                static_cast<uint64_t>(in_flight.size()));
++    files_high_water = std::max<uint64_t>(files_high_water,
++                                in_flight.size());
+     logger->set(l_pq_executing_high_water, files_high_water);
+     return;
+   }
+@@ -716,19 +716,19 @@ void PurgeQueue::_execute_item_complete(
+ 
+   in_flight.erase(iter);
+   logger->set(l_pq_executing, in_flight.size());
+-  files_high_water = std::max(files_high_water,
+-                              static_cast<uint64_t>(in_flight.size()));
++  files_high_water = std::max<uint64_t>(files_high_water,
++                              in_flight.size());
+   logger->set(l_pq_executing_high_water, files_high_water);
+   dout(10) << "in_flight.size() now " << in_flight.size() << dendl;
+ 
+-  uint64_t write_pos = journaler.get_write_pos(); 
+-  uint64_t read_pos = journaler.get_read_pos(); 
+-  uint64_t expire_pos = journaler.get_expire_pos(); 
+-  uint64_t item_num = (write_pos - (in_flight.size() ? expire_pos : read_pos)) 
++  uint64_t write_pos = journaler.get_write_pos();
++  uint64_t read_pos = journaler.get_read_pos();
++  uint64_t expire_pos = journaler.get_expire_pos();
++  uint64_t item_num = (write_pos - (in_flight.size() ? expire_pos : read_pos))
+ 		      / purge_item_journal_size;
+-  dout(10) << "left purge items in journal: " << item_num 
+-    << " (purge_item_journal_size/write_pos/read_pos/expire_pos) now at " 
+-    << "(" << purge_item_journal_size << "/" << write_pos << "/" << read_pos 
++  dout(10) << "left purge items in journal: " << item_num
++    << " (purge_item_journal_size/write_pos/read_pos/expire_pos) now at "
++    << "(" << purge_item_journal_size << "/" << write_pos << "/" << read_pos
+     << "/" << expire_pos << ")" << dendl;
+ 
+   logger->set(l_pq_item_in_journal, item_num);
diff --git a/repo/ceph/32-upstream32bit.patch b/repo/ceph/32-upstream32bit.patch
new file mode 100644
index 0000000..917cd03
--- /dev/null
+++ b/repo/ceph/32-upstream32bit.patch
@@ -0,0 +1,92 @@
+commit 72a5993da70955182a73755ddba35005a6d9fc11
+Author: Kefu Chai <kchai@redhat.com>
+Date:   Tue Apr 27 18:24:24 2021 +0800
+
+    cls/rbd, librbd: use uint64_t for sparse_size
+    
+    the size of `size_t` is varies from architecture to architecture. the
+    C++ standard only requires it to be able to represent the maximum possible
+    size of object of any type. on 32-bit architectures, it's very likely a
+    32-bit unsigned integer. to ensure the interoperability between the
+    64-bit systems and 32-bit systems, we should use a type with explicitly
+    defined size.
+    
+    also, we don't define the dencoder for size_t. so on systems where
+    size_t is not backed by uint32_t or uint64_t, the tree does not compile.
+    
+    in this change, use uint64_t for sparse_size. and leave
+    `C_SparsifyObject::m_sparse_size` intact. as the latter should be able
+    to be promoted to uint64_t when necessary.
+    
+    this change is backward compatible on 64-bit systems.
+    
+    Signed-off-by: Kefu Chai <kchai@redhat.com>
+
+diff --git a/src/cls/rbd/cls_rbd.cc b/src/cls/rbd/cls_rbd.cc
+index 33910b7df5..e3e05d85ed 100644
+--- a/src/cls/rbd/cls_rbd.cc
++++ b/src/cls/rbd/cls_rbd.cc
+@@ -7996,7 +7996,7 @@ int namespace_list(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
+  */
+ int sparsify(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
+ {
+-  size_t sparse_size;
++  uint64_t sparse_size;
+   bool remove_empty;
+   try {
+     auto iter = in->cbegin();
+diff --git a/src/cls/rbd/cls_rbd_client.cc b/src/cls/rbd/cls_rbd_client.cc
+index cefa1fed79..fee3ac8923 100644
+--- a/src/cls/rbd/cls_rbd_client.cc
++++ b/src/cls/rbd/cls_rbd_client.cc
+@@ -2974,7 +2974,7 @@ int namespace_list(librados::IoCtx *ioctx,
+   return namespace_list_finish(&iter, entries);
+ }
+ 
+-void sparsify(librados::ObjectWriteOperation *op, size_t sparse_size,
++void sparsify(librados::ObjectWriteOperation *op, uint64_t sparse_size,
+               bool remove_empty)
+ {
+   bufferlist bl;
+@@ -2983,7 +2983,7 @@ void sparsify(librados::ObjectWriteOperation *op, size_t sparse_size,
+   op->exec("rbd", "sparsify", bl);
+ }
+ 
+-int sparsify(librados::IoCtx *ioctx, const std::string &oid, size_t sparse_size,
++int sparsify(librados::IoCtx *ioctx, const std::string &oid, uint64_t sparse_size,
+              bool remove_empty)
+ {
+   librados::ObjectWriteOperation op;
+diff --git a/src/cls/rbd/cls_rbd_client.h b/src/cls/rbd/cls_rbd_client.h
+index 12b34c4832..ef2b05fd84 100644
+--- a/src/cls/rbd/cls_rbd_client.h
++++ b/src/cls/rbd/cls_rbd_client.h
+@@ -652,9 +652,9 @@ int sparse_copyup(librados::IoCtx *ioctx, const std::string &oid,
+                   const std::map<uint64_t, uint64_t> &extent_map,
+                   ceph::buffer::list data);
+ 
+-void sparsify(librados::ObjectWriteOperation *op, size_t sparse_size,
++void sparsify(librados::ObjectWriteOperation *op, uint64_t sparse_size,
+               bool remove_empty);
+-int sparsify(librados::IoCtx *ioctx, const std::string &oid, size_t sparse_size,
++int sparsify(librados::IoCtx *ioctx, const std::string &oid, uint64_t sparse_size,
+              bool remove_empty);
+ 
+ } // namespace cls_client
+diff --git a/src/librbd/WatchNotifyTypes.h b/src/librbd/WatchNotifyTypes.h
+index ca0b40f28f..4fad31ffac 100644
+--- a/src/librbd/WatchNotifyTypes.h
++++ b/src/librbd/WatchNotifyTypes.h
+@@ -410,10 +410,10 @@ struct MigratePayload : public AsyncRequestPayloadBase {
+ };
+ 
+ struct SparsifyPayload : public AsyncRequestPayloadBase {
+-  size_t sparse_size = 0;
++  uint64_t sparse_size = 0;
+ 
+   SparsifyPayload() {}
+-  SparsifyPayload(const AsyncRequestId &id, size_t sparse_size)
++  SparsifyPayload(const AsyncRequestId &id, uint64_t sparse_size)
+     : AsyncRequestPayloadBase(id), sparse_size(sparse_size) {
+   }
+ 
diff --git a/repo/ceph/32-upstream32bitcleanup.patch b/repo/ceph/32-upstream32bitcleanup.patch
new file mode 100644
index 0000000..1fe036e
--- /dev/null
+++ b/repo/ceph/32-upstream32bitcleanup.patch
@@ -0,0 +1,143 @@
+submitted as https://github.com/ceph/ceph/pull/41239
+
+commit 558adef26a2149b0dd644a2c9a7e2db8d370b556
+Author: Kefu Chai <kchai@redhat.com>
+Date:   Sat May 8 21:02:54 2021 +0800
+
+    librbd/deep_copy: cast uint64_t to size_t for constructing SparseBufferlistExtent
+    
+    SparseBufferlistExtent's ctor accepts size_t, so, on a 32-bit platform,
+    the parameter would be narrowed before passing to the ctor, and GCC
+    complains at seeing this:
+    
+    /builds/a16bitsysop/aports/community/ceph/src/ceph-16.2.3/src/librbd/deep_copy/ObjectCopyRequest.cc:789:60: warning: narrowing conversion of 'object_extent.striper::LightweightObjectExtent::length'
+    from 'uint64_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} [-Wnarrowing]
+      789 |             {io::SPARSE_EXTENT_STATE_ZEROED, object_extent.length});
+          |                                              ~~~~~~~~~~~~~~^~~~~~
+    
+    this change make this cast explicit and silences the warning.
+    
+    Signed-off-by: Kefu Chai <kchai@redhat.com>
+
+diff --git a/src/librbd/deep_copy/ObjectCopyRequest.cc b/src/librbd/deep_copy/ObjectCopyRequest.cc
+index e86ed5ea1c..efc6749536 100644
+--- a/src/librbd/deep_copy/ObjectCopyRequest.cc
++++ b/src/librbd/deep_copy/ObjectCopyRequest.cc
+@@ -614,7 +614,8 @@ void ObjectCopyRequest<I>::merge_write_ops() {
+ 
+         m_snapshot_sparse_bufferlist[src_snap_seq].insert(
+           object_extent.offset, object_extent.length,
+-          {io::SPARSE_EXTENT_STATE_DATA, object_extent.length,\
++          {io::SPARSE_EXTENT_STATE_DATA,
++           static_cast<size_t>(object_extent.length),
+            std::move(sub_bl)});
+ 
+         buffer_offset += object_extent.length;
+diff --git a/src/librbd/io/CopyupRequest.cc b/src/librbd/io/CopyupRequest.cc
+index d70851409f..a3af713151 100644
+--- a/src/librbd/io/CopyupRequest.cc
++++ b/src/librbd/io/CopyupRequest.cc
+@@ -711,7 +711,9 @@ int CopyupRequest<I>::prepare_copyup_data() {
+ 
+       sparse_bufferlist.insert(
+         object_offset, object_length,
+-        {SPARSE_EXTENT_STATE_DATA, object_length, std::move(sub_bl)});
++        {SPARSE_EXTENT_STATE_DATA,
++         static_cast<size_t>(object_length),
++         std::move(sub_bl)});
+     }
+   } else {
+     // copyup that will concurrently written to the HEAD revision with the
+commit 130fdf7bcfd2b4c5a5b34809952b69b70e9c11a4
+Author: Kefu Chai <kchai@redhat.com>
+Date:   Sat May 8 20:59:07 2021 +0800
+
+    mgr/PyModule: use Py_ssize_t for the PyList index
+    
+    also silences the warnings like:
+    
+    mgr/PyModule.cc:574:30: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'Py_ssize_t' {aka 'int'} [-Wsign-compare]
+      574 |       for (unsigned i = 0; i < PyList_Size(p); ++i) {
+          |                            ~~^~~~~~~~~~~~~~~~
+    
+    Signed-off-by: Kefu Chai <kchai@redhat.com>
+
+diff --git a/src/mgr/PyModule.cc b/src/mgr/PyModule.cc
+index 28c76fe7ed..ff1ff85e7e 100644
+--- a/src/mgr/PyModule.cc
++++ b/src/mgr/PyModule.cc
+@@ -562,7 +562,7 @@ int PyModule::load_options()
+     }
+     p = PyDict_GetItemString(pOption, "enum_allowed");
+     if (p && PyObject_TypeCheck(p, &PyList_Type)) {
+-      for (unsigned i = 0; i < PyList_Size(p); ++i) {
++      for (Py_ssize_t i = 0; i < PyList_Size(p); ++i) {
+ 	auto q = PyList_GetItem(p, i);
+ 	if (q) {
+ 	  auto r = PyObject_Str(q);
+@@ -573,7 +573,7 @@ int PyModule::load_options()
+     }
+     p = PyDict_GetItemString(pOption, "see_also");
+     if (p && PyObject_TypeCheck(p, &PyList_Type)) {
+-      for (unsigned i = 0; i < PyList_Size(p); ++i) {
++      for (Py_ssize_t i = 0; i < PyList_Size(p); ++i) {
+ 	auto q = PyList_GetItem(p, i);
+ 	if (q && PyObject_TypeCheck(q, &PyUnicode_Type)) {
+ 	  option.see_also.insert(PyUnicode_AsUTF8(q));
+@@ -582,7 +582,7 @@ int PyModule::load_options()
+     }
+     p = PyDict_GetItemString(pOption, "tags");
+     if (p && PyObject_TypeCheck(p, &PyList_Type)) {
+-      for (unsigned i = 0; i < PyList_Size(p); ++i) {
++      for (Py_ssize_t i = 0; i < PyList_Size(p); ++i) {
+ 	auto q = PyList_GetItem(p, i);
+ 	if (q && PyObject_TypeCheck(q, &PyUnicode_Type)) {
+ 	  option.tags.insert(PyUnicode_AsUTF8(q));
+commit 3bf4b32c9bd15652b24bc4b8c8ea07fb6bb04357
+Author: Kefu Chai <kchai@redhat.com>
+Date:   Sat May 8 20:51:19 2021 +0800
+
+    os/bluestore: print size_t using %xz
+    
+    we cannot assume that size_t is an alias of "long"
+    
+    Signed-off-by: Kefu Chai <kchai@redhat.com>
+
+diff --git a/src/os/bluestore/Allocator.cc b/src/os/bluestore/Allocator.cc
+index 75f3172ca5..3428545414 100644
+--- a/src/os/bluestore/Allocator.cc
++++ b/src/os/bluestore/Allocator.cc
+@@ -81,8 +81,8 @@ public:
+         f->open_object_section("free");
+         char off_hex[30];
+         char len_hex[30];
+-        snprintf(off_hex, sizeof(off_hex) - 1, "0x%lx", off);
+-        snprintf(len_hex, sizeof(len_hex) - 1, "0x%lx", len);
++        snprintf(off_hex, sizeof(off_hex) - 1, "0x%zx", off);
++        snprintf(len_hex, sizeof(len_hex) - 1, "0x%zx", len);
+         f->dump_string("offset", off_hex);
+         f->dump_string("length", len_hex);
+         f->close_section();
+commit 3af466ee84209896f8671046c837350e736f15de
+Author: Kefu Chai <kchai@redhat.com>
+Date:   Sat May 8 20:50:08 2021 +0800
+
+    client: print int64_t using PRId64
+    
+    we cannot assume that int64_t is an alias of "long"
+    
+    Signed-off-by: Kefu Chai <kchai@redhat.com>
+
+diff --git a/src/client/Client.cc b/src/client/Client.cc
+index acdd8f0934..7352824f6c 100644
+--- a/src/client/Client.cc
++++ b/src/client/Client.cc
+@@ -12772,7 +12772,7 @@ size_t Client::_vxattrcb_cluster_fsid(Inode *in, char *val, size_t size)
+ size_t Client::_vxattrcb_client_id(Inode *in, char *val, size_t size)
+ {
+   auto name = messenger->get_myname();
+-  return snprintf(val, size, "%s%ld", name.type_str(), name.num());
++  return snprintf(val, size, "%s%" PRId64, name.type_str(), name.num());
+ }
+ 
+ #define CEPH_XATTR_NAME(_type, _name) "ceph." #_type "." #_name
diff --git a/repo/ceph/35-fix_ErasureCodeShec.patch b/repo/ceph/35-fix_ErasureCodeShec.patch
new file mode 100644
index 0000000..0ab2cc2
--- /dev/null
+++ b/repo/ceph/35-fix_ErasureCodeShec.patch
@@ -0,0 +1,17 @@
+patch by Vladimir Bashkirtsev
+
+diff -uNr ceph-15.2.4/src/erasure-code/shec/ErasureCodeShec.cc ceph-15.2.4-fix_ErasureCodeShec/src/erasure-code/shec/ErasureCodeShec.cc
+--- ceph-15.2.4/src/erasure-code/shec/ErasureCodeShec.cc	2020-07-01 01:10:51.000000000 +0930
++++ ceph-15.2.4-fix_ErasureCodeShec/src/erasure-code/shec/ErasureCodeShec.cc	2020-11-14 00:46:20.029488684 +1030
+@@ -197,7 +197,10 @@
+   }
+   unsigned int k = get_data_chunk_count();
+   unsigned int m = get_chunk_count() - k;
+-  unsigned blocksize = (*chunks.begin()).second.length();
++  unsigned blocksize = 0;
++  if (chunks.size() > 0) {
++    blocksize = (*chunks.begin()).second.length();
++  }
+   for (unsigned int i =  0; i < k + m; i++) {
+     if (chunks.find(i) == chunks.end()) {
+       bufferlist tmp;
diff --git a/repo/ceph/37-fix_tests.patch b/repo/ceph/37-fix_tests.patch
new file mode 100644
index 0000000..169f6ef
--- /dev/null
+++ b/repo/ceph/37-fix_tests.patch
@@ -0,0 +1,86 @@
+patch by Vladimir Bashkirtsev
+increase timeouts for armv7 ci
+
+diff -uNr ceph-15.2.4/src/test/CMakeLists.txt ceph-15.2.4-fix_tests/src/test/CMakeLists.txt
+--- ceph-15.2.4/src/test/CMakeLists.txt	2020-07-01 01:10:51.000000000 +0930
++++ ceph-15.2.4-fix_tests/src/test/CMakeLists.txt	2020-11-08 17:37:15.788767448 +1030
+@@ -528,11 +528,17 @@
+   # Run rbd-unit-tests separate so they an run in parallel
+   # For values see: src/include/rbd/features.h
+   add_ceph_test(run-rbd-unit-tests-N.sh   ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh N)
++  set_tests_properties(run-rbd-unit-tests-N.sh PROPERTIES TIMEOUT 7200)
+   add_ceph_test(run-rbd-unit-tests-0.sh   ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh 0)
++  set_tests_properties(run-rbd-unit-tests-0.sh PROPERTIES TIMEOUT 7200)
+   add_ceph_test(run-rbd-unit-tests-1.sh   ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh 1)
++  set_tests_properties(run-rbd-unit-tests-1.sh PROPERTIES TIMEOUT 7200)
+   add_ceph_test(run-rbd-unit-tests-61.sh  ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh 61)
++  set_tests_properties(run-rbd-unit-tests-61.sh PROPERTIES TIMEOUT 7200)
+   add_ceph_test(run-rbd-unit-tests-109.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh 109)
++  set_tests_properties(run-rbd-unit-tests-109.sh PROPERTIES TIMEOUT 7200)
+   add_ceph_test(run-rbd-unit-tests-127.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh 127)
++  set_tests_properties(run-rbd-unit-tests-127.sh PROPERTIES TIMEOUT 7200)
+   if(FREEBSD)
+     add_ceph_test(rbd-ggate.sh ${CMAKE_CURRENT_SOURCE_DIR}/rbd-ggate.sh)
+   endif(FREEBSD)
+@@ -546,6 +552,7 @@
+ #add_ceph_test(test_pidfile.sh ${CMAKE_CURRENT_SOURCE_DIR}/test_pidfile.sh)
+ 
+ add_ceph_test(smoke.sh ${CMAKE_CURRENT_SOURCE_DIR}/smoke.sh)
++set_tests_properties(smoke.sh PROPERTIES TIMEOUT 14400)
+ 
+ set_property(
+   TEST ${tox_tests}
+diff -uNr ceph-15.2.4/src/test/encoding/CMakeLists.txt ceph-15.2.4-fix_tests/src/test/encoding/CMakeLists.txt
+--- ceph-15.2.4/src/test/encoding/CMakeLists.txt	2020-07-01 01:10:51.000000000 +0930
++++ ceph-15.2.4-fix_tests/src/test/encoding/CMakeLists.txt	2020-11-08 17:37:15.789767451 +1030
+@@ -1,3 +1,5 @@
+ # scripts
+ add_ceph_test(check-generated.sh ${CMAKE_CURRENT_SOURCE_DIR}/check-generated.sh)
++set_tests_properties(check-generated.sh PROPERTIES TIMEOUT 18000)
+ add_ceph_test(readable.sh ${CMAKE_CURRENT_SOURCE_DIR}/readable.sh)
++set_tests_properties(readable.sh PROPERTIES TIMEOUT 18000)
+diff -uNr ceph-15.2.4/src/test/mgr/CMakeLists.txt ceph-15.2.4-fix_tests/src/test/mgr/CMakeLists.txt
+--- ceph-15.2.4/src/test/mgr/CMakeLists.txt	2020-07-01 01:10:51.000000000 +0930
++++ ceph-15.2.4-fix_tests/src/test/mgr/CMakeLists.txt	2020-11-08 17:37:15.790767454 +1030
+@@ -9,6 +9,7 @@
+ if(WITH_MGR_DASHBOARD_FRONTEND)
+   if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64|arm|ARM")
+     add_ceph_test(mgr-dashboard-frontend-unittests ${CMAKE_SOURCE_DIR}/src/pybind/mgr/dashboard/run-frontend-unittests.sh)
++    set_tests_properties(mgr-dashboard-frontend-unittests PROPERTIES TIMEOUT 72000)
+   endif(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64|arm|ARM")
+ 
+   add_ceph_test(mgr-dashboard-smoke.sh ${CMAKE_CURRENT_SOURCE_DIR}/mgr-dashboard-smoke.sh)
+diff -uNr ceph-15.2.4/src/test/objectstore/CMakeLists.txt ceph-15.2.4-fix_tests/src/test/objectstore/CMakeLists.txt
+--- ceph-15.2.4/src/test/objectstore/CMakeLists.txt	2020-07-01 01:10:51.000000000 +0930
++++ ceph-15.2.4-fix_tests/src/test/objectstore/CMakeLists.txt	2020-11-08 17:37:15.791767457 +1030
+@@ -131,6 +131,7 @@
+     test_bluefs.cc
+     )
+   add_ceph_unittest(unittest_bluefs)
++  set_tests_properties(unittest_bluefs PROPERTIES TIMEOUT 7200)
+   target_link_libraries(unittest_bluefs os global)
+ 
+   # unittest_bluestore_types
+diff -uNr ceph-15.2.4/src/test/osd/CMakeLists.txt ceph-15.2.4-fix_tests/src/test/osd/CMakeLists.txt
+--- ceph-15.2.4/src/test/osd/CMakeLists.txt	2020-07-01 01:10:51.000000000 +0930
++++ ceph-15.2.4-fix_tests/src/test/osd/CMakeLists.txt	2020-11-08 17:41:54.515606236 +1030
+@@ -35,6 +35,7 @@
+ 
+ # scripts
+ add_ceph_test(safe-to-destroy.sh ${CMAKE_CURRENT_SOURCE_DIR}/safe-to-destroy.sh)
++set_tests_properties(safe-to-destroy.sh PROPERTIES TIMEOUT 7200)
+ 
+ # unittest_osdmap
+ add_executable(unittest_osdmap
+diff -uNr ceph-15.2.4/src/test/osd/TestOSDScrub.cc ceph-15.2.4-fix_tests/src/test/osd/TestOSDScrub.cc
+--- ceph-15.2.4/src/test/osd/TestOSDScrub.cc	2020-07-01 01:10:51.000000000 +0930
++++ ceph-15.2.4-fix_tests/src/test/osd/TestOSDScrub.cc	2020-11-08 17:37:15.793767463 +1030
+@@ -70,7 +70,7 @@
+   g_ceph_context->_conf.set_val("osd_scrub_begin_hour", "0");
+   g_ceph_context->_conf.set_val("osd_scrub_end_hour", "24");
+   g_ceph_context->_conf.apply_changes(nullptr);
+-  tm tm;
++  tm tm = {0};
+   tm.tm_isdst = -1;
+   strptime("2015-01-16 12:05:13", "%Y-%m-%d %H:%M:%S", &tm);
+   utime_t now = utime_t(mktime(&tm), 0);
diff --git a/repo/ceph/42-no-virtualenvs.patch b/repo/ceph/42-no-virtualenvs.patch
new file mode 100644
index 0000000..541b338
--- /dev/null
+++ b/repo/ceph/42-no-virtualenvs.patch
@@ -0,0 +1,71 @@
+based on gentoo patch
+use system node instead of nodeenv installing one as only availiable for x86 with musl
+
+--- a/cmake/modules/AddCephTest.cmake
++++ b/cmake/modules/AddCephTest.cmake
+@@ -68,14 +68,6 @@
+   endif()
+   string(REPLACE ";" "," tox_envs "${tox_envs}")
+   find_package(Python3 QUIET REQUIRED)
+-  add_custom_command(
+-    OUTPUT ${venv_path}/bin/activate
+-    COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh --python="${Python3_EXECUTABLE}" ${venv_path}
+-    WORKING_DIRECTORY ${tox_path}
+-    COMMENT "preparing venv for ${name}")
+-  add_custom_target(${name}-venv
+-    DEPENDS ${venv_path}/bin/activate)
+-  add_dependencies(tests ${name}-venv)
+   add_test(
+     NAME ${test_name}
+     COMMAND ${CMAKE_SOURCE_DIR}/src/script/run_tox.sh
+--- a/src/ceph-volume/CMakeLists.txt
++++ b/src/ceph-volume/CMakeLists.txt
+@@ -8,22 +8,6 @@
+   add_subdirectory(plugin/zfs)
+ endif()
+ 
+-# Required for running ceph-volume inventory in a vstart environment
+-set(CEPH_VOLUME_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/ceph-volume-virtualenv)
+-
+-add_custom_command(
+-  OUTPUT ${CEPH_VOLUME_VIRTUALENV}/bin/python
+-  COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh --python=${Python3_EXECUTABLE} ${CEPH_VOLUME_VIRTUALENV}
+-  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/ceph-volume
+-  COMMENT "ceph-volume venv is being created")
+-
+-add_custom_command(
+-  OUTPUT ${CEPH_VOLUME_VIRTUALENV}/bin/ceph-volume
+-  DEPENDS ${CEPH_VOLUME_VIRTUALENV}/bin/python
+-  COMMAND . ${CEPH_VOLUME_VIRTUALENV}/bin/activate && ${CEPH_VOLUME_VIRTUALENV}/bin/python setup.py develop && deactivate
+-  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/ceph-volume
+-  COMMENT "${CMAKE_SOURCE_DIR}/src/ceph-volume")
+-
+ add_custom_target(ceph-volume-venv-setup
+   DEPENDS ${CEPH_VOLUME_VIRTUALENV}/bin/ceph-volume)
+ 
+--- a/src/pybind/mgr/dashboard/CMakeLists.txt
++++ b/src/pybind/mgr/dashboard/CMakeLists.txt
+@@ -5,9 +5,6 @@
+   set(multi_kw COMMAND DEPENDS)
+   cmake_parse_arguments(NC "${options}" "${single_kw}" "${multi_kw}" ${ARGN})
+   string(REPLACE ";" " " command "${NC_COMMAND}")
+-  if(NC_NODEENV)
+-    string(REGEX REPLACE "^(.*(npm|npx) .*)$" ". ${mgr-dashboard-nodeenv-dir}/bin/activate && \\1 && deactivate" command ${command})
+-  endif()
+   string(REPLACE " " ";" command "${command}")
+   add_custom_command(
+     OUTPUT "${NC_OUTPUT}"
+@@ -51,11 +48,8 @@
+     set(node_mirror_opt "--mirror=$ENV{NODE_MIRROR}")
+   endif()
+   add_custom_command(
+-    OUTPUT "${mgr-dashboard-nodeenv-dir}/bin/npm"
+-    COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh --python=${MGR_PYTHON_EXECUTABLE} ${mgr-dashboard-nodeenv-dir}
+-    COMMAND ${mgr-dashboard-nodeenv-dir}/bin/pip install nodeenv
+-    COMMAND ${mgr-dashboard-nodeenv-dir}/bin/nodeenv --verbose ${node_mirror_opt} -p --node=12.18.2
+-    COMMAND mkdir ${mgr-dashboard-nodeenv-dir}/.npm
++    OUTPUT "/usr/bin/npm"
++    COMMAND /usr/bin/nodeenv -p --node=system
+     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+     COMMENT "dashboard nodeenv is being installed"
+     )
diff --git a/repo/ceph/43-LogClock.h.patch b/repo/ceph/43-LogClock.h.patch
new file mode 100644
index 0000000..8cd02e5
--- /dev/null
+++ b/repo/ceph/43-LogClock.h.patch
@@ -0,0 +1,18 @@
+reported as issue
+https://tracker.ceph.com/issues/50133
+
+needed for 32bit platforms
+
+--- aa/src/log/LogClock.h
++++ bb/src/log/LogClock.h
+@@ -12,10 +12,6 @@
+ #include "include/ceph_assert.h"
+ #include "common/ceph_time.h"
+ 
+-#ifndef suseconds_t
+-typedef long suseconds_t;
+-#endif
+-
+ namespace ceph {
+ namespace logging {
+ namespace _logclock {
diff --git a/repo/ceph/44-aarch64-erasure.patch b/repo/ceph/44-aarch64-erasure.patch
new file mode 100644
index 0000000..421decc
--- /dev/null
+++ b/repo/ceph/44-aarch64-erasure.patch
@@ -0,0 +1,129 @@
+merged as:
+https://github.com/ceph/isa-l/commit/bee5180a1517f8b5e70b02fcd66790c623536c5d
+
+--- a/src/isa-l/erasure_code/aarch64/gf_2vect_mad_neon.S
++++ b/src/isa-l/erasure_code/aarch64/gf_2vect_mad_neon.S
+@@ -360,7 +360,8 @@
+ 	sub	x_dest1, x_dest1, x_tmp
+ 	sub	x_dest2, x_dest2, x_tmp
+ 
+-	ldr	x_const, =const_tbl
++	adrp	x_const, const_tbl
++	add	x_const, x_const, :lo12:const_tbl
+ 	sub	x_const, x_const, x_tmp
+ 	ldr	q_tmp, [x_const, #16]
+ 
+@@ -394,7 +395,7 @@
+ 	mov	w_ret, #1
+ 	ret
+ 
+-.section .data
++.section .rodata
+ .balign 8
+ const_tbl:
+ 	.dword 0x0000000000000000, 0x0000000000000000
+--- a/src/isa-l/erasure_code/aarch64/gf_3vect_mad_neon.S
++++ b/src/isa-l/erasure_code/aarch64/gf_3vect_mad_neon.S
+@@ -332,7 +332,8 @@
+ 	sub	x_dest2, x_dest2, x_tmp
+ 	sub	x_dest3, x_dest3, x_tmp
+ 
+-	ldr	x_const, =const_tbl
++	adrp	x_const, const_tbl
++	add	x_const, x_const, :lo12:const_tbl
+ 	sub	x_const, x_const, x_tmp
+ 	ldr	q_tmp, [x_const, #16]
+ 
+@@ -374,7 +375,7 @@
+ 	mov	w_ret, #1
+ 	ret
+ 
+-.section .data
++.section .rodata
+ .balign 8
+ const_tbl:
+ 	.dword 0x0000000000000000, 0x0000000000000000
+--- a/src/isa-l/erasure_code/aarch64/gf_4vect_mad_neon.S
++++ b/src/isa-l/erasure_code/aarch64/gf_4vect_mad_neon.S
+@@ -397,7 +397,8 @@
+ 	sub	x_dest3, x_dest3, x_tmp
+ 	sub	x_dest4, x_dest4, x_tmp
+ 
+-	ldr	x_const, =const_tbl
++	adrp	x_const, const_tbl
++	add	x_const, x_const, :lo12:const_tbl
+ 	sub	x_const, x_const, x_tmp
+ 	ldr	q_tmp, [x_const, #16]
+ 
+@@ -448,7 +449,7 @@
+ 	mov	w_ret, #1
+ 	ret
+ 
+-.section .data
++.section .rodata
+ .balign 8
+ const_tbl:
+ 	.dword 0x0000000000000000, 0x0000000000000000
+--- a/src/isa-l/erasure_code/aarch64/gf_5vect_mad_neon.S
++++ b/src/isa-l/erasure_code/aarch64/gf_5vect_mad_neon.S
+@@ -463,7 +463,8 @@
+ 	sub	x_dest4, x_dest4, x_tmp
+ 	sub	x_dest5, x_dest5, x_tmp
+ 
+-	ldr	x_const, =const_tbl
++	adrp	x_const, const_tbl
++	add	x_const, x_const, :lo12:const_tbl
+ 	sub	x_const, x_const, x_tmp
+ 	ldr	q_tmp, [x_const, #16]
+ 
+@@ -527,7 +528,7 @@
+ 	mov	w_ret, #1
+ 	ret
+ 
+-.section .data
++.section .rodata
+ .balign 8
+ const_tbl:
+ 	.dword 0x0000000000000000, 0x0000000000000000
+--- a/src/isa-l/erasure_code/aarch64/gf_6vect_mad_neon.S
++++ b/src/isa-l/erasure_code/aarch64/gf_6vect_mad_neon.S
+@@ -526,7 +526,8 @@
+ 	sub	x_dest5, x_dest5, x_tmp
+ 	sub	x_dest6, x_dest6, x_tmp
+ 
+-	ldr	x_const, =const_tbl
++	adrp	x_const, const_tbl
++	add	x_const, x_const, :lo12:const_tbl
+ 	sub	x_const, x_const, x_tmp
+ 	ldr	q_tmp, [x_const, #16]
+ 
+@@ -602,7 +603,7 @@
+ 	mov	w_ret, #1
+ 	ret
+ 
+-.section .data
++.section .rodata
+ .balign 8
+ const_tbl:
+ 	.dword 0x0000000000000000, 0x0000000000000000
+--- a/src/isa-l/erasure_code/aarch64/gf_vect_mad_neon.S
++++ b/src/isa-l/erasure_code/aarch64/gf_vect_mad_neon.S
+@@ -281,7 +281,8 @@
+ 	mov	x_src, x_src_end
+ 	sub	x_dest1, x_dest1, x_tmp
+ 
+-	ldr	x_const, =const_tbl
++	adrp	x_const, const_tbl
++	add	x_const, x_const, :lo12:const_tbl
+ 	sub	x_const, x_const, x_tmp
+ 	ldr	q_tmp, [x_const, #16]
+ 
+@@ -307,7 +308,7 @@
+ 	mov	w_ret, #1
+ 	ret
+ 
+-.section .data
++.section .rodata
+ .balign 8
+ const_tbl:
+ 	.dword 0x0000000000000000, 0x0000000000000000
diff --git a/repo/ceph/44-cmake-buildtype.patch b/repo/ceph/44-cmake-buildtype.patch
new file mode 100644
index 0000000..7112ce1
--- /dev/null
+++ b/repo/ceph/44-cmake-buildtype.patch
@@ -0,0 +1,38 @@
+updated: https://github.com/ceph/ceph/commit/6e4481316884f08daad624c1d997378daedf410e
+
+commit a7e3ece459111d157a20d05de3a92cf4dab6bde6
+Author: Kefu Chai <kchai@redhat.com>
+Date:   Thu Jul 1 15:24:50 2021 +0800
+
+    cmake: set CMAKE_BUILD_TYPE only if .git exists
+    
+    distros intend to fine tune the CFLAGS and CXXFLAGS by themselves, see
+    
+    - https://git.alpinelinux.org/abuild/tree/abuild.conf
+    - https://wiki.archlinux.org/title/CMake_package_guidelines#CMake_undesired_behaviors
+    - https://github.com/Debian/debhelper/blob/5d1bb29841043d8e47ebbdd043e6cd086cad508e/lib/Debian/Debhelper/Buildsystem/cmake.pm#L16
+    
+    so instead of setting a CMAKE_BUILD_TYPE when building from a
+    dist tarball, let's just leave it empty.
+    
+    Signed-off-by: Kefu Chai <kchai@redhat.com>
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 760a2ceb0c..6f35e87f90 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -156,12 +156,8 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
+   endif()
+ endif(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
+ 
+-if(NOT CMAKE_BUILD_TYPE)
+-  if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
+-    set(default_build_type "Debug")
+-  else()
+-    set(default_build_type "RelWithDebInfo")
+-  endif()
++if(NOT DEFINED CMAKE_BUILD_TYPE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
++  set(default_build_type "Debug")
+   set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
+       STRING "Default BUILD_TYPE is Debug, other options are: RelWithDebInfo, Release, and MinSizeRel." FORCE)
+ endif()
diff --git a/repo/ceph/44-missing-include.patch b/repo/ceph/44-missing-include.patch
new file mode 100644
index 0000000..f944255
--- /dev/null
+++ b/repo/ceph/44-missing-include.patch
@@ -0,0 +1,16 @@
+submitted as:
+https://github.com/ceph/ceph/pull/41470
+
+diff --git a/src/rgw/rgw_string.h b/src/rgw/rgw_string.h
+index 257daa9c1..90e64f98a 100644
+--- a/src/rgw/rgw_string.h
++++ b/src/rgw/rgw_string.h
+@@ -8,6 +8,8 @@
+ #include <stdlib.h>
+ #include <limits.h>
+ #include <string_view>
++#include <string>
++#include <stdexcept>
+ 
+ #include <boost/container/small_vector.hpp>
+ 
diff --git a/repo/ceph/44-staticcast.patch b/repo/ceph/44-staticcast.patch
new file mode 100644
index 0000000..ebe8bbf
--- /dev/null
+++ b/repo/ceph/44-staticcast.patch
@@ -0,0 +1,13 @@
+submitted as https://github.com/ceph/ceph/pull/40582
+
+--- a/src/common/buffer.cc
++++ b/src/common/buffer.cc
+@@ -2268,7 +2268,7 @@
+
+ void ceph::buffer::list::page_aligned_appender::_refill(size_t len) {
+   const size_t alloc = \
+-    std::max((size_t)min_alloc, (len + CEPH_PAGE_SIZE - 1) & CEPH_PAGE_MASK);
++    std::max(static_cast<size_t>(min_alloc), static_cast<size_t>((len + CEPH_PAGE_SIZE - 1) & CEPH_PAGE_MASK));
+   auto new_back = \
+     ptr_node::create(buffer::create_page_aligned(alloc));
+   new_back->set_length(0);   // unused, so far.
diff --git a/repo/ceph/ceph-user.pre-install b/repo/ceph/ceph-user.pre-install
new file mode 100644
index 0000000..bae4f09
--- /dev/null
+++ b/repo/ceph/ceph-user.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+addgroup ceph -g 167 -S 2>/dev/null
+adduser ceph -u 167 -S -G ceph -s /sbin/nologin -h /var/lib/ceph -g "Ceph Daemons" 2> /dev/null
+exit 0
diff --git a/repo/ceph/ceph.confd b/repo/ceph/ceph.confd
new file mode 100644
index 0000000..32737b1
--- /dev/null
+++ b/repo/ceph/ceph.confd
@@ -0,0 +1,17 @@
+# Original source: https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-cluster/ceph/files/ceph.confd-r5
+
+# Example
+
+# default ceph conf file
+#ceph_conf="/etc/ceph/ceph.conf"
+
+# Set RADOSGW_WANT_NAME_PARAM=y in order to make the init script add
+# a --name=client.${RC_SVCNAME} parameter to command_args for radosgw.*
+# service instances. This will make the service use a key by the name
+# of client.${RC_SVCNAME} instead of the default client.admin key.
+# A setting like this in the ceph config file can be used to customize
+# the rgw_data and keyring paths used by radosgw instances:
+# [client]
+# rgw_data = /var/lib/ceph/radosgw/$cluster-$id
+# keyring = /var/lib/ceph/radosgw/$cluster-$id/keyring
+RADOSGW_WANT_NAME_PARAM=n
diff --git a/repo/ceph/ceph.initd b/repo/ceph/ceph.initd
new file mode 100644
index 0000000..c522efa
--- /dev/null
+++ b/repo/ceph/ceph.initd
@@ -0,0 +1,118 @@
+#!/sbin/openrc-run
+
+# Original source: https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-cluster/ceph/files/ceph.initd-r12
+
+# make sure /etc/conf.d/ceph gets loaded for ceph-mon etc
+_CONFD_FILE="${RC_SERVICE%/*}/../conf.d/${RC_SVCNAME%-*}"
+if [ -r "${_CONFD_FILE}" ]; then
+	. "${_CONFD_FILE}" || exit 1
+fi
+
+: "${ceph_conf:=/etc/ceph/ceph.conf}"
+daemon_type="${RC_SVCNAME#ceph-}"
+daemon_type="${daemon_type%%.*}"
+daemon_id="${RC_SVCNAME#ceph-*.}"
+daemon_id="${daemon_id:-0}"
+: "${rundir:=/run/ceph}"
+: "${user:=ceph}"
+: "${group:=ceph}"
+: "${rc_ulimit:=-n 1048576 -u 1048576}"
+
+pidfile="${rundir}/supervisor-${daemon_type}.${daemon_id}.pid"
+daemon_pidfile="${rundir}/${daemon_type}.${daemon_id}.pid"
+
+command="/usr/bin/${RC_SVCNAME%%.*}"
+command_args="-i ${daemon_id} --pid-file ${daemon_pidfile} -c ${ceph_conf}"
+extra_commands="${extra_commands} reload"
+command_args_foreground="--foreground"
+
+retry="${CEPH_TERMTIMEOUT:-TERM/120/KILL/5}"
+start_stop_daemon_args="--user ${user} --group ${group}"
+supervise_daemon_args="--user ${user} --group ${group}"
+
+: "${supervisor:=supervise-daemon}"
+: "${stdout:=/var/log/ceph/ceph}"
+: "${stderr:=/var/log/ceph/ceph}"
+: "${respawn_delay:=10}"
+: "${respawn_max:=5}"
+: "${respawn_period:=1800}"
+
+: "${osd_respawn_delay:=15}"
+: "{osd_respawn_max:=10}"
+
+: "{radosgw_respawn_max:=5}"
+: "${radosgw_respawn_period:=30}"
+
+depend() {
+	use dns logger
+	after net ntpd ntp-client chronyd
+	before netmount
+}
+
+is_type_valid() {
+	case ${daemon_type} in
+		mon|mds|osd|mgr|radosgw) return 0;;
+		*) return 1;;
+	esac
+}
+
+start_pre() {
+	local log_dir
+	export CEPH_CONF="${ceph_conf}"
+
+	checkpath -d -q -o "${user}:${group}" "${rundir}"
+
+	if ! is_type_valid ;then
+		eerror "Please give valid Ceph Server Type: mds, mon, osd"
+		return 1
+
+	elif pgrep -f "[c]eph-${daemon_type} -i ${daemon_id} "; then
+		eerror "${daemon_type}.${daemon_id} is still running, refusing to start"
+		return 1
+	fi
+
+	if [ -n "${bluestore_osd_fsid}" ]; then
+		einfo "Mounting Bluestore"
+		ceph-volume lvm activate "${daemon_id}" "${bluestore_osd_fsid}" --no-systemd
+	fi
+
+	if [ "${daemon_type}" = radosgw ] && [ "${RADOSGW_WANT_NAME_PARAM}" = y ]; then
+		command_args="${command_args} --name client.${daemon_id}"
+	fi
+
+	local arg_name arg_val repl_arg_name
+	for arg_name in stdout stderr respawn_delay respawn_max respawn_period; do
+		eval arg_val="\${${daemon_type}_${arg_name}}"
+
+		if [ -z "${arg_val}" ]; then
+			eval arg_val="\${${arg_name}}"
+		else
+			eval "${arg_name}=\"${arg_val}\""
+		fi
+
+		if [ "${arg_name}" = "stderr" ] || [ "${arg_name}" = "stdout" ]; then
+			local log_file log_postfix
+			log_postfix=".${daemon_id}-${arg_name}.log"
+			log_file="${arg_val}"
+
+			if [ "${log_file}" != /dev/null ]; then
+				log_file="${log_file}${log_postfix}"
+
+				log_dir="$(dirname "${log_file}")"
+				checkpath -m 0755 -o "${user}:${group}" -d "${log_dir}"
+			fi
+
+			repl_arg_name="$(printf -- "%s\n" "${arg_name}" | tr _ -)"
+			supervise_daemon_args="${supervise_daemon_args} --${repl_arg_name}=${log_file}"
+		fi
+	done
+}
+
+reload() {
+	ebegin "Reloading Ceph ${daemon_type}.${daemon_id}"
+	start-stop-daemon --signal 1 "${start_stop_daemon_args}"
+	eend ${?}
+}
+
+# vim:ft=gentoo-init-d:ts=4:sts=4:sw=4:noet:
+
diff --git a/repo/ceph/ceph.xibuild b/repo/ceph/ceph.xibuild
new file mode 100644
index 0000000..65d71fa
--- /dev/null
+++ b/repo/ceph/ceph.xibuild
@@ -0,0 +1,120 @@
+#!/bin/sh
+
+NAME="ceph"
+DESC="Ceph is a distributed object store and file system"
+
+MAKEDEPS="acl argp-standalone bc boost btrfs-progs bzip2 cmake cryptsetup cunit curl cython diffutils doxygen eudev expat fcgi flex fmt fuse fuse git graphviz grep gperf jq keyutils leveldb libaio libcap-ng libedit librdkafka libnl libtirpc libtool libxml2 linux-headers lua lvm2 lz4 nodejs nss oath-toolkit libldap openssl procps-ng python python-prettytable python-sphinx rabbitmq-c readline ninja snappy sqlite3 userspace-rcu xfsprogs xmlstarlet yarn yasm cryptsetup e2fsprogs parted util-linux xfsprogs fuse snappy lz4 lvm2 xmlstarlet python-coverage python-flake8 python-nodeenv python-nose python-pytest python-tox "
+
+PKG_VER=16.2.9
+SOURCE="https://download.ceph.com/tarballs/ceph_$PKG_VER.orig.tar.gz"
+
+ADDITIONAL="
+10-musl-fixes.patch
+11-dump_time_header_impl.patch
+11-parse_rfc1123_alt.patch
+11-s3_expiration_header.patch
+12-package.json-resolutions.patch
+20-pci.patch
+32-PurgeQueue.cc-cast.patch
+32-upstream32bit.patch
+32-upstream32bitcleanup.patch
+35-fix_ErasureCodeShec.patch
+37-fix_tests.patch
+42-no-virtualenvs.patch
+43-LogClock.h.patch
+44-aarch64-erasure.patch
+44-cmake-buildtype.patch
+44-missing-include.patch
+44-staticcast.patch
+ceph.confd
+ceph.initd
+"
+
+_py3_sitelib() {
+	python -c "import site; print(site.getsitepackages()[0])"
+}
+
+prepare() {
+    apply_patches
+
+	# delete bundled boost as >300mb and using system boost
+	rm -rf src/boost
+}
+
+build() {
+	export CEPH_BUILD_VIRTUALENV="$BUILD_ROOT"
+
+	# builders keep failing when -jN == nproc
+	export MAKEFLAGS="$MAKEFLAGS -j$((JOBS<12 ? JOBS : 12))"
+
+	# use alternate registry as original can timeout for arm32bit
+	export NPM_REGISTRY=https://registry.npmjs.org
+
+	cmake -B build -G Ninja \
+		-DCMAKE_BUILD_TYPE=MinSizeRel \
+		-DLUA_LIBRARIES=/usr/lib/liblua.so \
+		-DALLOCATOR=libc \
+		-DCMAKE_INSTALL_PREFIX=/usr \
+		-DCMAKE_INSTALL_LIBDIR=/usr/lib \
+		-DCMAKE_INSTALL_LOCALSTATEDIR=/var \
+		-DCMAKE_INSTALL_SYSCONFDIR=/etc \
+		-DWITH_REENTRANT_STRSIGNAL=ON \
+		-DWITH_THREAD_SAFE_RES_QUERY=ON \
+		-DWITH_MANPAGE=ON \
+		-DWITH_SYSTEM_BOOST=ON \
+		-DWITH_SYSTEM_NPM=ON \
+		-DWITH_LTTNG=OFF \
+		-DWITH_RDMA=OFF \
+		-DWITH_SYSTEMD=OFF \
+		-DWITH_SPDK=OFF \
+		-DWITH_BABELTRACE=OFF \
+		-DWITH_RADOSGW_AMQP_ENDPOINT=OFF \
+		-DWITH_TESTS=OFF
+    mkdir -p build/src/pybind/mgr/dashboard/cypress
+	cmake --build build
+
+}
+
+package() {
+	# free up some space before install
+	rm -rf build/src/pybind/mgr/dashboard/cypress
+	rm -rf src/pybind/mgr/dashboard/frontend/node_modules
+
+	DESTDIR="$PKG_DEST" cmake --install build
+	# yarn creates an empty usr/local/bin
+	rm -rf "${pkgdir:?}"/usr/local
+
+	# fix /usr permission
+	chmod 755 "$PKG_DEST/usr"
+
+	# remove dashboard angular app source
+	rm -rf "$PKG_DEST"/usr/share/ceph/mgr/dashboard/frontend/src
+
+	# remove the upstream init file and put in openrc ones
+	rm -f "$PKG_DEST"/etc/init.d/ceph
+	install -D -m 755 "$BUILD_ROOT"/"ceph".initd "$PKG_DEST"/etc/init.d/ceph
+	install -D -m 644 "$BUILD_ROOT"/"ceph".confd "$PKG_DEST"/etc/conf.d/ceph
+
+	# move mount.* binaries to /sbin
+	mkdir -p "$PKG_DEST"/sbin
+	mv "$PKG_DEST"/usr/sbin/mount.* "$PKG_DEST"/sbin
+
+	install -m 644 -D src/etc-rbdmap "$PKG_DEST"/etc/ceph/rbdmap
+	install -m 644 -D src/logrotate.conf "$PKG_DEST"/etc/logrotate.d/ceph
+	install -m 644 -D etc/sysctl/90-ceph-osd.conf "$PKG_DEST"/etc/sysctl.d/90-ceph-osd.conf
+
+	# udev rules
+	install -m 644 -D udev/50-rbd.rules "$PKG_DEST"/etc/udev/rules.d/50-rbd.rules
+	# sudoers.d
+	install -m 600 -D sudoers.d/ceph-smartctl "$PKG_DEST"/etc/sudoers.d/ceph-smartctl
+
+	# delete systemd related stuff
+	rm "$PKG_DEST"/usr/sbin/ceph-volume-systemd
+
+	# move docs to docs
+	mkdir -p "$PKG_DEST"/usr/share/doc/ceph/dashboard
+	mv "$PKG_DEST"/usr/share/ceph/mgr/dashboard/*.rst "$PKG_DEST"/usr/share/doc/ceph/dashboard/
+	mv "$PKG_DEST"/usr/share/ceph/mgr/cephadm/HACKING.rst "$PKG_DEST"/usr/share/doc/ceph/cephadm-HACKING.rst
+}
+
+# TODO split this into other packages
-- 
cgit v1.2.1