summaryrefslogtreecommitdiff
path: root/futility
diff options
context:
space:
mode:
authorDavid Riley <davidriley@chromium.org>2015-02-05 19:22:49 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-02-11 23:05:39 +0000
commit05987b159acb9737707b9ef92b818ac434ef8c3d (patch)
tree8e5e48a674b6756bf62a5913d336efc9b7ea162b /futility
parent2b0dc167451b151452b834f88dafd83d912a55cd (diff)
downloadvboot-05987b159acb9737707b9ef92b818ac434ef8c3d.tar.gz
Changes to compile signing tools on darwin
The following works from a Mac with these changes: make Q= ARCH=arm HAVE_MACOS=1 `pwd`/build/futility/futility Only vbutil_keyblock and vbutil_kernel have been exercised. BUG=none TEST='make Q= ARCH=arm HAVE_MACOS=1 `pwd`/build/futility/futility' BRANCH=none Signed-off-by: David Riley <davidriley@chromium.org> Change-Id: Ie69cfee0c650d4ff96be6322083a2fea1543ee39 Reviewed-on: https://chromium-review.googlesource.com/246773 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: David Riley <davidriley@chromium.org> Commit-Queue: David Riley <davidriley@chromium.org>
Diffstat (limited to 'futility')
-rw-r--r--futility/cmd_vbutil_kernel.c4
-rw-r--r--futility/file_type.c2
-rw-r--r--futility/misc.c4
-rw-r--r--futility/traversal.c4
4 files changed, 11 insertions, 3 deletions
diff --git a/futility/cmd_vbutil_kernel.c b/futility/cmd_vbutil_kernel.c
index f1573b61..ae4fd3f9 100644
--- a/futility/cmd_vbutil_kernel.c
+++ b/futility/cmd_vbutil_kernel.c
@@ -10,7 +10,9 @@
#include <fcntl.h>
#include <getopt.h>
#include <inttypes.h> /* For PRIu64 */
+#ifndef HAVE_MACOS
#include <linux/fs.h> /* For BLKGETSIZE64 */
+#endif
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
@@ -176,11 +178,13 @@ static uint8_t *ReadOldKPartFromFileOrDie(const char *filename,
Fatal("Unable to stat %s: %s\n", filename, strerror(errno));
if (S_ISBLK(statbuf.st_mode)) {
+#ifndef HAVE_MACOS
int fd = open(filename, O_RDONLY);
if (fd >= 0) {
ioctl(fd, BLKGETSIZE64, &file_size);
close(fd);
}
+#endif
} else {
file_size = statbuf.st_size;
}
diff --git a/futility/file_type.c b/futility/file_type.c
index 7d56ca24..6696bb48 100644
--- a/futility/file_type.c
+++ b/futility/file_type.c
@@ -37,7 +37,7 @@ BUILD_ASSERT(ARRAY_SIZE(type_strings) == NUM_FILE_TYPES);
const char * const futil_file_type_str(enum futil_file_type type)
{
- if (type < 0 || type >= NUM_FILE_TYPES)
+ if ((int) type < 0 || type >= NUM_FILE_TYPES)
type = FILE_TYPE_UNKNOWN;
return type_strings[type];
diff --git a/futility/misc.c b/futility/misc.c
index 24e645be..3d85f691 100644
--- a/futility/misc.c
+++ b/futility/misc.c
@@ -5,7 +5,9 @@
*/
#include <errno.h>
+#ifndef HAVE_MACOS
#include <linux/fs.h> /* For BLKGETSIZE64 */
+#endif
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
@@ -241,8 +243,10 @@ enum futil_file_err futil_map_file(int fd, int writeable,
return FILE_ERR_STAT;
}
+#ifndef HAVE_MACOS
if (S_ISBLK(sb.st_mode))
ioctl(fd, BLKGETSIZE64, &sb.st_size);
+#endif
/* If the image is larger than 2^32 bytes, it's wrong. */
if (sb.st_size < 0 || sb.st_size > UINT32_MAX) {
diff --git a/futility/traversal.c b/futility/traversal.c
index 3c3b4224..8421b253 100644
--- a/futility/traversal.c
+++ b/futility/traversal.c
@@ -164,7 +164,7 @@ static int invoke_callback(struct futil_traverse_state_s *state,
__func__, name, state->op, futil_cb_component_str[c],
offset, len, buf);
- if (c < 0 || c >= NUM_CB_COMPONENTS) {
+ if ((int) c < 0 || c >= NUM_CB_COMPONENTS) {
fprintf(stderr, "Invalid component %d\n", c);
return 1;
}
@@ -203,7 +203,7 @@ int futil_traverse(uint8_t *buf, uint32_t len,
const struct bios_area_s *area;
int retval = 0;
- if (state->op < 0 || state->op >= NUM_FUTIL_OPS) {
+ if ((int) state->op < 0 || state->op >= NUM_FUTIL_OPS) {
fprintf(stderr, "Invalid op %d\n", state->op);
return 1;
}