Skip to content

Commit

Permalink
Verify a test boot for Morello uses the right kernel.
Browse files Browse the repository at this point in the history
When booting an image with a non-default kernel, expect needs to
interrupt the loader and select the alternate kernel before booting.
If the boot gets to single user (mounting root) without interrupt the
loader, fail explicitly.
  • Loading branch information
jrtc27 authored and bsdjhb committed Jul 13, 2023
1 parent d152c29 commit 67b0c48
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pycheribuild/boot_cheribsd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,7 @@ def boot_and_login(child: CheriBSDSpawnMixin, *, starttime, kernel_init_only=Fal
loader_boot_prompt_messages = [*boot_messages, BOOT_LOADER_PROMPT]
loader_boot_messages = [*loader_boot_prompt_messages, AUTOBOOT_PROMPT]
i = child.expect(loader_boot_messages, timeout=20 * 60, timeout_msg="timeout before loader or kernel")
ran_manual_boot = False
if i >= len(boot_messages):
# Skip 10s wait from loader(8) if we see the autoboot message
if i == loader_boot_messages.index(AUTOBOOT_PROMPT): # Hit Enter
Expand All @@ -855,15 +856,18 @@ def boot_and_login(child: CheriBSDSpawnMixin, *, starttime, kernel_init_only=Fal
i = child.expect(loader_boot_prompt_messages, timeout=60,
timeout_msg="timeout before loader prompt")
if i != loader_boot_prompt_messages.index(BOOT_LOADER_PROMPT):
failure("failed to enter boot loader prompt", exit=True)
failure("failed to enter boot loader prompt after stopping autoboot", exit=True)
# Fall through to BOOT_LOADER_PROMPT
else:
child.sendline("\r")
if i == loader_boot_messages.index(BOOT_LOADER_PROMPT): # loader(8) prompt
success("===> loader(8) waiting boot commands")
# Just boot the default kernel if no alternate kernel directory is given
child.sendline("boot {}".format(boot_alternate_kernel_dir or ""))
ran_manual_boot = True
i = child.expect(boot_messages, timeout=5 * 60, timeout_msg="timeout before kernel")
if boot_alternate_kernel_dir and not ran_manual_boot:
failure("failed to enter boot loader prompt", exit=True)
if i == boot_messages.index(TRYING_TO_MOUNT_ROOT):
success("===> mounting rootfs")
if bootverbose:
Expand Down

0 comments on commit 67b0c48

Please sign in to comment.