mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-22 22:53:04 +00:00
tools/run_guest_kernel.sh: Support specifying kernel
Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
a47b590776
commit
5456642834
1 changed files with 20 additions and 4 deletions
|
@ -1,6 +1,11 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
if [ "$1" == "-k" ]; then
|
||||
kernel="$(realpath "$2")"
|
||||
shift 2
|
||||
fi
|
||||
|
||||
if [ ! -d "$1" ]; then
|
||||
echo "Usage:"
|
||||
echo " $0 <kernel build root> [kernel commandline] [initramfs]"
|
||||
|
@ -10,23 +15,34 @@ fi
|
|||
kernel_base="$(realpath "$1")"
|
||||
args="$2"
|
||||
initramfs=""
|
||||
if [ ! -z "$3" ]; then
|
||||
if [ -n "$3" ]; then
|
||||
initramfs="$(realpath "$3")"
|
||||
fi
|
||||
shift 3
|
||||
|
||||
if [ -z "$kernel" ]; then
|
||||
kernel="$kernel_base"/arch/arm64/boot/Image.gz
|
||||
fi
|
||||
|
||||
base="$(dirname "$0")"
|
||||
|
||||
echo "Creating m1n1+kernel image"
|
||||
cp "$base"/../../build/m1n1.bin /tmp/m1n1-linux.bin
|
||||
if [ ! -z "$args" ]; then
|
||||
if [ -n "$args" ]; then
|
||||
echo "chosen.bootargs=$args" >>/tmp/m1n1-linux.bin
|
||||
fi
|
||||
|
||||
cat "$kernel_base"/arch/arm64/boot/dts/apple/*.dtb "$kernel_base"/arch/arm64/boot/Image.gz >>/tmp/m1n1-linux.bin
|
||||
if [ ! -z "$initramfs" ]; then
|
||||
cat "$kernel_base"/arch/arm64/boot/dts/apple/*.dtb >>/tmp/m1n1-linux.bin
|
||||
if [[ "$kernel" == *.gz ]]; then
|
||||
cat "$kernel" >>/tmp/m1n1-linux.bin
|
||||
else
|
||||
gzip -c <"$kernel" >>/tmp/m1n1-linux.bin
|
||||
fi
|
||||
|
||||
if [ -n "$initramfs" ]; then
|
||||
cat "$initramfs" >>/tmp/m1n1-linux.bin
|
||||
fi
|
||||
|
||||
echo "Chainloading to updated m1n1..."
|
||||
python "$base"/chainload.py -r "$base"/../../build/m1n1.bin
|
||||
echo "Starting guest..."
|
||||
|
|
Loading…
Reference in a new issue