From b06a8f390e051bc6d09e65db1156fb989c7b7008 Mon Sep 17 00:00:00 2001 From: Philip Homburg Date: Tue, 5 Aug 2014 15:35:37 +0200 Subject: [PATCH] OSX and FreeBSD don't have mkfs.vfat. Use newfs_msdos instead. Change-Id: I51c4086192332f0967a434d88add14db2791395e --- releasetools/arm_sdimage.sh | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/releasetools/arm_sdimage.sh b/releasetools/arm_sdimage.sh index 8e23818db..5c817b4e8 100755 --- a/releasetools/arm_sdimage.sh +++ b/releasetools/arm_sdimage.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # @@ -48,6 +48,24 @@ fi # We host u-boot binaries. U_BOOT_GIT_VERSION=cb5178f12787c690cb1c888d88733137e5a47b15 +# Set the vfat mkfs command. We need to re-evaluate MKFS_VFAT_OPTS after +# FAT_SIZE is set :-( +case $(uname -s) in +Darwin) + MKFS_VFAT_CMD=newfs_msdos + MKFS_VFAT_OPTS='-h 64 -u 32 -S 512 -s ${FAT_SIZE} -o 0' +;; +FreeBSD) + MKFS_VFAT_CMD=newfs_msdos + MKFS_VFAT_OPTS= +;; +*) + MKFS_VFAT_CMD=mkfs.vfat + MKFS_VFAT_OPTS= +;; +esac + + if [ -n "$BASE_URL" ] then #we no longer download u-boot but do a checkout @@ -66,7 +84,7 @@ fi export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH -for needed in mcopy dd mkfs.vfat git +for needed in mcopy dd ${MKFS_VFAT_CMD} git do if ! which $needed 2>&1 > /dev/null then @@ -111,6 +129,8 @@ sh ${BUILDSH} -j ${JOBS} -m ${ARCH} -O ${OBJ} -D ${DESTDIR} ${BUILDVARS} -U -u d : ${HOME_SIZE=$(( 128*(2**20) / 512))} : ${USR_SIZE=$(( 1536*(2**20) / 512))} +eval MKFS_VFAT_OPTS="\"$MKFS_VFAT_OPTS\"" + # # create a fstab entry in /etc this is normally done during the # setup phase on x86 @@ -156,7 +176,7 @@ ${CROSS_TOOLS}/nbpartition -m ${IMG} ${FAT_START} "c:${FAT_SIZE}*" 81:${ROOT_SIZ # Format the fat partition and put the bootloaders # uEnv and the kernel command line in the FAT partition # -mkfs.vfat ${IMG_DIR}/fat.img +${MKFS_VFAT_CMD} ${MKFS_VFAT_OPTS} ${IMG_DIR}/fat.img # # Create a uEnv.txt file