4

I am trying to compile OpeniBoot on an ARM device, namely the PocketCHIP, as per this guide (abeit with some minor modifications, considering I am not using a Raspberry Pi.). OpeniBoot is a custom low-level bootloader designed to be installed on Apple devices, such as the iPod Touch or iPhone. It permits the user to run a Linux kernel alongside the stock iOS kernel, as well as execute other low-level operations.

I have managed to compile and install almost every dependency listed in order to compile the binary for OpeniBoot. However, when running scons iPhone4, I get an error:

chip@chip:~/openiBoot$ scons iPhone4
...
arch-arm/asmhelpers.sx: Assembler messages:
arch-arm/asmhelpers.sx:212: Error: selected processor does not support `wfi'
scons: *** [arch-arm/iPhone4_asmhelpers.o] Error 1
scons: building terminated because of errors.

I've researched this error, and I've found this solution:

Fixed it by adding "-mcpu=cortex-a8" to the compiler options.

I have already tried appending the option to the scons command itself, in a syntax similar to this:

scons -mcpu=cortex-a8 iPhone4

to no avail.

So the question is: How can I pass options to the compiler when using scons?

--EDIT--

I have since resolved this question, by changing a line in the file "ARMEnviroment.SConscript" to the likes of this:

plat_flags = ['-mlittle-endian', '-mfpu=vfp', '-mthumb', '-mthumb-interwork', '-fPIC', '-mcpu=cortex-a8']

However, I now encounter a new error upon compiling:

chip@chip:~/openiBoot$ scons iPhone4
...
arch-arm/entry.sx:0: error: bad value (cortex-a8) for -mcpu= switch
scons: *** [arch-arm/iPhone4_entry.o] Error 1
scons: building terminated because of errors.

I believe this is because scons is still using the old toolchain installed with apt-get, GCC-4.9.2, instead of using the openiboot-toolchain that I had compiled (and I believe is necessary for compiling this program).

So the question is, how do I change which toolchain scons uses to compile code?

Mateusz Piotrowski
  • 4,016
  • 4
  • 28
  • 53
unilock
  • 41
  • 2
  • 1
    I've tried to boil down your question to the issue at hand, please add any stuff back which you consider relevant. Let's see whether somebody has an answer for this. If not, please flag for mod attention in 2 days and we can migrate it to StackOverflow. – nohillside Aug 15 '17 at 18:55
  • Does `scons -h ` provide any tips or clues? – bmike Aug 15 '17 at 23:40
  • @bmike `scons -h` provides a list of options (which I've copy/pasted into [this pastebin](https://pastebin.com/raw/XgycjFS6)), though none of them seem to pertain to my problem. –  Aug 16 '17 at 01:49
  • scons reads a python file with config code, you probably need to set variables in there – nohillside Aug 16 '17 at 04:40
  • @patrix That seems to be what I was looking for, but when I insert '-mcpu=cortex-a8' into the ARMEnviroment.SConscript file like [this](https://pastebin.com/raw/WzGKMXCV), I get a [new error](https://pastebin.com/raw/vdWjK9Dg) while compiling. –  Aug 16 '17 at 12:25
  • We definitively need to move this somewhere where more people using compilers hang out – nohillside Aug 16 '17 at 13:24

0 Answers0