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
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
# Builds linux/boot.bin: shim.S (devkitA64) embedded in the BPMP payload.
|
||||
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/shim.o" "$D/shim.S"
|
||||
${A64}ld -Ttext=0xA0000000 -o "$D/shim.elf" "$D/shim.o"
|
||||
${A64}objcopy -O binary "$D/shim.elf" "$D/shim.bin"
|
||||
python3 - "$D/shim.bin" "$D/shim_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 shim.S. */\nstatic const u32 shim_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/boot.elf" "$D/boot.c"
|
||||
${ARM}objcopy -O binary "$D/boot.elf" "$D/boot.bin"
|
||||
echo "built $D/boot.bin"
|
||||
Reference in new issue
Block a user