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
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
# linux/mkdtb.sh IN.dtb OUT.dtb - the switchroot device tree with what the
|
||||
# emulator boot needs: a console on UART-B (the port the emulator prints),
|
||||
# kept past init, one CPU, verbose logging. The bootloader normally edits
|
||||
# bootargs the same way; nothing else changes.
|
||||
set -e
|
||||
DTC=${DTC:-$HOME/l4t/kernel/kernel-4.9/scripts/dtc/dtc}
|
||||
IN=$1; OUT=$2
|
||||
T=$(mktemp -d)
|
||||
"$DTC" -I dtb -O dts -q -o "$T/in.dts" "$IN"
|
||||
ARGS=${BOOTARGS:-"earlycon=uart8250,mmio32,0x70006040 keep_bootcon console=tty0 maxcpus=1 nosmp loglevel=8 ignore_loglevel clk_ignore_unused printk.time=1"}
|
||||
python3 - "$T/in.dts" "$T/out.dts" "$ARGS" <<'PY'
|
||||
import re, sys
|
||||
s = open(sys.argv[1]).read()
|
||||
args = sys.argv[3]
|
||||
s, n = re.subn(r'(\n\tchosen \{[^}]*?bootargs = )"[^"]*";', lambda m: m.group(1) + '"' + args + '";', s, count=1)
|
||||
if n != 1:
|
||||
raise SystemExit("no /chosen bootargs found")
|
||||
open(sys.argv[2], "w").write(s)
|
||||
PY
|
||||
"$DTC" -I dts -O dtb -q -o "$OUT" "$T/out.dts"
|
||||
rm -rf "$T"
|
||||
echo "built $OUT"
|
||||
Reference in new issue
Block a user