diff options
author | David Riley <davidriley@chromium.org> | 2015-02-05 19:22:49 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-02-11 23:05:39 +0000 |
commit | 05987b159acb9737707b9ef92b818ac434ef8c3d (patch) | |
tree | 8e5e48a674b6756bf62a5913d336efc9b7ea162b /cgpt/cgpt_common.c | |
parent | 2b0dc167451b151452b834f88dafd83d912a55cd (diff) | |
download | vboot-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 'cgpt/cgpt_common.c')
-rw-r--r-- | cgpt/cgpt_common.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/cgpt/cgpt_common.c b/cgpt/cgpt_common.c index ffaa3090..5bb44f7a 100644 --- a/cgpt/cgpt_common.c +++ b/cgpt/cgpt_common.c @@ -9,8 +9,10 @@ #include <errno.h> #include <fcntl.h> #include <getopt.h> +#ifndef HAVE_MACOS #include <linux/major.h> #include <mtd/mtd-user.h> +#endif #include <stdarg.h> #include <stdint.h> #include <stdio.h> @@ -265,6 +267,7 @@ static int ObtainDriveSize(int fd, uint64_t* size, uint32_t* sector_bytes) { if (fstat(fd, &stat) == -1) { return -1; } +#ifndef HAVE_MACOS if ((stat.st_mode & S_IFMT) != S_IFREG) { if (ioctl(fd, BLKGETSIZE64, size) < 0) { return -1; @@ -276,6 +279,10 @@ static int ObtainDriveSize(int fd, uint64_t* size, uint32_t* sector_bytes) { *sector_bytes = 512; /* bytes */ *size = stat.st_size; } +#else + *sector_bytes = 512; /* bytes */ + *size = stat.st_size; +#endif return 0; } @@ -289,7 +296,11 @@ int DriveOpen(const char *drive_path, struct drive *drive, int mode, // Clear struct for proper error handling. memset(drive, 0, sizeof(struct drive)); - drive->fd = open(drive_path, mode | O_LARGEFILE | O_NOFOLLOW); + drive->fd = open(drive_path, mode | +#ifndef HAVE_MACOS + O_LARGEFILE | +#endif + O_NOFOLLOW); if (drive->fd == -1) { Error("Can't open %s: %s\n", drive_path, strerror(errno)); return CGPT_FAILED; @@ -1010,4 +1021,6 @@ void PMBRToStr(struct pmbr *pmbr, char *str, unsigned int buflen) { /* Optional */ int __GenerateGuid(Guid *newguid) { return CGPT_FAILED; }; +#ifndef HAVE_MACOS int GenerateGuid(Guid *newguid) __attribute__((weak, alias("__GenerateGuid"))); +#endif |