summaryrefslogtreecommitdiff
path: root/sysutils/mmc-utils/files
diff options
context:
space:
mode:
Diffstat (limited to 'sysutils/mmc-utils/files')
-rw-r--r--sysutils/mmc-utils/files/patch-man_mmc.133
-rw-r--r--sysutils/mmc-utils/files/patch-mmc.h25
-rw-r--r--sysutils/mmc-utils/files/patch-mmc_cmds.c34
3 files changed, 92 insertions, 0 deletions
diff --git a/sysutils/mmc-utils/files/patch-man_mmc.1 b/sysutils/mmc-utils/files/patch-man_mmc.1
new file mode 100644
index 000000000000..9e859a8c724d
--- /dev/null
+++ b/sysutils/mmc-utils/files/patch-man_mmc.1
@@ -0,0 +1,33 @@
+--- man/mmc.1.orig 2017-01-25 19:03:34 UTC
++++ man/mmc.1
+@@ -30,21 +30,24 @@ This sets the eMMC to be write-protected
+ Set the eMMC data sector size to 4KB by disabling emulation on
+ <device>.
+ .TP
+-.BR "gp create <-y|-n> <length KiB> <partition> <enh_attr> <ext_attr> <device>"
++.BR "gp create <-y|-n|-c> <length KiB> <partition> <enh_attr> <ext_attr> <device>"
+ create general purpose partition for the <device>.
+-Dry-run only unless -y is passed.
++Dry-run only unless -y or -c is passed.
++Use -c if more partitioning settings are still to come.
+ To set enhanced attribute to general partition being created set <enh_attr> to 1 else set it to 0.
+ To set extended attribute to general partition set <ext_attr> to 1,2 else set it to 0.
+ NOTE! This is a one-time programmable (unreversible) change.
+ .TP
+-.BR "enh_area set <-y|-n> <start KiB> <length KiB> <device>"
++.BR "enh_area set <-y|-n|-c> <start KiB> <length KiB> <device>"
+ Enable the enhanced user area for the <device>.
+-Dry-run only unless -y is passed.
++Dry-run only unless -y or -c is passed.
++Use -c if more partitioning settings are still to come.
+ NOTE! This is a one-time programmable (unreversible) change.
+ .TP
+-.BR "write_reliability set <-y|-n> <partition> <device>"
++.BR "write_reliability set <-y|-n|-c> <partition> <device>"
+ Enable write reliability per partition for the <device>.
+-Dry-run only unless -y is passed.
++Dry-run only unless -y or -c is passed.
++Use -c if more partitioning settings are still to come.
+ NOTE! This is a one-time programmable (unreversible) change.
+ .TP
+ .BR "status get <device>"
diff --git a/sysutils/mmc-utils/files/patch-mmc.h b/sysutils/mmc-utils/files/patch-mmc.h
new file mode 100644
index 000000000000..1017e7cc82c0
--- /dev/null
+++ b/sysutils/mmc-utils/files/patch-mmc.h
@@ -0,0 +1,25 @@
+--- mmc.h.orig 2017-01-25 19:03:34 UTC
++++ mmc.h
+@@ -17,8 +17,22 @@
+ * those modifications are Copyright (c) 2016 SanDisk Corp.
+ */
+
++#if defined(__linux__)
+ #include <asm-generic/int-ll64.h>
+ #include <linux/mmc/ioctl.h>
++#elif defined(__FreeBSD__)
++#include <dev/mmc/mmc_ioctl.h>
++#include <sys/endian.h>
++#include <sys/types.h>
++typedef int8_t __s8;
++typedef uint8_t __u8;
++typedef int16_t __s16;
++typedef uint16_t __u16;
++typedef int32_t __s32;
++typedef uint32_t __u32;
++typedef int64_t __s64;
++typedef uint64_t __u64;
++#endif
+ #include <stdio.h>
+
+ #define CHECK(expr, msg, err_stmt) { if (expr) { fprintf(stderr, msg); err_stmt; } }
diff --git a/sysutils/mmc-utils/files/patch-mmc_cmds.c b/sysutils/mmc-utils/files/patch-mmc_cmds.c
new file mode 100644
index 000000000000..4bb8e20c0d15
--- /dev/null
+++ b/sysutils/mmc-utils/files/patch-mmc_cmds.c
@@ -0,0 +1,34 @@
+--- mmc_cmds.c.orig 2017-01-25 19:03:34 UTC
++++ mmc_cmds.c
+@@ -32,7 +32,11 @@
+ #include <errno.h>
+ #include <stdint.h>
+ #include <assert.h>
++#if defined(__linux__)
+ #include <linux/fs.h>
++#elif defined(__FreeBSD__)
++#include <sys/disk.h>
++#endif
+
+ #include "mmc.h"
+ #include "mmc_cmds.h"
+@@ -120,8 +124,19 @@ static __u32 get_size_in_blks(int fd)
+ {
+ int res;
+ int size;
++#if defined(__FreeBSD__)
++ off_t mediasize;
++#endif
+
++#if defined(__linux__)
+ res = ioctl(fd, BLKGETSIZE, &size);
++#elif defined(__FreeBSD__)
++ res = ioctl(fd, DIOCGMEDIASIZE, &mediasize);
++ if (!res) {
++ res = ioctl(fd, DIOCGSECTORSIZE, &size);
++ size = mediasize / size;
++ }
++#endif
+ if (res) {
+ fprintf(stderr, "Error getting device size, errno: %d\n",
+ errno);