g9lee
April 25, 2016, 3:45am
#1
I’m having trouble building the firmware from github on OSX. It complains about the following:
stat: cannot read file system information for `%z’: No such file or directory
I’m guessing this line in build/module.mk has issue? filesize=stat -f %z $1
Without proper filesize, I can’t seem to create the binary file. Anyone?
g9lee
April 25, 2016, 4:43am
#2
I’m getting the following log:
Invoking: ARM GNU Create Flash Image
arm-none-eabi-objcopy -O binary ../../../build/target/system-part1/platform-6-m/system-part1.elf ../../../build/target/system-part1/platform-6-m/system-part1.bin.pre_crc
if [ -s ../../../build/target/system-part1/platform-6-m/system-part1.bin.pre_crc ]; then \
head -c $((`stat -f %z ../../../build/target/system-part1/platform-6-m/system-part1.bin.pre_crc` - 38)) ../../../build/target/system-part1/platform-6-m/system-part1.bin.pre_crc > ../../../build/target/system-part1/platform-6-m/system-part1.bin.no_crc && \
tail -c 38 ../../../build/target/system-part1/platform-6-m/system-part1.bin.pre_crc > ../../../build/target/system-part1/platform-6-m/system-part1.bin.crc_block && \
test "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20280078563412" = `xxd -p -c 500 ../../../build/target/system-part1/platform-6-m/system-part1.bin.crc_block` && \
shasum -a 256 ../../../build/target/system-part1/platform-6-m/system-part1.bin.no_crc | cut -c 1-65 | xxd -r -p | dd bs=1 of=../../../build/target/system-part1/platform-6-m/system-part1.bin.pre_crc seek=$((`stat -f %z ../../../build/target/system-part1/platform-6-m/system-part1.bin.pre_crc` - 38)) conv=notrunc && \
head -c $((`stat -f %z ../../../build/target/system-part1/platform-6-m/system-part1.bin.pre_crc` - 4)) ../../../build/target/system-part1/platform-6-m/system-part1.bin.pre_crc > ../../../build/target/system-part1/platform-6-m/system-part1.bin.no_crc && \
crc32 ../../../build/target/system-part1/platform-6-m/system-part1.bin.no_crc | cut -c 1-10 | xxd -r -p | dd bs=1 of=../../../build/target/system-part1/platform-6-m/system-part1.bin.pre_crc seek=$((`stat -f %z ../../../build/target/system-part1/platform-6-m/system-part1.bin.pre_crc` - 4)) conv=notrunc ;\
fi
stat: cannot read file system information for `%z': No such file or directory
/bin/sh: File: "../../../build/target/system-part1/platform-6-m/system-part1.bin.pre_crc"
ID: 100000200000011 Namelen: * Type: hfs
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 124817000 Free: 24853094 Available: 24789094
Inodes: Total: 124816998 Free: 24789094 - 38: syntax error in expression (error token is ": "../../../build/target/system-part1/platform-6-m/system-part1.bin.pre_crc"
ID: 100000200000011 Namelen: * Type: hfs
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 124817000 Free: 24853094 Available: 24789094
Inodes: Total: 124816998 Free: 24789094 - 38")
make[1]: *** [../../../build/target/system-part1/platform-6-m/system-part1.bin] Error 127
Also, I did made a change to line 164 in build/module.mk:
filesize='stat -f %z $1'
instead of filesize='stat -f%z $1'
g9lee
April 25, 2016, 6:11am
#3
I answered my own question.
WIth OSX, it should never have arrived at line 164. Instead, filesize should equal stat -c %s $1.
With that change, everything works.
You may want to try the script I created . It installs the the Particle toolchain and dependencies for you, and makes it easier to build your code. https://github.com/nrobinson2000/po-util