mirror of
https://github.com/Creased/RCM-Emulator.git
synced 2026-12-06 02:48:11 +01:00
Boot Linux on CPU0
This commit is contained in:
1 parent
d5bf5922ed
commit
20949b4242
21 files changed
+1865
-25
No files matched your search
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
# Builds tests/kernelcpu/payload.bin: cpu0.S with devkitA64's assembler,
|
||||
# embedded as a word array into the BPMP payload built with arm-none-eabi.
|
||||
set -e
|
||||
D=$(dirname "$0")
|
||||
A64=${A64:-/opt/devkitpro/devkitA64/bin/aarch64-none-elf-}
|
||||
ARM=${ARM:-/opt/devkitpro/devkitARM/bin/arm-none-eabi-}
|
||||
${A64}gcc -c -o "$D/cpu0.o" "$D/cpu0.S"
|
||||
${A64}ld -Ttext=0xA0000000 -o "$D/cpu0.elf" "$D/cpu0.o"
|
||||
${A64}objcopy -O binary "$D/cpu0.elf" "$D/cpu0.bin"
|
||||
python3 - "$D/cpu0.bin" "$D/cpu0_blob.h" <<'PY'
|
||||
import sys, struct
|
||||
b = open(sys.argv[1], "rb").read()
|
||||
b += b"\0" * (-len(b) % 4)
|
||||
w = struct.unpack("<%dI" % (len(b) // 4), b)
|
||||
with open(sys.argv[2], "w") as f:
|
||||
f.write("/* Generated by build.sh from cpu0.S. */\nstatic const u32 cpu0_blob[] = {\n")
|
||||
for i in range(0, len(w), 6):
|
||||
f.write(" " + ", ".join("0x%08x" % x for x in w[i:i + 6]) + ",\n")
|
||||
f.write("};\n")
|
||||
PY
|
||||
${ARM}gcc -march=armv4t -marm -Os -ffreestanding -nostdlib -fno-builtin -I"$D" \
|
||||
-T "$D/link.ld" -o "$D/payload.elf" "$D/payload.c"
|
||||
${ARM}objcopy -O binary "$D/payload.elf" "$D/payload.bin"
|
||||
echo "built $D/payload.bin"
|
||||
Reference in new issue
Block a user