Skip to content

Commit a340aa6

Browse files
committed
tools/linux.py: Add option to boot EFI stub linux payloads via u-boot
The Fedora-Asahi-Remix kernel is built as EFI stub. This means it needs to be booted by u-boot. The EFI stub self-decompresses so force compression to none. Signed-off-by: Janne Grunau <j@jannau.net>
1 parent 6e8d7c0 commit a340aa6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

proxyclient/tools/linux.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,20 @@
1414
parser.add_argument('-b', '--bootargs', type=str, metavar='"boot arguments"')
1515
parser.add_argument('-t', '--tty', type=str)
1616
parser.add_argument('-u', '--u-boot', type=pathlib.Path, help="load u-boot before linux")
17+
parser.add_argument('-E', '--efi', action="store_true", help="payload is EFI stub (requires u-boot)")
1718
parser.add_argument('-T', '--tso', action="store_true", help="enable TSO")
1819
args = parser.parse_args()
1920

2021
from m1n1.setup import *
2122

23+
if args.efi and args.u_boot is None:
24+
raise Exception("Booting EFI stubs requires u-boot.")
25+
2226
if args.compression == 'auto':
2327
suffix = args.payload.suffix
24-
if suffix == '.gz':
28+
if args.efi:
29+
args.compression = 'none'
30+
elif suffix == '.gz':
2531
args.compression = 'gz'
2632
elif suffix == '.xz':
2733
args.compression = 'xz'
@@ -91,8 +97,12 @@
9197
x.startswith("bootcmd")
9298
), bootenv))
9399

94-
if initramfs is not None:
100+
if args.efi and initramfs is not None:
101+
bootcmd = "bootcmd=bootefi 0x%x:0x%x 0x%x:0x%x $fdtcontroladdr" % (kernel_base, kernel_size, initramfs_base, initramfs_size)
102+
elif initramfs is not None:
95103
bootcmd = "bootcmd=booti 0x%x 0x%x:0x%x $fdtcontroladdr" % (kernel_base, initramfs_base, initramfs_size)
104+
elif args.efi:
105+
bootcmd = "bootcmd=bootefi 0x%x:0x%x $fdtcontroladdr" % (kernel_base, kernel_size)
96106
else:
97107
bootcmd = "bootcmd=booti 0x%x - $fdtcontroladdr" % (kernel_base)
98108

0 commit comments

Comments
 (0)